Mercurial > repos > mini > strelka
comparison libexec/consolidateResults.pl @ 9:0e8e6011082b
Strelka Workflow 0.0.2
author | mini |
---|---|
date | Fri, 26 Sep 2014 15:51:35 +0200 |
parents | 87568e5a7d4f |
children |
comparison
equal
deleted
inserted
replaced
8:2cee4ed50058 | 9:0e8e6011082b |
---|---|
33 use Getopt::Long; | 33 use Getopt::Long; |
34 use Pod::Usage; | 34 use Pod::Usage; |
35 | 35 |
36 my $baseDir; | 36 my $baseDir; |
37 my $libDir; | 37 my $libDir; |
38 #my $optDir; | |
39 #my $vcftDir; | |
40 BEGIN { | 38 BEGIN { |
41 my $thisDir=(File::Spec->splitpath($0))[1]; | 39 my $thisDir=(File::Spec->splitpath($0))[1]; |
42 $baseDir=File::Spec->catdir($thisDir,File::Spec->updir()); | 40 $baseDir=File::Spec->catdir($thisDir,File::Spec->updir()); |
43 $libDir=File::Spec->catdir($baseDir,'lib'); | 41 $libDir=File::Spec->catdir($baseDir,'lib'); |
44 #$optDir=File::Spec->catdir($baseDir,'opt'); | |
45 #$vcftDir=File::Spec->catdir($optDir,'vcftools','lib','perl5','site_perl'); | |
46 } | 42 } |
47 use lib $libDir; | 43 use lib $libDir; |
48 use Utils; | 44 use Utils; |
49 #use lib $vcftDir; | |
50 use Vcf; | 45 use Vcf; |
51 | 46 |
52 if(getAbsPath($baseDir)) { | 47 if(getAbsPath($baseDir)) { |
53 errorX("Can't resolve path for strelka_workflow install directory: '$baseDir'"); | 48 errorX("Can't resolve path for strelka_workflow install directory: '$baseDir'"); |
54 } | 49 } |
55 #$optDir=File::Spec->catdir($baseDir,'opt'); | |
56 | 50 |
57 | 51 |
58 my $scriptName=(File::Spec->splitpath($0))[2]; | 52 my $scriptName=(File::Spec->splitpath($0))[2]; |
59 my $argCount=scalar(@ARGV); | 53 my $argCount=scalar(@ARGV); |
60 my $cmdline=join(' ',$0,@ARGV); | 54 my $cmdline=join(' ',$0,@ARGV); |
66 GetOptions( "config=s" => \$configFile, | 60 GetOptions( "config=s" => \$configFile, |
67 "help|h" => \$help) or pod2usage(2); | 61 "help|h" => \$help) or pod2usage(2); |
68 | 62 |
69 pod2usage(2) if($help); | 63 pod2usage(2) if($help); |
70 pod2usage(2) unless(defined($configFile)); | 64 pod2usage(2) unless(defined($configFile)); |
71 | |
72 # | |
73 # check fixed paths | |
74 # | |
75 #my $samtoolsBin = File::Spec->catfile($optDir,'samtools','samtools'); | |
76 #checkFile($samtoolsBin,"samtools binary"); | |
77 | |
78 | 65 |
79 # | 66 # |
80 # read config and validate values | 67 # read config and validate values |
81 # | 68 # |
82 checkFile($configFile,"configuration ini"); | 69 checkFile($configFile,"configuration ini"); |
245 } | 232 } |
246 | 233 |
247 return unless(scalar(@bamList)); | 234 return unless(scalar(@bamList)); |
248 | 235 |
249 my $headerFH = File::Temp->new(); | 236 my $headerFH = File::Temp->new(); |
250 my $getHeaderCmd = "bash -c '$samtoolsBin view -H ".$bamList[0]." > $headerFH'"; | 237 my $getHeaderCmd = "bash -c 'samtools view -H ".$bamList[0]." > $headerFH'"; |
251 executeCmd($getHeaderCmd); | 238 executeCmd($getHeaderCmd); |
252 | 239 |
253 my $allFile = File::Spec->catfile($reDir,$fileName . $itag); | 240 my $allFile = File::Spec->catfile($reDir,$fileName . $itag); |
254 my $cmd="$samtoolsBin merge -h $headerFH $allFile ". join(" ",@bamList); | 241 my $cmd="samtools merge -h $headerFH $allFile ". join(" ",@bamList); |
255 executeCmd($cmd); | 242 executeCmd($cmd); |
256 | 243 |
257 my $allFileFinished = File::Spec->catfile($reDir,$fileName); | 244 my $allFileFinished = File::Spec->catfile($reDir,$fileName); |
258 checkMove($allFile,$allFileFinished); | 245 checkMove($allFile,$allFileFinished); |
259 | 246 |
260 my $indexCmd="$samtoolsBin index $allFileFinished"; | 247 my $indexCmd="samtools index $allFileFinished"; |
261 executeCmd($indexCmd); | 248 executeCmd($indexCmd); |
262 | 249 |
263 # for now don't remove all the bin realignments... | 250 # for now don't remove all the bin realignments... |
264 # unlink(@bamList); | 251 # unlink(@bamList); |
265 } | 252 } |