[GenABEL-dev] Fwd: Re: Small patch for probabel.pl (against 0.2.0)
Marijn Verkerk
m.verkerk at erasmusmc.nl
Wed Aug 15 16:35:08 CEST 2012
Small patch of probabel.pl for review!
Regards,
Marijn
-------- Original Message --------
Subject: Re: Small patch for probabel.pl (against 0.2.0) - small
correction
Date: Tue, 14 Aug 2012 16:15:39 +0200
From: Marijn Verkerk <m.verkerk at erasmusmc.nl>
To: L.C. Karssen <l.karssen at erasmusmc.nl>, yurii.aulchenko at gmail.com
On 8/14/12 2:14 PM, Marijn Verkerk wrote:
> FYI
>
> This patch removes some redundancies in the code and makes probabel.pl
> compatible with a bit more complicated cohort configuration, i.e.
> where cohorts are located at a location with multiple references to
> the chromosome, see attachments.
>
> Best wishes,
> Marijn
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/genabel-devel/attachments/20120815/7252e2a5/attachment.html>
-------------- next part --------------
25c25
< $separator_filename = "_._chr_._";
---
> $chr_replacement = "_._chr_._";
38,41c38,41
< @mlinfo;
< @mldose;
< @mlprobe;
< @legend;
---
> @mlinfos;
> @mldoses;
> @mlprobes;
> @legends;
52,61c52,61
< {
< next if (/^#/);
< chomp($line);
< @line_array = split(/$separator_cfg/, $line);
< $cohorts{$line_array[0]} = $i;
< $mlinfo[$i] = $line_array[1];
< $mldose[$i] = $line_array[2];
< $mlprobe[$i] = $line_array[3];
< $legend[$i] = $line_array[4];
< }
---
> {
> next if (/^#/);
> chomp($line);
> @line_array = split(/$separator_cfg/, $line);
> $cohorts{$line_array[0]} = $i;
> $mlinfos[$i] = $line_array[1];
> $mldoses[$i] = $line_array[2];
> $mlprobes[$i] = $line_array[3];
> $legends[$i] = $line_array[4];
> }
140,145c140,143
<
< @mlinfo_split = split(/$separator_filename/, $mlinfo[$cohort_position]);
< @mldose_split = split(/$separator_filename/, $mldose[$cohort_position]);
< @mlprobe_split = split(/$separator_filename/, $mlprobe[$cohort_position]);
< @legend_split = split(/$separator_filename/, $legend[$cohort_position]);
<
---
> $mlinfo = $mlinfos[$cohort_position];
> $mldose = $mldoses[$cohort_position];
> $mlprobe = $mlprobes[$cohort_position];
> $legend = $legends[$cohort_position];
173,187c171,179
< {
< $mldose_probe_split1 = $mldose_split[0];
< $mldose_probe_split2 = $mldose_split[1];
< $model_option_num=1;
< }
< elsif($model eq "--allmodels")
< {
< $mldose_probe_split1 = $mlprobe_split[0];
< $mldose_probe_split2 = $mlprobe_split[1];
< $model_option_num=2;
< }
< else
< {
< die "error: Wrong key for model. You can use \"--additive\" or \"--allmodels\" only\n";
< }
---
> {
> $mldose_probe = $mldose;
> $model_option_num=1;
> } elsif($model eq "--allmodels") {
> $mldose_probe = $mlprobe;
> $model_option_num=2;
> } else {
> die "error: Wrong key for model. You can use \"--additive\" or \"--allmodels\" only\n";
> }
195a188,189
> $hadhead=0;
>
198c192,210
< print `$prog -p $phename.PHE --ngpreds $model_option_num -i $mlinfo_split[0]$mlinfo_split[1] -d $mldose_probe_split1$mldose_probe_split2 -m $legend_split[0]$legend_split[1] --chrom $chr -o $phename $keys`;
---
>
> $mlinfo_arg = $mlinfo;
> $mlinfo_arg =~ s/$chr_replacement/X/g;
>
> $mldose_arg = $mldose;
> $mldose_arg =~ s/$chr_replacement/X/g;
>
> $legend_arg = $legend;
> $legend_arg =~ s/$chr_replacement/X/g;
>
> if($hadhead==0) {
> $head="";
> $hadhead=1;
> } else {
> $head="--no-head";
> }
>
> print `$prog -p $phename.PHE --ngpreds $model_option_num -i $mlinfo_arg -d $mldose_arg -m $legend_arg --chrom X -o $phename $head $keys`;
>
203,232c215,258
< print `$prog -p $phename.PHE --ngpreds $model_option_num -i $mlinfo_split[0]${chr}$mlinfo_split[1] -d $mldose_probe_split1${chr}$mldose_probe_split2 -m $legend_split[0]${chr}$legend_split[1] --chrom $chr -o $phename $keys`;
< for($chr=($startchr+1);$chr<=$endchr;$chr++)
< {
< print `$prog -p $phename.PHE --ngpreds $model_option_num -i $mlinfo_split[0]${chr}$mlinfo_split[1] -d $mldose_probe_split1${chr}$mldose_probe_split2 -m $legend_split[0]${chr}$legend_split[1] --chrom $chr -o $phename.$chr --no-head $keys`;
<
< if($model_option_num==2)
< {
< `cat $phename.${chr}$_2df_file_postfix >> ${phename}${_2df_file_postfix}`;
< `rm $phename.${chr}$_2df_file_postfix`;
<
< `cat $phename.${chr}$_add_file_postfix >> ${phename}${_add_file_postfix}`;
< `rm $phename.${chr}$_add_file_postfix`;
<
< `cat $phename.${chr}$_domin_file_postfix >> ${phename}${_domin_file_postfix}`;
< `rm $phename.${chr}$_domin_file_postfix`;
<
< `cat $phename.${chr}$_recess_file_postfix >> ${phename}${_recess_file_postfix}`;
< `rm $phename.${chr}$_recess_file_postfix`;
<
< `cat $phename.${chr}$_over_domin_file_postfix >> ${phename}${_over_domin_file_postfix}`;
< `rm $phename.${chr}$_over_domin_file_postfix`;
< }
< else
< {
< `cat $phename.${chr}$_add_file_postfix >> $phename${_add_file_postfix}`;
< print "cat $phename.${chr}$_add_file_postfix >> $phename${_add_file_postfix}\n";
< `rm $phename.${chr}$_add_file_postfix`;
< print "rm $phename.${chr}$_add_file_postfix\n";
< }
< }
---
>
> for($chr=$startchr;$chr<=$endchr;$chr++)
> {
> $mlinfo_arg = $mlinfo;
> $mlinfo_arg =~ s/$chr_replacement/$chr/g;
>
> $mldose_arg = $mldose;
> $mldose_arg =~ s/$chr_replacement/$chr/g;
>
> $legend_arg = $legend;
> $legend_arg =~ s/$chr_replacement/$chr/g;
>
> if($hadhead==0) {
> $head="";
> $hadhead=1;
> } else {
> $head="--no-head";
> }
>
> print `$prog -p $phename.PHE --ngpreds $model_option_num -i $mlinfo_arg -d $mldose_arg -m $legend_arg --chrom $chr -o $phename.$chr $head $keys`;
>
> if($model_option_num==2)
> {
> `cat $phename.${chr}$_2df_file_postfix >> ${phename}${_2df_file_postfix}`;
> `rm $phename.${chr}$_2df_file_postfix`;
>
> `cat $phename.${chr}$_add_file_postfix >> ${phename}${_add_file_postfix}`;
> `rm $phename.${chr}$_add_file_postfix`;
>
> `cat $phename.${chr}$_domin_file_postfix >> ${phename}${_domin_file_postfix}`;
> `rm $phename.${chr}$_domin_file_postfix`;
>
> `cat $phename.${chr}$_recess_file_postfix >> ${phename}${_recess_file_postfix}`;
> `rm $phename.${chr}$_recess_file_postfix`;
>
> `cat $phename.${chr}$_over_domin_file_postfix >> ${phename}${_over_domin_file_postfix}`;
> `rm $phename.${chr}$_over_domin_file_postfix`;
> } else {
> `cat $phename.${chr}$_add_file_postfix >> $phename${_add_file_postfix}`;
> print "cat $phename.${chr}$_add_file_postfix >> $phename${_add_file_postfix}\n";
> `rm $phename.${chr}$_add_file_postfix`;
> print "rm $phename.${chr}$_add_file_postfix\n";
> }
> }
More information about the genabel-devel
mailing list