> Hi all,

Hi Michael,
> 
> I am having trouble with combining data from several files, 
> and I can't  
> even figure out how to get started. So, I am NOT asking for any code  
> (though pseudo-code is ok) as I would like to try figuring 
> this problem  
> out myself. So, if anyone can give me any references or hints that  
> would be great.

Thatīs a good approach :-)

[..]
> 
> Basically, I would like to concatenate the sequence of each  
> corresponding animal so that the various input files would  
> be out put  
> to a file like so:
> 
[..]

> 
> Notice that in the two files the data are not in the same 
> order. So, I  
> am trying to figure out how to have the script figure out what the  
> first organism is in FILE 1( say "cat" in this case) and find the  
> corresponding "cat" in the other input files. Then take the sequence  
> data (all the cat data) from FILE 2 and concatenate it to the cat  
> sequence data in FILE 1 to an output file. Then it should go 
> on to the  
> next organism in FILE 1 and search for that next organism in 
> the other  
> files (in this case FILE 2). I do not care about the order of 
> the data,  
> only that the "like" data is concatenated together.

If memory is not a problem (i.e. the amount of data you're processing is
rather small), I would read all files into a hash and concatenate them
there. Something like:
- open the first file
- search for the beginning of an "organism" (say: ">cat"), read everything
after this point
- search in your hash if you already stored data of this organism
  - if yes, append your new sequence to the already existing data
  - if no, create a new key in the hash
- repeat this until you run out of "organisms"
- repeat the whole procedure until you run out of files

I'd happily elaborate, but I don't want to spoil your approach of wanting to
solve this by yourself.
If you have any questions or need additional information, just post again.
:-)

> 
> Again, I do NOT want this solved for me (unless I am totally lost).  
> Otherwise, I'll never learn. I would just like either hints /  
> suggestions / pseudo code / even links to books or sites that 
> discuss  
> this particular topic. Meanwhile, I am eagerly awaiting my "PERL  
> Cookbook" and I'll keep searching the web.

Another good starting point might be the "camel book" 
(O`Reilly: Programming Perl)...

HTH,

Philipp

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to