Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nested
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Matej Lexa
nested
Commits
e1edc3d8
There was an error fetching the commit references. Please try again later.
Commit
e1edc3d8
authored
7 years ago
by
rlapar
Browse files
Options
Downloads
Patches
Plain Diff
transposon.py minor change
parent
1b47571b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
python/transposons.py
+12
-59
12 additions, 59 deletions
python/transposons.py
with
12 additions
and
59 deletions
python/transposons.py
+
12
−
59
View file @
e1edc3d8
...
...
@@ -4,6 +4,7 @@ import copy
from
python
import
ltr
as
pythonLtr
from
python
import
domains
as
pythonBlast
from
python
import
geneGraph
class
Nester
:
#self.genes
...
...
@@ -24,72 +25,22 @@ class Nester:
self
.
nested
[
g
]
=
self
.
__expandTransposons
(
self
.
nested
[
g
])
def
__expandInterval
(
self
,
source
,
target
):
if
math
.
isnan
(
target
[
0
]):
return
target
if
source
[
0
]
>
target
[
1
]:
return
target
src_len
=
source
[
1
]
-
source
[
0
]
if
target
[
0
]
>
source
[
0
]:
target
[
0
]
+=
src_len
if
target
[
1
]
>
source
[
0
]:
target
[
0
]
+=
src_len
length
=
(
source
[
1
]
-
source
[
0
])
if
source
[
0
]
<=
target
[
0
]:
target
[
0
]
+=
length
if
source
[
0
]
<=
target
[
1
]:
target
[
1
]
+=
length
return
target
def
__expandTransposons
(
self
,
nested
):
for
i
in
reversed
(
range
(
len
(
nested
)
-
1
)):
pass
for
i
in
reversed
(
range
(
len
(
nested
)
-
1
)):
te_len
=
(
nested
[
i
][
'
location
'
][
1
]
-
nested
[
i
][
'
location
'
][
0
])
for
j
in
range
(
i
+
1
,
len
(
nested
)):
if
nested
[
i
][
'
location
'
][
0
]
<=
nested
[
j
][
'
location
'
][
0
]:
nested
[
j
][
'
location
'
][
0
]
+=
te_len
if
nested
[
i
][
'
location
'
][
0
]
<=
nested
[
j
][
'
location
'
][
1
]:
nested
[
j
][
'
location
'
][
1
]
+=
te_len
for
domain
in
nested
[
j
][
'
features
'
][
'
domains
'
]:
if
nested
[
i
][
'
location
'
][
0
]
<=
domain
[
'
location
'
][
0
]:
domain
[
'
location
'
][
0
]
+=
te_len
if
nested
[
i
][
'
location
'
][
0
]
<=
domain
[
'
location
'
][
1
]:
domain
[
'
location
'
][
1
]
+=
te_len
if
nested
[
i
][
'
location
'
][
0
]
<=
nested
[
j
][
'
features
'
][
'
ppt
'
][
0
]:
nested
[
j
][
'
features
'
][
'
ppt
'
][
0
]
+=
te_len
if
nested
[
i
][
'
location
'
][
0
]
<=
nested
[
j
][
'
features
'
][
'
ppt
'
][
1
]:
nested
[
j
][
'
features
'
][
'
ppt
'
][
1
]
+=
te_len
if
nested
[
i
][
'
location
'
][
0
]
<=
nested
[
j
][
'
features
'
][
'
pbs
'
][
0
]:
nested
[
j
][
'
features
'
][
'
pbs
'
][
0
]
+=
te_len
if
nested
[
i
][
'
location
'
][
0
]
<=
nested
[
j
][
'
features
'
][
'
pbs
'
][
1
]:
nested
[
j
][
'
features
'
][
'
pbs
'
][
1
]
+=
te_len
"""
for i in range(len(nested)):
print nested[i][
'
location
'
]
for domain in nested[i][
'
features
'
][
'
domains
'
]:
print
'
\t
'
, domain[
'
location
'
]
"""
"""
for te in nested:
te[
'
crop_point
'
] = []
for i in range(len(nested) - 2, -1, -1):
for j in range(i+1, len(nested)):
te_len = (nested[i][
'
location
'
][1] - nested[i][
'
location
'
][0])
if nested[i][
'
location
'
][0] <= nested[j][
'
location
'
][1]:
nested[j][
'
location
'
][1] += te_len
#expand crop points
for p in nested[j][
'
crop_point
'
]:
p = self.__expandInterval(nested[i][
'
location
'
], p)
#expand domains
for domain in nested[j][
'
features
'
][
'
domains
'
]:
domain = self.__expandInterval(nested[i][
'
location
'
], domain[
'
location
'
])
#expand ppt,pbs
nested
[
j
][
'
location
'
]
=
self
.
__expandInterval
(
nested
[
i
][
'
location
'
],
nested
[
j
][
'
location
'
])
for
domain
in
nested
[
j
][
'
features
'
][
'
domains
'
]:
domain
[
'
location
'
]
=
self
.
__expandInterval
(
nested
[
i
][
'
location
'
],
domain
[
'
location
'
])
nested
[
j
][
'
features
'
][
'
ppt
'
]
=
self
.
__expandInterval
(
nested
[
i
][
'
location
'
],
nested
[
j
][
'
features
'
][
'
ppt
'
])
nested
[
j
][
'
features
'
][
'
pbs
'
]
=
self
.
__expandInterval
(
nested
[
i
][
'
location
'
],
nested
[
j
][
'
features
'
][
'
pbs
'
])
if nested[i][
'
location
'
][0] <= nested[j][
'
location
'
][0]:
nested[j][
'
location
'
][0] += te_len
else: #nesting case
nested[j][
'
crop_point
'
].append(copy.deepcopy(nested[i][
'
location
'
]))
"""
return
nested
...
...
@@ -152,6 +103,8 @@ class Nester:
def
__evaluatePair
(
self
,
ltr_pair
,
gene
):
#g = geneGraph.GeneGraph(ltr_pair, gene['domains'])
score
=
0
features
=
{
'
domains
'
:
[],
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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