Skip to content

Commit

Permalink
WIP add linear combination to tree_stats pairplot
Browse files Browse the repository at this point in the history
  • Loading branch information
willdumm committed Jul 22, 2024
1 parent be3946c commit cf5e4b8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
11 changes: 8 additions & 3 deletions gctree/branching_processes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1575,10 +1575,14 @@ def print_stats(
# To clear _dp_data fields of their large cargo
dag.optimal_weight_annotate(edge_weight_func=lambda n1, n2: 0)
num_ranking_filters = len(dag_filters)
col_names = combined_observer_filter.weight_funcs.names

if not lexicographic:
col_names += (ranking_strategy.replace(' ', ''),)
dag_ls = [tup + (linear_combinator(tup),) for tup in dag_ls]

def minfunckey(tup):
return linear_combinator(tup[:num_ranking_filters])
return tup[-1]

else:
_tuple_coeffs = [
Expand All @@ -1590,14 +1594,15 @@ def minfunckey(tup):

dag_ls.sort(key=minfunckey)


df = pd.DataFrame(
dag_ls, columns=combined_observer_filter.weight_funcs.names
dag_ls, columns=col_names
).drop(columns=[""])
df.to_csv(outbase + ".tree_stats.csv")
df["set"] = ["all_trees"] * len(df)
bestdf = pd.DataFrame(
[first_tree_weighttuple],
columns=combined_observer_filter.weight_funcs.names,
columns=col_names,
)
bestdf["set"] = ["best_tree"]
toplot_df = pd.concat([df, bestdf], ignore_index=True)
Expand Down
11 changes: 5 additions & 6 deletions tests/smalltest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ export XDG_RUNTIME_DIR=/tmp/runtime-runner
export MPLBACKEND=agg
mkdir -p tests/smalltest_output

# mutabilities=HS5F_Mutability.csv
# substitutions=HS5F_Substitution.csv
mutabilities=random_s5_mutabilities.csv
substitutions=random_s5_substitution.csv
# wget -O HS5F_Mutability.csv https://bitbucket.org/kleinstein/shazam/raw/ba4b30fc6791e2cfd5712e9024803c53b136e664/data-raw/HS5F_Mutability.csv
# wget -O HS5F_Substitution.csv https://bitbucket.org/kleinstein/shazam/raw/ba4b30fc6791e2cfd5712e9024803c53b136e664/data-raw/HS5F_Substitution.csv
mutabilities=HS5F_Mutability.csv
substitutions=HS5F_Substitution.csv

wget -O $mutabilities https://bitbucket.org/kleinstein/shazam/raw/ba4b30fc6791e2cfd5712e9024803c53b136e664/data-raw/HS5F_Mutability.csv
wget -O $substitutions https://bitbucket.org/kleinstein/shazam/raw/ba4b30fc6791e2cfd5712e9024803c53b136e664/data-raw/HS5F_Substitution.csv

gctree infer tests/small_outfile tests/abundances.csv --outbase tests/smalltest_output/gctree.infer1 --root GL --frame 1 --verbose --idlabel

Expand Down

0 comments on commit cf5e4b8

Please sign in to comment.