Mercurial > repos > romaingred > pirna_pipeline
changeset 19:39b039d82743 draft
Uploaded
author | romaingred |
---|---|
date | Thu, 19 Oct 2017 04:39:33 -0400 |
parents | fcaea740c23a |
children | 509d95c26dab |
files | bin/align.pm |
diffstat | 1 files changed, 10 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/bin/align.pm Thu Oct 19 04:39:18 2017 -0400 +++ b/bin/align.pm Thu Oct 19 04:39:33 2017 -0400 @@ -302,14 +302,16 @@ sub sam_to_bam_bg { my ( $sam, $scale, $number_of_cpus ) = @_; - my ( $bam_sorted, $bedgraphM, $bedgraphP ) = ( '', '', '' ); + my ( $bam_sorted, $bedgraphM, $bedgraphP, $view_err, $sort_err ) = ( '', '', '', '', '' ); if ( $sam =~ /(.*?).sam$/ ) { $bam_sorted = $1.'_sorted.bam'; $bedgraphP= $1.'_plus.bedgraph'; $bedgraphM = $1.'_minus.bedgraph'; + $view_err = $1.'_view.err'; + $sort_err = $1.'_sort.err'; } - `samtools view -Shb --threads $number_of_cpus $sam | samtools sort -O BAM --threads $number_of_cpus /dev/stdin > $bam_sorted`; + `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`; `bedtools genomecov -scale $scale -strand + -bga -ibam $bam_sorted > $bedgraphP`; `bedtools genomecov -scale $scale -strand - -bga -ibam $bam_sorted > $bedgraphM`; } @@ -317,12 +319,15 @@ sub sam_sorted_bam { my ( $sam, $number_of_cpus ) = @_; - my $bam_sorted =''; + my ( $bam_sorted, $view_err, $sort_err ) = ( '', '', '' ); if ( $sam =~ /(.*?).sam$/ ) { $bam_sorted = $1.'_sorted.bam'; + $view_err = $1.'_view.err'; + $sort_err = $1.'_sort.err'; + } - `samtools view -Shb --threads $number_of_cpus $sam | samtools sort -O BAM --threads $number_of_cpus /dev/stdin > $bam_sorted`; + `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`; } sub BWA_call @@ -401,7 +406,7 @@ $arn =reverse($arn); $arn =~ tr/atgcuATGCU/tacgaTACGA/; } - #&& $line[11] eq "XT:A:U" ) + if ( ( $line[1] == 16 || $line[1] == 0 ) ) { print $f_out "\@".$line[0]."\n".$arn."\n+\n".$line[10]."\n" ;