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
c9a891e3
Commit
c9a891e3
authored
21 years ago
by
Arne Stabenau
Browse files
Options
Downloads
Patches
Plain Diff
revert, should be on new seqstore
parent
d1578ac5
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
+51
-72
51 additions, 72 deletions
modules/Bio/EnsEMBL/Mapper.pm
with
51 additions
and
72 deletions
modules/Bio/EnsEMBL/Mapper.pm
+
51
−
72
View file @
c9a891e3
...
...
@@ -149,91 +149,70 @@ sub map_coordinates{
my
$last_used_pair
;
my
@result
;
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
;
}
}
foreach
my
$pair
(
@
{
$hash
->
{
uc
(
$id
)}}
)
{
my
$self_coord
=
$pair
->
{
$from
};
my
$target_coord
=
$pair
->
{
$to
};
my
$i
=
$start_idx
;
for
(
my
$i
=
$start_idx
;
$i
<=
$#$lr
;
$i
++
)
{
$pair
=
$lr
->
[
$i
];
my
$self_coord
=
$pair
->
{
$from
};
my
$target_coord
=
$pair
->
{
$to
};
# if we haven't even reached the start, move on
if
(
$self_coord
->
{'
end
'}
<
$start
)
{
next
;
}
# if we haven't even reached the start, move on
if
(
$self_coord
->
{'
end
'}
<
$start
)
{
next
;
}
# if we have over run, break
if
(
$self_coord
->
{'
start
'}
>
$end
)
{
last
;
}
# if we have over run, break
if
(
$self_coord
->
{'
start
'}
>
$end
)
{
last
;
}
if
(
$start
<
$self_coord
->
{'
start
'}
)
{
# gap detected
my
$gap
=
Bio::EnsEMBL::Mapper::
Gap
->
new
(
$start
,
$self_coord
->
{'
start
'}
-
1
);
push
(
@result
,
$gap
);
$start
=
$gap
->
{'
end
'}
+
1
;
}
my
(
$target_start
,
$target_end
,
$target_ori
);
# start is somewhere inside the region
if
(
$pair
->
{'
ori
'}
==
1
)
{
$target_start
=
$target_coord
->
{'
start
'}
+
(
$start
-
$self_coord
->
{'
start
'});
}
else
{
$target_end
=
$target_coord
->
{'
end
'}
-
(
$start
-
$self_coord
->
{'
start
'});
}
# either we are enveloping this map or not. If yes, then end
# point (self perspective) is determined solely by target. If not
# we need to adjust
if
(
$start
<
$self_coord
->
{'
start
'}
)
{
# gap detected
my
$gap
=
Bio::EnsEMBL::Mapper::
Gap
->
new
(
$start
,
$self_coord
->
{'
start
'}
-
1
);
push
(
@result
,
$gap
);
$start
=
$gap
->
{'
end
'}
+
1
;
}
my
(
$target_start
,
$target_end
,
$target_ori
);
if
(
$end
>
$self_coord
->
{'
end
'}
)
{
# enveloped
# start is somewhere inside the region
if
(
$pair
->
{'
ori
'}
==
1
)
{
$target_end
=
$target_coord
->
{'
end
'};
$target_start
=
$target_coord
->
{'
start
'}
+
(
$start
-
$self_coord
->
{'
start
'});
}
else
{
$target_start
=
$target_coord
->
{'
start
'};
$target_end
=
$target_coord
->
{'
end
'}
-
(
$start
-
$self_coord
->
{'
start
'});
}
}
else
{
# need to adjust end
if
(
$pair
->
{'
ori
'}
==
1
)
{
$target_end
=
$target_coord
->
{'
start
'}
+
(
$end
-
$self_coord
->
{'
start
'});
# either we are enveloping this map or not. If yes, then end
# point (self perspective) is determined solely by target. If not
# we need to adjust
if
(
$end
>
$self_coord
->
{'
end
'}
)
{
# enveloped
if
(
$pair
->
{'
ori
'}
==
1
)
{
$target_end
=
$target_coord
->
{'
end
'};
}
else
{
$target_start
=
$target_coord
->
{'
start
'};
}
}
else
{
$target_start
=
$target_coord
->
{'
end
'}
-
(
$end
-
$self_coord
->
{'
start
'});
# need to adjust end
if
(
$pair
->
{'
ori
'}
==
1
)
{
$target_end
=
$target_coord
->
{'
start
'}
+
(
$end
-
$self_coord
->
{'
start
'});
}
else
{
$target_start
=
$target_coord
->
{'
end
'}
-
(
$end
-
$self_coord
->
{'
start
'});
}
}
}
my
$res
=
Bio::EnsEMBL::Mapper::
Coordinate
->
new
(
$target_coord
->
{'
id
'},
my
$res
=
Bio::EnsEMBL::Mapper::
Coordinate
->
new
(
$target_coord
->
{'
id
'},
$target_start
,
$target_end
,
$pair
->
{'
ori
'}
*
$strand
);
push
(
@result
,
$res
);
$last_used_pair
=
$pair
;
$start
=
$self_coord
->
{'
end
'}
+
1
;
push
(
@result
,
$res
);
$last_used_pair
=
$pair
;
$start
=
$self_coord
->
{'
end
'}
+
1
;
}
if
(
!
defined
$last_used_pair
)
{
...
...
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