Skip to content

Instantly share code, notes, and snippets.

@radaniba
Created November 29, 2012 17:20
Show Gist options
  • Save radaniba/4170524 to your computer and use it in GitHub Desktop.
Save radaniba/4170524 to your computer and use it in GitHub Desktop.
Is there any signal in the intron of genes that could guide the mRNA splicing? This could be kind of a old question, but let's just start with it. So to find out the answer, the first thing you need is the sequence flanking the exon-intron border, or mayb
use Bio::EnsEMBL::Registry;
use Bio::SeqIO;
use Bio::Seq;
my $sp = "mouse";
my $ensembl = "Bio::EnsEMBL::Registry";
$ensembl->load_registry_from_db(
-host => 'ensembldb.ensembl.org',
-user => 'anonymous',
-verbose => '1'
);
my $ensg_dba = $ensembl->get_adaptor($sp,"core","Gene");
my $enst_dba = $ensembl->get_adaptor($sp,"core","Transcript");
my $ense_dba = $ensembl->get_adaptor($sp,"core","Exon");
my $enss_dba = $ensembl->get_adaptor($sp,"core","Slice");
my $out = new Bio::SeqIO(-file=>">".$sp.".fasta",-format=>"fasta");
foreach $enst (@{$enst_dba->fetch_all()}) {
next unless($enst->biotype eq "protein_coding");
my $ensg = $ensg_dba->fetch_by_transcript_stable_id($enst->stable_id);
my $rank = 1;
my $exons = $ense_dba->fetch_all_by_Transcript($enst);
foreach my $this_exon (@$exons) {
my $slice = $enss_dba -> fetch_by_exon_stable_id($this_exon->stable_id);
if($enst->strand < 0)
{
$slice = $slice->invert();
}
my $seq = new Bio::Seq(-seq => $slice->seq, display_id => $ensg->display_id."_".$enst->display_id."_".$this_exon->display_id."_".$this_exon->is_constitutive."_".$rank."|".$slice->seq_region_name.":".$slice->start."-".$slice->end.":".$slice->strand);
$out->write_seq($seq);
$rank ++;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment