comparison bin/piPipe.pl @ 43:0be8011b3d98 draft

Uploaded
author romaingred
date Fri, 01 Dec 2017 08:01:45 -0500
parents af4ee65eaffb
children 851c8bbb3214
comparison
equal deleted inserted replaced
42:cb33c7d521c4 43:0be8011b3d98
105 my ( $TE_name, $TE_path, $TE_suffix ) = fileparse( $TE, @suffix ); 105 my ( $TE_name, $TE_path, $TE_suffix ) = fileparse( $TE, @suffix );
106 my ( $ex_name, $ex_path, $ex_suffix ) = fileparse( $transcripts, @suffix ); 106 my ( $ex_name, $ex_path, $ex_suffix ) = fileparse( $transcripts, @suffix );
107 107
108 $pm->start($fastq[$child]) and next; 108 $pm->start($fastq[$child]) and next;
109 109
110 my $dir_fq = $dir.$name.'/'; 110 my $dir_fq = $dir.$fastq_n[$child].'/';
111 mkdir $dir_fq; 111 mkdir $dir_fq;
112 112
113 my $gen_dir = $dir_fq.'genome/'; 113 my $gen_dir = $dir_fq.'genome/';
114 mkdir $gen_dir; 114 mkdir $gen_dir;
115 115
117 mkdir $size_dir; 117 mkdir $size_dir;
118 118
119 my $fastq_resized = $dir_fq.$name.'_'.$min.'-'.$max.'.fastq'; 119 my $fastq_resized = $dir_fq.$name.'_'.$min.'-'.$max.'.fastq';
120 size_distribution ( $fastq[$child], $fastq_resized, $size_dir, $min, $max ); 120 size_distribution ( $fastq[$child], $fastq_resized, $size_dir, $min, $max );
121 121
122 my $sam_genome = $gen_dir.$name.'_'.$min.'-'.$max.'_'.$ref_name.'.sam'; 122 my $sam_genome = $gen_dir.$fastq_n[$child].'_'.$min.'-'.$max.'_'.$ref_name.'.sam';
123 my $sam_genome_unique = $gen_dir.$name.'_'.$min.'-'.$max.'_'.$ref_name.'_unique.sam'; 123 my $sam_genome_unique = $gen_dir.$fastq_n[$child].'_'.$min.'-'.$max.'_'.$ref_name.'_unique.sam';
124 my $fastq_prefix = $gen_dir.$name.'_'.$min.'-'.$max.'_'.$ref_name; 124 my $fastq_prefix = $gen_dir.$fastq_n[$child].'_'.$min.'-'.$max;
125 125
126 BWA_call ( $ref, $fastq_resized, $sam_genome, $mis, $proc_child, $report ); 126 BWA_call ( $ref, $fastq_resized, $sam_genome, $mis, $proc_child, $report );
127 my ( $fai_ref_hashP, $ma, $ma_uni ) = get_unique ( $sam_genome, $sam_genome_unique, $gen_dir, 1, $report ); 127 my ( $fai_ref_hashP, $ma, $ma_uni ) = get_unique ( $sam_genome, $sam_genome_unique, $gen_dir, $fq_collection.$fastq_n[$child], 1, $report );
128 128
129 my $scale = 1000000 / $ma; 129 my $scale = 1000000 / $ma;
130 sam_to_bam_bg ( $sam_genome_unique, $scale, $proc_child ); 130 sam_to_bam_bg ( $sam_genome_unique, $scale, $proc_child );
131 sam_to_bam_bg ( $sam_genome, $scale, $proc_child ); 131 sam_to_bam_bg ( $sam_genome, $scale, $proc_child );
132 132
146 close $gfai; 146 close $gfai;
147 bg_to_png ( $fai_file, $fastq_prefix.'_unique_plus.bedgraph', $fastq_prefix.'_unique_minus.bedgraph', $Gviz_dir_uni, 'Mb' ); 147 bg_to_png ( $fai_file, $fastq_prefix.'_unique_plus.bedgraph', $fastq_prefix.'_unique_minus.bedgraph', $Gviz_dir_uni, 'Mb' );
148 bg_to_png ( $fai_file, $fastq_prefix.'_plus.bedgraph', $fastq_prefix.'_minus.bedgraph', $Gviz_dir_rand, 'Mb' ); 148 bg_to_png ( $fai_file, $fastq_prefix.'_plus.bedgraph', $fastq_prefix.'_minus.bedgraph', $Gviz_dir_rand, 'Mb' );
149 149
150 my $group_dir = $dir_fq.'subgroups/'; 150 my $group_dir = $dir_fq.'subgroups/';
151 my $fastq_uni = $gen_dir.'unique.fastq'; 151 my $fastq_uni = $fq_collection.$fastq_n[$child].'unique_mappers.fastq';
152 my $fastq_all = $gen_dir.'all.fastq'; 152 my $fastq_all = $fq_collection.$fastq_n[$child].'all_mappers.fastq';
153 my ($bo, $mi, $pi) = subgroups ( $fastq_all, $group_dir, $mis, $misTE, $proc_child, $tRNAs, $rRNAs, $snRNAs, $miRNAs, $transcripts, $TE, $si_min, $si_max, $pi_min, $pi_max, $report); 153 my ($bo, $mi, $pi) = subgroups ( $fastq_all, $group_dir, $mis, $misTE, $proc_child, $tRNAs, $rRNAs, $snRNAs, $miRNAs, $transcripts, $TE, $si_min, $si_max, $pi_min, $pi_max, $report);
154 154
155 pie_chart($group_dir); 155 pie_chart($group_dir);
156 156
157 open (my $dupnum, $gen_dir.'dup_mapnum.txt') || die "cannot open dup_mapnum.txt $!"; 157 open (my $dupnum, $gen_dir.'dup_mapnum.txt') || die "cannot open dup_mapnum.txt $!";
181 my $type_prefix = $types_names[$grand_child].'-'; 181 my $type_prefix = $types_names[$grand_child].'-';
182 mkdir $type_dir; 182 mkdir $type_dir;
183 $pm2->start($types[$grand_child]) and next; 183 $pm2->start($types[$grand_child]) and next;
184 my ( $type_sam_genome, $type_sam_TEs, $type_sam_transcripts ) = ( $type_dir.$type_prefix.'genome.sam', $type_dir.$type_prefix.'TEs.sam', $type_dir.$type_prefix.'transcripts.sam' ); 184 my ( $type_sam_genome, $type_sam_TEs, $type_sam_transcripts ) = ( $type_dir.$type_prefix.'genome.sam', $type_dir.$type_prefix.'TEs.sam', $type_dir.$type_prefix.'transcripts.sam' );
185 my ( $type_sam_uni_genome, $type_sam_uni_TEs, $type_sam_uni_transcripts ) = ( $type_dir.$type_prefix.'genome_unique.sam', $type_dir.$type_prefix.'TEs_unique.sam', $type_dir.$type_prefix.'transcripts_unique.sam' ); 185 my ( $type_sam_uni_genome, $type_sam_uni_TEs, $type_sam_uni_transcripts ) = ( $type_dir.$type_prefix.'genome_unique.sam', $type_dir.$type_prefix.'TEs_unique.sam', $type_dir.$type_prefix.'transcripts_unique.sam' );
186 my ( $type_uni_genome_fastq, $type_uni_TEs_fastq, $type_uni_transcripts_fastq ) = ( $fq_collection.$type_prefix.'genome_uni.fastq', $fq_collection.$type_prefix.'TEs_uni.fastq', $fq_collection.$type_prefix.'transcripts_uni.fastq'); 186 my ( $type_uni_genome_fastq, $type_uni_TEs_fastq, $type_uni_transcripts_fastq ) = ( $fq_collection.$fastq_n[$child].$type_prefix.'genome_uni.fastq', $fq_collection.$fastq_n[$child].$type_prefix.'TEs_uni.fastq', $fq_collection.$fastq_n[$child].$type_prefix.'transcripts_uni.fastq');
187 my ( $type_genome_fastq, $type_TEs_fastq, $type_transcripts_fastq ) = ( $fq_collection.$type_prefix.'genome.fastq', $fq_collection.$type_prefix.'TEs.fastq', $fq_collection.$type_prefix.'transcripts.fastq'); 187 my ( $type_genome_fastq, $type_TEs_fastq, $type_transcripts_fastq ) = ( $fq_collection.$fastq_n[$child].$type_prefix.'genome.fastq', $fq_collection.$fastq_n[$child].$type_prefix.'TEs.fastq', $fq_collection.$fastq_n[$child].$type_prefix.'transcripts.fastq');
188 my $type_sequence_hashP = get_fastq_seq ( $types[$grand_child] ); 188 my $type_sequence_hashP = get_fastq_seq ( $types[$grand_child] );
189 189
190 if ( $grand_child == 1 ) 190 if ( $grand_child == 1 )
191 { 191 {
192 BWA_call ( $TE, $types[$grand_child], $type_sam_TEs, $misTE, $proc_child, $report ); 192 BWA_call ( $TE, $types[$grand_child], $type_sam_TEs, $misTE, $proc_child, $report );