--- a +++ b/cdk-qa/trunk/projects/080813-00001/extractZINCmol2AtomTypes.bsh @@ -0,0 +1,33 @@ +#!/usr/bin/bsh + +import java.io.File; +import java.io.FileReader; +import java.io.BufferedReader; + +File file = new File("10_p0.1.mol2"); +BufferedReader reader = new BufferedReader( + new FileReader(file) +); +String line = reader.readLine(); +boolean inAtomBlock = false; +int counter = 0; +while (line != null && counter <= 1000) { + if (line.startsWith("ZINC")) { + print(line); + } else if (line.startsWith("@<TRIPOS>ATOM")) { + inAtomBlock = true; + line = reader.readLine(); + counter++; + } else if (line.startsWith("@<TRIPOS>BOND")) { + inAtomBlock = false; + } + if (inAtomBlock) { + String atomtype = line.substring(47,53).trim(); + if (atomtype.endsWith(".ar")) { + print(atomtype.substring(0,atomtype.indexOf(".ar"))+".2"); + } else { + print(atomtype); + } + } + line = reader.readLine(); +}