User 55ffa2f197
10-04-2012 01:37:41
Hi, I am processing a large smiles file. Some of the smiles are illegal in format. I am using following block to read the smiles file, but the program died with following error, is there a way to ignore the bad smiles and move on until it finishes the whole file
Error I am getting:
chemaxon.formats.MolFormatException at chemaxon.marvin.io.formats.smiles.SmilesImport.readMol0( at chemaxon.marvin.io.formats.smiles.SmilesImport.readMol( at chemaxon.marvin.io.formats.smiles.SmilesImport.readMol( at chemaxon.marvin.io.MRecordImporter.readStructure( at chemaxon.marvin.io.MRecordImporter.readMol( at chemaxon.marvin.io.MRecordImporter.readMol( at chemaxon.marvin.io.MRecordImporter.readMol0(
: Unmatched brackets in SMILES string *=**123(*456789SmilesImport.java:1029)SmilesImport.java:566)SmilesImport.java:526)MRecordImporter.java:764)MRecordImporter.java:709)MRecordImporter.java:678)MRecordImporter.java:593)
Code bloack for reading the smiles file
public void sssMapping( BufferedReader in ) {
String line;
String[] line2 = new String[2];
int count = 1;
try {
while((line=in.readLine())!=null){
line2 = line.split(",");
Molecule t = MolImporter.importMol(line2[1]);
t.aromatize();
ms.setTarget( t );
for ( Map.Entry<Integer, Molecule> entry : queryMol.entrySet() ){
Molecule q = ( Molecule ) entry.getValue();
int smarts_id = entry.getKey();
ms.setQuery( q );
int mc = ms.getMatchCount();
if ( mc > 0 ) {
System.out.println( line2[0] + '\t' + mc + '\t' + smarts_id );
}
}
System.err.println( "process " + count );
++count;
}
} catch (RuntimeException ioe){
} catch ( MolFormatException e ) {
e.printStackTrace();
} catch ( IOException e ) {
e.printStackTrace();
} catch ( SearchException e ){
e.printStackTrace();
} }