1
0
Fork 0
mirror of https://github.com/MillironX/taxprofiler.git synced 2024-11-22 20:49:54 +00:00

Merge pull request #116 from nf-core/nf-core-template-merge-2.5.1

Important! Template update for nf-core/tools v2.5.1
This commit is contained in:
James A. Fellows Yates 2022-09-02 13:47:39 +02:00 committed by GitHub
commit c9a7797682
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 25 deletions

View file

@ -55,11 +55,10 @@ jobs:
sudo update-locale LANG=en_US.UTF-8 sudo update-locale LANG=en_US.UTF-8
- name: Run pipeline with test data - name: Run pipeline with test data
# TODO nf-core: You can customise CI pipeline run tests as required uses: Wandalen/wretry.action@v1.0.11
# For example: adding multiple test runs with different parameters with:
# Remember that you can parallelise this by using strategy.matrix command: nextflow run ${GITHUB_WORKSPACE} -profile test,docker --outdir ./results ${{ matrix.parameters }}
run: | attempt_limit: 3
nextflow run ${GITHUB_WORKSPACE} -profile test,docker --outdir ./results ${{ matrix.parameters }}
motus: motus:
name: Test mOTUs with workflow parameters name: Test mOTUs with workflow parameters
@ -79,14 +78,9 @@ jobs:
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Install Nextflow - name: Install Nextflow
env: uses: nf-core/setup-nextflow@v1
NXF_VER: ${{ matrix.NXF_VER }} with:
# Uncomment only if the edge release is more recent than the latest stable release version: "${{ matrix.NXF_VER }}"
# See https://github.com/nextflow-io/nextflow/issues/2467
# NXF_EDGE: ${{ matrix.NXF_EDGE }}
run: |
wget -qO- get.nextflow.io | bash
sudo mv nextflow /usr/local/bin/
- name: Show current locale - name: Show current locale
run: locale run: locale

View file

@ -6,10 +6,10 @@ 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>"
parser = argparse.ArgumentParser(description=Description, epilog=Epilog) parser = argparse.ArgumentParser(description=Description, epilog=Epilog)
@ -17,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:
@ -25,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 != "":
@ -34,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:
@ -117,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,
) )
@ -182,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(

10
pyproject.toml Normal file
View file

@ -0,0 +1,10 @@
# Config file for Python. Mostly used to configure linting of bin/check_samplesheet.py with Black.
# Should be kept the same as nf-core/tools to avoid fighting with template synchronisation.
[tool.black]
line-length = 120
target_version = ["py37", "py38", "py39", "py310"]
[tool.isort]
profile = "black"
known_first_party = ["nf_core"]
multi_line_output = 3