Skip to content

Instantly share code, notes, and snippets.

@pditommaso
Forked from egonw/demo.nf
Last active April 21, 2019 09:32
Show Gist options
  • Save pditommaso/77847724c877a70ebe0dcf33b1175ef0 to your computer and use it in GitHub Desktop.
Save pditommaso/77847724c877a70ebe0dcf33b1175ef0 to your computer and use it in GitHub Desktop.
Using Bioclipse in Nextflow.
#!/usr/bin/env nextflow
@Grab(group='net.bioclipse.bacting', module='managers-cdk', version='0.0.3')
import net.bioclipse.managers.CDKManager
params.str = "./data.tsv"
params.size = 5000
process splitWikidata {
input:
file str from Channel.fromPath(params.str)
output:
file 'chunk_*' into smiChunks
"""
cat $str | tail -n +2 | split -l ${params.size} - chunk_
"""
}
process checkSMILES {
input:
val x from smiChunks
output:
stdout results
exec:
def cdk = new CDKManager(".");
new File(x).readLines().each {
def fields = it.split()
try {
// println "x: " + fields[1]
cdk.fromSMILES(fields[1])
} catch (Exception exc) {
println fields[0] + ": " + exc.message
}
}
}
results.subscribe {
println it
}
@pditommaso
Copy link
Author

My fault. The input should be declared as:

  input: 
  val x from smiChunks.flatten()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment