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
dc3f5fff
Commit
dc3f5fff
authored
19 years ago
by
Daniel Rios
Browse files
Options
Downloads
Patches
Plain Diff
Modified with the code from the branch
parent
7c7aee86
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/StrainSlice.pm
+17
-17
17 additions, 17 deletions
modules/Bio/EnsEMBL/StrainSlice.pm
with
17 additions
and
17 deletions
modules/Bio/EnsEMBL/StrainSlice.pm
+
17
−
17
View file @
dc3f5fff
...
...
@@ -65,7 +65,7 @@ use Data::Dumper;
-strain_name => $strain_name);
Description : Creates a new Bio::EnsEMBL::StrainSlice object that will contain a shallow copy of the
Slice object, plus additional information such as the Strain this Slice refers to
and listref of Bio::EnsEMBL::Variation::
Variation
Features of differences with the
and listref of Bio::EnsEMBL::Variation::
Allele
Features of differences with the
reference sequence
ReturnType : Bio::EnsEMBL::StrainSlice
Exceptions : none
...
...
@@ -95,9 +95,9 @@ sub new{
return
'';
}
my
$
v
f_adaptor
=
$variation_db
->
get_
Variation
FeatureAdaptor
;
my
$
a
f_adaptor
=
$variation_db
->
get_
Allele
FeatureAdaptor
;
if
(
$
v
f_adaptor
)
{
if
(
$
a
f_adaptor
)
{
#get the Population for the given strain
my
$pop_adaptor
=
$variation_db
->
get_PopulationAdaptor
;
...
...
@@ -105,8 +105,8 @@ sub new{
my
$population
=
$pop_adaptor
->
fetch_by_name
(
$self
->
{'
strain_name
'});
#check that the population returned is a strain
if
((
defined
$population
)
&&
(
$population
->
is_strain
)){
my
$
variation
_features
=
$
v
f_adaptor
->
fetch_all_by_Slice_Population
(
$self
,
$population
);
$self
->
{'
variation
Features
'}
=
$
variation
_features
;
my
$
allele
_features
=
$
a
f_adaptor
->
fetch_all_by_Slice_Population
(
$self
,
$population
);
$self
->
{'
allele
Features
'}
=
$
allele
_features
;
return
$self
;
}
else
{
...
...
@@ -151,7 +151,7 @@ sub seq {
# sort edits in reverse order to remove complication of
# adjusting downstream edits
my
@variation_features_ordered
=
sort
{
$b
->
start
()
<=>
$a
->
start
()}
@
{
$self
->
{'
variation
Features
'}}
if
(
defined
$self
->
{'
variation
Features
'});
my
@variation_features_ordered
=
sort
{
$b
->
start
()
<=>
$a
->
start
()}
@
{
$self
->
{'
allele
Features
'}}
if
(
defined
$self
->
{'
allele
Features
'});
foreach
my
$vf
(
@variation_features_ordered
){
$vf
->
apply_edit
(
$reference_sequence
);
#change, in the reference sequence, the vf
...
...
@@ -178,7 +178,7 @@ sub seq {
sub
get_all_differences_Slice
{
my
$self
=
shift
;
return
$self
->
{'
variation
Features
'};
return
$self
->
{'
allele
Features
'};
}
=head2 get_all_differences_StrainSlice
...
...
@@ -199,29 +199,29 @@ sub get_all_differences_StrainSlice{
if
(
!
ref
(
$strainSlice
)
||
!
$strainSlice
->
isa
('
Bio::EnsEMBL::StrainSlice
')){
throw
('
Bio::EnsEMBL::StrainSlice arg expected
');
}
if
(
@
{
$self
->
{'
variation
Features
'}}
==
0
&&
@
{
$strainSlice
->
{'
variation
Features
'}}
==
0
){
if
(
@
{
$self
->
{'
allele
Features
'}}
==
0
&&
@
{
$strainSlice
->
{'
allele
Features
'}}
==
0
){
return
undef
;
#there are no differences in any of the Strains
}
my
$differences
;
#differences between strains
if
(
@
{
$strainSlice
->
{'
variation
Features
'}}
==
0
){
if
(
@
{
$strainSlice
->
{'
allele
Features
'}}
==
0
){
#need to create a copy of VariationFeature
foreach
my
$difference
(
@
{
$self
->
{'
variation
Features
'}}){
foreach
my
$difference
(
@
{
$self
->
{'
allele
Features
'}}){
my
%vf
=
%$difference
;
push
@
{
$differences
},
bless
\
%vf
,
ref
(
$difference
);
}
}
elsif
(
@
{
$self
->
{'
variation
Features
'}}
==
0
){
elsif
(
@
{
$self
->
{'
allele
Features
'}}
==
0
){
#need to create a copy of VariationFeature, but changing the allele by the allele in the reference
foreach
my
$difference
(
@
{
$strainSlice
->
{'
variation
Features
'}}){
foreach
my
$difference
(
@
{
$strainSlice
->
{'
allele
Features
'}}){
push
@
{
$differences
},
$strainSlice
->
_convert_difference
(
$difference
);
}
}
else
{
#both strains have differences
#create a hash with the differences in the self strain slice
my
%variation_features_self
=
map
{
$_
->
start
=>
$_
}
@
{
$self
->
{'
variation
Features
'}};
foreach
my
$difference
(
@
{
$strainSlice
->
{'
variation
Features
'}}){
my
%variation_features_self
=
map
{
$_
->
start
=>
$_
}
@
{
$self
->
{'
allele
Features
'}};
foreach
my
$difference
(
@
{
$strainSlice
->
{'
allele
Features
'}}){
#there is no difference in the other strain slice, convert the allele
if
(
!
defined
$variation_features_self
{
$difference
->
start
}){
push
@
{
$differences
},
$strainSlice
->
_convert_difference
(
$difference
);
...
...
@@ -331,7 +331,7 @@ sub sub_Slice {
my
$vf_end
;
my
$offset
=
$subSlice
->
start
-
$self
->
start
;
foreach
my
$variationFeature
(
@
{
$self
->
{'
variation
Features
'}}){
foreach
my
$variationFeature
(
@
{
$self
->
{'
allele
Features
'}}){
#calculate the new position of the variation_feature in the subSlice
$vf_start
=
$variationFeature
->
start
-
$offset
;
$vf_end
=
$variationFeature
->
end
-
$offset
;
...
...
@@ -346,7 +346,7 @@ sub sub_Slice {
push
@
{
$new_variations
},
$test
;
}
}
$subSlice
->
{'
variation
Features
'}
=
$new_variations
;
$subSlice
->
{'
allele
Features
'}
=
$new_variations
;
return
$subSlice
;
}
...
...
@@ -420,7 +420,7 @@ sub mapper{
my
$mapper
=
Bio::EnsEMBL::
Mapper
->
new
('
Slice
','
StrainSlice
');
#align with Slice
#get all the VariationFeatures in the strain Slice, from start to end in the Slice
my
@variation_features_ordered
=
sort
{
$a
->
start
()
<=>
$b
->
start
()}
@
{
$self
->
{'
variation
Features
'}}
if
(
defined
$self
->
{'
variation
Features
'});
my
@variation_features_ordered
=
sort
{
$a
->
start
()
<=>
$b
->
start
()}
@
{
$self
->
{'
allele
Features
'}}
if
(
defined
$self
->
{'
allele
Features
'});
my
$start_slice
=
1
;
my
$end_slice
;
...
...
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