Skip to content

Commit 135b193

Browse files
committed
Run snakefmt to destroy the formatting
1 parent e1add6f commit 135b193

File tree

5 files changed

+58
-52
lines changed

5 files changed

+58
-52
lines changed

workflow/rules/calling-gatk-genotype-db-split.smk

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Make Contig Shards
33
# =================================================================================================
44

5+
56
# Special rule for the case that we want to split the contigs for the genomics db import,
67
# but are not using contig groups. In that case, we could pretend to have contig groups,
78
# and create fake ones that each contain a single chromosome or contig of the reference.
@@ -13,9 +14,9 @@ rule make_contig_bed:
1314
input:
1415
fai=get_fai,
1516
output:
16-
bed="calling/contig-shards/{contig}/contig.bed"
17+
bed="calling/contig-shards/{contig}/contig.bed",
1718
params:
18-
contig="{contig}"
19+
contig="{contig}",
1920
run:
2021
# Produce only the matching contig and write 0–length interval
2122
contig_lengths = get_contig_lengths(input.fai)
@@ -37,20 +38,20 @@ localrules:
3738
# Why that then is an option at all is beyond my comprehension. GATK, WTF.
3839
checkpoint preprocess_contig_shard:
3940
input:
40-
dict = genome_dict(),
41-
ref = config["data"]["reference-genome"],
41+
dict=genome_dict(),
42+
ref=config["data"]["reference-genome"],
4243
# contigs=contigs_groups_input,
43-
contig = (
44+
contig=(
4445
"calling/contig-groups/{contig}.bed"
4546
if config["settings"].get("contig-group-size", 0) > 0
4647
else "calling/contig-shards/{contig}/contig.bed"
47-
)
48+
),
4849
output:
49-
interval_list = "calling/contig-shards/{contig}/contig.interval_list",
50-
shard_list = "calling/contig-shards/{contig}/shards.interval_list",
50+
interval_list="calling/contig-shards/{contig}/contig.interval_list",
51+
shard_list="calling/contig-shards/{contig}/shards.interval_list",
5152
params:
52-
bin_length = config["params"]["gatk"]["GenomicsDBImport-interval-size"],
53-
padding = config["params"]["gatk"]["GenomicsDBImport-interval-padding"],
53+
bin_length=config["params"]["gatk"]["GenomicsDBImport-interval-size"],
54+
padding=config["params"]["gatk"]["GenomicsDBImport-interval-padding"],
5455
log:
5556
"logs/calling/preprocess-contig-shard/{contig}.log",
5657
conda:
@@ -85,18 +86,18 @@ localrules:
8586
rule extract_contig_shard:
8687
input:
8788
# shard_list=checkpoints.preprocess_contig_shard.output.shard_list
88-
shard_list="calling/contig-shards/{contig}/shards.interval_list"
89+
shard_list="calling/contig-shards/{contig}/shards.interval_list",
8990
output:
90-
shard = "calling/contig-shards/{contig}/shard-{shard}.interval_list"
91+
shard="calling/contig-shards/{contig}/shard-{shard}.interval_list",
9192
run:
9293
header, data = [], []
9394
for line in open(input.shard_list):
94-
if line.startswith('@'):
95+
if line.startswith("@"):
9596
header.append(line)
9697
else:
9798
data.append(line)
9899
i = int(wildcards.shard)
99-
with open(output.shard, 'w') as out:
100+
with open(output.shard, "w") as out:
100101
out.writelines(header + [data[i]])
101102

102103

@@ -108,7 +109,7 @@ localrules:
108109
def get_shard_indices(wc):
109110
r = checkpoints.preprocess_contig_shard.get(contig=wc.contig)
110111
# skip header lines
111-
shards = [l for l in open(r.output.shard_list) if not l.startswith('@')]
112+
shards = [l for l in open(r.output.shard_list) if not l.startswith("@")]
112113
return [i for i in range(len(shards))]
113114
# return [{"shard": i} for i in range(len(shards))]
114115

