Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Kincekara committed Dec 31, 2024
1 parent 3ecc505 commit c12d3f9
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 49 deletions.
9 changes: 1 addition & 8 deletions tasks/task_amrfinderplus.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,6 @@ task amrfinderplus_nuc {
date | tee DATE
amrfinder --version | tee AMRFINDER_VERSION

# check prodigal files
if [[ -f "~{prodigal_faa}" ]] && [[ -f "~{prodigal_gff}" ]]; then
protein=true
else
protein=false
fi

# select mash organism if avalible
if [[ "~{mash_organism}" != "" ]]; then
organism="~{mash_organism}"
Expand Down Expand Up @@ -151,7 +144,7 @@ task amrfinderplus_nuc {
fi

# checking bash variable
echo "amrfinder_organism is set to:" ${amrfinder_organism}
echo "amrfinder_organism is set to: ${amrfinder_organism}"

# protein + nucleotide (activate HMM)
if [[ -f "~{prodigal_faa}" ]] && [[ -f "~{prodigal_gff}" ]]; then
Expand Down
8 changes: 4 additions & 4 deletions tasks/task_bbtools.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ task assembly_prep {

command <<<
# version control
echo "$(java -ea -Xmx31715m -Xms31715m -cp /bbmap/current/ jgi.BBDuk 2>&1)" | grep version > VERSION
java -ea -Xmx31715m -Xms31715m -cp /bbmap/current/ jgi.BBDuk 2>&1 | grep version > VERSION

# PhiX cleaning
bbduk.sh \
Expand Down Expand Up @@ -85,7 +85,7 @@ task insert_size_dist {

command <<<
# version control
echo "$(java -ea -Xmx31715m -Xms31715m -cp /bbmap/current/ jgi.BBDuk 2>&1)" | grep version > VERSION
java -ea -Xmx31715m -Xms31715m -cp /bbmap/current/ jgi.BBDuk 2>&1 | grep version > VERSION
# map reads and create histogram
bbmap.sh \
ref=~{reference} \
Expand All @@ -96,12 +96,12 @@ task insert_size_dist {
maxindel=~{max_indel} \
fast
#parse histogram file
cat ~{samplename}.ihist.txt | sed '6,1006!d' > ~{samplename}.hist.txt
sed '6,1006!d' ~{samplename}.ihist.txt > ~{samplename}.hist.txt
mean=$(awk -F "\t" 'NR==1 {print $2}' ~{samplename}.ihist.txt)
median=$(awk -F "\t" 'NR==2 {print $2}' ~{samplename}.ihist.txt)
mode=$(awk -F "\t" 'NR==3 {print $2}' ~{samplename}.ihist.txt)
stdev=$(awk -F "\t" 'NR==4 {print $2}' ~{samplename}.ihist.txt)
echo $median > MEDIAN
echo "$median" > MEDIAN
# create a html plot
touch ~{samplename}.hist.html
x=$(awk -vORS=, 'NR>1 {print $1}' "~{samplename}.hist.txt" | sed 's/,$/\n/')
Expand Down
2 changes: 1 addition & 1 deletion tasks/task_blast.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ task tblastn {
then
echo "No blast hit!" > GENES
else
echo $hits > GENES
echo "$hits" > GENES
fi
>>>

Expand Down
4 changes: 2 additions & 2 deletions tasks/task_checkm2.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ task checkm2 {
File checkm2_db
String samplename
String docker = "staphb/checkm2:1.0.2"
Int? memory = 16
Int? cpu = 4
Int memory = 16
Int cpu = 4
}

command <<<
Expand Down
18 changes: 9 additions & 9 deletions tasks/task_fastp.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ task fastp_pe {
File? adapters
String docker = "staphb/fastp:0.24.0"
String samplename
Int? leading = 1
Int? front_mean_quality = 10
Int? trailing = 1
Int? tail_mean_quality = 10
Int? minlen = 50
Int? window_size = 4
Int? right_mean_quality = 20
Int? thread = 4
Int? read_quality = 30
Int leading = 1
Int front_mean_quality = 10
Int trailing = 1
Int tail_mean_quality = 10
Int minlen = 50
Int window_size = 4
Int right_mean_quality = 20
Int thread = 4
Int read_quality = 30
}

command <<<
Expand Down
8 changes: 4 additions & 4 deletions tasks/task_json.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ task write_json {
Int total_reads_trim
Int r1_reads
Int r2_reads
Float? r1_q30_raw
Float? r2_q30_raw
Float? r1_q30_trim
Float? r2_q30_trim
Float r1_q30_raw
Float r2_q30_raw
Float r1_q30_trim
Float r2_q30_trim
# BBtools
String? phiX_ratio
# Bracken
Expand Down
10 changes: 5 additions & 5 deletions tasks/task_mash.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ task predict_taxon {
File? reference
String samplename
String docker = "kincekara/mash:2.3-cbird-v2.0"
Int? memory = 16
Int? cpu = 4
Int memory = 16
Int cpu = 4
}

command <<<
Expand Down Expand Up @@ -35,11 +35,11 @@ task predict_taxon {
else
taxon=$(echo "$candidate" | cut -d ' ' -f 1,2)
fi
echo $taxon > TAXON
echo "$taxon" > TAXON
# find ratio
ratio=$(awk -F "\t" 'NR==1 {printf "%.2f\n",$1*100}' ~{samplename}.mash.sorted.tsv)
echo $ratio > RATIO
printf "$taxon\t$ratio\n" > ~{samplename}.top_taxon.tsv
echo "$ratio" > RATIO
printf '%s\t%s\n' "$taxon" "$ratio" > ~{samplename}.top_taxon.tsv
>>>

output {
Expand Down
8 changes: 4 additions & 4 deletions tasks/task_mlst.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ task ts_mlst {
File assembly
String samplename
String docker = "staphb/mlst:2.23.0-2024-12-01"
Int? cpu = 4
Int cpu = 4
# Parameters
# --nopath Strip filename paths from FILE column (default OFF)
# --scheme [X] Don't autodetect, force this scheme on all inputs (default '')
Expand All @@ -22,7 +22,7 @@ task ts_mlst {
Float? minscore
}
command <<<
echo $(mlst --version 2>&1) | sed 's/mlst //' | tee VERSION
mlst --version 2>&1 | sed 's/mlst //' | tee VERSION

#create output header
echo -e "Filename\tPubMLST_Scheme_name\tSequence_Type_(ST)\tAllele_IDs" > ~{samplename}_ts_mlst.tsv
Expand Down Expand Up @@ -54,8 +54,8 @@ task ts_mlst {
fi
fi

echo $predicted_mlst | tee PREDICTED_MLST
echo $pubmlst_scheme | tee PUBMLST_SCHEME
echo "$predicted_mlst" | tee PREDICTED_MLST
echo "$pubmlst_scheme" | tee PUBMLST_SCHEME
>>>
output {
File ts_mlst_results = "~{samplename}_ts_mlst.tsv"
Expand Down
4 changes: 2 additions & 2 deletions tasks/task_plasmidfinder.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ task plasmidfinder {
File assembly
String samplename
String docker = "kincekara/plasmidfinder:2.1.6-db_2023-03-17"
Float? min_coverage = 0.6
Float? threshold = 0.9
Float min_coverage = 0.6
Float threshold = 0.9
}

command <<<
Expand Down
12 changes: 6 additions & 6 deletions tasks/task_taxonomy.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ task profile {
File kraken2_db
String samplename
String docker = "staphb/bracken:2.9"
Int? bracken_read_len = 100
Int? bracken_threshold = 10
String? min_hit_groups = 3
Int? memory = 32
Int? cpu = 4
Int bracken_read_len = 100
Int bracken_threshold = 10
Int min_hit_groups = 3
Int memory = 32
Int cpu = 4
}

command <<<
# version
echo $(kraken2 --version 2>&1) | sed 's/^.*Kraken version //;s/ .*$//' | tee KVERSION
kraken2 --version 2>&1 | sed 's/^.*Kraken version //;s/ .*$//' | tee KVERSION
basename -s .tar.gz ~{kraken2_db} | cut -d "_" -f2,3,4 | tee K2DB

# Decompress the Kraken2 database
Expand Down
8 changes: 4 additions & 4 deletions workflows/wf_c-bird.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,10 @@ workflow cbird_workflow {
Int total_reads_trim = fastp_trim.total_reads_trim
Int r1_reads = fastp_trim.r1_reads
Int r2_reads = fastp_trim.r2_reads
Float? r1_q30_raw = fastp_trim.r1_q30_raw
Float? r2_q30_raw = fastp_trim.r2_q30_raw
Float? r1_q30_trim = fastp_trim.r1_q30_trim
Float? r2_q30_trim = fastp_trim.r2_q30_trim
Float r1_q30_raw = fastp_trim.r1_q30_raw
Float r2_q30_raw = fastp_trim.r2_q30_raw
Float r1_q30_trim = fastp_trim.r1_q30_trim
Float r2_q30_trim = fastp_trim.r2_q30_trim
# BBtools
File? phiX_stats = assembly_prep.phiX_stats
String? bbtools_docker = assembly_prep.bbtools_docker
Expand Down

0 comments on commit c12d3f9

Please sign in to comment.