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
af3a76a7
Commit
af3a76a7
authored
14 years ago
by
Andreas Kusalananda Kähäri
Browse files
Options
Downloads
Patches
Plain Diff
In map_indel(): Fix documentation to mention right return type. From
Michael S. Also, reformat method.
parent
85b9cea0
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/Mapper.pm
+57
-59
57 additions, 59 deletions
modules/Bio/EnsEMBL/Mapper.pm
with
57 additions
and
59 deletions
modules/Bio/EnsEMBL/Mapper.pm
+
57
−
59
View file @
af3a76a7
...
...
@@ -641,83 +641,81 @@ sub add_indel_coordinates{
Arg [5] : string $type - the coordinate system name the coords are from.
Example : @coords = $mapper->map_indel();
Description: This is in internal function which handles the special mapping
case for indels (start = end +1). It will be used to map from
case for indels (start = end +1). It will be used to map from
a coordinate system with a gap to another that contains an
insertion. It will be mainly used by the Variation API.
Returntype : Bio::EnsEMBL::Mapper::
IndelCoordinate
objects
Returntype : Bio::EnsEMBL::Mapper::
Unit
objects
Exceptions : none
Caller : general
=cut
sub
map_indel
{
my
(
$self
,
$id
,
$start
,
$end
,
$strand
,
$type
)
=
@_
;
my
(
$self
,
$id
,
$start
,
$end
,
$strand
,
$type
)
=
@_
;
# swap start/end and map the resultant 2bp coordinate
(
$start
,
$end
)
=
(
$end
,
$start
);
# swap start/end and map the resultant 2bp coordinate
(
$start
,
$end
)
=
(
$end
,
$start
);
if
(
!
$self
->
{'
_is_sorted
'}
)
{
$self
->
_sort
()
}
if
(
!
$self
->
{'
_is_sorted
'}
)
{
$self
->
_sort
()
}
my
$hash
=
$self
->
{"
_pair_
$type
"};
my
$hash
=
$self
->
{"
_pair_
$type
"};
my
(
$from
,
$to
,
$cs
);
my
(
$from
,
$to
,
$cs
);
if
(
$type
eq
$self
->
{'
to
'})
{
$from
=
'
to
';
$to
=
'
from
';
$cs
=
$self
->
{'
from_cs
'};
}
else
{
$from
=
'
from
';
$to
=
'
to
';
$cs
=
$self
->
{'
to_cs
'};
}
if
(
$type
eq
$self
->
{'
to
'}
)
{
$from
=
'
to
';
$to
=
'
from
';
$cs
=
$self
->
{'
from_cs
'};
}
else
{
$from
=
'
from
';
$to
=
'
to
';
$cs
=
$self
->
{'
to_cs
'};
}
unless
(
defined
$hash
)
{
throw
("
Type
$type
is neither to or from coordinate systems
");
}
my
$last_used_pair
;
my
@indel_coordinates
;
my
(
$start_idx
,
$end_idx
,
$mid_idx
,
$pair
,
$self_coord
);
my
$lr
=
$hash
->
{
uc
(
$id
)};
$start_idx
=
0
;
$end_idx
=
$#$lr
;
# binary search the relevant pairs
# helps if the list is big
while
((
$end_idx
-
$start_idx
)
>
1
)
{
$mid_idx
=
(
$start_idx
+
$end_idx
)
>>
1
;
$pair
=
$lr
->
[
$mid_idx
];
$self_coord
=
$pair
->
{
$from
};
if
(
$self_coord
->
{'
end
'}
<=
$start
)
{
$start_idx
=
$mid_idx
;
}
else
{
$end_idx
=
$mid_idx
;
}
}
unless
(
defined
$hash
)
{
throw
("
Type
$type
is neither to or from coordinate systems
");
}
my
$last_used_pair
;
my
@indel_coordinates
;
for
(
my
$i
=
$start_idx
;
$i
<=
$#$lr
;
$i
++
)
{
$pair
=
$lr
->
[
$i
];
my
$self_coord
=
$pair
->
{
$from
};
my
$target_coord
=
$pair
->
{
$to
};
my
(
$start_idx
,
$end_idx
,
$mid_idx
,
$pair
,
$self_coord
);
my
$lr
=
$hash
->
{
uc
(
$id
)
};
if
(
exists
$pair
->
{'
indel
'}){
#need to return unit coordinate
my
$to
=
Bio::EnsEMBL::Mapper::
Unit
->
new
(
$target_coord
->
{'
id
'},
$target_coord
->
{'
start
'},
$target_coord
->
{'
end
'},
);
push
@indel_coordinates
,
$to
;
last
;
}
$last_used_pair
=
$pair
;
}
$start_idx
=
0
;
$end_idx
=
$#$lr
;
# binary search the relevant pairs
# helps if the list is big
while
(
(
$end_idx
-
$start_idx
)
>
1
)
{
$mid_idx
=
(
$start_idx
+
$end_idx
)
>>
1
;
$pair
=
$lr
->
[
$mid_idx
];
$self_coord
=
$pair
->
{
$from
};
if
(
$self_coord
->
{'
end
'}
<=
$start
)
{
$start_idx
=
$mid_idx
;
}
else
{
$end_idx
=
$mid_idx
;
}
}
for
(
my
$i
=
$start_idx
;
$i
<=
$#$lr
;
$i
++
)
{
$pair
=
$lr
->
[
$i
];
my
$self_coord
=
$pair
->
{
$from
};
my
$target_coord
=
$pair
->
{
$to
};
return
@indel_coordinates
;
}
if
(
exists
$pair
->
{'
indel
'}
)
{
#need to return unit coordinate
my
$to
=
Bio::EnsEMBL::Mapper::
Unit
->
new
(
$target_coord
->
{'
id
'},
$target_coord
->
{'
start
'},
$target_coord
->
{'
end
'},
);
push
@indel_coordinates
,
$to
;
last
;
}
$last_used_pair
=
$pair
;
}
return
@indel_coordinates
;
}
## end sub map_indel
=head2 add_Mapper
...
...
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