in reply to fasta hash
It's usually more efficient to do it the other way round: First read the file with the IDs, store the IDs in a hash, and then go through the fasta file, and print each line if its ID appears in the hash. That way you have to store less data in memory.
Regarding your code: Use strict and warnings, and indent the code properly, for example 4 characters for each opening bracket. It actually makes code readable. See perlstyle.
@data=split(" ",$line); $fastahash{$fastaID}=$sequence;
This is almost certainly wrong: the hash key ($fastaID) doesn't depend on $line, so whatever it is, it's not the current ID. First assign to $fastaID, then use it as a hash key.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: fasta hash
by morio56 (Initiate) on Aug 26, 2011 at 13:51 UTC | |
by ForgotPasswordAgain (Vicar) on Aug 26, 2011 at 22:37 UTC | |
by moritz (Cardinal) on Aug 26, 2011 at 13:56 UTC | |
by morio56 (Initiate) on Aug 26, 2011 at 15:12 UTC | |
by moritz (Cardinal) on Aug 26, 2011 at 16:38 UTC | |
by morio56 (Initiate) on Aug 26, 2011 at 19:10 UTC | |
|