cdkbook

ProteinFromSequence.groovy

Source code:

@Grab(group='org.openscience.cdk', module='cdk-bundle', version='2.8')

 import org.openscience.cdk.tools.*;
crambin = ProteinBuilderTool.createProtein(
  "TTCCPSIVARSNFNVCRLPGTPEA" +
  "ICATYTGCIIIPGATCPGDYAN"
);
println "Crambin has " + crambin.atomCount +
  " atoms."

Output:

Crambin has 327 atoms.