From: <ha...@us...> - 2010-07-11 22:22:51
|
Revision: 13551 http://jmol.svn.sourceforge.net/jmol/?rev=13551&view=rev Author: hansonr Date: 2010-07-11 22:22:43 +0000 (Sun, 11 Jul 2010) Log Message: ----------- version=12.0.RC25_dev # new feature: 3D-SEARCH /noStereo/ flag Modified Paths: -------------- trunk/Jmol/src/org/jmol/smiles/SmilesParser.java trunk/Jmol/src/org/jmol/smiles/SmilesSearch.java trunk/Jmol/src/org/jmol/smiles/package.html trunk/Jmol/src/org/jmol/viewer/Jmol.properties Modified: trunk/Jmol/src/org/jmol/smiles/SmilesParser.java =================================================================== --- trunk/Jmol/src/org/jmol/smiles/SmilesParser.java 2010-07-11 21:34:10 UTC (rev 13550) +++ trunk/Jmol/src/org/jmol/smiles/SmilesParser.java 2010-07-11 22:22:43 UTC (rev 13551) @@ -140,11 +140,14 @@ throw new InvalidSmilesException("SMILES expressions must not be null"); pattern = cleanPattern(pattern, isSmarts); boolean noAromatic = false; - if (isSmarts && pattern.startsWith("/")) { + boolean ignoreStereochemistry = false; + while (isSmarts && pattern.startsWith("/")) { String flags = getSubPattern(pattern, 0, '/').toUpperCase(); pattern = pattern.substring(flags.length()); if (flags.indexOf("NOAROMATIC") >= 0) noAromatic = true; + if (flags.indexOf("NOSTEREO") >= 0) + ignoreStereochemistry = true; } if (pattern.indexOf("$") >= 0) pattern = parseVariables(pattern); @@ -158,7 +161,7 @@ for (int i = 0; i < patterns.length; i++) { String key = "|" + patterns[i] + "|"; if (toDo.indexOf(key) < 0) { - search.subSearches[i] = getSearch(search, patterns[i], noAromatic); + search.subSearches[i] = getSearch(search, patterns[i], noAromatic, ignoreStereochemistry); toDo += key; } } @@ -166,7 +169,7 @@ Logger.info(toDo); return search; } - return getSearch(null, pattern, noAromatic); + return getSearch(null, pattern, noAromatic, ignoreStereochemistry); } private String parseVariableLength(String pattern) @@ -284,7 +287,10 @@ return (sout.length() < 2 ? pattern : sout.substring(2)); } - private SmilesSearch getSearch(SmilesSearch parent, String pattern, boolean noAromatic) throws InvalidSmilesException { + private SmilesSearch getSearch(SmilesSearch parent, String pattern, + boolean noAromatic, + boolean ignoreStereochemistry) + throws InvalidSmilesException { // First pass htMeasures = new Hashtable(); SmilesSearch molecule = new SmilesSearch(); @@ -292,6 +298,7 @@ molecule.isSmarts = isSmarts; molecule.pattern = pattern; molecule.noAromatic = noAromatic; + molecule.ignoreStereochemistry = ignoreStereochemistry; if (pattern.indexOf("$(") >= 0) pattern = parseNested(molecule, pattern); parseSmiles(molecule, pattern, null, false); @@ -317,9 +324,9 @@ throw new InvalidSmilesException("unbracketed atoms must be one of: " + SmilesAtom.UNBRACKETED_SET); } - + // set the searches now that we know what's a bioAtom and what's not - + if (isSmarts) { for (int i = molecule.atomCount; --i >= 0;) { SmilesAtom atom = molecule.patternAtoms[i]; @@ -329,11 +336,11 @@ String s = (String) o; if (s.charAt(0) != '~' && atom.bioType != '\0') s = "~" + atom.bioType + "~" + s; - SmilesSearch search = getSearch(molecule, s, noAromatic); + SmilesSearch search = getSearch(molecule, s, noAromatic, ignoreStereochemistry); if (search.atomCount > 0 && search.patternAtoms[0].selected) atom.selected = true; - molecule.setNested(atom.iNested, search); - } + molecule.setNested(atom.iNested, search); + } } } } Modified: trunk/Jmol/src/org/jmol/smiles/SmilesSearch.java =================================================================== --- trunk/Jmol/src/org/jmol/smiles/SmilesSearch.java 2010-07-11 21:34:10 UTC (rev 13550) +++ trunk/Jmol/src/org/jmol/smiles/SmilesSearch.java 2010-07-11 22:22:43 UTC (rev 13551) @@ -85,6 +85,7 @@ int ringDataMax = Integer.MIN_VALUE; Vector measures = new Vector(); boolean noAromatic; + boolean ignoreStereochemistry; StringBuffer ringSets; BitSet bsAromatic = new BitSet(); SmilesAtom lastChainAtom; @@ -574,7 +575,7 @@ // check stereochemistry - if (!checkStereochemistry()) + if (!ignoreStereochemistry && !checkStereochemistry()) return true; // set up the return BitSet and Vector, if requested Modified: trunk/Jmol/src/org/jmol/smiles/package.html =================================================================== --- trunk/Jmol/src/org/jmol/smiles/package.html 2010-07-11 21:34:10 UTC (rev 13550) +++ trunk/Jmol/src/org/jmol/smiles/package.html 2010-07-11 22:22:43 UTC (rev 13551) @@ -132,9 +132,9 @@ [CYS.SG#16//* 31:A *//]%84.[CYS.SG#16//* 21:A *//]%89.[CYS.SG#16//* 11:A *//]%83%87.[CYS.SG#16//* 38:A *//]%86. //* HOH *//[O] </pre> -</li><li>Jmol recognizes "/..../" at the beginning of a pattern as processing flags. "/noAromatic/", for example, -turns off all checks for aromaticity, speeding processing when that is not important or no distinction between -aromatic and nonaromatic atoms is desired. +</li><li>Jmol recognizes "/..../" at the beginning of a pattern as processing flags. The two flags noAromatic and noStereo are defined. +"/noAromatic/" turns off all checks for aromaticity, speeding processing when that is not important or no distinction between +aromatic and nonaromatic atoms is desired. "/noAromatic,noStereo/" indicates that in addition, no stereochemical checking should be done. </li> </ul> @@ -201,10 +201,12 @@ allows SMARTS searches to target specific ranges of values. <br /><br /> </li><li><b>processing flags</b> Jmol recognizes "/..../" at the beginning of a pattern as processing flags. -Currently the only flag supported is "noAromatic". This flag turns off all aromaticity checks. +Currently the only flags supported are "noAromatic" and "noStereo". "noAromatic" turns off all aromaticity checks. It may be desireable when no distinction between aromatic and nonaromatic atoms is desired. For large biomolecules /noAromatic/ can dramatically improve processing speed when no check for aromaticity is necessary. All atoms are then considered NOT aromatic. +"noStereo" turns off all stereochemical checking. + </li></ol> @@ -552,10 +554,14 @@ [smartDef] == [preface] [smartsSet] [preface] == { [flagDefs] [variableDefs] | [variableDefs] | NULL } - [flagDefs] == "/" [processingFlags] "/" - [processingFlags] == "noAromatic" (case-insensitive) + [flagDefs] == { [flagDef] || [flagDef] [flagDefs] } + [flagDef] == "/" [processingFlags] "/" + [processingFlags] == { [processingFlag] | [processingFlag] [processingFlags] } + [processingFlag] == { "noAromatic" | "noStereo" } (case-insensitive) # note: the noAromatic flag indicates to not distinguish between # aromatic/aliphatic searches -- "C" and "c" + # note: the noStereo flag turns off all stereochemical testing + # note: thus, both "/noAromatic//noStereo/" and "/noAromatic noStereo/" are valid [variableDefs] == [variableDef] | [variableDef] [variableDefs] [variableDef] == "$" [label] "=" "\"" [smarts] "\"" [comments] ";" [label] == [any characters other than "=" and "$", and not starting with "("] Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2010-07-11 21:34:10 UTC (rev 13550) +++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2010-07-11 22:22:43 UTC (rev 13551) @@ -3,6 +3,7 @@ version=12.0.RC25_dev +# new feature: 3D-SEARCH /noStereo/ flag # bug fix: SMARTS searching with || and measures can fail # new feature: plot PROPERTIES propertyX propertyY [propertyZ] [[min {x y z}] [max {x y z}]] # added min/max allows for truncation of data This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |