From: <ha...@us...> - 2013-01-28 08:55:23
|
Revision: 17888 http://jmol.svn.sourceforge.net/jmol/?rev=17888&view=rev Author: hansonr Date: 2013-01-28 08:55:13 +0000 (Mon, 28 Jan 2013) Log Message: ----------- ___JmolVersion="13.1.13_dev" new feature: load =xxx/ where xxx is a database code that can be set up in the future by a user. -- currently including mp MaterialsProject http://www.materialsproject.org/materials/%FILE/cif -- along with pdb, smiles, pubchem, ligand, nmr, and cactus Modified Paths: -------------- trunk/Jmol/src/org/jmol/viewer/Jmol.properties trunk/Jmol/src/org/jmol/viewer/JmolConstants.java trunk/Jmol/src/org/jmol/viewer/StateManager.java trunk/Jmol/src/org/jmol/viewer/Viewer.java Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2013-01-28 08:35:53 UTC (rev 17887) +++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2013-01-28 08:55:13 UTC (rev 17888) @@ -11,8 +11,9 @@ ___JmolVersion="13.1.13_dev" -new feature: load =xxx= where xxx is a database code that can be set up in the future by a user. - -- currently including =mp= MaterialsProject http://www.materialsproject.org/materials/%ID/cif +new feature: load =xxx/ where xxx is a database code that can be set up in the future by a user. + -- currently including mp MaterialsProject http://www.materialsproject.org/materials/%FILE/cif + -- along with pdb, smiles, pubchem, ligand, nmr, and cactus bug fix: The "show history" command is supposed to clear out the "show history" command itself, but only if it is a top-level command (from the console), Modified: trunk/Jmol/src/org/jmol/viewer/JmolConstants.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/JmolConstants.java 2013-01-28 08:35:53 UTC (rev 17887) +++ trunk/Jmol/src/org/jmol/viewer/JmolConstants.java 2013-01-28 08:55:13 UTC (rev 17888) @@ -1293,7 +1293,15 @@ // "@hetero", handled specially }; - public static String[] databases = { "mp", "http://www.materialsproject.org/materials/%ID/cif" }; + public static String[] databases = { + "cactus", "http://cactus.nci.nih.gov/chemical/structure/%FILE", + "ligand", "http://www.rcsb.org/pdb/files/ligand/%FILE.cif", + "mp", "http://www.materialsproject.org/materials/%FILE/cif", + "pdb", "http://www.rcsb.org/pdb/files/%FILE.pdb.gz", + "nmr", "http://www.nmrdb.org/predictor?smiles=", + "smiles", "http://cactus.nci.nih.gov/chemical/structure/%FILE/file?format=sdf&get3d=True", + "pubchem", "http://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/%FILE/SDF?record_type=3d" + }; public final static String MODELKIT_ZAP_STRING = "1 0 C 0 0"; public static final String MODELKIT_ZAP_TITLE = "Jmol Model Kit";//do not ever change this -- it is in the state Modified: trunk/Jmol/src/org/jmol/viewer/StateManager.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/StateManager.java 2013-01-28 08:35:53 UTC (rev 17887) +++ trunk/Jmol/src/org/jmol/viewer/StateManager.java 2013-01-28 08:55:13 UTC (rev 17888) @@ -685,8 +685,22 @@ useScriptQueue = g.useScriptQueue; useArcBall = g.useArcBall; databases = g.databases; + } + if (databases == null) { + databases = new Hashtable<String, String>(); + getDataBaseList(JmolConstants.databases); + loadFormat = databases.get("pdb"); + loadLigandFormat = databases.get("ligand"); + nmrUrlFormat = databases.get("nmr"); + smilesUrlFormat = databases.get("smiles"); + nihResolverFormat = databases.get("cactus"); + pubChemFormat = databases.get("pubchem"); + + // beyond these six, they are just in the form load =xxx/id + + getDataBaseList(userDatabases); } - + for (EnumCallback item : EnumCallback.values()) resetValue(item.name() + "Callback", g); @@ -1022,12 +1036,8 @@ boolean forceAutoBond = false; boolean fractionalRelative = false; // true: UNITCELL offset will change meaning of {1/2 1/2 1/2} char inlineNewlineChar = '|'; //pseudo static - String loadFormat = "http://www.rcsb.org/pdb/files/%FILE.pdb.gz"; - String loadLigandFormat = "http://www.rcsb.org/pdb/files/ligand/%FILE.cif"; - String nmrUrlFormat = "http://www.nmrdb.org/predictor?smiles="; - String smilesUrlFormat = "http://cactus.nci.nih.gov/chemical/structure/%FILE/file?format=sdf&get3d=True"; - String nihResolverFormat = "http://cactus.nci.nih.gov/chemical/structure/%FILE"; - String pubChemFormat = "http://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/%FILE/SDF?record_type=3d"; + String loadFormat, loadLigandFormat, nmrUrlFormat, smilesUrlFormat, nihResolverFormat, pubChemFormat; + String edsUrlFormat = "http://eds.bmc.uu.se/eds/dfs/%LC13/%LCFILE/%LCFILE.omap"; String edsUrlCutoff = "load('http://eds.bmc.uu.se/eds/dfs/%LC13/%LCFILE/%LCFILE.sfdat').lines.find('MAP_SIGMA').split(' ')[2]"; String edsUrlOptions = "within 2.0 {*}"; @@ -1738,15 +1748,10 @@ } public String resolveDataBase(String database, String id) { - if (databases == null) { - databases = new Hashtable<String, String>(); - getDataBaseList(JmolConstants.databases); - getDataBaseList(userDatabases); - } String format = databases.get(database.toLowerCase()); if (format == null) return null; - return TextFormat.formatStringS(format, "ID", id); + return (format.indexOf("%FILE") < 0 ? format + id : TextFormat.formatStringS(format, "FILE", id)); } private void getDataBaseList(String[] list) { Modified: trunk/Jmol/src/org/jmol/viewer/Viewer.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Viewer.java 2013-01-28 08:35:53 UTC (rev 17887) +++ trunk/Jmol/src/org/jmol/viewer/Viewer.java 2013-01-28 08:55:13 UTC (rev 17888) @@ -4933,10 +4933,10 @@ f = f.substring(1); type = '#'; } else - if (f.indexOf("=") > 0) { - // =xxxx=.... + if (f.indexOf("/") > 0) { + // =xxxx/.... try { - int pt = f.indexOf("="); + int pt = f.indexOf("/"); String database = f.substring(0, pt); f = global.resolveDataBase(database, f.substring(pt + 1)); return (f == null ? name : f); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |