[Genabel-commits] r1055 - in pkg/ProbABEL: src tests
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Dec 13 18:12:18 CET 2012
Author: lckarssen
Date: 2012-12-13 18:12:18 +0100 (Thu, 13 Dec 2012)
New Revision: 1055
Modified:
pkg/ProbABEL/src/probabel.pl
pkg/ProbABEL/tests/check_probabel.pl_chunk.sh
Log:
ProbABEL: Fixed bug #2436, probabel.pl doesn't overwrite output file.
Modified: pkg/ProbABEL/src/probabel.pl
===================================================================
--- pkg/ProbABEL/src/probabel.pl 2012-12-13 17:10:39 UTC (rev 1054)
+++ pkg/ProbABEL/src/probabel.pl 2012-12-13 17:12:18 UTC (rev 1055)
@@ -201,6 +201,7 @@
my $mlinfo_arg;
my $mldose_arg;
my $legend_arg;
+my $outfile_arg;
# Separate command for the sex chromosomes.
if ($chr eq "X" || $chr eq "Y") {
@@ -225,6 +226,18 @@
exit;
}
+# Clean up any existing output files
+if($model_option_num==2)
+{
+ system "rm ${outfile_prefix}${_2df_file_postfix} 2>/dev/null";
+ system "rm ${outfile_prefix}${_add_file_postfix} 2>/dev/null";
+ system "rm ${outfile_prefix}${_domin_file_postfix} 2>/dev/null";
+ system "rm ${outfile_prefix}${_recess_file_postfix} 2>/dev/null";
+ system "rm ${outfile_prefix}${_over_domin_file_postfix} 2>/dev/null";
+} else {
+ system "rm ${outfile_prefix}${_add_file_postfix} 2>/dev/null";
+}
+
# Commands for the autosomes
for($chr=$startchr; $chr<=$endchr; $chr++) {
@@ -262,34 +275,42 @@
$legend_arg =~ s/$chr_replacement/$chr/g;
$legend_arg =~ s/$chunk_replacement/$chunk/g;
- my $command = "$prog -p $phename.PHE --ngpreds $model_option_num -i $mlinfo_arg -d $mldose_arg -m $legend_arg --chrom $chr -o $outfile_prefix.chunk$chunk.chr$chr $head $keys";
+ $outfile_arg = "$outfile_prefix.chunk${chunk}.chr${chr}";
+
+ my $command = "$prog -p $phename.PHE --ngpreds $model_option_num ";
+ $command = $command . "-i $mlinfo_arg -d $mldose_arg -m $legend_arg";
+ $command = $command . " --chrom $chr";
+ $command = $command . " -o $outfile_arg ";
+ $command = $command . "$head $keys";
print "$command \n";
system $command;
+ # Combine the output data for all chunks of this chromosome
if($model_option_num==2)
{
- `cat $outfile_prefix.chunk${chunk}.chr${chr}$_2df_file_postfix >> ${outfile_prefix}.${chr}${_2df_file_postfix}`;
- `rm $outfile_prefix.chunk${chunk}.chr${chr}$_2df_file_postfix`;
+ `cat $outfile_arg$_2df_file_postfix >> ${outfile_prefix}.${chr}${_2df_file_postfix}`;
+ `rm $outfile_arg$_2df_file_postfix`;
- `cat $outfile_prefix.chunk${chunk}.chr${chr}$_add_file_postfix >> ${outfile_prefix}.${chr}${_add_file_postfix}`;
- `rm $outfile_prefix.chunk${chunk}.chr${chr}$_add_file_postfix`;
+ `cat $outfile_arg$_add_file_postfix >> ${outfile_prefix}.${chr}${_add_file_postfix}`;
+ `rm $outfile_arg$_add_file_postfix`;
- `cat $outfile_prefix.chunk${chunk}.chr${chr}$_domin_file_postfix >> ${outfile_prefix}.${chr}${_domin_file_postfix}`;
- `rm $outfile_prefix.chunk${chunk}.chr${chr}$_domin_file_postfix`;
+ `cat $outfile_arg$_domin_file_postfix >> ${outfile_prefix}.${chr}${_domin_file_postfix}`;
+ `rm $outfile_arg$_domin_file_postfix`;
- `cat $outfile_prefix.chunk${chunk}.chr${chr}$_recess_file_postfix >> ${outfile_prefix}.${chr}${_recess_file_postfix}`;
- `rm $outfile_prefix.chunk${chunk}.chr${chr}$_recess_file_postfix`;
+ `cat $outfile_arg$_recess_file_postfix >> ${outfile_prefix}.${chr}${_recess_file_postfix}`;
+ `rm $outfile_arg$_recess_file_postfix`;
- `cat $outfile_prefix.chunk${chunk}.chr${chr}$_over_domin_file_postfix >> ${outfile_prefix}.${chr}${_over_domin_file_postfix}`;
- `rm $outfile_prefix.chunk${chunk}.chr${chr}$_over_domin_file_postfix`;
+ `cat $outfile_arg$_over_domin_file_postfix >> ${outfile_prefix}.${chr}${_over_domin_file_postfix}`;
+ `rm $outfile_arg$_over_domin_file_postfix`;
} else {
- `cat $outfile_prefix.chunk${chunk}.chr${chr}$_add_file_postfix >> $outfile_prefix.${chr}${_add_file_postfix}`;
- print "cat $outfile_prefix.chunk${chunk}.chr${chr}$_add_file_postfix >> $outfile_prefix.chr${chr}${_add_file_postfix}\n";
- `rm $outfile_prefix.chunk${chunk}.chr${chr}$_add_file_postfix`;
- print "rm $outfile_prefix.chunk${chunk}.chr${chr}$_add_file_postfix\n";
+ `cat $outfile_arg$_add_file_postfix >> $outfile_prefix.${chr}${_add_file_postfix}`;
+ print "cat $outfile_arg$_add_file_postfix >> $outfile_prefix.chr${chr}${_add_file_postfix}\n";
+ `rm $outfile_arg$_add_file_postfix`;
+ print "rm $outfile_arg$_add_file_postfix\n";
}
}
+ # Combine the output data for all chromosomes into one file
if($model_option_num==2)
{
`cat $outfile_prefix.${chr}$_2df_file_postfix >> ${outfile_prefix}${_2df_file_postfix}`;
@@ -307,8 +328,8 @@
`cat $outfile_prefix.${chr}$_over_domin_file_postfix >> ${outfile_prefix}${_over_domin_file_postfix}`;
`rm $outfile_prefix.${chr}$_over_domin_file_postfix`;
} else {
- `cat $outfile_prefix.${chr}$_add_file_postfix >> $outfile_prefix${_add_file_postfix}`;
- print "cat $outfile_prefix.${chr}$_add_file_postfix >> $outfile_prefix${_add_file_postfix}\n";
+ `cat $outfile_prefix.${chr}$_add_file_postfix >> ${outfile_prefix}${_add_file_postfix}`;
+ print "cat $outfile_prefix.${chr}$_add_file_postfix >> ${outfile_prefix}${_add_file_postfix}\n";
`rm $outfile_prefix.${chr}$_add_file_postfix`;
print "rm $outfile_prefix.${chr}$_add_file_postfix\n";
}
Modified: pkg/ProbABEL/tests/check_probabel.pl_chunk.sh
===================================================================
--- pkg/ProbABEL/tests/check_probabel.pl_chunk.sh 2012-12-13 17:10:39 UTC (rev 1054)
+++ pkg/ProbABEL/tests/check_probabel.pl_chunk.sh 2012-12-13 17:12:18 UTC (rev 1055)
@@ -106,7 +106,7 @@
{
# Run an analysis on dosage data
outfile="height_add.out.txt"
- rm -f $outfile
+
echo "Checking output using dosages $WithOrWithout chunks..."
./probabel.pl 1 2 linear $1 --additive height
echo -n " Verifying $outfile: "
@@ -122,10 +122,6 @@
height_ngp2_over_domin.out.txt height_ngp2_domin.out.txt
height_ngp2_add.out.txt"
- for file in $outfilelist; do
- rm -f $file
- done
-
echo "Checking output using probabilities $WithOrWithout chunks..."
./probabel.pl 1 2 linear $1 --allmodels height -o _ngp2
for file in $outfilelist; do
More information about the Genabel-commits
mailing list