Skip to content

Commit

Permalink
debuging semibin dryrun
Browse files Browse the repository at this point in the history
  • Loading branch information
SilasK committed Jul 26, 2023
1 parent 44f1e86 commit 2160cda
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
1 change: 1 addition & 0 deletions workflow/rules/cobinning.smk
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def get_bams_of_bingroup(wildcards):
return expand(
"Intermediate/cobinning/{bingroup}/bams/{sample}.sorted.bam",
sample=samples_of_group,
bingroup= wildcards.bingroup
)


Expand Down
22 changes: 14 additions & 8 deletions workflow/rules/semibin.smk
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ rule semibin_generate_data_multi:
rule semibin_train:
input:
flag="{sample}/{sample}_contigs.fasta",
fasta_sample=rules.filter_contigs.output,
fasta_sample=rules.filter_contigs.output[0],
bams=get_bams_of_bingroup,
data_folder=rules.semibin_generate_data_multi.output[0],
output:
Expand Down Expand Up @@ -74,23 +74,28 @@ rule semibin_train:

def semibin_input(wildcards):

bingroup_of_sample = sampleTable.loc[wildcards.sample, "bingroup"]
bingroup_of_sample = sampleTable.loc[wildcards.sample, "BinGroup"]
samples_of_bingroup = sampleTable.query(
f'BinGroup=="{bingroup_of_sample}"'
).index.tolist()

return dict(
flag="{sample}/{sample}_contigs.fasta",
fasta=rules.filter_contigs.output,
bams=lambda wc: expand(rules.sort_bam.output, sample=samples_of_bingroup),
assert len(samples_of_bingroup)>1

mapping= dict(
flag=get_assembly(wildcards),
fasta=rules.filter_contigs.output[0].format(**wildcards),
bams= expand("Intermediate/cobinning/{bingroup}/bams/{sample}.sorted.bam", sample=samples_of_bingroup, bingroup =bingroup_of_sample ),
data_folder=rules.semibin_generate_data_multi.output[0].format(
bingroup=bingroup_of_sample
bingroup=bingroup_of_sample,
**wildcards
),
model=rules.semibin_train.output[0].format(
bingroup=bingroup_of_sample, sample=wildcards.sample
bingroup=bingroup_of_sample, **wildcards
),
)

return mapping


rule run_semibin:
input:
Expand Down Expand Up @@ -133,6 +138,7 @@ rule run_semibin:
localrules:
parse_semibin_output,

ruleorder: parse_semibin_output > get_unique_cluster_attribution

rule parse_semibin_output:
input:
Expand Down

0 comments on commit 2160cda

Please sign in to comment.