If you're trying to get a unique seq of protein sequences from a PIR file, I'd suggest using a hash of arrays. Use the sequence as the key and store the accession number (or a hash or array of all attribs, or an object representing the record) in the array.
If you don't need all of the other data in the record, you can use $hash{$sequence} = $count to track how many duplicates were observed.$hash{$sequence} = [ $accnum1, $accnum2, ... ]; $hash{$sequence} = [ { ENTRY => ... TITLE => ... ORGANISM => ... ACCESSIONS => ... }, ];
Calling keys on the hash returns the unique set of sequences.
If there are a very large number of sequences in the input file, you might be better off using a database.
In reply to Re: how to remove duplicate strings?
by bobf
in thread how to remove duplicate strings?
by heidi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |