Skip to content

Commit

Permalink
small changes from issues that came up in real analysis scenarios
Browse files Browse the repository at this point in the history
  • Loading branch information
adamcantor22 committed Jan 15, 2025
1 parent 5125c48 commit c2a6317
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion mmeds/snakemake/rules/common.smk
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def pairwise_splits(wildcards, tool, vars):
else:
tables = [f"taxa_table_L{x}" for x in config["taxa_levels"]]

subclasses = None
subclasses = False
if tool == "lefse" and "subclasses" in config and config["subclasses"]:
subclasses = deepcopy(config["subclasses"])

Expand Down
2 changes: 1 addition & 1 deletion mmeds/snakemake/rules/demux_denoise.smk
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ rule demux_dual_barcodes_pheniqs:

rule strip_error_barcodes:
input:
dir = directory("section_{sequencing_run}/pheniqs_output"),
dir = "section_{sequencing_run}/pheniqs_output",
mapping_file = "section_{sequencing_run}/qiime_mapping_file_{sequencing_run}.tsv",
output:
dir = directory("section_{sequencing_run}/stripped_output")
Expand Down
4 changes: 2 additions & 2 deletions mmeds/snakemake/rules/file_manipulation.smk
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ rule format_metadata_qiime_to_lefse_class:
output:
"tables/{class}/lefse_format.{table}.{class}.{subclass}.tsv"
params:
subclass = lefse_get_subclass
subclass_param = lefse_get_subclass
conda:
"mmeds_test"
shell:
"format_lefse.py "
"-i {input.feature_table} "
"-m {input.mapping_file} "
"-c {wildcards.class} "
"-s {params.subclass} "
"-s {params.subclass_param} "
"-u HostSubjectId "
"-o {output}"

Expand Down
2 changes: 2 additions & 0 deletions mmeds/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -1704,6 +1704,7 @@ def format_table_to_lefse(i_table, metadata_file, metadata_column_class, metadat
# Store metadata by ID, allowing for any subset of samples from the metadata
categories = {}
for i, cell in enumerate(mdf['#SampleID']['#q2:types']):
cell = str(cell)

Check warning on line 1707 in mmeds/util.py

View check run for this annotation

Codecov / codecov/patch

mmeds/util.py#L1707

Added line #L1707 was not covered by tests
if cell not in categories:
categories[cell] = {}
categories[cell][metadata_column_class] = mdf[metadata_column_class]['categorical'][i]
Expand All @@ -1725,6 +1726,7 @@ def format_table_to_lefse(i_table, metadata_file, metadata_column_class, metadat
t = [metadata_column_class]
to_drop = []
for i, cell in enumerate(path_df.loc[0]):
cell = str(cell)

Check warning on line 1729 in mmeds/util.py

View check run for this annotation

Codecov / codecov/patch

mmeds/util.py#L1729

Added line #L1729 was not covered by tests
if i == 0:
continue
if pd.isna(categories[cell][metadata_column_class]):
Expand Down

0 comments on commit c2a6317

Please sign in to comment.