From 80d0160f6ddb234866f3d724b22f2d27b5fdbe2f Mon Sep 17 00:00:00 2001 From: Athanasios Baltzis Date: Thu, 2 Feb 2023 13:20:37 +0100 Subject: [PATCH 1/7] Make black happy --- bin/check_samplesheet.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/bin/check_samplesheet.py b/bin/check_samplesheet.py index 495b059b..3376e0eb 100755 --- a/bin/check_samplesheet.py +++ b/bin/check_samplesheet.py @@ -47,10 +47,8 @@ def check_samplesheet(file_in, file_out): For an example see: https://raw.githubusercontent.com/nf-core/test-datasets/viralrecon/samplesheet/samplesheet_test_illumina_amplicon.csv """ - sequence_mapping_dict = {} with open(file_in, "r") as fin: - ## Check header MIN_COLS = 2 # TODO nf-core: Update the column names for the input samplesheet From e3cb948b71c1117a0ca3056add107a715d36e4f9 Mon Sep 17 00:00:00 2001 From: Athanasios Baltzis Date: Thu, 2 Feb 2023 13:25:39 +0100 Subject: [PATCH 2/7] Fix linting black --- bin/check_samplesheet.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/bin/check_samplesheet.py b/bin/check_samplesheet.py index 3376e0eb..58b69b31 100755 --- a/bin/check_samplesheet.py +++ b/bin/check_samplesheet.py @@ -109,7 +109,6 @@ def check_samplesheet(file_in, file_out): print_error("Samplesheet contains duplicate rows!", "Line", line) else: sequence_mapping_dict[sequence].append(sequence_info) - ## Write validated samplesheet with appropriate columns if len(sequence_mapping_dict) > 0: out_dir = os.path.dirname(file_out) @@ -117,23 +116,19 @@ def check_samplesheet(file_in, file_out): with open(file_out, "w") as fout: fout.write(",".join(["sequence", "fasta"]) + "\n") for sequence in sorted(sequence_mapping_dict.keys()): - ## Check that multiple runs of the same sample are of the same datatype if not all(x[0] == sequence_mapping_dict[sequence][0][0] for x in sequence_mapping_dict[sequence]): print_error( "Multiple runs of a sequence must be of the same datatype!", "Sequence: {}".format(sequence) ) - for idx, val in enumerate(sequence_mapping_dict[sequence]): fout.write(",".join(["{}_T{}".format(sequence, idx + 1)] + val) + "\n") else: print_error("No entries to process!", "Samplesheet: {}".format(file_in)) - def main(args=None): args = parse_args(args) check_samplesheet(args.FILE_IN, args.FILE_OUT) - if __name__ == "__main__": - sys.exit(main()) + sys.exit(main()) \ No newline at end of file From e5a64942f324fff04933567f3bb061d11df68aa8 Mon Sep 17 00:00:00 2001 From: Athanasios Baltzis Date: Thu, 2 Feb 2023 13:27:16 +0100 Subject: [PATCH 3/7] Fix linting black --- bin/check_samplesheet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/check_samplesheet.py b/bin/check_samplesheet.py index 58b69b31..052f85f2 100755 --- a/bin/check_samplesheet.py +++ b/bin/check_samplesheet.py @@ -131,4 +131,4 @@ def main(args=None): check_samplesheet(args.FILE_IN, args.FILE_OUT) if __name__ == "__main__": - sys.exit(main()) \ No newline at end of file + sys.exit(main()) From 9fd9620ca85615faba92599a6352a5c4912467ab Mon Sep 17 00:00:00 2001 From: Athanasios Baltzis Date: Thu, 2 Feb 2023 13:31:19 +0100 Subject: [PATCH 4/7] Fix linting black second attempt --- bin/check_samplesheet.py | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/check_samplesheet.py b/bin/check_samplesheet.py index 052f85f2..f4d1f1c8 100755 --- a/bin/check_samplesheet.py +++ b/bin/check_samplesheet.py @@ -109,6 +109,7 @@ def check_samplesheet(file_in, file_out): print_error("Samplesheet contains duplicate rows!", "Line", line) else: sequence_mapping_dict[sequence].append(sequence_info) + ## Write validated samplesheet with appropriate columns if len(sequence_mapping_dict) > 0: out_dir = os.path.dirname(file_out) From 77f6226ccb58f19956b95e3e14bf6cfcea6550f0 Mon Sep 17 00:00:00 2001 From: Athanasios Baltzis Date: Thu, 2 Feb 2023 13:36:44 +0100 Subject: [PATCH 5/7] Fix linting black third attempt --- bin/check_samplesheet.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/check_samplesheet.py b/bin/check_samplesheet.py index f4d1f1c8..0a436c82 100755 --- a/bin/check_samplesheet.py +++ b/bin/check_samplesheet.py @@ -109,7 +109,7 @@ def check_samplesheet(file_in, file_out): print_error("Samplesheet contains duplicate rows!", "Line", line) else: sequence_mapping_dict[sequence].append(sequence_info) - + ## Write validated samplesheet with appropriate columns if len(sequence_mapping_dict) > 0: out_dir = os.path.dirname(file_out) @@ -117,6 +117,7 @@ def check_samplesheet(file_in, file_out): with open(file_out, "w") as fout: fout.write(",".join(["sequence", "fasta"]) + "\n") for sequence in sorted(sequence_mapping_dict.keys()): + ## Check that multiple runs of the same sample are of the same datatype if not all(x[0] == sequence_mapping_dict[sequence][0][0] for x in sequence_mapping_dict[sequence]): print_error( From 370c1063e8f6dd0ff95e629904239a2b1d27c740 Mon Sep 17 00:00:00 2001 From: Athanasios Baltzis Date: Thu, 2 Feb 2023 13:42:49 +0100 Subject: [PATCH 6/7] Fix linting black fourth attempt --- bin/check_samplesheet.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/check_samplesheet.py b/bin/check_samplesheet.py index 0a436c82..f81bf619 100755 --- a/bin/check_samplesheet.py +++ b/bin/check_samplesheet.py @@ -128,9 +128,11 @@ def check_samplesheet(file_in, file_out): else: print_error("No entries to process!", "Samplesheet: {}".format(file_in)) + def main(args=None): args = parse_args(args) check_samplesheet(args.FILE_IN, args.FILE_OUT) + if __name__ == "__main__": sys.exit(main()) From 1ca198b102c3d2b3fbaa5c0b9f95cef9eb88b13e Mon Sep 17 00:00:00 2001 From: Athanasios Baltzis Date: Thu, 2 Feb 2023 13:47:33 +0100 Subject: [PATCH 7/7] Fix linting black fifth attempt --- bin/check_samplesheet.py | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/check_samplesheet.py b/bin/check_samplesheet.py index f81bf619..5a1bf052 100755 --- a/bin/check_samplesheet.py +++ b/bin/check_samplesheet.py @@ -117,7 +117,6 @@ def check_samplesheet(file_in, file_out): with open(file_out, "w") as fout: fout.write(",".join(["sequence", "fasta"]) + "\n") for sequence in sorted(sequence_mapping_dict.keys()): - ## Check that multiple runs of the same sample are of the same datatype if not all(x[0] == sequence_mapping_dict[sequence][0][0] for x in sequence_mapping_dict[sequence]): print_error(