Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ensembl-gh-mirror
ensembl
Commits
42c8c035
Commit
42c8c035
authored
Feb 18, 2010
by
William McLaren
Browse files
Added aligned_seq method
parent
04a15da4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
0 deletions
+52
-0
modules/Bio/EnsEMBL/MappedSlice.pm
modules/Bio/EnsEMBL/MappedSlice.pm
+52
-0
No files found.
modules/Bio/EnsEMBL/MappedSlice.pm
View file @
42c8c035
...
...
@@ -514,6 +514,58 @@ sub seq {
sub
subseq
{
}
sub
aligned_seq
{
my
$self
=
shift
;
my
$seq
=
'';
my
$start
=
0
;
# get slice/mapper pairs from mapped slice (usually only one anyway)
foreach
my
$pair
(
@
{
$self
->
get_all_Slice_Mapper_pairs
()})
{
my
(
$s
,
$m
)
=
@$pair
;
my
$strain_seq
=
$s
->
seq
();
# project from mapped slice to reference slice
foreach
my
$ref_coord
(
$m
->
map_coordinates
('
mapped_slice
',
1
,
CORE::
length
(
$strain_seq
),
$s
->
strand
,
'
mapped_slice
'))
{
# normal coord
if
(
!
$ref_coord
->
isa
('
Bio::EnsEMBL::Mapper::IndelCoordinate
')
&&
!
$ref_coord
->
isa
('
Bio::EnsEMBL::Mapper::Gap
'))
{
# project from reference slice to container slice
foreach
my
$ms_coord
(
$self
->
container
->
mapper
->
map_coordinates
(
$self
->
container
->
ref_slice
->
seq_region_name
,
$ref_coord
->
start
,
$ref_coord
->
end
,
$ref_coord
->
strand
,
'
ref_slice
'))
{
# normal coord
if
(
!
$ms_coord
->
isa
('
Bio::EnsEMBL::Mapper::IndelCoordinate
')
&&
!
$ms_coord
->
isa
('
Bio::EnsEMBL::Mapper::Gap
'))
{
$seq
.=
substr
(
$strain_seq
,
$start
,
$ms_coord
->
length
);
$start
+=
$ms_coord
->
length
();
}
# indel coord
else
{
$seq
.=
'
-
'
x
$ms_coord
->
length
();
}
}
}
# indel / gap
else
{
# if there's a gap aswell, add sequence
if
(
$ref_coord
->
gap_length
>
0
)
{
$seq
.=
substr
(
$strain_seq
,
$start
,
$ref_coord
->
gap_length
);
$start
+=
$ref_coord
->
gap_length
;
}
# add "-" to the sequence
$seq
.=
'
-
'
x
(
$ref_coord
->
length
()
-
$ref_coord
->
gap_length
());
}
}
}
return
$seq
;
}
sub
get_repeatmasked_seq
{
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment