mirror of
https://github.com/MillironX/taxprofiler.git
synced 2024-12-22 15:18:16 +00:00
Black linting I hope
This commit is contained in:
parent
7917e1d656
commit
3a33d81e80
1 changed files with 8 additions and 12 deletions
|
@ -6,10 +6,9 @@ import sys
|
||||||
import errno
|
import errno
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
|
|
||||||
def parse_args(args=None):
|
def parse_args(args=None):
|
||||||
Description = (
|
Description = "Reformat nf-core/taxprofiler samplesheet file and check its contents."
|
||||||
"Reformat nf-core/taxprofiler samplesheet file and check its contents."
|
|
||||||
)
|
|
||||||
|
|
||||||
Epilog = "Example usage: python check_samplesheet.py <FILE_IN> <FILE_OUT>"
|
Epilog = "Example usage: python check_samplesheet.py <FILE_IN> <FILE_OUT>"
|
||||||
|
|
||||||
|
@ -18,6 +17,7 @@ def parse_args(args=None):
|
||||||
parser.add_argument("FILE_OUT", help="Output file.")
|
parser.add_argument("FILE_OUT", help="Output file.")
|
||||||
return parser.parse_args(args)
|
return parser.parse_args(args)
|
||||||
|
|
||||||
|
|
||||||
def make_dir(path):
|
def make_dir(path):
|
||||||
if len(path) > 0:
|
if len(path) > 0:
|
||||||
try:
|
try:
|
||||||
|
@ -26,6 +26,7 @@ def make_dir(path):
|
||||||
if exception.errno != errno.EEXIST:
|
if exception.errno != errno.EEXIST:
|
||||||
raise exception
|
raise exception
|
||||||
|
|
||||||
|
|
||||||
def print_error(error, context="Line", context_str=""):
|
def print_error(error, context="Line", context_str=""):
|
||||||
error_str = "ERROR: Please check samplesheet -> {}".format(error)
|
error_str = "ERROR: Please check samplesheet -> {}".format(error)
|
||||||
if context != "" and context_str != "":
|
if context != "" and context_str != "":
|
||||||
|
@ -35,6 +36,7 @@ def print_error(error, context="Line", context_str=""):
|
||||||
print(error_str)
|
print(error_str)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
def check_samplesheet(file_in, file_out):
|
def check_samplesheet(file_in, file_out):
|
||||||
"""
|
"""
|
||||||
This function checks that the samplesheet follows the following structure:
|
This function checks that the samplesheet follows the following structure:
|
||||||
|
@ -118,9 +120,7 @@ def check_samplesheet(file_in, file_out):
|
||||||
num_cols = len([x for x in lspl if x])
|
num_cols = len([x for x in lspl if x])
|
||||||
if num_cols < MIN_COLS:
|
if num_cols < MIN_COLS:
|
||||||
print_error(
|
print_error(
|
||||||
"Invalid number of populated columns (minimum = {})!".format(
|
"Invalid number of populated columns (minimum = {})!".format(MIN_COLS),
|
||||||
MIN_COLS
|
|
||||||
),
|
|
||||||
"Line",
|
"Line",
|
||||||
line,
|
line,
|
||||||
)
|
)
|
||||||
|
@ -183,13 +183,9 @@ def check_samplesheet(file_in, file_out):
|
||||||
## Auto-detect paired-end/single-end
|
## Auto-detect paired-end/single-end
|
||||||
if sample and fastq_1 and fastq_2: ## Paired-end short reads
|
if sample and fastq_1 and fastq_2: ## Paired-end short reads
|
||||||
sample_info.extend(["0", fastq_1, fastq_2, fasta])
|
sample_info.extend(["0", fastq_1, fastq_2, fasta])
|
||||||
elif (
|
elif sample and fastq_1 and not fastq_2: ## Single-end short/long fastq reads
|
||||||
sample and fastq_1 and not fastq_2
|
|
||||||
): ## Single-end short/long fastq reads
|
|
||||||
sample_info.extend(["1", fastq_1, fastq_2, fasta])
|
sample_info.extend(["1", fastq_1, fastq_2, fasta])
|
||||||
elif (
|
elif sample and fasta and not fastq_1 and not fastq_2: ## Single-end long reads
|
||||||
sample and fasta and not fastq_1 and not fastq_2
|
|
||||||
): ## Single-end long reads
|
|
||||||
sample_info.extend(["1", fastq_1, fastq_2, fasta])
|
sample_info.extend(["1", fastq_1, fastq_2, fasta])
|
||||||
elif fasta and (fastq_1 or fastq_2):
|
elif fasta and (fastq_1 or fastq_2):
|
||||||
print_error(
|
print_error(
|
||||||
|
|
Loading…
Reference in a new issue