[Genabel-commits] r1000 - pkg/ProbABEL/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Nov 5 01:09:49 CET 2012


Author: lckarssen
Date: 2012-11-05 01:09:49 +0100 (Mon, 05 Nov 2012)
New Revision: 1000

Modified:
   pkg/ProbABEL/src/probabel.pl
Log:
Fixed a bug in probabel.pl that stopped the script from working when no chunked files could be found. This should have been part of the previous commit.

Modified: pkg/ProbABEL/src/probabel.pl
===================================================================
--- pkg/ProbABEL/src/probabel.pl	2012-11-04 23:19:39 UTC (rev 999)
+++ pkg/ProbABEL/src/probabel.pl	2012-11-05 00:09:49 UTC (rev 1000)
@@ -233,7 +233,12 @@
     my $infofiles = $mlinfo;
     $infofiles =~ s/$chr_replacement/$chr/g;
     $infofiles =~ s/$chunk_replacement/*/g;
-    $nrchunks = `ls $infofiles | wc -l`;
+    $nrchunks = `ls $infofiles 2>/dev/null | wc -l`;
+    if ($nrchunks==0) {
+	# If no chunked info files exist the 'wc -l' command returns 0
+	# so that actually means 1 chunk containing all data.
+	$nrchunks = 1;
+    }
     print "Nr. of chunks: $nrchunks";
 
     # Loop over all chunks
@@ -257,7 +262,9 @@
 	$legend_arg =~ s/$chr_replacement/$chr/g;
 	$legend_arg =~ s/$chunk_replacement/$chunk/g;
 
-	system "$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";
+	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";
+	print "$command \n";
+	system $command;
 
 	if($model_option_num==2)
 	{



More information about the Genabel-commits mailing list