Skip to content

Instantly share code, notes, and snippets.

@egonw
Created April 20, 2019 17:48
Show Gist options
  • Save egonw/653bf2e42f306a9e8b9e16775d29f378 to your computer and use it in GitHub Desktop.
Save egonw/653bf2e42f306a9e8b9e16775d29f378 to your computer and use it in GitHub Desktop.
Using Bioclipse in Nextflow.
#!/usr/bin/env nextflow
params.str = file("./data.tsv")
params.size = 5000
process splitWikidata {
output:
file 'chunk_*' into smiChunks
"""
cat '${params.str}' | tail -n +2 | split -l ${params.size} - chunk_
"""
}
process checkSMILES {
input:
each x from smiChunks
output:
stdout results
script:
"""
#!/usr/bin/env groovy
@Grab(group='net.bioclipse.bacting', module='managers-cdk', version='0.0.3')
def cdk = new net.bioclipse.managers.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
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment