Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
VEBER Philippe
codepi
Commits
8d3f4472
Commit
8d3f4472
authored
Jun 05, 2019
by
Carine Rey
Committed by
Philippe Veber
Sep 20, 2019
Browse files
fix error during tree pruning
parent
987009b7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
lib/scripts/filter_input_tree.py
lib/scripts/filter_input_tree.py
+12
-2
No files found.
lib/scripts/filter_input_tree.py
View file @
8d3f4472
...
...
@@ -185,14 +185,24 @@ else:
trim_t
=
t
.
copy
(
method
=
"deepcopy"
)
if
sp_present
:
trim_t
.
prune
(
sp_present
)
trim_t
.
prune
(
sp_present
,
preserve_branch_length
=
True
)
# Check father node transition if Condition == 1
for
n
in
trim_t
.
traverse
(
"postorder"
):
if
(
hasattr
(
n
,
"Condition"
)
and
n
.
Condition
==
"1"
):
if
not
(
hasattr
(
n
,
"Transition"
)
and
n
.
Transition
==
"1"
):
parent_n
=
n
.
up
if
not
parent_n
.
Condition
==
"1"
:
if
not
(
hasattr
(
parent_n
,
"Transition"
)
and
parent_n
.
Transition
==
"1"
):
n
.
Transition
=
"1"
sister_T
=
True
while
sister_T
:
sister_T
=
False
for
n
in
trim_t
.
traverse
(
"postorder"
):
# Check for 2 sister Transitions
children
=
n
.
get_children
()
if
len
(
children
)
==
2
:
if
hasattr
(
children
[
0
],
"Transition"
)
and
hasattr
(
children
[
1
],
"Transition"
):
if
hasattr
(
children
[
0
],
"Transition"
)
and
hasattr
(
children
[
1
],
"Transition"
):
if
children
[
0
].
Transition
==
"1"
and
children
[
1
].
Transition
==
"1"
:
n
.
Transition
=
"1"
n
.
Condition
=
"1"
...
...
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