Skip to content

Instantly share code, notes, and snippets.

@avrilcoghlan
Created December 18, 2013 11:20
Show Gist options
  • Save avrilcoghlan/8020733 to your computer and use it in GitHub Desktop.
Save avrilcoghlan/8020733 to your computer and use it in GitHub Desktop.
Perl script that uses the Ensembl Compara Perl API to print all the members of the tree containing the human ncRNA gene ENSG00000238344
#!/usr/bin/env perl
# Print all the members of the tree containing the human ncRNA gene ENSG00000238344
use strict;
use warnings;
use Bio::EnsEMBL::Registry;
my $registry = 'Bio::EnsEMBL::Registry';
$registry->load_registry_from_db(
-host => 'ensembldb.ensembl.org',
-user => 'anonymous'
);
my $gta = $registry->get_adaptor('multi', 'compara', 'GeneTree');
my $gma = $registry->get_adaptor('multi', 'compara', 'GeneMember');
my $gene_member = $gma->fetch_by_source_stable_id("ENSEMBLGENE", "ENSG00000238344"); # Get the 'GeneMember' object for the gene ENSG00000238344
my $genetree = $gta->fetch_default_for_Member($gene_member);
my @mem = @{$genetree->get_all_Members()};
foreach my $mem (@mem) {
my $stable_id = $mem->stable_id();
print "___ $stable_id\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment