Skip to content

Instantly share code, notes, and snippets.

@avrilcoghlan
Created December 17, 2013 10:04
Show Gist options
  • Save avrilcoghlan/8002675 to your computer and use it in GitHub Desktop.
Save avrilcoghlan/8002675 to your computer and use it in GitHub Desktop.
Perl script to use the Ensembl Compara Perl API to print the sequence of the Member corresponding to SwissProt protein O93279
#!/usr/bin/env perl
# Print the sequence of the Member corresponding to SwissProt protein O93279
use strict;
use warnings;
use Bio::EnsEMBL::Registry;
my $registry = 'Bio::EnsEMBL::Registry';
$registry->load_registry_from_db(
-host => 'ensembldb.ensembl.org',
-user => 'anonymous'
);
# get the Bio::EnsEMBL::Compara::SeqMember for the SwissProt protein O93279
my $sma = $registry->get_adaptor("multi", "compara", "seqmember");
my $seqmember = $sma->fetch_by_source_stable_id("Uniprot/SWISSPROT", "O93279");
# get the stable id. for protein O93279
my $stable_id = $seqmember->stable_id();
print "stable id. is: $stable_id\n";
# get the sequence for protein O93279
my $sequence = $seqmember->sequence();
print "sequence is:\n$sequence\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment