[ensembl-dev] variation api - only get variation features that are snps
Andrea Edwards
edwardsa at cs.man.ac.uk
Mon Nov 29 12:23:21 GMT 2010
Hello
I have some code below which gets all of the variation features for cow
that are mapped to know chromosomes. However this code gets all
variation features and I would like to get just snps. Could you suggest
how i do this? Also i'm new to the api so if you spot i'm doing
something in an inefficient manner and feel like pointing it out then
that's fine by me
thanks a lot
======================================
my $slice_adaptor = $registry->get_adaptor('bos_taurus', 'core',
'slice'); #get the database adaptor for Slice objects
my $vf_adaptor = $registry->get_adaptor('bos_taurus', 'variation',
'variationfeature'); #get adaptor to VariationFeature object
@slices = @{ $slice_adaptor->fetch_all('chromosome', undef, 0, 1) };
foreach $slice (@slices) {
unless ($slice->seq_region_name() =~ /Un/) {
#return ALL variations defined in $slice
$vfs = $vf_adaptor->fetch_all_by_Slice($slice);
foreach my $vf (@{$vfs}) {
# Variation feature representing a single nucleotide
polymorphism
#insert into my database
}#end for each variation feature
}#end unless slice is a chromosome
}#end for each slice
More information about the Dev
mailing list