Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/workflowhub_update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Publish workflows on WorkflowHub

on:
release:
types: [published]

jobs:
wfh-submit:
name: WorkflowHub submission
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Submit workflows
uses: workflowhub-eu/submission-action@v0
env:
API_TOKEN: ${{ secrets.WORKFLOWHUB_API_TOKEN }}
with:
team_id: 204
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ Release 11 of sanger-tol/ascc
- `KMER_COUNTER` has been replaced with `COBIONTID_KMERCOUNTER` to increase efficiency.
- This required the addition of `REFORMAT_NPY_2_CSV` to generate the kmer table.
- `FCSGX_RUNGX` has been updated to not depend on `modulecmd` instead, production profiles will instead default to a local installation of fcs_gx. Avoiding containerised options provided in the module.
- Samtools modules have been updated to `1.23.1`.
- `ORGANELLAR` and `GENOMIC` subworkflows have been merged into a single `ASCC` workflow.
- This was an artifact from when the two would have been doing significantly different processes.

### `Dependencies`

Expand All @@ -24,6 +27,7 @@ Release 11 of sanger-tol/ascc
| `REFORMAT_NPY_2_CSV` | npy_2_csv.py | NA | 1.0.0 |
| `SAMTOOLS_DICT` | samtools | 1.22.1 | 1.23.1 |
| `SAMTOOLS_FAIDX` | samtools | 1.22.1 | 1.23.1 |
| `SAMTOOLS_SORT` | samtools | 1.22.1 | 1.23.1 |
| `MINIMAP2_ALIGN2` | minimap2 + samtools | 2.29 + 1.21 | 2.30 + 1.23.1 |

## [0.6.0] - Red Notebook [28/01/2025]
Expand Down
4 changes: 1 addition & 3 deletions assets/farm_testing/samplesheet.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
sample,assembly_type,assembly_file
odCymConc1,PRIMARY,/lustre/scratch122/tol/data/d/8/a/6/e/b/Cymbastela_concentrica/assembly/draft/odCymConc1.20241101/odCymConc1.20241101.fa.gz
odCymConc1,HAPLO,/lustre/scratch122/tol/data/d/8/a/6/e/b/Cymbastela_concentrica/assembly/draft/odCymConc1.20241101/odCymConc1.20241101.haplotigs.decontaminated.fa.gz
odCymConc1,MITO,/lustre/scratch122/tol/data/d/8/a/6/e/b/Cymbastela_concentrica/assembly/draft/odCymConc1.20241101/odCymConc1-MT.fa.gz
odCymConc1,PRIMARY,/nfs/treeoflife-01/resources/nextflow/test-data/Laetiporus_sulphureus/assembly/release/gfLaeSulp1.1/insdc/GCA_927399515.1.fasta.gz
51 changes: 35 additions & 16 deletions bin/abnormal_contamination_check.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#!/usr/bin/env python

import general_purpose_functions as gpf
import sys
import argparse
import os.path
import pathlib
import argparse
import sys
import textwrap

import general_purpose_functions as gpf

VERSION = "V1.2.0"

