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
a39c4362
Commit
a39c4362
authored
14 years ago
by
Andreas Kusalananda Kähäri
Browse files
Options
Downloads
Patches
Plain Diff
For readability.
parent
2e0688ff
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/BaseFeatureAdaptor.pm
+49
-44
49 additions, 44 deletions
modules/Bio/EnsEMBL/DBSQL/BaseFeatureAdaptor.pm
with
49 additions
and
44 deletions
modules/Bio/EnsEMBL/DBSQL/BaseFeatureAdaptor.pm
+
49
−
44
View file @
a39c4362
...
...
@@ -214,22 +214,23 @@ sub fetch_all_by_Slice_and_score {
=cut
sub
fetch_all_by_Slice_constraint
{
my
(
$self
,
$slice
,
$constraint
,
$logic_name
)
=
@_
;
my
(
$self
,
$slice
,
$constraint
,
$logic_name
)
=
@_
;
my
@result
=
();
if
(
!
ref
(
$slice
)
||
!
(
$slice
->
isa
('
Bio::EnsEMBL::Slice
')
or
$slice
->
isa
('
Bio::EnsEMBL::LRGSlice
')))
{
if
(
!
ref
(
$slice
)
||
!
(
$slice
->
isa
('
Bio::EnsEMBL::Slice
')
or
$slice
->
isa
('
Bio::EnsEMBL::LRGSlice
')
)
)
{
throw
("
Bio::EnsEMBL::Slice argument expected.
");
}
$constraint
||=
'';
$constraint
=
$self
->
_logic_name_to_constraint
(
$constraint
,
$logic_name
);
$constraint
=
$self
->
_logic_name_to_constraint
(
$constraint
,
$logic_name
);
# If the logic name was invalid, undef was returned
return
[]
if
(
!
defined
(
$constraint
)
)
;
if
(
!
defined
(
$constraint
)
)
{
return
[]
}
my
$key
;
...
...
@@ -239,13 +240,14 @@ sub fetch_all_by_Slice_constraint {
{
#strain test and add to constraint if so to stop caching.
if
(
$slice
->
isa
('
Bio::EnsEMBL::StrainSlice
')){
my
$string
=
$self
->
dbc
->
db_handle
->
quote
(
$slice
->
strain_name
);
if
(
$constraint
ne
""){
$constraint
.=
"
AND
$string
=
$string
";
}
else
{
$constraint
.=
"
$string
=
$string
";
if
(
$slice
->
isa
('
Bio::EnsEMBL::StrainSlice
')
)
{
my
$string
=
$self
->
dbc
()
->
db_handle
()
->
quote
(
$slice
->
strain_name
()
);
if
(
$constraint
ne
""
)
{
$constraint
.=
"
AND
$string
=
$string
";
}
else
{
$constraint
.=
"
$string
=
$string
";
}
}
...
...
@@ -266,11 +268,11 @@ sub fetch_all_by_Slice_constraint {
$self
->
{'
_bind_param_generic_fetch
'}
=
();
return
$self
->
{'
_slice_feature_cache
'}
->
{
$key
};
}
}
}
## end if ( !( defined( $self...)))
my
$sa
=
$slice
->
adaptor
();
# Hap/PAR support: retrieve normalized 'non-symlinked' slices
# Hap/PAR support: retrieve normalized 'non-symlinked' slices
.
my
@proj
=
@
{
$sa
->
fetch_normalized_slice_projection
(
$slice
)
};
if
(
@proj
==
0
)
{
...
...
@@ -279,63 +281,66 @@ sub fetch_all_by_Slice_constraint {
);
}
# Want to get features on the FULL original slice
#
as well as any
symlinked slices
# Want to get features on the FULL original slice
as well as any
# symlinked slices
.
# Filter out partial slices from projection that are on
#
same
seq_region as original slice
# Filter out partial slices from projection that are on
same
# seq_region as original slice
.
my
$sr_id
=
$slice
->
get_seq_region_id
();
@proj
=
grep
{
$_
->
to_Slice
->
get_seq_region_id
()
!=
$sr_id
}
@proj
;
my
$segment
=
bless
(
[
1
,
$slice
->
length
(),
$slice
],
'
Bio::EnsEMBL::ProjectionSegment
');
my
$segment
=
bless
(
[
1
,
$slice
->
length
(),
$slice
],
'
Bio::EnsEMBL::ProjectionSegment
'
);
push
(
@proj
,
$segment
);
# construct list of Hap/PAR boundaries for entire seq region
my
@bounds
;
my
$ent_slice
=
$sa
->
fetch_by_seq_region_id
(
$sr_id
);
$ent_slice
=
$ent_slice
->
invert
()
if
(
$slice
->
strand
==
-
1
);
my
@ent_proj
=
@
{
$sa
->
fetch_normalized_slice_projection
(
$ent_slice
)};
if
(
$slice
->
strand
()
==
-
1
)
{
$ent_slice
=
$ent_slice
->
invert
();
}
shift
@ent_proj
;
# skip first
@bounds
=
map
{
$_
->
from_start
-
$slice
->
start
()
+
1
}
@ent_proj
;
my
@ent_proj
=
@
{
$sa
->
fetch_normalized_slice_projection
(
$ent_slice
)
};
shift
(
@ent_proj
);
# skip first
@bounds
=
map
{
$_
->
from_start
()
-
$slice
->
start
()
+
1
}
@ent_proj
;
# fetch features for the primary slice AND all symlinked slices
foreach
my
$seg
(
@proj
)
{
my
$offset
=
$seg
->
from_start
();
my
$seg_slice
=
$seg
->
to_Slice
();
my
$features
=
$self
->
_slice_fetch
(
$seg_slice
,
$constraint
);
## NO RESULTS
my
$offset
=
$seg
->
from_start
();
my
$seg_slice
=
$seg
->
to_Slice
();
my
$features
=
$self
->
_slice_fetch
(
$seg_slice
,
$constraint
);
## NO RESULTS
# if this was a symlinked slice offset the feature coordinates as needed
if
(
$seg_slice
->
name
()
ne
$slice
->
name
())
{
# If this was a symlinked slice offset the feature coordinates as
# needed.
if
(
$seg_slice
->
name
()
ne
$slice
->
name
()
)
{
FEATURE:
foreach
my
$f
(
@$features
)
{
if
(
$offset
!=
1
)
{
$f
->
{'
start
'}
+=
$offset
-
1
;
$f
->
{'
end
'}
+=
$offset
-
1
;
foreach
my
$f
(
@
{
$features
}
)
{
if
(
$offset
!=
1
)
{
$f
->
{'
start
'}
+=
$offset
-
1
;
$f
->
{'
end
'}
+=
$offset
-
1
;
}
# discard boundary crossing features from symlinked regions
foreach
my
$bound
(
@bounds
)
{
if
(
$f
->
{'
start
'}
<
$bound
&&
$f
->
{'
end
'}
>=
$bound
)
{
if
(
$f
->
{'
start
'}
<
$bound
&&
$f
->
{'
end
'}
>=
$bound
)
{
next
FEATURE
;
}
}
$f
->
{'
slice
'}
=
$slice
;
push
@result
,
$f
;
push
(
@result
,
$f
)
;
}
}
else
{
push
(
@result
,
@
{
$features
}
);
}
else
{
push
@result
,
@$features
;
}
}
}
## end foreach my $seg (@proj)
# Will only use feature_cache when set attribute no_cache in DBAdaptor
if
(
defined
(
$key
)
)
{
...
...
@@ -343,7 +348,7 @@ sub fetch_all_by_Slice_constraint {
}
return
\
@result
;
}
}
## end sub fetch_all_by_Slice_constraint
=head2 fetch_all_by_logic_name
...
...
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