Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ensembl
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ensembl-gh-mirror
ensembl
Commits
d43a18d0
Commit
d43a18d0
authored
18 years ago
by
Felix Kokocinski
Browse files
Options
Downloads
Patches
Plain Diff
ditag code changes for havana
parent
0638c02e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/Bio/EnsEMBL/Map/DBSQL/DitagFeatureAdaptor.pm
+98
-5
98 additions, 5 deletions
modules/Bio/EnsEMBL/Map/DBSQL/DitagFeatureAdaptor.pm
modules/Bio/EnsEMBL/Map/DitagFeature.pm
+27
-9
27 additions, 9 deletions
modules/Bio/EnsEMBL/Map/DitagFeature.pm
with
125 additions
and
14 deletions
modules/Bio/EnsEMBL/Map/DBSQL/DitagFeatureAdaptor.pm
+
98
−
5
View file @
d43a18d0
...
...
@@ -170,6 +170,7 @@ sub fetch_all_by_type {
Example : $tags = $ditagfeature_adaptor->fetch_all_by_Slice($slice, "SME005");
Description: Retrieves ditagFeatures from the database overlapping a specific region
and (optional) of a specific ditag type or analysis.
Start & end locations are returned in slice coordinates, now.
Returntype : listref of Bio::EnsEMBL::Map::DitagFeatures
Caller : general
...
...
@@ -232,7 +233,7 @@ sub fetch_all_by_Slice {
WHERE ditag_feature_id IN(
"
.
$ids_to_fetch
.
"
)
"
);
$sth
->
execute
();
my
$result
=
$self
->
_fetch
(
$sth
);
my
$result
=
$self
->
_fetch
(
$sth
,
$slice
);
push
(
@result
,
@$result
);
}
...
...
@@ -240,9 +241,77 @@ sub fetch_all_by_Slice {
}
=head2 fetch_pairs_by_Slice
Arg [1] : Bio::EnsEMBL::Slice
Arg [2] : (optional) ditag type (specific library)
Arg [3] : (optional) analysis logic_name
Example : my $ditagfeatures = $dfa->fetch_pairs_by_Slice($slice);
foreach my $ditagfeature (@$ditagfeatures){
$minstart = $$ditagfeature2{'start'};
$maxend = $$ditagfeature2{'end'};
$bothstrand = $$ditagfeature2{'strand'};
$tag_count = $$ditagfeature2{'tag_count'};
print "$minstart, $maxend, $bothstrand, $tag_count\n";
}
Description: Retrieves ditagFeature information in pairs from the database overlapping a specific region
and (optional) of a specific ditag type or analysis. The absotute start and end points are
fetched.
Slices should be SMALL!
Returntype : array ref with hash ref of artifical DitagFeature object
Caller : general
=cut
sub
fetch_pairs_by_Slice
{
my
(
$self
,
$slice
,
$tagtype
,
$logic_name
)
=
@_
;
my
(
$tag_id
,
$pair_id
,
$seq_region_id
,
$start
,
$end
,
$strand
,
$analysis_id
,
$tag_count
);
my
@result
;
my
$sql
=
"
SELECT df.ditag_id, df.ditag_pair_id, df.seq_region_id, MIN(df.seq_region_start),
"
.
"
MAX(df.seq_region_end), df.seq_region_strand, df.analysis_id, d.tag_count
"
.
"
FROM ditag_feature df, ditag d
"
.
"
WHERE df.ditag_id=d.ditag_id
";
if
(
$tagtype
){
$sql
.=
"
AND d.type =
\"
"
.
$tagtype
.
"
\"
";
}
$sql
.=
"
AND df.seq_region_id =
"
.
$slice
->
get_seq_region_id
.
"
AND df.seq_region_start <=
"
.
$slice
->
end
.
"
AND df.seq_region_end >=
"
.
$slice
->
start
;
if
(
$logic_name
){
my
$analysis
=
$self
->
db
->
get_AnalysisAdaptor
->
fetch_by_logic_name
(
$logic_name
);
if
(
!
$analysis
)
{
return
undef
;
}
$sql
.=
"
AND df.analysis_id =
"
.
$analysis
->
dbID
();
}
$sql
.=
"
GROUP BY df.ditag_id, df.ditag_pair_id;
";
my
$sth
=
$self
->
prepare
(
$sql
);
$sth
->
execute
();
$sth
->
bind_columns
(
\
$tag_id
,
\
$pair_id
,
\
$seq_region_id
,
\
$start
,
\
$end
,
\
$strand
,
\
$analysis_id
,
\
$tag_count
);
while
(
$sth
->
fetch
)
{
my
%ditag_pair
=
(
ditag
=>
$tag_id
,
pair_id
=>
$pair_id
,
region
=>
$seq_region_id
,
start
=>
$start
,
end
=>
$end
,
strand
=>
$strand
,
analysis
=>
$analysis_id
,
tag_count
=>
$tag_count
);
push
(
@result
,
\
%ditag_pair
);
}
return
\
@result
;
}
=head2 _fetch
Arg [1] : statement handler
Arg [2] : (optional) target-slice for the feature
Description: generic sql-fetch function for the DitagFeature fetch methods
Returntype : listref of Bio::EnsEMBL::Map::DitagFeatures
Caller : private
...
...
@@ -250,7 +319,7 @@ sub fetch_all_by_Slice {
=cut
sub
_fetch
{
my
(
$self
,
$sth
)
=
@_
;
my
(
$self
,
$sth
,
$dest_slice
)
=
@_
;
my
(
$tag_id
,
$mothertag_id
,
$seqreg
,
$seqstart
,
$seqend
,
$strand
,
$analysis_id
,
$hit_start
,
$hit_end
,
$hit_strand
,
$cigar_line
,
$ditag_side
,
$ditag_pair_id
);
...
...
@@ -260,13 +329,36 @@ sub _fetch {
\
$hit_strand
,
\
$cigar_line
,
\
$ditag_side
,
\
$ditag_pair_id
);
my
@ditags
;
my
@ditag_features
;
my
$dest_slice_start
;
my
$dest_slice_end
;
my
$dest_slice_strand
;
if
(
$dest_slice
)
{
$dest_slice_start
=
$dest_slice
->
start
();
$dest_slice_end
=
$dest_slice
->
end
();
$dest_slice_strand
=
$dest_slice
->
strand
();
}
while
(
$sth
->
fetch
)
{
my
$analysis_obj
=
$self
->
db
->
get_AnalysisAdaptor
->
fetch_by_dbID
(
$analysis_id
);
my
$slice
=
$self
->
db
->
get_SliceAdaptor
->
fetch_by_seq_region_id
(
$seqreg
);
push
@ditags
,
if
(
$dest_slice
)
{
if
(
$dest_slice_start
!=
1
||
$dest_slice_strand
!=
1
)
{
if
(
$dest_slice_strand
==
1
)
{
$seqstart
=
$seqstart
-
$dest_slice_start
+
1
;
$seqend
=
$seqend
-
$dest_slice_start
+
1
;
}
else
{
my
$tmp_seq_region_start
=
$seqstart
;
$seqstart
=
$dest_slice_end
-
$seqend
+
1
;
$seqend
=
$dest_slice_end
-
$tmp_seq_region_start
+
1
;
$strand
*=
-
1
;
}
$slice
=
$dest_slice
;
}
}
push
@ditag_features
,
Bio::EnsEMBL::Map::
DitagFeature
->
new
(
-
dbid
=>
$tag_id
,
-
slice
=>
$slice
,
-
start
=>
$seqstart
,
...
...
@@ -280,11 +372,12 @@ sub _fetch {
-
cigar_line
=>
$cigar_line
,
-
ditag_side
=>
$ditag_side
,
-
ditag_pair_id
=>
$ditag_pair_id
,
-
ditag
=>
undef
,
-
adaptor
=>
$self
,
);
}
return
\
@ditags
;
return
\
@ditag
_feature
s
;
}
...
...
This diff is collapsed.
Click to expand it.
modules/Bio/EnsEMBL/Map/DitagFeature.pm
+
27
−
9
View file @
d43a18d0
...
...
@@ -67,6 +67,7 @@ use Bio::EnsEMBL::Utils::Argument qw( rearrange );
Arg [15] : (optional) int tag_count, only used for imported mappings where
identical positions where collapsed into into one feature.
Default: 1
Arg [16] : (optional) ditag object
Example : $ditag = Bio::EnsEMBL::Map::DitagFeature->new
(-dbID => 123, -adaptor => $adaptor, ...);
...
...
@@ -79,9 +80,9 @@ use Bio::EnsEMBL::Utils::Argument qw( rearrange );
sub
new
{
my
(
$caller
,
@args
)
=
@_
;
my
(
$dbID
,
$adaptor
,
$start
,
$end
,
$strand
,
$slice
,
$analysis
,
$hit_start
,
$hit_end
,
$hit_strand
,
$ditag_id
,
$ditag_side
,
$cigar_line
,
$ditag_pair_id
,
$tag_count
)
=
rearrange
(
[
'
dbid
',
'
adaptor
'
,'
start
',
'
end
',
'
strand
',
'
slice
',
'
analysis
',
'
hit_start
',
'
hit_end
',
'
hit_strand
',
'
ditag_id
',
'
ditag_side
',
'
cigar_line
',
'
ditag_pair_id
'
,'
tag_count
'],
$hit_strand
,
$ditag_id
,
$ditag_side
,
$cigar_line
,
$ditag_pair_id
,
$tag_count
,
$ditag
)
=
rearrange
(
[
'
dbid
',
'
adaptor
'
,'
start
',
'
end
',
'
strand
',
'
slice
',
'
analysis
',
'
hit_start
',
'
hit_end
',
'
hit_strand
',
'
ditag_id
',
'
ditag_side
',
'
cigar_line
',
'
ditag_pair_id
'
,'
tag_count
'
,
'
ditag
'
],
@args
);
my
$class
=
ref
(
$caller
)
||
$caller
;
...
...
@@ -131,6 +132,7 @@ sub new {
'
ditag_side
'
=>
$ditag_side
,
'
cigar_line
'
=>
$cigar_line
,
'
tag_count
'
=>
$tag_count
,
'
ditag
'
=>
$ditag
,
},
$class
);
return
$self
;
...
...
@@ -139,21 +141,37 @@ sub new {
=head2 fetch_ditag
Arg [1] : none
Description: Get the ditag object of this DitagFeature
Description: Deprecated, use ditag() instead
=cut
sub
fetch_ditag
{
throw
("
Deprecated method, please use ditag() instead.
\n
")
}
=head2 ditag
Arg [1] : (optional) ditag object
Description: Get/Set the ditag object of this DitagFeature
Returntype : Bio::EnsEMBL::Map::Ditag
Exceptions : none
Caller : general
=cut
sub
fetch_
ditag
{
sub
ditag
{
my
$self
=
shift
;
my
$ditag_adaptor
=
$self
->
adaptor
->
db
->
get_DitagAdaptor
;
my
$ditag
=
$ditag_adaptor
->
fetch_by_dbID
(
$self
->
ditag_id
);
if
(
@
_
)
{
$self
->
{'
ditag
'}
=
shift
;
}
elsif
(
!
$self
->
{'
ditag
'}
&&
$self
->
{'
adaptor
'}
&&
$self
->
{'
ditag_id
'})
{
#lazy load the ditag
my
$ditag_adaptor
=
$self
->
adaptor
->
db
->
get_DitagAdaptor
;
$self
->
{'
ditag
'}
=
$ditag_adaptor
->
fetch_by_dbID
(
$self
->
ditag_id
);
}
return
$ditag
;
return
$
self
->
{'
ditag
'}
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment