reece

fetching exons with ensembl

May 21st, 2011
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.59 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3. use strict;
  4. use warnings;
  5.  
  6. use Bio::EnsEMBL::ApiVersion;
  7. use Bio::EnsEMBL::Registry;
  8.  
  9. my $ac = shift;
  10.  
  11. my $r = 'Bio::EnsEMBL::Registry';
  12. $r->load_registry_from_db(
  13.       -user => 'anonymous',
  14.       -host => 'ensembldb.ensembl.org',
  15.       -port => 5306
  16.      );
  17.  
  18. my $ta = $r->get_adaptor( 'homo_sapiens', 'Core', 'Transcript' );
  19.  
  20. my ($tx) = @{ $ta->fetch_all_by_external_name($ac) };
  21.  
  22. printf("Ensembl %s (%s; %s)\n", software_version(), $ac, $tx->display_id);
  23. foreach my $exon ( @{ $tx->get_all_Exons() } ) {
  24.   printf("%d\t%d\t%d\n", $exon->start, $exon->end, $exon->length);
  25. }
Advertisement
Add Comment
Please, Sign In to add comment