-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into smw-flye-dev
Showing
128 changed files
with
2,834 additions
and
1,047 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
cromwell* | ||
_LAST | ||
2024* | ||
2024*site/ | ||
site/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
function addTableSearch() { | ||
// Select all containers with the class 'searchable-table' | ||
const containers = document.querySelectorAll('.searchable-table'); | ||
|
||
containers.forEach((container) => { | ||
// Find the table within this container | ||
const table = container.querySelector('table'); | ||
|
||
if (table) { | ||
// Ensure we don't add multiple search boxes | ||
if (!container.querySelector('input[type="search"]')) { | ||
// Create the search input element | ||
const searchInput = document.createElement("input"); | ||
searchInput.setAttribute("type", "search"); | ||
searchInput.setAttribute("placeholder", "Search table..."); | ||
searchInput.classList.add('table-search-input'); | ||
searchInput.style.marginBottom = "10px"; | ||
searchInput.style.display = "block"; | ||
|
||
// Insert the search input before the table | ||
container.insertBefore(searchInput, container.firstChild); | ||
|
||
// Add event listener for table search | ||
searchInput.addEventListener("input", function () { | ||
const filter = searchInput.value.toUpperCase(); | ||
const rows = table.getElementsByTagName("tr"); | ||
|
||
for (let i = 1; i < rows.length; i++) { // Skip header row | ||
const cells = rows[i].getElementsByTagName("td"); | ||
let match = false; | ||
|
||
for (let j = 0; j < cells.length; j++) { | ||
if (cells[j].innerText.toUpperCase().includes(filter)) { | ||
match = true; | ||
break; | ||
} | ||
} | ||
|
||
rows[i].style.display = match ? "" : "none"; | ||
} | ||
}); | ||
} | ||
} else { | ||
console.log('Table not found within container.'); | ||
} | ||
}); | ||
} | ||
|
||
// Run on page load | ||
addTableSearch(); | ||
|
||
// Reapply search bar on page change | ||
function observeDOMChanges() { | ||
const targetNode = document.querySelector('body'); | ||
const config = { childList: true, subtree: true }; | ||
|
||
const observer = new MutationObserver(() => { | ||
addTableSearch(); | ||
}); | ||
|
||
observer.observe(targetNode, config); | ||
} | ||
|
||
observeDOMChanges(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Fetch SRR Accession Workflow | ||
|
||
## Quick Facts | ||
|
||
| **Workflow Type** | **Applicable Kingdom** | **Last Known Changes** | **Command-line Compatibility** | **Workflow Level** | | ||
|---|---|---|---|---| | ||
| [Data Import](../../workflows_overview/workflows_type.md/#data-import) | [Any Taxa](../../workflows_overview/workflows_kingdom.md/#any-taxa) | PHB v2.3.0 | Yes | Sample-level | | ||
|
||
## Fetch SRR Accession | ||
|
||
This workflow retrieves the Sequence Read Archive (SRA) accession (SRR) associated with a given sample accession. The primary inputs are BioSample IDs (e.g., SAMN00000000) or SRA Experiment IDs (e.g., SRX000000), which link to sequencing data in the SRA repository. | ||
|
||
The workflow uses the fastq-dl tool to fetch metadata from SRA and specifically parses this metadata to extract the associated SRR accession and outputs the SRR accession. | ||
|
||
### Inputs | ||
|
||
| **Terra Task Name** | **Variable** | **Type** | **Description**| **Default Value** | **Terra Status** | | ||
| --- | --- | --- | --- | --- | --- | | ||
| fetch_srr_metadata | **sample_accession** | String | SRA-compatible accession, such as a **BioSample ID** (e.g., "SAMN00000000") or **SRA Experiment ID** (e.g., "SRX000000"), used to retrieve SRR metadata. | | Required | | ||
| fetch_srr_metadata | **cpu** | Int | Number of CPUs allocated for the task. | 2 | Optional | | ||
| fetch_srr_metadata | **disk_size** | Int | Disk space in GB allocated for the task. | 10 | Optional | | ||
| fetch_srr_metadata | **docker**| String | Docker image for metadata retrieval. | `us-docker.pkg.dev/general-theiagen/biocontainers/fastq-dl:2.0.4--pyhdfd78af_0` | Optional | | ||
| fetch_srr_metadata | **memory** | Int | Memory in GB allocated for the task. | 8 | Optional | | ||
| version_capture | **docker** | String | The Docker container to use for the task | "us-docker.pkg.dev/general-theiagen/theiagen/alpine-plus-bash:3.20.0" | Optional | | ||
| version_capture | **timezone** | String | Set the time zone to get an accurate date of analysis (uses UTC by default) | | Optional | | ||
|
||
### Workflow Tasks | ||
|
||
This workflow has a single task that performs metadata retrieval for the specified sample accession. | ||
|
||
??? task "`fastq-dl`: Fetches SRR metadata for sample accession" | ||
When provided a BioSample accession or SRA experiment ID, 'fastq-dl' collects metadata and returns the appropriate SRR accession. | ||
|
||
!!! techdetails "fastq-dl Technical Details" | ||
| | Links | | ||
| --- | --- | | ||
| Task | [Task on GitHub](https://github.com/theiagen-org/phb-workflows/blob/main/tasks/utilities/data_handling/task_fetch_srr_metadata.wdl) | | ||
| Software Source Code | [fastq-dl Source](https://github.com/rvalieris/fastq-dl) | | ||
| Software Documentation | [fastq-dl Documentation](https://github.com/rvalieris/fastq-dl#documentation) | | ||
| Original Publication | [fastq-dl: A fast and reliable tool for downloading SRA metadata](https://doi.org/10.1186/s12859-021-04346-3) | | ||
|
||
### Outputs | ||
|
||
| **Variable** | **Type** | **Description**| | ||
|---|---|---| | ||
| srr_accession| String | The SRR accession's associated with the input sample accession.| | ||
| fetch_srr_accession_version | String | The version of the fetch_srr_accession workflow. | | ||
| fetch_srr_accession_analysis_date | String | The date the fetch_srr_accession analysis was run. | | ||
|
||
## References | ||
|
||
> Valieris, R. et al., "fastq-dl: A fast and reliable tool for downloading SRA metadata." Bioinformatics, 2021. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Concatenate Illumina Lanes | ||
|
||
## Quick Facts | ||
|
||
| **Workflow Type** | **Applicable Kingdom** | **Last Known Changes** | **Command-line Compatibility** | **Workflow Level** | | ||
|---|---|---|---|---| | ||
| [Standalone](../../workflows_overview/workflows_type.md/#standalone) | [Any Taxa](../../workflows_overview/workflows_kingdom.md/#any-taxa) | PHB 2.3.0 | Yes | Sample-level | | ||
|
||
## Concatenate_Illumina_Lanes_PHB | ||
|
||
Some Illumina machines produce multi-lane FASTQ files for a single sample. This workflow concatenates the multiple lanes into a single FASTQ file per read type (forward or reverse). | ||
|
||
### Inputs | ||
|
||
| **Terra Task Name** | **Variable** | **Type** | **Description** | **Default Value** | **Terra Status** | | ||
|---|---|---|---|---|---| | ||
| concatenate_illumina_lanes | **read1_lane1** | File | The first lane for the forward reads | | Required | | ||
| concatenate_illumina_lanes | **read1_lane2** | File | The second lane for the forward reads | | Required | | ||
| concatenate_illumina_lanes | **samplename** | String | The name of the sample, used to name the output files | | Required | | ||
| cat_lanes | **cpu** | Int | Number of CPUs to allocate to the task | 2 | Optional | | ||
| cat_lanes | **disk_size** | Int | Amount of storage (in GB) to allocate to the task | 50 | Optional | | ||
| cat_lanes | **docker** | String | The Docker container to use for the task | "us-docker.pkg.dev/general-theiagen/theiagen/utility:1.2" | Optional | | ||
| cat_lanes | **memory** | Int | Amount of memory/RAM (in GB) to allocate to the task | 4 | Optional | | ||
| concatenate_illumina_lanes | **read1_lane3** | File | The third lane for the forward reads | | Optional | | ||
| concatenate_illumina_lanes | **read1_lane4** | File | The fourth lane for the forward reads | | Optional | | ||
| concatenate_illumina_lanes | **read2_lane1** | File | The first lane for the reverse reads | | Optional | | ||
| concatenate_illumina_lanes | **read2_lane2** | File | The second lane for the reverse reads | | Optional | | ||
| concatenate_illumina_lanes | **read2_lane3** | File | The third lane for the reverse reads | | Optional | | ||
| concatenate_illumina_lanes | **read2_lane4** | File | The fourth lane for the reverse reads | | Optional | | ||
| version_capture | **docker** | String | The Docker container to use for the task | "us-docker.pkg.dev/general-theiagen/theiagen/alpine-plus-bash:3.20.0" | Optional | | ||
| version_capture | **timezone** | String | Set the time zone to get an accurate date of analysis (uses UTC by default) | | Optional | | ||
|
||
### Workflow Tasks | ||
|
||
This workflow concatenates the Illumina lanes for forward and (if provided) reverse reads. The output files are named as followed: | ||
|
||
- Forward reads: `<samplename>_merged_R1.fastq.gz` | ||
- Reverse reads: `<samplename>_merged_R2.fastq.gz` | ||
|
||
### Outputs | ||
|
||
| **Variable** | **Type** | **Description** | | ||
|---|---|---| | ||
| concatenate_illumina_lanes_analysis_date | String | Date of analysis | | ||
| concatenate_illumina_lanes_version | String | Version of PHB used for the analysis | | ||
| read1_concatenated | File | Concatenated forward reads | | ||
| read2_concatenated | File | Concatenated reverse reads | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
122 changes: 122 additions & 0 deletions
122
tasks/species_typing/escherichia_shigella/task_stxtyper.wdl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
version 1.0 | ||
|
||
task stxtyper { | ||
input { | ||
File assembly | ||
String samplename | ||
Boolean enable_debugging = false # Additional messages are printed and files in $TMPDIR are not removed after running | ||
String docker = "us-docker.pkg.dev/general-theiagen/staphb/stxtyper:1.0.24" | ||
Int disk_size = 50 | ||
Int cpu = 1 | ||
Int memory = 4 | ||
} | ||
command <<< | ||
# fail task if any commands below fail since there's lots of bash conditionals below (AGH!) | ||
set -eo pipefail | ||
|
||
# capture version info | ||
stxtyper --version | tee VERSION.txt | ||
|
||
# NOTE: by default stxyper uses $TMPDIR or /tmp, so if we run into issues we may need to adjust in the future. Could potentially use PWD as the TMPDIR. | ||
echo "DEBUG: TMPDIR is set to: $TMPDIR" | ||
|
||
echo "DEBUG: running StxTyper now..." | ||
# run StxTyper on assembly; may need to add/remove options in the future if they change | ||
# NOTE: stxtyper can accept gzipped assemblies, so no need to unzip | ||
stxtyper \ | ||
--nucleotide ~{assembly} \ | ||
--name ~{samplename} \ | ||
--output ~{samplename}_stxtyper.tsv \ | ||
~{true='--debug' false='' enable_debugging} \ | ||
--log ~{samplename}_stxtyper.log | ||
|
||
# parse output TSV | ||
echo "DEBUG: Parsing StxTyper output TSV..." | ||
|
||
# check for output file with only 1 line (meaning no hits found); exit cleanly if so | ||
if [ "$(wc -l < ~{samplename}_stxtyper.tsv)" -eq 1 ]; then | ||
echo "No hits found by StxTyper" > stxtyper_hits.txt | ||
echo "0" > stxtyper_num_hits.txt | ||
echo "DEBUG: No hits found in StxTyper output TSV. Exiting task with exit code 0 now." | ||
|
||
# create empty output files | ||
touch stxtyper_all_hits.txt stxtyper_complete_operons.txt stxtyper_partial_hits.txt stxtyper_stx_frameshifts_or_internal_stop_hits.txt stx_novel_hits.txt | ||
# put "none" into all of them so task does not fail | ||
echo "None" | tee stxtyper_all_hits.txt stxtyper_complete_operons.txt stxtyper_partial_hits.txt stxtyper_stx_frameshifts_or_internal_stop_hits.txt stx_novel_hits.txt | ||
exit 0 | ||
fi | ||
|
||
# check for output file with more than 1 line (meaning hits found); count lines & parse output TSV if so | ||
if [ "$(wc -l < ~{samplename}_stxtyper.tsv)" -gt 1 ]; then | ||
echo "Hits found by StxTyper. Counting lines & parsing output TSV now..." | ||
# count number of lines in output TSV (excluding header) | ||
wc -l < ~{samplename}_stxtyper.tsv | awk '{print $1-1}' > stxtyper_num_hits.txt | ||
# remove header line | ||
sed '1d' ~{samplename}_stxtyper.tsv > ~{samplename}_stxtyper_noheader.tsv | ||
|
||
##### parse output TSV ##### | ||
### complete operons | ||
echo "DEBUG: Parsing complete operons..." | ||
awk -F'\t' -v OFS=, '$4 == "COMPLETE" {print $3}' ~{samplename}_stxtyper.tsv | paste -sd, - | tee stxtyper_complete_operons.txt | ||
# if grep for COMPLETE fails, write "None" to file for output string | ||
if [[ "$(grep --silent 'COMPLETE' ~{samplename}_stxtyper.tsv; echo $?)" -gt 0 ]]; then | ||
echo "None" > stxtyper_complete_operons.txt | ||
fi | ||
|
||
### complete_novel operons | ||
echo "DEBUG: Parsing complete novel hits..." | ||
awk -F'\t' -v OFS=, '$4 == "COMPLETE_NOVEL" {print $3}' ~{samplename}_stxtyper.tsv | paste -sd, - | tee stx_novel_hits.txt | ||
# if grep for COMPLETE_NOVEL fails, write "None" to file for output string | ||
if [ "$(grep --silent 'COMPLETE_NOVEL' ~{samplename}_stxtyper.tsv; echo $?)" -gt 0 ]; then | ||
echo "None" > stx_novel_hits.txt | ||
fi | ||
|
||
### partial hits (to any gene in stx operon) | ||
echo "DEBUG: Parsing stxtyper partial hits..." | ||
# explanation: if "operon" column contains "PARTIAL" (either PARTIAL or PARTIAL_CONTIG_END possible); print either "stx1" or "stx2" or "stx1,stx2" | ||
awk -F'\t' -v OFS=, '$4 ~ "PARTIAL.*" {print $3}' ~{samplename}_stxtyper.tsv | sort | uniq | paste -sd, - | tee stxtyper_partial_hits.txt | ||
# if no stx partial hits found, write "None" to file for output string | ||
if [ "$(grep --silent 'stx' stxtyper_partial_hits.txt; echo $?)" -gt 0 ]; then | ||
echo "None" > stxtyper_partial_hits.txt | ||
fi | ||
|
||
### frameshifts or internal stop codons in stx genes | ||
echo "DEBUG: Parsing stx frameshifts or internal stop codons..." | ||
# explanation: if operon column contains "FRAME_SHIFT" or "INTERNAL_STOP", print the "operon" in a sorted/unique list | ||
awk -F'\t' -v OFS=, '$4 == "FRAMESHIFT" || $4 == "INTERNAL_STOP" {print $3}' ~{samplename}_stxtyper.tsv | sort | uniq | paste -sd, - | tee stxtyper_stx_frameshifts_or_internal_stop_hits.txt | ||
# if no frameshifts or internal stop codons found, write "None" to file for output string | ||
if [ "$(grep --silent -E 'FRAMESHIFT|INTERNAL_STOP' ~{samplename}_stxtyper.tsv; echo $?)" -gt 0 ]; then | ||
echo "None" > stxtyper_stx_frameshifts_or_internal_stop_hits.txt | ||
fi | ||
|
||
echo "DEBUG: generating stx_type_all string output now..." | ||
# sort and uniq so there are no duplicates; then paste into a single comma-separated line with commas | ||
# sed is to remove any instances of "None" from the output | ||
cat stxtyper_complete_operons.txt stxtyper_partial_hits.txt stxtyper_stx_frameshifts_or_internal_stop_hits.txt stx_novel_hits.txt | sed '/None/d' | sort | uniq | paste -sd, - > stxtyper_all_hits.txt | ||
|
||
fi | ||
echo "DEBUG: Finished parsing StxTyper output TSV." | ||
>>> | ||
output { | ||
File stxtyper_report = "~{samplename}_stxtyper.tsv" | ||
File stxtyper_log = "~{samplename}_stxtyper.log" | ||
String stxtyper_docker = docker | ||
String stxtyper_version = read_string("VERSION.txt") | ||
# outputs parsed from stxtyper output TSV | ||
Int stxtyper_num_hits = read_int("stxtyper_num_hits.txt") | ||
String stxtyper_all_hits = read_string("stxtyper_all_hits.txt") | ||
String stxtyper_complete_operon_hits = read_string("stxtyper_complete_operons.txt") | ||
String stxtyper_partial_hits = read_string("stxtyper_partial_hits.txt") | ||
String stxtyper_frameshifts_or_internal_stop_hits = read_string("stxtyper_stx_frameshifts_or_internal_stop_hits.txt") | ||
String stxtyper_novel_hits = read_string("stx_novel_hits.txt") | ||
} | ||
runtime { | ||
docker: "~{docker}" | ||
memory: "~{memory} GB" | ||
cpu: cpu | ||
disks: "local-disk " + disk_size + " SSD" | ||
disk: disk_size + " GB" | ||
preemptible: 1 # does not take long (usually <3 min) to run stxtyper on 1 genome, preemptible is fine | ||
maxRetries: 3 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
tasks/utilities/data_handling/task_fetch_srr_accession.wdl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
version 1.0 | ||
|
||
task fetch_srr_accession { | ||
input { | ||
String sample_accession | ||
String docker = "us-docker.pkg.dev/general-theiagen/biocontainers/fastq-dl:2.0.4--pyhdfd78af_0" | ||
Int disk_size = 10 | ||
Int cpu = 2 | ||
Int memory = 8 | ||
} | ||
meta { | ||
volatile: true | ||
} | ||
command <<< | ||
set -euo pipefail | ||
|
||
# Output the current date and fastq-dl version for debugging | ||
date -u | tee DATE | ||
fastq-dl --version | tee VERSION | ||
|
||
echo "Fetching metadata for accession: ~{sample_accession}" | ||
|
||
# Run fastq-dl and capture stderr | ||
fastq-dl --accession ~{sample_accession} --only-download-metadata -m 2 --verbose 2> stderr.log || true | ||
|
||
# Handle whether the ID/accession is valid and contains SRR metadata based on stderr | ||
if grep -q "No results found for" stderr.log; then | ||
echo "No SRR accession found" > srr_accession.txt | ||
echo "No SRR accession found for accession: ~{sample_accession}" | ||
elif grep -q "received an empty response" stderr.log; then | ||
echo "No SRR accession found" > srr_accession.txt | ||
echo "No SRR accession found for accession: ~{sample_accession}" | ||
elif grep -q "is not a Study, Sample, Experiment, or Run accession" stderr.log; then | ||
echo "Invalid accession: ~{sample_accession}" >&2 | ||
exit 1 | ||
elif [[ ! -f fastq-run-info.tsv ]]; then | ||
echo "No metadata file found for accession: ~{sample_accession}" >&2 | ||
exit 1 | ||
else | ||
# Extract SRR accessions from the TSV file if it exists | ||
SRR_accessions=$(awk -F'\t' 'NR>1 {print $1}' fastq-run-info.tsv | paste -sd ',' -) | ||
if [[ -z "${SRR_accessions}" ]]; then | ||
echo "No SRR accession found" > srr_accession.txt | ||
else | ||
echo "Extracted SRR accessions: ${SRR_accessions}" | ||
echo "${SRR_accessions}" > srr_accession.txt | ||
fi | ||
fi | ||
>>> | ||
output { | ||
String srr_accession = read_string("srr_accession.txt") | ||
String fastq_dl_version = read_string("VERSION") | ||
} | ||
runtime { | ||
docker: docker | ||
memory: "~{memory} GB" | ||
cpu: cpu | ||
disks: "local-disk " + disk_size + " SSD" | ||
disk: disk_size + " GB" | ||
preemptible: 1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
version 1.0 | ||
|
||
task cat_lanes { | ||
input { | ||
String samplename | ||
|
||
File read1_lane1 | ||
File read1_lane2 | ||
File? read1_lane3 | ||
File? read1_lane4 | ||
|
||
File? read2_lane1 | ||
File? read2_lane2 | ||
File? read2_lane3 | ||
File? read2_lane4 | ||
|
||
Int cpu = 2 | ||
Int disk_size = 50 | ||
String docker = "us-docker.pkg.dev/general-theiagen/theiagen/utility:1.2" | ||
Int memory = 4 | ||
} | ||
meta { | ||
volatile: true | ||
} | ||
command <<< | ||
# exit task if anything throws an error (important for proper gzip format) | ||
set -euo pipefail | ||
|
||
exists() { [[ -f $1 ]]; } | ||
|
||
set -euo pipefail | ||
|
||
cat ~{read1_lane1} ~{read1_lane2} ~{read1_lane3} ~{read1_lane4} > "~{samplename}_merged_R1.fastq.gz" | ||
|
||
if exists ~{read2_lane1} ; then | ||
cat ~{read2_lane1} ~{read2_lane2} ~{read2_lane3} ~{read2_lane4} > "~{samplename}_merged_R2.fastq.gz" | ||
fi | ||
|
||
# ensure newly merged FASTQs are valid gzipped format | ||
gzip -t *merged*.gz | ||
>>> | ||
output { | ||
File read1_concatenated = "~{samplename}_merged_R1.fastq.gz" | ||
File? read2_concatenated = "~{samplename}_merged_R2.fastq.gz" | ||
} | ||
runtime { | ||
docker: "~{docker}" | ||
memory: memory + " GB" | ||
cpu: cpu | ||
disks: "local-disk " + disk_size + " SSD" | ||
disk: disk_size + " GB" | ||
preemptible: 1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.