diff bin/piPipe.pl @ 21:2bd100775c36 draft

Uploaded
author romaingred
date Fri, 20 Oct 2017 08:34:50 -0400
parents 198009598544
children 7dd78ad2875f
line wrap: on
line diff
--- a/bin/piPipe.pl	Fri Oct 20 08:34:35 2017 -0400
+++ b/bin/piPipe.pl	Fri Oct 20 08:34:50 2017 -0400
@@ -20,7 +20,7 @@
 my ( $ref, $tRNAs, $rRNAs, $snRNAs, $miRNAs, $exons, $TE );
 my ( $si_min, $si_max, $pi_min, $pi_max );
 my ( $build_index, $build_tRNAs, $build_rRNAs, $build_snRNAs, $build_miRNAs, $build_exons, $build_TE );
-my $max_procs = 4;
+my $max_procs = 8;
 
 ( $build_index, $build_tRNAs, $build_rRNAs, $build_snRNAs, $build_miRNAs, $build_exons, $build_TE ) = (0,0,0,0,0,0,0);
 ( $min, $max, $mis, $misTE, $si_min, $si_max, $pi_min, $pi_max, $dir ) = ( 18, 29, 0, 3, 21, 21, 23, 29 );
@@ -73,9 +73,9 @@
 to_build ( \%toBuild, $report );
 
 my $proc_child = ceil($max_procs / scalar(@fastq));
-my $proc_grand_child = ceil($proc_child/5);
+my $proc_grand_child = ceil($proc_child/4);
 my $pm = Parallel::ForkManager->new($max_procs);
-my $pm3 = Parallel::ForkManager->new($proc_grand_child);
+my $pm2 = Parallel::ForkManager->new($proc_grand_child);
 
 $pm->run_on_finish( sub {
 	my ($pid, $exit_code, $ident) = @_;
@@ -87,13 +87,13 @@
 	my ($pid,$ident)=@_;
 	print $report "Fastq fork : $ident started, pid: $pid\n";
 	});
-$pm3->run_on_finish( sub {
+$pm2->run_on_finish( sub {
 	my ($pid, $exit_code, $ident) = @_;
 	print $report "** Subgroup fork $ident just finished ".
 	"with PID $pid and exit code: $exit_code\n";
 	die "Something went wrong!\n" if $exit_code != 0;
 	});
-$pm3->run_on_start( sub {
+$pm2->run_on_start( sub {
 	my ($pid,$ident)=@_;
 	print $report "** Subgroup fork $ident started, pid: $pid\n";
 	});
@@ -182,7 +182,7 @@
 		my $type_dir = $group_dir.$types_names[$grand_child].'/';
 		my $type_prefix = $types_names[$grand_child].'-';
 		mkdir  $type_dir;
-
+		$pm2->start($types[$grand_child]) and next;
 		my ( $type_sam_genome, $type_sam_TEs, $type_sam_exons ) = ( $type_dir.$type_prefix.'genome.sam', $type_dir.$type_prefix.'TEs.sam', $type_dir.$type_prefix.'exons.sam' );
 		my ( $type_sam_uni_genome, $type_sam_uni_TEs,  $type_sam_uni_exons ) = ( $type_dir.$type_prefix.'genome_unique.sam', $type_dir.$type_prefix.'TEs_unique.sam', $type_dir.$type_prefix.'exons_unique.sam' );
 		my ( $type_uni_genome_fastq, $type_uni_TEs_fastq,  $type_uni_exons_fastq ) = ( $fq_collection.$type_prefix.'genome_uni.fastq', $fq_collection.$type_prefix.'TEs_uni.fastq', $fq_collection.$type_prefix.'exons_uni.fastq');
@@ -240,9 +240,9 @@
 		my $prefix_details_pages = $dir.$fastq_n[$child].'-'.$types_names[$grand_child];
 		details_pages ( $type_dir, $prefix_details_pages, \@fastq_n, $fastq_n[$child], $misTE, $dir );
 
-		$pm3->finish($grand_child);
+		$pm2->finish();
 	}
-	$pm3->wait_all_children;
+	$pm2->wait_all_children;
 
 	if ( $Pcheck eq 'true' )
 	{
@@ -261,7 +261,7 @@
 	my $menu_page = $dir.$fastq_n[$child].'-sub.html';
 	menu_page ( $group_dir, $menu_page, \@fastq_n, $fastq_n[$child], $min, $max, $si_min, $si_max, $pi_min, $pi_max, $dir );
 
-	$pm->finish($child); # pass an exit code to finish
+	$pm->finish(); # pass an exit code to finish
 }
 $pm->wait_all_children;