Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tbgl
tools
mrdna
Commits
e440cc78
Commit
e440cc78
authored
Aug 17, 2018
by
cmaffeo2
Browse files
Enabled automatic creation of terminal 5prime and 3prime ends
parent
6f48f441
Changes
1
Hide whitespace changes
Inline
Side-by-side
segmentmodel.py
View file @
e440cc78
...
...
@@ -2061,41 +2061,33 @@ class SegmentModel(ArbdModel):
""" Ensure unconnected ends have 5prime Location objects """
for
seg
in
self
.
segments
:
## TODO move into Segment calls
import
pdb
if
False
:
# TODO: Make this happen conditionally
if
seg
.
start5
.
connection
is
None
:
add_end
=
True
for
l
in
seg
.
get_locations
(
"5prime"
):
if
l
.
address
==
0
and
l
.
on_fwd_strand
:
add_end
=
False
break
if
add_end
:
seg
.
add_5prime
(
0
)
if
'end5'
in
seg
.
__dict__
and
seg
.
end5
.
connection
is
None
:
add_end
=
True
for
l
in
seg
.
get_locations
(
"5prime"
):
if
l
.
address
==
1
and
(
l
.
on_fwd_strand
is
False
):
add_end
=
False
break
if
add_end
:
seg
.
add_5prime
(
seg
.
num_nt
-
1
,
on_fwd_strand
=
False
)
if
'start3'
in
seg
.
__dict__
and
seg
.
start3
.
connection
is
None
:
add_end
=
True
for
l
in
seg
.
get_locations
(
"3prime"
):
if
l
.
address
==
0
and
(
l
.
on_fwd_strand
is
False
):
add_end
=
False
break
if
add_end
:
seg
.
add_3prime
(
0
,
on_fwd_strand
=
False
)
if
seg
.
end3
.
connection
is
None
:
add_end
=
True
for
l
in
seg
.
get_locations
(
"3prime"
):
if
l
.
address
==
1
and
l
.
on_fwd_strand
:
add_end
=
False
break
if
add_end
:
seg
.
add_3prime
(
seg
.
num_nt
-
1
)
five_prime_locs
=
seg
.
get_locations
(
"5prime"
)
three_prime_locs
=
seg
.
get_locations
(
"3prime"
)
def
is_start_5prime
(
l
):
return
l
.
get_nt_pos
()
<
1
and
l
.
on_fwd_strand
def
is_end_5prime
(
l
):
return
l
.
get_nt_pos
()
>
seg
.
num_nt
-
1
and
not
l
.
on_fwd_strand
def
is_start_3prime
(
l
):
return
l
.
get_nt_pos
()
<
1
and
not
l
.
on_fwd_strand
def
is_end_3prime
(
l
):
return
l
.
get_nt_pos
()
>
seg
.
num_nt
-
1
and
l
.
on_fwd_strand
if
seg
.
start5
.
connection
is
None
:
if
len
(
list
(
filter
(
is_start_5prime
,
five_prime_locs
)))
==
0
:
seg
.
add_5prime
(
0
)
# TODO ensure this is the same place
if
'end5'
in
seg
.
__dict__
and
seg
.
end5
.
connection
is
None
:
if
len
(
list
(
filter
(
is_end_5prime
,
five_prime_locs
)))
==
0
:
seg
.
add_5prime
(
seg
.
num_nt
-
1
,
on_fwd_strand
=
False
)
if
'start3'
in
seg
.
__dict__
and
seg
.
start3
.
connection
is
None
:
if
len
(
list
(
filter
(
is_start_3prime
,
three_prime_locs
)))
==
0
:
seg
.
add_3prime
(
0
,
on_fwd_strand
=
False
)
if
seg
.
end3
.
connection
is
None
:
if
len
(
list
(
filter
(
is_end_3prime
,
three_prime_locs
)))
==
0
:
seg
.
add_3prime
(
seg
.
num_nt
-
1
)
# print( [(l,l.get_connected_location()) for l in seg.locations] )
# addresses = np.array([l.address for l in seg.get_locations("5prime")])
...
...
Write
Preview
Supports
Markdown
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