Mercurial > repos > brasset_jensen > srnapipe
comparison bin/align.pm @ 60:9645d995fb3c draft
Fix for spaces in datasets names.
author | pierre.pouchin |
---|---|
date | Wed, 24 Oct 2018 07:40:20 -0400 |
parents | 4bc00caa60b4 |
children | 9185ca0a7b43 |
comparison
equal
deleted
inserted
replaced
59:eeb89c3331ad | 60:9645d995fb3c |
---|---|
32 sub build_index | 32 sub build_index |
33 { | 33 { |
34 my $to_index = shift; | 34 my $to_index = shift; |
35 my $log = shift; | 35 my $log = shift; |
36 my $index_log = $to_index.'_index.err'; | 36 my $index_log = $to_index.'_index.err'; |
37 `bwa index $to_index 2> $index_log`; | 37 `bwa index '$to_index' 2> '$index_log'`; |
38 print $log "Creating index for $to_index\n"; | 38 print $log "Creating index for $to_index\n"; |
39 } | 39 } |
40 | 40 |
41 sub get_unique | 41 sub get_unique |
42 { | 42 { |
410 $bedgraphP= $1.'_plus.bedgraph'; | 410 $bedgraphP= $1.'_plus.bedgraph'; |
411 $bedgraphM = $1.'_minus.bedgraph'; | 411 $bedgraphM = $1.'_minus.bedgraph'; |
412 $view_err = $1.'_view.err'; | 412 $view_err = $1.'_view.err'; |
413 $sort_err = $1.'_sort.err'; | 413 $sort_err = $1.'_sort.err'; |
414 } | 414 } |
415 `samtools view -Shb --threads $number_of_cpus $sam 2> $view_err | samtools sort -O BAM --threads $number_of_cpus /dev/stdin 2> $sort_err > $bam_sorted`; | 415 `samtools view -Shb --threads $number_of_cpus '$sam' 2> '$view_err' | samtools sort -O BAM --threads $number_of_cpus /dev/stdin 2> '$sort_err' > '$bam_sorted'`; |
416 `bedtools genomecov -scale $scale -strand + -bga -ibam $bam_sorted > $bedgraphP`; | 416 `bedtools genomecov -scale $scale -strand + -bga -ibam '$bam_sorted' > '$bedgraphP'`; |
417 `bedtools genomecov -scale $scale -strand - -bga -ibam $bam_sorted > $bedgraphM`; | 417 `bedtools genomecov -scale $scale -strand - -bga -ibam '$bam_sorted' > '$bedgraphM'`; |
418 } | 418 } |
419 | 419 |
420 sub sam_sorted_bam | 420 sub sam_sorted_bam |
421 { | 421 { |
422 my ( $sam, $number_of_cpus ) = @_; | 422 my ( $sam, $number_of_cpus ) = @_; |
426 $bam_sorted = $1.'_sorted.bam'; | 426 $bam_sorted = $1.'_sorted.bam'; |
427 $view_err = $1.'_view.err'; | 427 $view_err = $1.'_view.err'; |
428 $sort_err = $1.'_sort.err'; | 428 $sort_err = $1.'_sort.err'; |
429 | 429 |
430 } | 430 } |
431 `samtools view -Shb --threads $number_of_cpus $sam 2> $view_err | samtools sort -O BAM --threads $number_of_cpus /dev/stdin 2> $sort_err > $bam_sorted`; | 431 `samtools view -Shb --threads $number_of_cpus '$sam' 2> '$view_err' | samtools sort -O BAM --threads $number_of_cpus /dev/stdin 2> '$sort_err' > '$bam_sorted'`; |
432 } | 432 } |
433 | 433 |
434 sub BWA_call | 434 sub BWA_call |
435 { | 435 { |
436 my ( $index, $fastq, $sam, $mismatches, $number_of_cpus, $report ) = @_; | 436 my ( $index, $fastq, $sam, $mismatches, $number_of_cpus, $report ) = @_; |
437 my ( $aln_err, $samse_err, $seq_num ) = ( $sam.'_aln.err', $sam.'_samse.err', 0 ); | 437 my ( $aln_err, $samse_err, $seq_num ) = ( $sam.'_aln.err', $sam.'_samse.err', 0 ); |
438 print $report "-----------------------------\n"; | 438 print $report "-----------------------------\n"; |
439 print $report "bwa aln -t $number_of_cpus -n $mismatches $index $fastq 2> $aln_err | bwa samse $index /dev/stdin $fastq 2> $samse_err > $sam\n"; | 439 print $report "bwa aln -t $number_of_cpus -n $mismatches '$index' '$fastq' 2> '$aln_err' | bwa samse $index /dev/stdin '$fastq' 2> '$samse_err' > '$sam'\n"; |
440 `bwa aln -t $number_of_cpus -n $mismatches $index $fastq 2> $aln_err | bwa samse $index /dev/stdin $fastq 2> $samse_err > $sam `; | 440 `bwa aln -t $number_of_cpus -n $mismatches '$index' '$fastq' 2> '$aln_err' | bwa samse $index /dev/stdin '$fastq' 2> '$samse_err' > '$sam' `; |
441 } | 441 } |
442 | 442 |
443 sub rpms_rpkm | 443 sub rpms_rpkm |
444 { | 444 { |
445 my ( $counthashR, $sizehashR, $mapped, $out_file, $piRNA_number, $miRNA_number, $bonafide_number ) =@_; | 445 my ( $counthashR, $sizehashR, $mapped, $out_file, $piRNA_number, $miRNA_number, $bonafide_number ) =@_; |