You are going to be on a very steep learning curve with Perl. But to get you started, I would create a hash table out of file2. This will allow you to translate any TID into the SPNAME. Code below. Note how I limited the number of things coming out of the split(). You will need that technique to parse the first file, except there will be 3 fields instead of 2.
my ($gid,$tid,$concat) = split(/\s+/,$_,3);
#!/usr/bin/perl -w use strict; use Data::Dumper; my %tid2spname; foreach (<DATA>) { chomp; my ($tid, $txt) = split(/\s+/,$_,2); $tid2spname{$tid} = $txt; } print Dumper \%tid2spname; __DATA__ 10090 Mus musculus 10116 Rattus norvegicus 148305 Magnaporthe grisea 28985 Kluyveromyces lactis 33169 Eremothecium gossypii 3702 Arabidopsis thaliana 4530 Oryza sativa 4896 Schizosaccharomyces pombe 4932 Saccharomyces cerevisiae 5141 Neurospora crassa 5833 Plasmodium falciparum 6239 Caenorhabditis elegans 7165 Anopheles gambiae 7227 Drosophila melanogaster 7955 Danio rerio 9031 Gallus gallus 9598 Pan troglodytes 9606 Homo sapiens 9615 Canis lupusfamiliaris 9913 Bos taurus
In reply to Re: Multiple loops and comparisions
by Marshall
in thread Multiple loops and comparisions
by sundeep
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |