Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DataflowReadChannel clone(DataflowReadChannel channel) {
- // Tap
- new_ = Channel.create()
- tapped = channel.tap(new_)
- // Replace channel with tapped channel in script variables
- variables = Global.session.binding.getVariables()
- variables.each { variable, value ->
- if (value == channel) {
- variables[variable] = tapped
- }
- }
- // Return the other channel
- return new_
- }
- ///////////////
- // Input
- species = Channel
- .fromPath("$params.input/species.txt")
- .splitCsv(sep: "\t", header: true)
- .map { it + [proteome: Paths.get("$params.input/proteome.${it.shortName}.fasta")] }
- .mapWithIndex { i, species -> [id: i] + species }
- ////////////////////////////////////////////
- // Blast all vs all proteomes
- // TODO
- // createdb ---dbs--(tap)|--> blastp.onComplete( dbs --> deletedb )
- // --proteomes-----|
- // TODO do not consume cpus
- // TODO cancel run if pipeline cancels
- input = clone(species)
- .map { species -> [
- species.shortName,
- species.proteome,
- "${USER}_${workflow.runName}_$species.shortName"
- ]}
- process createDatabase {
- //module 'decypher'
- input:
- set speciesName, file(databaseFasta), databaseName from input
- output:
- set speciesName, databaseName into proteinDatabases
- """
- echo dc_run -parameters format_aa_into_aa -query $databaseFasta -database $databaseName -description "Temporary Cedalion database, auto-generated"
- """
- }
- input = clone(species)
- .map { [it.proteome, it.shortName] }
- .combine(clone(proteinDatabases))
- process allVsAllProteomes {
- //module 'decypher'
- input:
- set file(fasta), species, databaseSpecies, databaseName from input
- output:
- stdout into log1
- when:
- species != databaseSpecies
- script:
- """
- echo $fasta $databaseName
- """
- }
- log1.view()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement