Skip to content

Commit

Permalink
Add collapse lineages feature, dependent on min demix depth
Browse files Browse the repository at this point in the history
Sublineages may be collapsed to parent if insufficient depth
covering lineage-defining mutations to differentiate. Samples
that passed previously may fail depending on how coverage and
updated barcode align.

Similar to issue:
andersen-lab/Freyja#137

Fixed by pr:
andersen-lab/Freyja#145

Further explanation:
andersen-lab/Freyja#167
  • Loading branch information
Jessica Caleta - Genomics Liaison Technical Officer - NML/BCCDC committed Oct 18, 2023
1 parent 830f5ef commit 4c09101
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions modules/effluent.nf
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -63,44 +63,45 @@ process lineage_freyja {


tag "Calculating relative viral lineage abundances from ${sample_id} with Freyja" tag "Calculating relative viral lineage abundances from ${sample_id} with Freyja"
publishDir "${params.out_dir}/freyja_individual_lineage_summaries", mode: 'copy' publishDir "${params.out_dir}/freyja_individual_lineage_summaries", mode: 'copy'
errorStrategy { sample_id.toLowerCase() =~ /neg/ ? 'ignore' : 'terminate' }


input: input:
tuple val(sample_id), path(depths), path(vcf) tuple val(sample_id), path(depths), path(vcf)


output: output:
tuple val(sample_id), file("*.tsv") tuple val(sample_id), file("*.tsv"), file("*.yml")


""" """
freyja demix\ freyja demix\
--depthcutoff ${params.demixdepth} \
--output ${sample_id}_freyja_lineage_summary.tsv \
${vcf} \ ${vcf} \
${depths} \ ${depths}
--output ${sample_id}_freyja_lineage_summary.tsv
""" """
//freyja demix --version > "${params.out_dir}/freyja_overall_lineage_summary/barcode_version.log"
} }


process bootstrap_freyja { process bootstrap_freyja {


tag "Bootstrapping lineage prevalences from ${sample_id} with Freyja" tag "Bootstrapping lineage prevalences from ${sample_id} with Freyja"
publishDir "${params.out_dir}/freyja_individual_bootstrapped_lineages", mode: 'copy' publishDir "${params.out_dir}/freyja_individual_bootstrapped_lineages", mode: 'copy'
errorStrategy { sample_id.toLowerCase() =~ /neg/ ? 'ignore' : 'terminate' }


input: input:
tuple val(sample_id), path(depths), path(vcf) tuple val(sample_id), path(depths), path(vcf)


output: output:
tuple val(sample_id), file("*_lineages.csv"), file("*_summarized.csv") tuple val(sample_id), file("*_lineages.csv"), file("*_summarized.csv"), file("*_lineages.yml")

when:
params.boot==true


""" """
freyja boot \ freyja boot \
${vcf} \ ${vcf} \
${depths} \ ${depths} \
--nt ${task.cpus} \ --nt ${task.cpus} \
--nb ${params.bootnum} \ --nb ${params.bootnum} \
--output_base ${sample_id}_boot --output_base ${sample_id}_boot \
--depthcutoff ${params.demixdepth}
""" """


Expand Down Expand Up @@ -252,7 +253,7 @@ workflow EFFLUENT {
bootstrap_freyja(read_depths.out bootstrap_freyja(read_depths.out
.filter { it[1].size()>0 } .filter { it[1].size()>0 }
.join(freeb_vcf_ch .join(freeb_vcf_ch
.filter { it[1].size()>0 })) .filter { it[1].size()>0 }))
} }


}else { }else {
Expand All @@ -273,7 +274,7 @@ workflow EFFLUENT {
} }




lineage_ch = lineage_freyja.out lineage_ch = lineage_freyja.out.view()


lineage_ch.collect() | summarize_freyja lineage_ch.collect() | summarize_freyja


Expand Down

0 comments on commit 4c09101

Please sign in to comment.