[ensembl-dev] variation set method get all features by slice returns unordered features?

Andrea Edwards edwardsa at cs.man.ac.uk
Mon Dec 27 19:50:12 GMT 2010


Hi

I have this code to get watson snps:

================================================================

my @unsorted_slices = @{ $slice_adaptor->fetch_all('chromosome', undef, 
0, 1) };

my @sorted_slices = sort by_num_then_letter @unsorted_slices;

# Base pair overlap between returned slices
my $overlap = 0;

# Maximum size of returned slices
my $max_size = 10000;
# Maximum size of returned slices
my $max_size = 10000;

# Break chromosomal slices into smaller 100k component slices
my @slices = @{split_Slices( \@sorted_slices, $max_size, $overlap )  };
my $snp_id = 0;
foreach my $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');
             $snp_id++;

             #insert snp to my database

=============================================================================

@sorted_slices contains chromosome slices sorted into numerical then 
alphabetical order, though this doesn't really matter
as my code didn't get past chromosome 1 before it lost connection to the 
server.

I then tried to start the code from the chromosome segment where it had 
left off and i found that the snps weren't in 'base pair' order in the 
database. For example, on chromosome 1 the first snp was at locus 4626 
and the next snp was at base 1081. (this position was obtained from     
$locus = $vf->start();)

So it appears to me that the method 
get_all_VariationFeatures_by_Slice($slice) on the variation set object 
does not return snps in base order. Is this correct? How do i retrieve 
them in order?

Thanks




More information about the Dev mailing list