Many apologies in advance for the obfuscation...
#!/opt/local/bin/perl -w open(STDERR, ">errors.log") || die "cannot create error log"; $dir = `pwd`; chomp $dir; if ($dir =~ m/(^.*)(GQ.*)/) { $path = $1; $lib = $2; }; chop $path; $xpath = "$path/ProjectSpecificInfo/"; print "working from $dir\n"; print "library is $lib\n"; opendir (DIR, ".") || die "cannot read from current dir"; open (XREF, "<$xpath$lib.OUT") || die "cannot open cross-ref file $xpa +th$lib.OUT"; %XREF = (); while (<XREF>) { ($SeqID, $MNid) = (split /\t/, $_)[0,1]; $XREF{$SeqID} = $MNid; }; `phred -pd phd_dir *.gz`; `phran -q $phran_cut phd_dir/*.phd.1`; `mv $dir/phd_dir/*.raw $dir/phd_dir/phran_dir/`; print "raw files moved to phran, now sorting\n"; while ($sequence = readdir (DIR)) { if ( $sequence =~ /MN/ ) { if ( $sequence =~ /(^.*)(\.gz)/ ) { $sequence = $1; }; if (exists $XREF{$sequence}) { $seqID = $XREF{$sequence}; if ($seqID =~ TB) { `mv $dir/phd_dir/phran_dir/$sequence.raw $dir/phd_dir/phra +n_dir/3prime/`; } else { `mv $dir/phd_dir/phran_dir/$sequence.raw $dir/phd_dir/phra +n_dir/5prime/`; }; }; }; }; $threeprimedir = "$dir/phd_dir/phran_dir/3prime"; $fiveprimedir = "$dir/phd_dir/phran_dir/5prime"; @primes = ($threeprimedir, $fiveprimedir); foreach $vfdir ( @primes ) { $pid = fork and next; &VF4($line); print "Completed $dir\n"; }; print "processing complete for $dir\n"; $dir/phd_dir/phran_dir/vf_dir/`; sub finish { chdir "$dir/phd_dir/phran_dir/vf_dir/"; print "Running artifact filter\n"; `af *.seq > afresults.log`; `mv *qc $dir/phd_dir/phran_dir/vf_dir/af_dir/`; `mv afresults.log $dir/phd_dir/phran_dir/vf_dir/af_dir/`; `mv *.af.out $dir/phd_dir/phran_dir/vf_dir/af_dir/`; `mv $dir/phd_dir/phran_dir/vf_dir/*.raw $dir/phd_dir/phran_d +ir/`; }; sub VF4($) { if ($vfdir =~ /3prime/) { chdir "$dir/phd_dir/phran_dir/3prime"; `gstVF4 -o $vffile3 *.raw > 3primevf.log`; print "finished Running VF4 in 3prime\n"; `mv $dir/phd_dir/phran_dir/3prime/* $dir/phd_dir/phran_dir/vf_dir/ +`; chdir ".."; `rm $vfdir`; #&finish; }elsif ($vfdir =~ /5prime/) { chdir "$dir/phd_dir/phran_dir/5prime"; `gstVF4 -o $vffile5 *.raw > 5primevf.log`; print "finished Running VF4 in 5prime\n"; `mv $dir/phd_dir/phran_dir/5prime/* $dir/phd_dir/phran_dir/vf_dir/ +`; chdir ".."; `rm $vfdir`; #&finish; }; &finish; };

In reply to Re: Re: forking patience... by Anonymous Monk
in thread forking patience... by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.