Skip to content

Commit

Permalink
Merge pull request #75 from sanger-tol/basal_lineage
Browse files Browse the repository at this point in the history
Basal lineage configuration
  • Loading branch information
priyanka-surana authored Jul 1, 2023
2 parents c7d183d + 5011a18 commit 5412568
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
9 changes: 3 additions & 6 deletions modules/local/blobtoolkit/extractbuscos.nf
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ process BLOBTOOLKIT_EXTRACTBUSCOS {

input:
tuple val(meta), path(fasta)
tuple val(meta1), path(seq1, stageAs: "lineage1/*")
tuple val(meta2), path(seq2, stageAs: "lineage2/*")
tuple val(meta3), path(seq3, stageAs: "lineage3/*")
tuple val(metaseq), path(seq, stageAs: "lineage??/*")

output:
tuple val(meta), path("*_buscogenes.fasta"), emit: genes
Expand All @@ -23,11 +21,10 @@ process BLOBTOOLKIT_EXTRACTBUSCOS {
script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def seq_args = seq.collect { "--busco " + it } .join(' ')
"""
btk pipeline extract-busco-genes \\
--busco $seq1 \\
--busco $seq2 \\
--busco $seq3 \\
$seq_args \\
--out ${prefix}_buscogenes.fasta
cat <<-END_VERSIONS > versions.yml
Expand Down
27 changes: 14 additions & 13 deletions subworkflows/local/busco_diamond_blastp.nf
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@ workflow BUSCO_DIAMOND {
GOAT_TAXONSEARCH.out.taxonsearch
| map { meta, csv -> csv.splitCsv(header:true, sep:'\t', strip:true) }
| map { row -> row.odb10_lineage.findAll { it != "" } }
| map { lineages -> [ lineages + [ "bacteria_odb10", "archaea_odb10" ] ] }
| set { ch_ancestral_lineages }


// Add the basal lineages to the list (excluding duplicates)
basal_lineages = [ "archaea_odb10", "bacteria_odb10", "eukaryota_odb10" ]
ch_ancestral_lineages
| map { lineages -> (lineages + basal_lineages).unique() }
| flatten ()
| set { ch_lineages }

Expand All @@ -47,18 +53,13 @@ workflow BUSCO_DIAMOND {
// Select input for BLOBTOOLKIT_EXTRACTBUSCOS
//
BUSCO.out.seq_dir
| map { meta, seq -> [ [ "id": seq.parent.baseName ], seq ] }
| branch {
meta, seq ->
archaea : meta.id == "run_archaea_odb10"
bacteria : meta.id == "run_bacteria_odb10"
eukaryota : meta.id == "run_eukaryota_odb10"
}
| set { ch_busco }


// Extract BUSCO genes from the 3 kingdoms
BLOBTOOLKIT_EXTRACTBUSCOS ( fasta, ch_busco.archaea, ch_busco.bacteria, ch_busco.eukaryota )
| filter { meta, seq -> basal_lineages.contains(seq.parent.baseName.minus("run_")) }
| groupTuple()
| set { ch_basal_buscos }


// Extract BUSCO genes from the basal lineages
BLOBTOOLKIT_EXTRACTBUSCOS ( fasta, ch_basal_buscos )
ch_versions = ch_versions.mix ( BLOBTOOLKIT_EXTRACTBUSCOS.out.versions.first() )


Expand Down

0 comments on commit 5412568

Please sign in to comment.