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
41b92fbd
Commit
41b92fbd
authored
23 years ago
by
Simon Potter
Browse files
Options
Downloads
Patches
Plain Diff
adapted to work with tandem repeats
more mutilation of James' beautiful adaptor ...
parent
4321dc79
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/Bio/EnsEMBL/DBSQL/RepeatFeatureAdaptor.pm
+47
-31
47 additions, 31 deletions
modules/Bio/EnsEMBL/DBSQL/RepeatFeatureAdaptor.pm
with
47 additions
and
31 deletions
modules/Bio/EnsEMBL/DBSQL/RepeatFeatureAdaptor.pm
+
47
−
31
View file @
41b92fbd
...
...
@@ -12,7 +12,7 @@ use vars qw(@ISA);
sub
fetch_by_RawContig
{
my
(
$self
,
$contig
)
=
@_
;
my
@repeats
=
$self
->
fetch_by_contig_id
(
$contig
->
dbID
);
foreach
my
$r
(
@repeats
)
{
$r
->
attach_seq
(
$contig
);
...
...
@@ -22,7 +22,7 @@ sub fetch_by_RawContig {
sub
fetch_by_contig_id
{
my
(
$self
,
$contig_id
)
=
@_
;
return
$self
->
_generic_fetch
(
qq{ contig_id = $contig_id }
);
...
...
@@ -30,7 +30,7 @@ sub fetch_by_contig_id {
sub
fetch_by_dbID
{
my
(
$self
,
$db_id
)
=
@_
;
my
(
$rf
)
=
$self
->
_generic_fetch
(
qq{ repeat_feature_id = $db_id }
);
...
...
@@ -39,7 +39,7 @@ sub fetch_by_dbID {
sub
_generic_fetch
{
my
(
$self
,
$where_clause
)
=
@_
;
my
(
$repeat_feature_id
,
$contig_id
,
$contig_start
,
...
...
@@ -50,7 +50,7 @@ sub _generic_fetch {
$repeat_end
,
$analysis_id
,
);
my
$sth
=
$self
->
prepare
(
qq{
SELECT repeat_feature_id
, contig_id
...
...
@@ -63,7 +63,7 @@ sub _generic_fetch {
, analysis_id
FROM repeat_feature f
WHERE }
.
$where_clause
);
$sth
->
execute
;
$sth
->
bind_columns
(
\
$repeat_feature_id
,
...
...
@@ -76,7 +76,7 @@ sub _generic_fetch {
\
$repeat_end
,
\
$analysis_id
,
);
my
$rca
=
$self
->
db
->
get_RepeatConsensusAdaptor
;
my
$aa
=
$self
->
db
->
get_AnalysisAdaptor
;
...
...
@@ -85,18 +85,18 @@ sub _generic_fetch {
# new in RepeatFeature takes no arguments
my
$r
=
Bio::EnsEMBL::
RepeatFeature
->
new
;
$r
->
dbID
(
$repeat_feature_id
);
# So RepeatFeature can get its repeat
$r
->
repeat_consensus_adaptor
(
$rca
);
$r
->
repeat_id
(
$repeat_id
);
$r
->
contig_id
(
$contig_id
);
$r
->
start
(
$contig_start
);
$r
->
end
(
$contig_end
);
$r
->
strand
(
$contig_strand
);
$r
->
hstart
(
$repeat_start
);
$r
->
hend
(
$repeat_end
);
my
(
$ana_obj
);
unless
(
$ana_obj
=
$analysis_cache
{
$analysis_id
})
{
$ana_obj
=
$aa
->
fetch_by_dbID
(
$analysis_id
)
...
...
@@ -104,7 +104,7 @@ sub _generic_fetch {
$analysis_cache
{
$analysis_id
}
=
$ana_obj
;
}
$r
->
analysis
(
$ana_obj
);
push
(
@repeats
,
$r
);
}
return
(
@repeats
);
...
...
@@ -115,7 +115,7 @@ sub store {
my
$rca
=
$self
->
db
->
get_RepeatConsensusAdaptor
;
my
(
$cons
,
$db_id
);
$self
->
throw
("
Can't store repeats without a contig_id (got '
$contig_id
')
")
unless
$contig_id
=~
/^\d+$/
;
...
...
@@ -134,31 +134,47 @@ sub store {
}
);
foreach
my
$rf
(
@repeats
)
{
unless
(
$rf
->
repeat_id
)
{
# must have a consensus attached
$self
->
throw
("
Must have a RepeatConsensus attached
")
unless
defined
(
$cons
=
$rf
->
repeat_consensus
);
# need to get the consensus seq object for this repeat
# for tandem repeats - simply store consensus and repeat
# one pair per hit. don't need to check consensi stored
# already. consensus has name and class set to 'trf'
if
(
$cons
->
name
eq
'
trf
')
{
$rca
->
store
(
$cons
);
$rf
->
repeat_id
(
$cons
->
dbID
);
$self
->
throw
("
Must have a RepeatConsensus attached
")
unless
defined
(
$cons
=
$rf
->
repeat_consensus
);
}
else
{
unless
(
$cons
->
dbID
)
{
my
@match
=
(
$rca
->
fetch_by_name
(
$cons
->
name
));
# for other repeats - need to see if a consensus is stored already
if
(
@match
>
1
)
{
$self
->
warn
(
@match
.
"
consensi for
"
.
$cons
->
name
.
"
\n
");
}
# FIXME - need to take some action here if we don't
# match a consensus seq already stored
elsif
(
@match
==
0
)
{
$self
->
warn
("
Can't find
"
.
$cons
->
name
.
"
\n
");
$cons
->
repeat_consensus
("
N
");
$rca
->
store
(
$cons
);
}
$db_id
=
(
$rca
->
fetch_by_name
(
$cons
->
name
))[
0
]
->
dbID
;
unless
(
$rf
->
repeat_id
)
{
$cons
->
dbID
(
$db_id
);
# need to get the consensus seq object for this repeat
unless
(
$cons
->
dbID
)
{
my
@match
=
(
$rca
->
fetch_by_name
(
$cons
->
name
));
if
(
@match
>
1
)
{
$self
->
warn
(
@match
.
"
consensi for
"
.
$cons
->
name
.
"
\n
");
}
elsif
(
@match
==
0
)
{
# if we don't match a consensus already stored
# create a fake one
# set consensus to 'N' as null seq not allowed
# FIXME: not happy with this, but ho hum ...
$self
->
warn
("
Can't find
"
.
$cons
->
name
.
"
\n
");
$cons
->
repeat_consensus
("
N
");
$rca
->
store
(
$cons
);
}
$db_id
=
(
$rca
->
fetch_by_name
(
$cons
->
name
))[
0
]
->
dbID
;
$cons
->
dbID
(
$db_id
);
}
$rf
->
repeat_id
(
$cons
->
dbID
);
}
$rf
->
repeat_id
(
$cons
->
dbID
);
}
$sth
->
execute
(
...
...
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