DESCRIPTION = """
Expand Down Expand Up @@ -38,11 +39,33 @@ def parse_args():
parser.add_argument("assembly", type=str, help="Path to the fasta assembly file")
parser.add_argument("summary_path", type=str, help="Path to the tiara summary file")
parser.add_argument("-q", "--out_prefix", type=str, help="Output file prefix for the report")
parser.add_argument("-o", "--output", type=str, help="Path to output file", default="fcs-gx_alarm_indicator_file.txt")
parser.add_argument("-p", "--alarm_percentage", type=int, help="Percentage of putative contaminant sequence in genomic assembly that will trip the alarm", default=3)
parser.add_argument("-l", "--alarm_length_removed", type=int, help="Length of removed sequence is greater than default, greater than this will trip the alarm.", default=1e7)
parser.add_argument("-s", "--alarm_scaff_length", type=int, help="Length of largest scaffold removed to trip alarm.", default=1.8e6)
parser.add_argument("-t", "--alarm_scaff_percent_removed", type=float, help="Percentage of Scaffolds set for removal from assembly to trip the alarm.", default=10.0)
parser.add_argument(
"-o", "--output", type=str, help="Path to output file", default="fcs-gx_alarm_indicator_file.txt"
)
parser.add_argument(
"-p",
"--alarm_percentage",
type=int,
help="Percentage of putative contaminant sequence in genomic assembly that will trip the alarm",
default=3,
)
parser.add_argument(
"-l",
"--alarm_length_removed",
type=int,
help="Length of removed sequence is greater than default, greater than this will trip the alarm.",
default=1e7,
)
parser.add_argument(
"-s", "--alarm_scaff_length", type=int, help="Length of largest scaffold removed to trip alarm.", default=1.8e6
)
parser.add_argument(
"-t",
"--alarm_scaff_percent_removed",
type=float,
help="Percentage of Scaffolds set for removal from assembly to trip the alarm.",
default=10.0,
)
parser.add_argument("-r", "--review_info", type=int, help="Number of REVIEW/INFO to the trigger alarm", default=0)
parser.add_argument("-v", "--version", action="version", version=VERSION)
return parser.parse_args()
Expand All @@ -66,9 +89,7 @@ def load_fcs_gx_results(seq_dict, fcs_gx_and_tiara_summary_path):
Loads FCS-GX actions from the FCS-GX and Tiara results summary file, adds them to the dictionary that contains sequence lengths
"""
fcs_gx_and_tiara_summary_data = gpf.l(fcs_gx_and_tiara_summary_path)
fcs_gx_and_tiara_summary_data = fcs_gx_and_tiara_summary_data[
1 : len(fcs_gx_and_tiara_summary_data)
]
fcs_gx_and_tiara_summary_data = fcs_gx_and_tiara_summary_data[1 : len(fcs_gx_and_tiara_summary_data)]
for line in fcs_gx_and_tiara_summary_data:
split_line = line.split(",")
assert len(split_line) == 5
Expand All @@ -87,9 +108,7 @@ def main():
sys.exit(1)

if os.path.isfile(args.assembly) is False:
sys.stderr.write(
f"The assembly FASTA file was not found at the expected location ({args.assembly})\n"
)
sys.stderr.write(f"The assembly FASTA file was not found at the expected location ({args.assembly})\n")
sys.exit(1)

seq_dict = get_sequence_lengths(args.assembly)
Expand All @@ -115,7 +134,7 @@ def main():
"PERCENTAGE_LENGTH_REMOVED": args.alarm_percentage,
"LARGEST_SCAFFOLD_REMOVED": args.alarm_scaff_length,
"PERCENTAGE_SCAFFOLDS_REMOVED": args.alarm_scaff_percent_removed,
"REVIEW_OR_INFO": args.review_info
"REVIEW_OR_INFO": args.review_info,
}

report_dict = {
Expand All @@ -124,7 +143,7 @@ def main():
"LARGEST_SCAFFOLD_REMOVED": max(lengths_removed, default=0),
"SCAFFOLDS_REMOVED": scaffolds_removed,
"PERCENTAGE_SCAFFOLDS_REMOVED": 100 * scaffolds_removed / scaffold_count,
"REVIEW_OR_INFO": review_info
"REVIEW_OR_INFO": review_info,
}

# Seperated out to ensure that the file is written in one go and doesn't confuse Nextflow
Expand Down
31 changes: 10 additions & 21 deletions bin/general_purpose_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
#
# Copyright (c) 2020-2021 Genome Research Ltd.
#
# Author: Eerik Aunin (eeaunin@gmail.com)
#
# Author: Eerik Aunin (eeaunin@gmail.com
# This file is a part of the Genome Decomposition Analysis (GDA) pipeline.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
Expand All @@ -29,13 +28,13 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

import argparse
import os
from os.path import isfile
import sys
import subprocess
import signal
import subprocess
import sys
from datetime import datetime
import argparse
from os.path import isfile


def l(path):
Expand Down Expand Up @@ -172,17 +171,15 @@ def string_to_chunks(line, n):
return [line[i : i + n] for i in range(0, len(line), n)]


def run_system_command(
system_command, verbose=True, dry_run=False, tries=1, expected_exit_code=0
):
def run_system_command(system_command, verbose=True, dry_run=False, tries=1, expected_exit_code=0):
"""
Executes a system command and checks its exit code
"""
triggering_script_name = sys.argv[0].split("/")[-1]
try_counter_string = ""
if dry_run == False:
if not dry_run:
for i in range(0, tries):
if verbose == True:
if verbose:
time_now = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
if i > 0:
try_counter_string = ", try {}".format(i + 1)
Expand All @@ -201,11 +198,7 @@ def run_system_command(
break
except subprocess.CalledProcessError as exc:
out_errormessage = (
"<"
+ triggering_script_name
+ "> "
+ " exited with error code "
+ str(exc.returncode)
"<" + triggering_script_name + "> " + " exited with error code " + str(exc.returncode)
)
if exc.output.isspace() == False:
out_errormessage += ". Error message: " + exc.output
Expand Down Expand Up @@ -234,11 +227,7 @@ def get_file_paths(in_folder_path, extension):
onlyfiles = list()
selected_file_paths = list()
if os.path.isdir(in_folder_path):
onlyfiles = [
f
for f in os.listdir(in_folder_path)
if os.path.isfile(os.path.join(in_folder_path, f))
]
onlyfiles = [f for f in os.listdir(in_folder_path) if os.path.isfile(os.path.join(in_folder_path, f))]
for file_item in onlyfiles:
if "." + extension in file_item:
file_item_split = file_item.split(".")
Expand Down
4 changes: 2 additions & 2 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ process {
]
}

