Hi Tiago, On Wed, 13 Jul 2011 14:29:40 -0230 Tiago Hori <tiago.h...@gmail.com> wrote:
> Hi All, > > I work with microarrays and get huge tab delimited files as outputs from the > software that analysis these microarrays. The result is a tab-delimted Excel > type of file that has 160000 rows and about 20 columns. > > Every 44K rows make one unit within the data. These units are identified by > the Second data column, called meta arrow. So the first 44K rows have the > value 1 on Meta row, the next 44K have the value 2 and so for. > > I would like to be able to separate these files into 4 different files, each > one containing each unit of data. So all the rows that have meta row 1 would > go to one file, and the ones with meta row 2 would go to another file and so > forth. > > I have been reading beginning perl to tried to figure this out, but I > haven't be able to come up with anything. > > I have many questions: I know I can use a filhandle to connect to the file, > but how would I store the data to begin with? You can write the data directly to the four filehandles as you go over them. You can have filehandles as the values of arrays or hashes. Just make sure you are using a CSV parsing and output module: http://beta.metacpan.org/release/Text-CSV > > Is there a way to iteratively read through the rows and then copy them to a > variable as long as their metarow column read let's say 1? Yes, there is, use a conditional or a hash for that. But you shouldn't keep everything in memory - use multiple file-handles. > and then out put > that as a new file? > > Any help would be greatly appriciated, even if is just hints on how to get > started. > > Cheers, > > Tiago > > Regards, Shlomi Fish -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ Freecell Solver - http://fc-solve.berlios.de/ mplayer 0.9.999.2010.03.11-rc5-adc83b19e793491b1c6ea0fd8b46cd9f32e592fc now available for download. — Shlomi Fish and d3x. Please reply to list if it's a mailing list post - http://shlom.in/reply . -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/