This module is an entry point into a Glovar database. It allows you to retrieve
STSs from Glovar.
sub fetch_all_by_clone_accession
{ my ($self, $embl_acc, $embl_version, $cl_start, $cl_end) = @_;
my @cloneinfo = $self->fetch_clone_by_accession($embl_acc);
return([]) unless (@cloneinfo);
my ($nt_name, $id_seq, $clone_start, $clone_end, $clone_strand) = @cloneinfo;
my ($q_start, $q_end);
if ($clone_strand == 1) {
$q_start = $clone_start + $cl_start - 1;
$q_end = $clone_start + $cl_end + 1;
} else{
$q_start = $clone_end - $cl_end - 1;
$q_end = $clone_end - $cl_start + 1;
}
$q_start -= 1000;
my $q2 = qq(
SELECT
ss.id_sts as internal_id,
ss.sts_name as sts_name,
ms.start_coordinate as sts_start,
ms.end_coordinate as sts_end,
ms.is_revcomp as sts_strand,
length(ss.sense_oligoprimer) as sen_len,
length(ss.antisense_oligoprimer) as anti_len,
sod.description as pass_status,
sad.description as assay_type,
ss.is_private as private
FROM
mapped_sts ms,
sts_summary ss,
sts_outcome_dict sod,
snpassaydict sad
WHERE ms.id_sequence = ?
AND ms.id_sts = ss.id_sts
AND ss.assay_type = sad.id_dict
AND ss.pass_status = sod.id_dict
AND ms.start_coordinate BETWEEN $q_start AND $q_end
);
my $sth;
eval {
$sth = $self->prepare($q2);
$sth->execute($id_seq);
};
if ($@){
warn("ERROR: SQL failed in " . (caller(0))[3] . "\n$@");
return([]);
}
my @features = ();
while (my $row = $sth->fetchrow_hashref()) {
return([]) unless keys %{$row};
warn "WARNING: private STS!" if $row->{'PRIVATE'};
my ($start, $end);
$row->{'STS_END'} ||= $row->{'STS_START'};
if ($clone_strand == 1) {
$start = $row->{'STS_START'} - $clone_start + 1;
$end = $row->{'STS_END'} - $clone_start + 1;
} else {
$start = $clone_end - $row->{'STS_END'} + 1;
$end = $clone_end - $row->{'STS_START'} + 1;
}
my $strand = (1 - 2 * $row->{'STS_STRAND'}) * $clone_strand;
push @features, Bio::EnsEMBL::ExternalData::Glovar::STS->new_fast({
'analysis' => 'glovar_sts',
'display_id' => $row->{'STS_NAME'},
'dbID' => $row->{'INTERNAL_ID'},
'start' => $start,
'end' => $end,
'strand' => $strand,
'seqname' => $embl_acc,
'sense_length' => $row->{'SEN_LEN'},
'antisense_length' => $row->{'ANTI_LEN'},
'pass_status' => $row->{'PASS_STATUS'},
'assay_type' => $row->{'ASSAY_TYPE'},
});
}
return(\@features); } |