Mercurial > repos > mir-bioinf > multi_join_left
diff run-multi_join_serial.pl @ 3:0aa0ebcd307c draft
Uploaded
author | mir-bioinf |
---|---|
date | Wed, 15 Apr 2015 16:31:04 -0400 |
parents | 3a9cc859f4c1 |
children |
line wrap: on
line diff
--- a/run-multi_join_serial.pl Wed Apr 15 14:43:04 2015 -0400 +++ b/run-multi_join_serial.pl Wed Apr 15 16:31:04 2015 -0400 @@ -11,7 +11,6 @@ #require '/opt/galaxy/galaxy-dist/tools/ngs_rna/Unreleased/GetOptWC.pm'; GetOptions( - "log=s" => \$log, "join_file=s" => \$data_in, "join_col=s" => \$coljoin, "time" => \$mTime, @@ -36,8 +35,6 @@ # # use IO::Handle; -open OUTPUT, '>>',$log or die "cant open this file for OUTPUT: $log. Computer says: $!\n";; -open ERROR, '>>', $log or die "cant open this file for ERROR: $log. Computer says: $!\n"; STDOUT->fdopen( \*OUTPUT, 'a' ) or die "cant open file $!\n"; #cms changing mode from 'w' to 'a' for multiple files in one run STDERR->fdopen( \*ERROR, 'a' ) or die "cant open file $!\n"; #cms changing mode from 'w' to 'a' for multiple files in one run # # # @@ -55,7 +52,6 @@ ## At the end of the last iteration close($Filenames); - print "\nLAST ITERATION COMPLETED and at least two input files provided.\n"; ##Read in file temp_filenames.txt open(my $tmpfile, "<", "temp_filenames.txt") or die "Cannot open temp file: $!"; @@ -69,11 +65,6 @@ ##Also need to send yes/no for keeping header: push @fileArray, $header_yes; - ##Debug: - print "\nFirst file fileArray[0] is $fileArray[0]."; - print "\nOutput file is next-to-last val in fileArray, $fileArray[-2]."; - print "\nUse header? is last val in fileArray, $fileArray[-1]."; - print "\nSecond file now is fileArray[2], $fileArray[2]."; ##@fileArray has one file per line,output,header_yes, so $N+1 rows my $f=0; @@ -82,7 +73,6 @@ do { @first = split('\t',$fileArray[$f]); ##was filename\tJoinCol - print "\njoin column from first line is $first[1]."; ##CMS DEALING WITH HEADER OR NOT: if ($header_yes eq "no") { @@ -90,7 +80,6 @@ $fh1 = IO::File->new("<$first[0]"); my $line1file1 = $fh1->getline(); $line1file1 =~ s/\s+$//; - #print "\nline1file1 is $line1file1\n"; ##DEBUG @cols = split "\t",$line1file1; my $numcols1 = @cols; my $head1; @@ -99,7 +88,6 @@ } $head1.="C$numcols1\n"; open(my $fh_sub, '>', './header1.txt') or die "OOPIES: $!\n"; - print "\nheader first file $first[0] on next line:\n$head1"; ##DEBUG print $fh_sub $head1; close $fh_sub; system("cat $first[0] >> ./header1.txt"); ##put header in front of file @@ -123,18 +111,14 @@ $head2.="C$i\t"; } $head2.="C$numcols2\n"; - open(my $fh_sub, '>', './header2.txt') or die "OOPIES: $!\n"; - print "\nheader from $second[0] on next line:\n$head2"; ##DEBUG + open(my $fh_sub, '>', './header2.txt') or die "ERROR: $!\n"; print $fh_sub $head2; close $fh_sub; system("cat $second[0] >> ./header2.txt"); $second[0]="./header2.txt"; } - print "\ncommand following:\n"; - print "/opt/galaxy/galaxy-dist/tools/ngs_rna/Unreleased/addColumnsFromFile2ToFile1.pl -File1=$first[0] -File2=$second[0] -cola1=$first[1] -cola2=$second[1] -colb1=$first[1] -colb2=$second[1]"; system("/opt/galaxy/galaxy-dist/tools/ngs_rna/Unreleased/addColumnsFromFile2ToFile1.pl", "-File1=$first[0]", "-File2=$second[0]", "-cola1=$first[1]", "-cola2=$second[1]", "-colb1=$first[1]", "-colb2=$second[1]"); - print "\nOut from system call on next line:\n$!"; $f+=2; system("mv file1_file2.txt joined.txt"); if ($header_yes eq "no") { @@ -145,7 +129,6 @@ for ($f; $f<$N; $f++) { my @current = split('\t',$fileArray[$f]); ##was filename\tJoinCol - print "\njoin column from first line is $first[1]."; if ($header_yes eq "no") { my $fh; @@ -160,17 +143,13 @@ } $head.="C$numcols\n"; open(my $fh_sub, '>', './header.txt') or die "OOPIES: $!\n"; - print "\nheader from file $current[0] on next line:\n$head"; ##DEBUG print $fh_sub $head; close $fh_sub; system("cat $current[0] >> ./header.txt"); $current[0]="./header.txt"; } - print "\ncommand following:\n"; - print "/opt/galaxy/galaxy-dist/tools/ngs_rna/Unreleased/addColumnsFromFile2ToFile1.pl -File1=joined.txt -File2=$current[0] -cola1=$first[1] -cola2=$current[1] -colb1=$first[1] -colb2=$current[1]"; system("/opt/galaxy/galaxy-dist/tools/ngs_rna/Unreleased/addColumnsFromFile2ToFile1.pl","-File1=joined.txt", "-File2=$current[0]", "-cola1=$first[1]", "-cola2=$current[1]", "-colb1=$first[1]", "-colb2=$current[1]"); - print "\nOut from system call on next line:\n$!"; system("mv file1_file2.txt joined.txt"); if ($header_yes eq "no") { system("rm ./header.txt"); @@ -188,9 +167,7 @@ } elsif ($N<2) { - print "\n<br /><i>Only one file; not running join.</i>\n"; } -#print "LOG $mv\n";