Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Woot! 100% what Emos wanted?

  • Loading branch information...
commit 8ddbaa53637b247353822c6b4310c8a2c38445f7 1 parent 3565043
@jhannah authored
Showing with 30 additions and 29 deletions.
  1. +0 −8 emos/fetch.pl
  2. 0  emos/out.fasta
  3. +30 −21 emos/x.pl
View
8 emos/fetch.pl
@@ -1,8 +0,0 @@
-use Bio::Perl;
-
-my $out = Bio::SeqIO->new(-format => 'fasta', -file => '>out.fasta');
-foreach my $id (qw( ENSG00000162946 )) {
- my $seq = get_sequence('embl', $id);
- $out->write_seq($seq);
-}
-
View
0  emos/out.fasta
No changes.
View
51 emos/x.pl
@@ -3,33 +3,42 @@
use strict;
use Bio::DB::EntrezGene;
use Bio::EnsEMBL::Registry;
+use Bio::SeqIO;
-my $id = '54806';
my $db = new Bio::DB::EntrezGene;
-my $seq = $db->get_Seq_by_id($id);
-my $ac = $seq->annotation;
-
-my ($chr,$from,$to);
-for my $ann ($ac->get_Annotations('chromosome')) {
- $chr = $ann->value;
-}
-for my $ann ($ac->get_Annotations('dblink')) {
- if ($ann->database eq "Evidence Viewer") {
- # get the sequence identifier, the start, and the stop
- ($from,$to) = $ann->url =~ /from=(\d+)&to=(\d+)/;
- }
-}
-printf("chr%s %s..%s\n", $chr, $from, $to);
my $registry = 'Bio::EnsEMBL::Registry';
-
$registry->load_registry_from_db(
- -host => 'ensembldb.ensembl.org',
- -user => 'anonymous'
+ -host => 'ensembldb.ensembl.org',
+ -user => 'anonymous'
);
-
my $slice_adaptor = $registry->get_adaptor( 'Human', 'Core', 'Slice' );
-my $slice = $slice_adaptor->fetch_by_region( 'chromosome', $chr, $from - 100000, $to + 100000 );
-print $slice->seq;
+open(OUT, ">out.fasta");
+
+foreach my $id (qw( 54806 27185 1815 280730 581 )) {
+ my $seq = $db->get_Seq_by_id($id);
+ my $ac = $seq->annotation;
+ my ($chr,$from,$to);
+ for my $ann ($ac->get_Annotations('chromosome')) {
+ $chr = $ann->value;
+ }
+ for my $ann ($ac->get_Annotations('dblink')) {
+ if ($ann->database eq "Evidence Viewer") {
+ # get the sequence identifier, the start, and the stop
+ ($from,$to) = $ann->url =~ /from=(\d+)&to=(\d+)/;
+ }
+ }
+ $from -= 100000;
+ $to += 100000;
+ my $long_id = sprintf("%s chr%s %s..%s", $id, $chr, $from, $to);
+ print "$long_id\n";
+ print OUT ">$long_id\n";
+
+ my $slice = $slice_adaptor->fetch_by_region( 'chromosome', $chr, $from - 100000, $to + 100000 );
+ print OUT $slice->seq;
+ print OUT "\n";
+}
+
+
Please sign in to comment.
Something went wrong with that request. Please try again.