Skip to content

Commit

Permalink
switch freyja update to happen in the work dir
Browse files Browse the repository at this point in the history
  • Loading branch information
hoelzer committed May 13, 2024
1 parent abda6f6 commit c02cdb3
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions workflows/process/freyja.nf
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,18 @@ process freyja {
tuple val(name), path("*_freyja_plot.svg"), path("*_freyja_plot.png"), emit: plots, optional: true

script:
if ( params.freyja_update ) { freyja_update_cmd = "freyja update" }
else { freyja_update_cmd = " " }
if ( params.freyja_update )
{ freyja_update_cmd = "mkdir data; freyja update --outdir data"
// here we will download the latest Freyja data again instead of using the files obtained when installing the conda env
freyja_ref_data = "data"
}
else
{ freyja_update_cmd = " "
// this is the original path where inside of the container the Freyja data is stored
freyja_ref_data = "/opt/conda/envs/freyja-env/lib/python3.10/site-packages/freyja/data/"
}
"""
sed -i "s/^>.*\$/>MN908947.3/" ${reference} #rename reference-sequence as Alignment is done with this sequence-name even so using the same reference freyja will detect deviating names and thro an error
sed -i "s/^>.*\$/>MN908947.3/" ${reference} #rename reference-sequence as Alignment is done with this sequence-name even so using the same reference freyja will detect deviating names and throw an error
mkdir -p freyja_result/
${freyja_update_cmd}
Expand All @@ -28,19 +36,23 @@ process freyja {
freyja demix ${name}_freyja_variants.tsv \
${name}_freyja_depths.tsv \
--output freyja_result/${name}_freyja_demix.tsv \
--barcodes ${freyja_ref_data}/usher_barcodes.csv \
--lineageyml ${freyja_ref_data}/lineages.yml
freyja aggregate freyja_result/ \
--output ${name}_freyja_aggregate.tsv \
freyja plot ${name}_freyja_aggregate.tsv \
--output ${name}_freyja_plot.svg \
--lineages \
--mincov 10.0 #default minCoverage: 60
--mincov 10.0 #default minCoverage: 60 \
--lineageyml ${freyja_ref_data}/lineages.yml
freyja plot ${name}_freyja_aggregate.tsv \
--output ${name}_freyja_plot.png \
--lineages \
--mincov 10.0 #default minCoverage: 60
--mincov 10.0 #default minCoverage: 60 \
--lineageyml ${freyja_ref_data}/lineages.yml
mv freyja_result/${name}_freyja_demix.tsv \$PWD #freyha_demix.tsv is put into a folder before to give it to freyja aggregate
"""
Expand Down

0 comments on commit c02cdb3

Please sign in to comment.