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):
...
@@ -2061,41 +2061,33 @@ class SegmentModel(ArbdModel):
""" Ensure unconnected ends have 5prime Location objects """
""" Ensure unconnected ends have 5prime Location objects """
for
seg
in
self
.
segments
:
for
seg
in
self
.
segments
:
## TODO move into Segment calls
## TODO move into Segment calls
import
pdb
five_prime_locs
=
seg
.
get_locations
(
"5prime"
)
if
False
:
# TODO: Make this happen conditionally
three_prime_locs
=
seg
.
get_locations
(
"3prime"
)
if
seg
.
start5
.
connection
is
None
:
add_end
=
True
def
is_start_5prime
(
l
):
for
l
in
seg
.
get_locations
(
"5prime"
):
return
l
.
get_nt_pos
()
<
1
and
l
.
on_fwd_strand
if
l
.
address
==
0
and
l
.
on_fwd_strand
:
def
is_end_5prime
(
l
):
add_end
=
False
return
l
.
get_nt_pos
()
>
seg
.
num_nt
-
1
and
not
l
.
on_fwd_strand
break
def
is_start_3prime
(
l
):
if
add_end
:
return
l
.
get_nt_pos
()
<
1
and
not
l
.
on_fwd_strand
seg
.
add_5prime
(
0
)
def
is_end_3prime
(
l
):
if
'end5'
in
seg
.
__dict__
and
seg
.
end5
.
connection
is
None
:
return
l
.
get_nt_pos
()
>
seg
.
num_nt
-
1
and
l
.
on_fwd_strand
add_end
=
True
for
l
in
seg
.
get_locations
(
"5prime"
):
if
seg
.
start5
.
connection
is
None
:
if
l
.
address
==
1
and
(
l
.
on_fwd_strand
is
False
):
if
len
(
list
(
filter
(
is_start_5prime
,
five_prime_locs
)))
==
0
:
add_end
=
False
seg
.
add_5prime
(
0
)
# TODO ensure this is the same place
break
if
add_end
:
if
'end5'
in
seg
.
__dict__
and
seg
.
end5
.
connection
is
None
:
seg
.
add_5prime
(
seg
.
num_nt
-
1
,
on_fwd_strand
=
False
)
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
:
add_end
=
True
if
'start3'
in
seg
.
__dict__
and
seg
.
start3
.
connection
is
None
:
for
l
in
seg
.
get_locations
(
"3prime"
):
if
len
(
list
(
filter
(
is_start_3prime
,
three_prime_locs
)))
==
0
:
if
l
.
address
==
0
and
(
l
.
on_fwd_strand
is
False
):
seg
.
add_3prime
(
0
,
on_fwd_strand
=
False
)
add_end
=
False
break
if
seg
.
end3
.
connection
is
None
:
if
add_end
:
if
len
(
list
(
filter
(
is_end_3prime
,
three_prime_locs
)))
==
0
:
seg
.
add_3prime
(
0
,
on_fwd_strand
=
False
)
seg
.
add_3prime
(
seg
.
num_nt
-
1
)
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
)
# print( [(l,l.get_connected_location()) for l in seg.locations] )
# print( [(l,l.get_connected_location()) for l in seg.locations] )
# addresses = np.array([l.address for l in seg.get_locations("5prime")])
# 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