Advertisement
Guest User

carandraug

a guest
Jun 28th, 2011
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.24 KB | None | 0 0
  1. use Bio::DB::EUtilities;
  2.  
  3. my $gene_uid = 9555;
  4. my $get_nuc = Bio::DB::EUtilities->new(
  5.                                         -eutil  => 'elink',
  6.                                         -db     => 'nucleotide',
  7.                                         -dbfrom => 'gene',
  8.                                         -id     => [$gene_uid]
  9.                                         );
  10. my %struct;
  11. while (my $nuc_link = $get_nuc->next_LinkSet) {
  12.   next unless $nuc_link->get_link_name eq 'gene_nuccore_refseqrna';
  13.   my @nuc_uids  = $nuc_link->get_ids;
  14.   foreach my $nuc_uid (@nuc_uids) {
  15.     my $get_prot = Bio::DB::EUtilities->new(
  16.                                             -eutil  => 'elink',
  17.                                             -db     => 'protein',
  18.                                             -dbfrom => 'nucleotide',
  19.                                             -id     => [$nuc_uid]
  20.                                             );
  21.     while (my $prot_link = $get_prot->next_LinkSet) {
  22.       next unless $prot_link->get_link_name eq 'nuccore_protein';
  23.       my ($prot_uid) = $prot_link->get_ids;
  24.       $struct{$nuc_uid} = $prot_uid;
  25.     }
  26.   }
  27. }
  28. foreach (keys %struct) {
  29.   say "transcript with UID $_ encodes protein with UID $struct{$_}";
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement