No such thing as a small change | |
PerlMonks |
unix loops in perlby a217 (Novice) |
on Oct 26, 2011 at 05:25 UTC ( [id://933785]=perlquestion: print w/replies, xml ) | Need Help?? |
a217 has asked for the wisdom of the Perl Monks concerning the following question: I am trying to create a pipeline using perl script to make calls to various code. The problem I'm facing is that the initial program splits a large data file into separate smaller files (separated by chromosome) so that numerous files are produced (e.g. chr1.out, chr2.out, chr3.out ...). When I was not restricted to the pipeline, I used unix for-loops to cycle through each respective output file in such manner:
What I am trying to convey here is that each filename is nearly the same except for the specific chr number for each (which is why I cycle through from chr1 to chr24) However, within the perl script I am having a hard time trying to get the correct language to cycle through each chromosome. I have been using the system() command in perl which allows me to execute separate perl code in the server using the pipeline. I have tried:
which does not seem to work, and I've also tried:
because I know using the ` character allows you to enter unix commands. I know I am approaching this the wrong way but I'm having a hard time trying to find a solution. I have already tried to catenate the separated output files and then run the pipeline on one large file, but this method will create problems down the road for me. I've also included a sample to test if necessary: pipe.test.pl
chr1.in.txt
chr2.in.txt
As you can see its a very simple test, and to run it I use the command: "perl pipe.test.pl chr1.in.txt chr1.out.txt" for chr1. Essentially, the goal here is to be able to execute pipe.test.pl from a separate perl script using for-loops to cycle through each chromosome. I hope I am coming across clear to everybody.
Back to
Seekers of Perl Wisdom
|
|