Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: replace calc-weighted-overlap with mgmanysearch #19

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -371,13 +371,14 @@ rule metag_x_genomes_prefetch:
input:
genomes = expand("sketches/genomes/{n}.sig.zip", n=GENOME_NAMES),
metag="sketches/metag/{metag}.sig.zip",
bin = "scripts/calc-weighted-overlap.py",
output:
"outputs/prefetch/{metag}.x.genomes.{k}.csv",
threads: 1
shell: """
{input.bin} -k {wildcards.k} --genomes {input.genomes} \
--metagenomes {input.metag} -o {output}
sourmash scripts mgmanysearch -k {wildcards.k} \
--queries {input.genomes} \
--against {input.metag} \
-o {output}
"""

rule metag_x_genomes_prefetch_summary:
Expand Down
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
sourmash_plugin_containment_search>=0.4.3

# mkdocs stuff
pymdown-extensions
mkdocs-material
mkdocs-material-extensions
Expand Down
122 changes: 0 additions & 122 deletions scripts/calc-weighted-overlap.py

This file was deleted.

8 changes: 4 additions & 4 deletions scripts/summarize-weighted-overlap.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def main():
sample_dfs = {}
for sample in samples:
sample_df = df[df['match_name'] == sample]
sample_df = sample_df[['query_name', 'f_unique_weighted']]
sample_df = sample_df[['query_name', 'f_match_weighted']]
sample_dfs[sample] = sample_df

# go through and merge, retaining the column named `containment`;
Expand All @@ -40,14 +40,14 @@ def main():
# do the first sample:
sample = samples.pop(0)
combined_df = sample_dfs[sample]
combined_df.rename(columns={'f_unique_weighted': sample}, inplace=True)
combined_df.rename(columns={'f_match_weighted': sample}, inplace=True)

# and then... the rest!
while samples:
sample = samples.pop(0)
sample_df = sample_dfs[sample]
sample_df = sample_df[['query_name', 'f_unique_weighted']]
sample_df.rename(columns={'f_unique_weighted': sample},
sample_df = sample_df[['query_name', 'f_match_weighted']]
sample_df.rename(columns={'f_match_weighted': sample},
inplace=True)
combined_df = combined_df.merge(sample_df, on='query_name',
how='outer')
Expand Down