Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // To run in Bioclipse groovy console write:
- // evaluate(ui.readFile("/Bioclipse_project_MM/makeSmilesFile.groovy"))
- dataIn = new java.net.URL("platform:/resource/Bioclipse_project_MM/solubilityData.csv")
- smilesIn = new java.net.URL("platform:/resource/Bioclipse_project_MM/solubilitySMILES.txt")
- def map = new java.util.HashMap();
- ( dataIn.openStream() ).eachLine { line ->
- sid = line.split(",")[0];
- sol = line.split(",")[7];
- if (map.containsKey(sid)) {
- print("Found " + sid + " twice");
- }
- map.put(sid, sol)
- }
- file = new File( ui.newFile("Bioclipse_project_MM/solubility.smi").getRawLocation().toString() )
- i = 0
- ( smilesIn.openStream() ).eachLine { line ->
- sid = line.split("\t")[0];
- SMILES = line.split("\t")[1];
- file << (SMILES + ", " + ( Double.parseDouble(map.get(sid)) / cdk.calculateMass(cdk.fromSMILES(SMILES) ) / 1000) + "\n");
- if ( ++i%100 == 0 ) {
- print(i + " Done. \n");
- }
- }
- print("All Done.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement