Skip to content

Commit 46202ff

Browse files
committed
fixed bug subsetting cf table
1 parent a0eb9ba commit 46202ff

1 file changed

Lines changed: 5 additions & 11 deletions

File tree

splitTableCF.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ def main():
3131
#make subset datasets
3232
removes = [s for s in l if s != placeholder]
3333
left_cf = subset_df_blacklist(cf, removes) #keeps placeholder
34-
right_cf = subset_df_whitelist(cf, l)
34+
removes2 = [s for s in tree.get_tip_labels() if s not in l]
35+
right_cf = subset_df_blacklist(cf, removes2)
3536
left_tree = tree_remove_blacklist(tree, removes)
3637
#print(left_tree.get_tip_labels())
3738
right_tree = tree_remove_whitelist(tree, l)
@@ -58,19 +59,12 @@ def tree_remove_blacklist(tree, badbois):
5859
return(tree.drop_tips(names=rem))
5960

6061
def subset_df_blacklist(df, badbois):
61-
ret = df
62+
ret = df.copy()
6263
for i in badbois:
63-
bools = df.eq(i).any(1)
64-
ret = df[bools]
64+
bools = ret.eq(i).any(1)
65+
ret = ret[~bools]
6566
return(ret)
6667

67-
def subset_df_whitelist(df, goodbois):
68-
ret = df
69-
for i in goodbois:
70-
bools = df.eq(i).any(1)
71-
#print(bools)
72-
ret = df[~bools]
73-
return(ret)
7468

7569
#Object to parse command-line arguments
7670
class parseArgs():

0 commit comments

Comments
 (0)