Skip to content
Snippets Groups Projects
Commit c1c287bd authored by Felix Kokocinski's avatar Felix Kokocinski
Browse files

removed unreliable fetch_grouped function

parent 865fd799
No related branches found
No related tags found
No related merge requests found
......@@ -237,82 +237,6 @@ sub fetch_all_by_Slice {
}
=head2 fetch_grouped
Arg [1] : (optional) ditag id
Arg [2] : (optional) ditag type
Arg [3] : (optional) Bio::EnsEMBL::Slice
Example : $gouped_tags = $ditagfeature_adaptor->fetch_grouped(undef, "ZZ11", undef);
Description: Retrieves Features from the database in their start-end groups;
The start will be the lower seq_region_start, the end the higher seq_region_end.
In context this should refer to potential transcript start and end locations.
This is a convinience method for analysing the ditag mappings, in general
fetch_grouped_ditagFeatures should be used to fetch proper objects.
Returntype : listref of hashes similar to DitagFeatures:
%grouped_tag( -slice => $slice,
-start => $seqstart,
-end => $seqend,
-strand => $strand,
-tag_count => $tagcount,
-hit_strand => $hit_strand,
-ditag_id => $ditag_id,
-ditag_pair_id => $ditag_pair_id,
);
Caller : general
=cut
sub fetch_grouped {
my ($self, $ditagid, $tagtype, $slice) = @_;
my (@grouped_tags, @querywords);
my $sql = "SELECT df.seq_region_id, MIN(df.seq_region_start) AS minstart,
MAX(df.seq_region_end) AS maxend, df.seq_region_strand,
df.hit_strand, df.ditag_id, df.ditag_pair_id, d.tag_count
FROM ditag_feature df, ditag d
WHERE df.ditag_id=d.ditag_id ";
if($tagtype){
$sql .= " AND d.type = \"".$tagtype."\"";
}
if($ditagid){
$sql .= " AND df.ditag_id = ".$ditagid;
}
if($slice){
$sql .= " AND df.seq_region_id = ".$slice->get_seq_region_id.
" AND df.seq_region_start >= ".$slice->start.
" AND df.seq_region_end <= ".$slice->end;
}
$sql .= " GROUP BY df.ditag_id, df.ditag_pair_id".
" ORDER BY df.seq_region_id, minstart, maxend";
my $sth = $self->prepare($sql);
$sth->execute();
my ( $seqreg, $seqstart, $seqend, $strand, $hit_strand, $ditag_id, $ditag_pair_id, $tagcount );
$sth->bind_columns( \$seqreg, \$seqstart, \$seqend,
\$strand, \$hit_strand, \$ditag_id,
\$ditag_pair_id, \$tagcount );
while ( $sth->fetch ) {
my $alt_slice = $self->db->get_SliceAdaptor->fetch_by_seq_region_id($seqreg);
my %grouped_tag = ( slice => $alt_slice,
start => $seqstart,
end => $seqend,
strand => $strand,
tag_count => $tagcount,
hit_strand => $hit_strand,
ditag_id => $ditag_id,
ditag_pair_id => $ditag_pair_id,
);
push @grouped_tags, \%grouped_tag;
}
return \@grouped_tags;
}
=head2 _fetch
Arg [1] : statement handler
......
......@@ -2,7 +2,7 @@ use strict;
BEGIN { $| = 1;
use Test ;
plan tests => 14;
plan tests => 12;
}
use Bio::EnsEMBL::Test::MultiTestDB;
......@@ -84,7 +84,7 @@ ok($testfeature && $testfeature->isa('Bio::EnsEMBL::Map::DitagFeature'));
$multi->restore('core', 'ditag_feature');
########
# 5-13 #
# 5-11 #
########
#test fetch methods
......@@ -120,15 +120,10 @@ ok(scalar(@$dfs) && $dfs->[0]->isa('Bio::EnsEMBL::Map::DitagFeature'));
#use logic-name
$dfs = $dfa->fetch_all_by_Slice($slice, '', $logic_name);
ok(1);#scalar(@$dfs) && $dfs->[0]->isa('Bio::EnsEMBL::Map::DitagFeature'));
#test fetch_grouped
$dfs = $dfa->fetch_grouped('', $tag_library);
ok(scalar @$dfs);
ok($dfs->[0]->{'ditag_id'} && $dfs->[0]->{'start'} && $dfs->[0]->{'end'});
ok(scalar(@$dfs) && $dfs->[0]->isa('Bio::EnsEMBL::Map::DitagFeature'));
######
# 14 #
# 12 #
######
#test list_dbIDs
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment