Skip to content
Snippets Groups Projects
Commit 184c47b8 authored by Blaise Li's avatar Blaise Li
Browse files

Fix fold column access in tables.

parent 7f8506cc
No related branches found
No related tags found
No related merge requests found
...@@ -4410,19 +4410,23 @@ rule make_gene_list_lfc_boxplots: ...@@ -4410,19 +4410,23 @@ rule make_gene_list_lfc_boxplots:
lfc_data = pd.read_table(input.data, index_col="gene") lfc_data = pd.read_table(input.data, index_col="gene")
for (list_name, id_list) in params.id_lists.items(): for (list_name, id_list) in params.id_lists.items():
try: try:
selected_rows = lfc_data.loc[lfc_data.index.intersection(id_list)] selected_rows = lfc_data.loc[lfc_data.index.intersection(id_list)]
except TypeError as err: except TypeError as err:
print(params.id_lists) print(params.id_lists)
print(type(id_list)) print(type(id_list))
print(lfc_data.index.intersection(id_list)) print(lfc_data.index.intersection(id_list))
raise raise
selected_data = selected_rows[wildcards.fold_type] if wildcards.fold_type in RPM_FOLD_TYPES:
fold_type = "mean_log2_RPM_fold"
else:
fold_type = wildcards.fold_type
selected_data = selected_rows[fold_type]
lfcs_dict[list_name] = selected_data lfcs_dict[list_name] = selected_data
lfcs = pd.DataFrame(lfcs_dict) lfcs = pd.DataFrame(lfcs_dict)
# lfcs = pd.DataFrame( # lfcs = pd.DataFrame(
# {list_name : lfc_data.loc[set(id_list)][wildcards.fold_type] for ( # {list_name : lfc_data.loc[set(id_list)][wildcards.fold_type] for (
# list_name, id_list) in params.id_lists.items()}) # list_name, id_list) in params.id_lists.items()})
title = f"{wildcards.small_type} folds for {wildcards.contrast}" title = f"{wildcards.small_type} {wildcards.fold_type} for {wildcards.contrast}"
try: try:
save_plot( save_plot(
output.boxplots, output.boxplots,
...@@ -4484,7 +4488,7 @@ rule make_contrast_lfc_boxplots: ...@@ -4484,7 +4488,7 @@ rule make_contrast_lfc_boxplots:
# set(id_list)]["mean_log2_RPM_fold"] for ( # set(id_list)]["mean_log2_RPM_fold"] for (
# contrast, filename) in zip(contrasts_dict["ip"], input.data) for ( # contrast, filename) in zip(contrasts_dict["ip"], input.data) for (
# list_name, id_list) in params.id_lists.items()}) # list_name, id_list) in params.id_lists.items()})
title=f"{wildcards.small_type} folds for {wildcards.contrast_type} contrasts" title=f"{wildcards.small_type} {wildcards.fold_type} for {wildcards.contrast_type} contrasts"
try: try:
save_plot( save_plot(
output.boxplots, output.boxplots,
...@@ -4505,7 +4509,6 @@ rule make_contrast_lfc_boxplots: ...@@ -4505,7 +4509,6 @@ rule make_contrast_lfc_boxplots:
raise raise
rule make_biotype_lfc_boxplots: rule make_biotype_lfc_boxplots:
"""For a given gene list, make one box for each contrast.""" """For a given gene list, make one box for each contrast."""
input: input:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment