(Cross posted to OpenBabel-discuss and BlueObelisk-discuss)
A discussion has started in the OpenBabel list about comments in SMILES. Currently, the SMILES spec has no provision for comments, but some implementations allow them. For example, OpenBabel will silently ignore any line that starts with a non-SMILES character such as a space. Here is what I wrote in response to a comment by Chris Morley:
> a) The facility to have comment lines in SMILES files seems
> *very* useful and it would be a great shame to lose it.
That's very true, and perhaps we should add something to the OpenSMILES specification. Perhaps something like starting a line with '#' or '//', like so many other languages. Or even starting a line with whitespace -- it doesn't matter, as long as it's formally specified.
As we used to say in my electrical engineering days: "The great thing about standards is that there are so many to choose from!" In other words, a standard isn't any good unless we all follow it. If OpenBabel treats these lines as comments, it will produce files that other parsers can't read.
Just to illustrate: Suppose someone else said, "I'm going to skip whitespace that starts a line, and parse SMILES starting at the first non-whitespace character." In other words, they'd parse indented SMILES. This isn't hypothetical, I've seen people do this. They would try to parse the lines that you think are comments, so this file:
| This is a comment about
| CCO, the ethanol molecule, not to be mistaken with the
| CO methanol molecule.
would be interpreted by OpenBabel as one SMILES, and by the other guys as three SMILES and one error.
So my proposal is to say that any line that starts with '#', '/', or ' ' (space) should be treated as a comment line, and should be ignored completely when processing the file, except that it may be copied to the output if a program's output format supports comments.
Hey what a brilliant post I have come across and believe me I have been searching out for this similar kind of post for past a week and hardly came across this. Thank you very much and will look for more postings from you.
mol SMILES is a superset of OpenSMILES, allowing a freer format, ..... Using comments and white space to correlate a SMILES string with a 3D structure. ..... For example, the Jmol command LOAD files “$caffeine” “:caffeine” ...
Thank you for your post. I have read through some similar topics! However, your article gave me a very special impression, unlike other articles. I hope you continue to have valuable posts like this or more to share with everyone!geometry dash