withName: ".*:ASCC_ORGANELLAR:RUN_DECONTAMINATE_FASTA:DECONTAMINATE_GENERATE_BED" {
ext.args = "--is_organelle True"
withName: ".*:ASCC_ASSEMBLY:RUN_DECONTAMINATE_FASTA:DECONTAMINATE_GENERATE_BED" {
ext.args = { meta.assembly_type == "organellar" ? "--is_organelle True" : "" }
}

withName: "ASCC_MERGE_TABLES|DECONTAMINATE_GENERATE_BED|GZIP" {
Expand Down
12 changes: 5 additions & 7 deletions conf/production.config
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ process {
// Allowing it to use default resources, stops it showing up in LSF?
withName: FCSGX_RUNGX {
container = ""
module = ""
//module = "fcs-gx/farm/0.5.5"
cpus = { 32 }
memory = { 520.GB }
time = { 12.h }
Expand Down Expand Up @@ -67,13 +65,13 @@ params {
// for sanger decontamination.

run_essentials = "both"
run_kmers = "off" //genomic
run_kmers = "genomic" //genomic
run_tiara = "both"
run_coverage = "both"
run_nt_blast = "off" //both
run_nr_diamond = "off" //both
run_uniprot_diamond = "off" //both
run_kraken = "off" //both
run_nt_blast = "both" //both
run_nr_diamond = "both" //both
run_uniprot_diamond = "both" //both
run_kraken = "both" //both
run_fcsgx = "both" //both
run_fcs_adaptor = "both" //both
run_vecscreen = "both" //both
Expand Down
31 changes: 25 additions & 6 deletions conf/test.config
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,33 @@
----------------------------------------------------------------------------------------
*/


process {
resourceLimits = [
cpus: 4,
memory: '15.GB',
time: '1.h'
]
// Adding the module info here
// stopped the resources from base.config
// from being used, and causes the job
// to only use the defaulted process_* tag
// which is just not enough for FCS_GX
// TODO
// Allowing it to use default resources, stops it showing up in LSF?
withName: FCSGX_RUNGX {
container = ""
cpus = { 32 }
memory = { 520.GB }
time = { 12.h }
}

withName: SANGER_TOL_BTK {
clusterOptions = {"-J NF_ASCC::BLOBTOOLKIT(${meta.id})"}
queue = "oversubscribed"
cpus = { 2 }
memory = { 1200.MB * task.attempt }
time = { 96.h * task.attempt }
}
}



params {
config_profile_name = 'Test profile'
config_profile_description = 'Minimal test dataset to check pipeline function'
Expand Down Expand Up @@ -82,7 +101,7 @@ params {
run_organellar_blast = "genomic"
run_autofilter_assembly = "both"
run_create_btk_dataset = "both"
run_merge_datasets = "genomic"
run_merge_datasets = "both"
run_decontaminate_fasta = "both"
run_html_report = "both"
}
26 changes: 13 additions & 13 deletions conf/test_full.config
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,21 @@ params {
run_essentials = "both" // both
run_kmers = "genomic" // genomic
run_tiara = "both" // both
run_coverage = "both" // both
run_nt_blast = "both" // both
run_nr_diamond = "both" // both
run_uniprot_diamond = "both" // both
run_kraken = "both" // both
run_coverage = "off" // both
run_nt_blast = "off" // both
run_nr_diamond = "off" // both
run_uniprot_diamond = "off" // both
run_kraken = "off" // both
run_fcsgx = "both" // both
run_fcs_adaptor = "both" // both
run_vecscreen = "both" // both
run_btk_busco = "genomic" // genomic
run_pacbio_barcodes = "both" // both
run_organellar_blast = "genomic" // genomic
run_fcs_adaptor = "off" // both
run_vecscreen = "off" // both
run_btk_busco = "off" // genomic
run_pacbio_barcodes = "off" // both
run_organellar_blast = "off" // genomic
run_autofilter_assembly = "both" // both
run_create_btk_dataset = "both" // both
run_merge_datasets = "genomic" // genomic
run_create_btk_dataset = "off" // both
run_merge_datasets = "off" // genomic
run_decontaminate_fasta = "both" // both
run_html_report = "both" // both
run_html_report = "off" // both

}
16 changes: 10 additions & 6 deletions modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,6 @@
"installed_by": ["modules"],
"patch": "modules/nf-core/fcs/fcsadaptor/fcs-fcsadaptor.diff"
},
"fcsgx/rungx": {
"branch": "master",
"git_sha": "6d46786420b4d7bc88eba026eb389c0c5535d120",
"installed_by": ["modules"],
"patch": "modules/nf-core/fcsgx/rungx/fcsgx-rungx.diff"
},
"gnu/sort": {
"branch": "master",
"git_sha": "7ad318b7b2c0ef6a101c01b6083b8acd6a9a63de",
Expand Down Expand Up @@ -151,6 +145,16 @@
"git_sha": "f919028603ca42cb01a59e45475c19106840372d",
"installed_by": ["fastx_map_long_reads"]
},
"fcsgx/parseresults": {
"branch": "main",
"git_sha": "17d7d065459873b60bb795714fac19137304b793",
"installed_by": ["modules"]
},
"fcsgx/rungx": {
"branch": "main",
"git_sha": "864e75dc4bf5b4fc50f7a5e568a4cb6236bfb528",
"installed_by": ["modules"]
},
"samtools/mergedup": {
"branch": "main",
"git_sha": "729e9c8cfa83bc64c95ea6024dd5477c936e305e",
Expand Down
2 changes: 1 addition & 1 deletion modules/local/ascc/merge_tables/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ process ASCC_MERGE_TABLES {
script:
def args = task.ext.args ?: ""

def empty_file_size = 80
def empty_file_size = 50
def coverage_data = coverage.size() > empty_file_size ? "-c ${coverage}" : ""
def tiara_data = tiara.size() > empty_file_size ? "-t ${tiara}" : ""
def nt_kraken_data = nt_kraken.size() > empty_file_size ? "-nk ${nt_kraken}" : ""
Expand Down
Loading
Loading