@@ -208,8 +209,7 @@ rule genotype_variants:
208209
+ " "
209210
+ config["params"]["gatk"]["GenotypeGVCFs-extra"],
210211
java_opts=config["params"]["gatk"]["GenotypeGVCFs-java-opts"],
211-
threads:
212-
get_rule_threads("genotype_variants")
212+
threads: get_rule_threads("genotype_variants")
213213
log:
214214
"logs/calling/gatk-genotype-gvcfs/{contig}/shard-{shard}.log",
215215
benchmark:
@@ -241,6 +241,7 @@ rule genotype_variants:
241241
# shard=get_shard_indices(wildcards)
242242
# )
243243

244+
244245
def merge_vcfs_vcfs_input(wc):
245246
cp = checkpoints.preprocess_contig_shard.get(**wc)
246247
# cp = checkpoints.preprocess_contig_shard.get(contig=wc.contig)
@@ -250,9 +251,10 @@ def merge_vcfs_vcfs_input(wc):
250251
return expand(
251252
"calling/genotyped/{contig}/shard-{shard}.vcf.gz",
252253
contig=wc.contig,
253-
shard=list(range(len(shards)))
254+
shard=list(range(len(shards))),
254255
)
255256

257+
256258
def merge_vcfs_done_input(wc):
257259
cp = checkpoints.preprocess_contig_shard.get(**wc)
258260
# cp = checkpoints.preprocess_contig_shard.get(contig=wc.contig)
@@ -261,13 +263,14 @@ def merge_vcfs_done_input(wc):
261263
return expand(
262264
"calling/genotyped/{contig}/shard-{shard}.vcf.gz.done",
263265
contig=wc.contig,
264-
shard=list(range(len(shards)))
266+
shard=list(range(len(shards))),
265267
)
266268

269+
267270
rule merge_shard_vcfs:
268271
input:
269-
dict = genome_dict(),
270-
ref = config["data"]["reference-genome"],
272+
dict=genome_dict(),
273+
ref=config["data"]["reference-genome"],
271274
contigs=contigs_groups_input,
272275
# vcfs = expand("calling/genotyped/{contig}/shard-{shard}.vcf.gz", get_shard_indices),
273276
# done = expand("calling/genotyped/{contig}/shard-{shard}.vcf.gz.done", get_shard_indices),
@@ -288,8 +291,7 @@ rule merge_shard_vcfs:
288291
if platform.system() == "Darwin"
289292
else ""
290293
),
291-
threads:
292-
get_rule_threads("merge_shard_vcfs")
294+
threads: get_rule_threads("merge_shard_vcfs")
293295
log:
294296
"logs/calling/picard-merge-vcfs/{contig}.log",
295297
benchmark:

workflow/rules/calling-gatk.smk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ else:
142142
# Merging Variants
143143
# =================================================================================================
144144

145+
145146
# Need an input function to work with the fai checkpoint
146147
def merge_variants_vcfs_input(wildcards):
147148
fai = checkpoints.samtools_faidx.get().output[0]

workflow/rules/calling.smk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Grouping of (Small) Contigs
33
# =================================================================================================
44

5+
56
# Get the list of chromosome names that are present in the fai file,
67
# and their length, with a length filter if needed.
78
def read_contigs_from_fai(fai, min_contig_size=0):
@@ -23,7 +24,6 @@ def read_contigs_from_fai(fai, min_contig_size=0):
2324
# If we want to combine contigs into groups, use the rules and functions for this.
2425
if config["settings"].get("contig-group-size", 0) > 0:
2526

26-
2727
include: "calling-contig-groups.smk"
2828

2929

workflow/rules/initialize.smk

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ extra_logfile = os.path.abspath(
4848
)
4949
logger_manager.logger.addHandler(logging.FileHandler(extra_logfile))
5050

51+
5152
# For now, we define our own wrapper around the wrapper of the snakemake logging...
5253
# That allows us to use this as a single point of modification should they finally
5354
# manage to get the logging to work properly.
@@ -62,12 +63,14 @@ def fix_log_info(message):
6263
sys.__stdout__.write(message + "\n")
6364
sys.__stdout__.flush()
6465

66+
6567
def fix_log_warn(message):
6668
logger.warning(message)
6769
# print(message, file=sys.stdout)
6870
sys.__stdout__.write(message + "\n")
6971
sys.__stdout__.flush()
7072

73+
7174
# =================================================================================================
7275
# Basic Configuration
7376
# =================================================================================================
@@ -248,33 +251,33 @@ if resources_file:
248251
cfgfiles = "\n ".join(cfgfiles)
249252

250253
# Main grenepipe header, helping with debugging etc for user issues
251-
fix_log_info( "=====================================================================================")
252-
fix_log_info( r" _____ _______ __ __ _______ ______ ___ ______ _______ ")
253-
fix_log_info( r" / ___\ ____ / ____// \ / / / ____/| _ \ \ \ | _ \ / ____/ ")
254-
fix_log_info( r" / /____| _ \| |___ | \| || |___ | |_] || | | |_] | |___ ")
255-
fix_log_info( r" | /|__ | |_) | ___| | || ___| | ___/ | | | ___/| ___| ")
256-
fix_log_info( r" \ \__| | _ <| |____ | |\ || |____ | | | | | | | |____ ")
257-
fix_log_info( r" \______/|_| \_\_______\/__| \__|\_______\|__| \___\|__| \_______\ ")
258-
fix_log_info( "")
259-
fix_log_info( " Date: " + datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
260-
fix_log_info( " Platform: " + pltfrm)
261-
fix_log_info( " Host: " + hostname)
262-
fix_log_info( " User: " + username)
263-
fix_log_info( " Conda: " + str(conda_ver))
264-
fix_log_info( " Mamba: " + str(mamba_ver))
265-
fix_log_info( " Python: " + str(sys.version.split(" ")[0]))
266-
fix_log_info( " Snakemake: " + str(snakemake.__version__))
267-
fix_log_info( " Grenepipe: " + str(grenepipe_version))
268-
fix_log_info( " Conda env: " + str(conda_env))
269-
fix_log_info( " Command: " + cmdline)
270-
fix_log_info( "")
271-
fix_log_info( " Base directory: " + workflow.basedir)
272-
fix_log_info( " Working directory: " + os.getcwd())
273-
fix_log_info( " Config file(s): " + cfgfiles)
274-
fix_log_info( " Samples: " + get_sample_units_print())
275-
fix_log_info( "")
276-
fix_log_info( "=====================================================================================")
277-
fix_log_info( "")
254+
fix_log_info("=====================================================================================")
255+
fix_log_info(r" _____ _______ __ __ _______ ______ ___ ______ _______ ")
256+
fix_log_info(r" / ___\ ____ / ____// \ / / / ____/| _ \ \ \ | _ \ / ____/ ")
257+
fix_log_info(r" / /____| _ \| |___ | \| || |___ | |_] || | | |_] | |___ ")
258+
fix_log_info(r" | /|__ | |_) | ___| | || ___| | ___/ | | | ___/| ___| ")
259+
fix_log_info(r" \ \__| | _ <| |____ | |\ || |____ | | | | | | | |____ ")
260+
fix_log_info(r" \______/|_| \_\_______\/__| \__|\_______\|__| \___\|__| \_______\ ")
261+
fix_log_info("")
262+
fix_log_info(" Date: " + datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
263+
fix_log_info(" Platform: " + pltfrm)
264+
fix_log_info(" Host: " + hostname)
265+
fix_log_info(" User: " + username)
266+
fix_log_info(" Conda: " + str(conda_ver))
267+
fix_log_info(" Mamba: " + str(mamba_ver))
268+
fix_log_info(" Python: " + str(sys.version.split(" ")[0]))
269+
fix_log_info(" Snakemake: " + str(snakemake.__version__))
270+
fix_log_info(" Grenepipe: " + str(grenepipe_version))
271+
fix_log_info(" Conda env: " + str(conda_env))
272+
fix_log_info(" Command: " + cmdline)
273+
fix_log_info("")
274+
fix_log_info(" Base directory: " + workflow.basedir)
275+
fix_log_info(" Working directory: " + os.getcwd())
276+
fix_log_info(" Config file(s): " + cfgfiles)
277+
fix_log_info(" Samples: " + get_sample_units_print())
278+
fix_log_info("")
279+
fix_log_info("=====================================================================================")
280+
fix_log_info("")
278281

279282

280283
# No need to have these output vars available in the rest of the snakefiles

workflow/rules/prepare-reference.smk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ def check_fai_contig_names(fai_file):
331331
"Problematic reference genome names:"
332332
)
333333
printed_warning_header = True
334-
fix_log_warn( " - " + contig)
334+
fix_log_warn(" - " + contig)
335335
checked_fai_contig_names = True
336336

337337

0 commit comments

Comments
 (0)