Skip to content

Instantly share code, notes, and snippets.

@avrilcoghlan
Last active December 31, 2015 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save avrilcoghlan/8003808 to your computer and use it in GitHub Desktop.
Save avrilcoghlan/8003808 to your computer and use it in GitHub Desktop.
Perl script that uses the Ensembl Compara Perl API to print the protein tree with the stable id ENSGT00390000003602
#!/usr/bin/env perl
# Print the protein tree with the stable id ENSGT00390000003602
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 $genetree = $gta->fetch_by_stable_id("ENSGT00390000003602");
$genetree->print_tree(); # prints the tree in ASCII format
print "\n\n";
print $genetree->newick_format('simple'),"\n\n"; # prints the tree in Newick format
print $genetree->nhx_format('full'),"\n\n"; # prints the tree in nhx format
print $genetree->nhx_format('display_label_composite'),"\n\n"; # includes the gene names and species names in nhx format
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment