[ensembl-dev] getting the gene for a variation feature in a pseudogene of rna gene

Andrea Edwards edwardsa at cs.man.ac.uk
Tue Dec 7 20:56:45 GMT 2010


Hi

I'm using the api to have a look at Watson SNPs and i was wondering how 
i would get the genes the SNPs are in. (i know you can get this using 
biomart but i was using the api to get more used to it).

I just wanted to check that snps in mRNA genes and pseudogenes have 
transcripts (and hence transcript variations) in ensembl  otherwise my 
code below to get the gene from the transcript id of the transcript 
object of the transcriptvariation(s) of a variation feature (this seems 
long winded doesn't it - am i missing an easier way) won't work for snps 
in mRNA genes and pseuodgenes.

Every pseudogene/rna gene that i have looked at in ensembl has a 
transcript but i would like to be sure i can count on it.

thanks a lot

my $variation_set_adaptor= $reg->get_adaptor('human', 'variation', 
'variationset');
my $watson_set = $variation_set_adaptor->fetch_by_name("ENSEMBL:Watson");

my $slice_adaptor = $reg->get_adaptor($species, 'core', 'slice');
my $gene_adaptor =$reg->get_adaptor($species, 'core','gene');
my $transcript_adaptor =$reg->get_adaptor($species, 'core','Transcript');

@slices = @{ $slice_adaptor->fetch_all('chromosome', undef, 0, 1) };
foreach $slice (@slices) {

     unless ($slice->seq_region_name() =~ /Un/) {


         my @vfs 
=@{$watson_set->get_all_VariationFeatures_by_Slice($slice)};
         foreach my $vf (@vfs) {
             next if ($vf->var_class ne 'snp');


              #@dbsnp_syns = @{$var->get_all_synonyms('dbSNP')};
              $all_synonyms = join ',', @{$var->get_all_synonyms()};

              my @tvs = @{$vf->get_all_TranscriptVariations};
              foreach my $tv (@tvs) {
                 $gene_id = 
$gene_adaptor->fetch_by_transcript_id($tv->transcript->stable_id());
                 print "gene id: $gene_id\n";
                 print "variation: ", 
$tv->variation_feature()->variation_name(), "\n";
                  print "transcript: ", $tv->transcript->stable_id(), "\n";
                   print "consequence type:  @{$tv->consequence_type()}\n";
                   print "peptide alleles: ", $tv->pep_allele_string(), 
"\n";

             }
         }
     }
}




More information about the Dev mailing list