-
Notifications
You must be signed in to change notification settings - Fork 0
/
printJPlogP.nf
55 lines (39 loc) · 1.55 KB
/
printJPlogP.nf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env nextflow
@Grab(group='io.github.egonw.bacting', module='managers-cdk', version='0.0.9')
@Grab(group='org.openscience.cdk', module='cdk-qsarmolecular', version='2.3')
import net.bioclipse.managers.CDKManager
import org.openscience.cdk.qsar.descriptors.molecular.JPlogPDescriptor
import org.openscience.cdk.interfaces.IAtomContainer
Channel
.fromPath("./query_result.tsv")
.splitCsv(header: ['wikidata', 'smiles' , 'isoSmiles'], sep:'\t')
.map{ row -> tuple(row.wikidata, row.smiles, row.isoSmiles) }
.set { molecules_ch }
process printJPlogP {
input:
set wikidata, smiles, isoSmiles from molecules_ch
/* maxForks 1 */
exec:
println "Running.."
if (smiles != null){
cdk = new CDKManager(".");
try {
molecule = cdk.fromSMILES(smiles)
descriptor = new JPlogPDescriptor()
jplogp = descriptor.calculate(molecule.getAtomContainer()).value.toString()
println "$molecule has JPLogP : " + jplogp
} catch (Exception exc) {
println "Error in parsing this SMILE $smiles"
}
}else {
cdk = new CDKManager(".");
try {
molecule = cdk.fromSMILES(isoSmiles)
descriptor = new JPlogPDescriptor()
jplogp = descriptor.calculate(molecule.getAtomContainer()).value.toString()
println "$molecule has JPLogP : " + jplogp
} catch (Exception exc) {
println "Error in parsing this isoSMILE $isoSmiles"
}
}
}