From 75eb1637e4eb84f223e70d65be435128338fe28e Mon Sep 17 00:00:00 2001 From: Florian Date: Tue, 31 Oct 2023 10:44:53 +0100 Subject: [PATCH] PythonBlack --- bin/check_samplesheet.py | 26 +++++++++++++++++++++++--- bin/generate_config.py | 12 ++++++------ bin/generate_lib_csv.py | 14 ++++++++------ 3 files changed, 37 insertions(+), 15 deletions(-) diff --git a/bin/check_samplesheet.py b/bin/check_samplesheet.py index 59d39ca5..3544dab9 100755 --- a/bin/check_samplesheet.py +++ b/bin/check_samplesheet.py @@ -158,8 +158,14 @@ def check_samplesheet(file_in, file_out): sample_type = "" if "sample_type" in header: sample_type = lspl[colmap["sample_type"]] - if (sample_type not in SAMPLE_TYPES): - print_error("Sample type {} is not supported! Please specify either {}".format(sample_type, " or ".join(SAMPLE_TYPES)), "Line", line) + if sample_type not in SAMPLE_TYPES: + print_error( + "Sample type {} is not supported! Please specify either {}".format( + sample_type, " or ".join(SAMPLE_TYPES) + ), + "Line", + line, + ) for fastq in fastq_list: if fastq: @@ -194,7 +200,21 @@ def check_samplesheet(file_in, file_out): ## Write validated samplesheet with appropriate columns if len(sample_mapping_dict) > 0: with open(file_out, "w") as fout: - fout.write(",".join(["sample", "single_end", "fastq_1", "fastq_2", "expected_cells", "seq_center" , "fastq_barcode", "sample_type"]) + "\n") + fout.write( + ",".join( + [ + "sample", + "single_end", + "fastq_1", + "fastq_2", + "expected_cells", + "seq_center", + "fastq_barcode", + "sample_type", + ] + ) + + "\n" + ) for sample in sorted(sample_mapping_dict.keys()): ## Check that multiple runs of the same sample are of the same datatype diff --git a/bin/generate_config.py b/bin/generate_config.py index e9c9d45e..85647826 100755 --- a/bin/generate_config.py +++ b/bin/generate_config.py @@ -16,12 +16,12 @@ config = open("config", "w") config.write("{\n") - config.write("\torganism: \"{}\"\n".format(args["fasta"].split(".")[0])) - config.write("\tgenome: [\"cellrangerarc_reference\"]\n") - config.write("\tinput_fasta: [\"{}\"]\n".format(args["fasta"])) - config.write("\tinput_gtf: [\"{}\"]\n".format(args["gtf"])) - config.write("\tinput_motifs: \"{}\"\n".format(args["motifs"])) - if(args["add"] != "none"): + config.write('\torganism: "{}"\n'.format(args["fasta"].split(".")[0])) + config.write('\tgenome: ["cellrangerarc_reference"]\n') + config.write('\tinput_fasta: ["{}"]\n'.format(args["fasta"])) + config.write('\tinput_gtf: ["{}"]\n'.format(args["gtf"])) + config.write('\tinput_motifs: "{}"\n'.format(args["motifs"])) + if args["add"] != "none": config.write(args["add"] + "\n") config.write("}") config.close() diff --git a/bin/generate_lib_csv.py b/bin/generate_lib_csv.py index f93a23eb..07ab9661 100755 --- a/bin/generate_lib_csv.py +++ b/bin/generate_lib_csv.py @@ -22,13 +22,15 @@ lib_csv = open(args["out"], "w") lib_csv.write("fastqs,sample,library_type") - for i in range(0,len(sample_types)): - if (sample_names[i] in unique_samples_names): - unique_samples_names.remove(sample_names[i]) # this has to be done to account for different Lane files (e.g., L002) - if(sample_types[i] == "gex"): - lib_csv.write("\n{},{},{}".format(args["fastq_folder"], sample_names[i],"Gene Expression")) + for i in range(0, len(sample_types)): + if sample_names[i] in unique_samples_names: + unique_samples_names.remove( + sample_names[i] + ) # this has to be done to account for different Lane files (e.g., L002) + if sample_types[i] == "gex": + lib_csv.write("\n{},{},{}".format(args["fastq_folder"], sample_names[i], "Gene Expression")) else: - lib_csv.write("\n{},{},{}".format(args["fastq_folder"], sample_names[i],"Chromatin Accessibility")) + lib_csv.write("\n{},{},{}".format(args["fastq_folder"], sample_names[i], "Chromatin Accessibility")) lib_csv.close()