Skip to content

Commit

Permalink
PythonBlack
Browse files Browse the repository at this point in the history
  • Loading branch information
heylf committed Oct 31, 2023
1 parent 44d8cab commit 75eb163
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 15 deletions.
26 changes: 23 additions & 3 deletions bin/check_samplesheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions bin/generate_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
14 changes: 8 additions & 6 deletions bin/generate_lib_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit 75eb163

Please sign in to comment.