SHARE
TWEET

Untitled

a guest Apr 15th, 2017 3 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. DataflowReadChannel clone(DataflowReadChannel channel) {
  2.     // Tap
  3.     new_ = Channel.create()
  4.     tapped = channel.tap(new_)
  5.  
  6.     // Replace channel with tapped channel in script variables
  7.     variables = Global.session.binding.getVariables()
  8.     variables.each { variable, value ->
  9.         if (value == channel) {
  10.             variables[variable] = tapped
  11.         }
  12.     }
  13.  
  14.     // Return the other channel
  15.     return new_
  16. }
  17.  
  18. ///////////////
  19. // Input
  20. species = Channel
  21.     .fromPath("$params.input/species.txt")
  22.     .splitCsv(sep: "\t", header: true)
  23.     .map { it + [proteome: Paths.get("$params.input/proteome.${it.shortName}.fasta")] }
  24.     .mapWithIndex { i, species -> [id: i] + species }
  25.  
  26.  
  27. ////////////////////////////////////////////
  28. // Blast all vs all proteomes
  29.  
  30. // TODO
  31. // createdb ---dbs--(tap)|--> blastp.onComplete( dbs --> deletedb )
  32. //       --proteomes-----|
  33.  
  34. // TODO do not consume cpus
  35. // TODO cancel run if pipeline cancels
  36. input = clone(species)
  37.     .map { species -> [
  38.         species.shortName,
  39.         species.proteome,
  40.         "${USER}_${workflow.runName}_$species.shortName"
  41.     ]}
  42. process createDatabase {
  43.     //module 'decypher'
  44.  
  45.     input:
  46.     set speciesName, file(databaseFasta), databaseName from input
  47.  
  48.     output:
  49.     set speciesName, databaseName into proteinDatabases
  50.  
  51.     """
  52.    echo dc_run -parameters format_aa_into_aa -query $databaseFasta -database $databaseName -description "Temporary Cedalion database, auto-generated"
  53.    """
  54. }
  55.  
  56. input = clone(species)
  57.     .map { [it.proteome, it.shortName] }
  58.     .combine(clone(proteinDatabases))
  59. process allVsAllProteomes {
  60.     //module 'decypher'
  61.  
  62.     input:
  63.     set file(fasta), species, databaseSpecies, databaseName from input
  64.  
  65.     output:
  66.     stdout into log1
  67.  
  68.     when:
  69.     species != databaseSpecies
  70.  
  71.     script:
  72.     """
  73.    echo $fasta $databaseName
  74.    """
  75. }
  76. log1.view()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top