Skip to content

Instantly share code, notes, and snippets.

@egonw
Created February 20, 2009 13:52
Show Gist options
  • Select an option

  • Save egonw/67462 to your computer and use it in GitHub Desktop.

Select an option

Save egonw/67462 to your computer and use it in GitHub Desktop.
// search and download entries from PubChem
var query = "aspirin";
var searchResults = pubchem.search(query);
var max = Math.min(15, searchResults.size());
for (i=0; i<max; i++) {
var cid = searchResults.get(i);
var filename = "/Virtual/" + query.replace(" ", "") + "." + cid + ".xml";
var filename3d = "/Virtual/" + query.replace(" ", "") + "." + cid + ".mol";
js.print("downloading CID " + cid + "...\n");
pubchem.loadCompound(cid, filename);
pubchem.loadCompound3d(cid, filename3d);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment