Skip to content

Commit

Permalink
Line separator fix for RGroup writer
Browse files Browse the repository at this point in the history
Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>
  • Loading branch information
Mark Rijnbeek authored and egonw committed Apr 22, 2010
1 parent 4fc4837 commit ad706cc
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/main/org/openscience/cdk/io/RGroupQueryWriter.java
Expand Up @@ -125,7 +125,7 @@ private String getCTAB (IAtomContainer atomContainer) throws CDKException {
String ctab = strWriter.toString();
//strip of the individual header, as we have one super header instead.
for (int line=1; line <=3; line++ ){
ctab = ctab.substring(ctab.indexOf(LSEP)+1);
ctab = ctab.substring(ctab.indexOf(LSEP)+(LSEP.length()));
}
return ctab;
}
Expand Down Expand Up @@ -175,17 +175,17 @@ public void write(IChemObject object) throws CDKException {
StringBuffer rootBlock=new StringBuffer();
String header =
"$MDL REV 1 "+now+LSEP+
"$MOL\n" +
"$HDR\n" +
" Rgroup query file (RGFile)\n"+
" CDK "+now+"2D\n\n"+
"$END HDR\n"+
"$MOL"+LSEP+
"$HDR"+LSEP+
" Rgroup query file (RGFile)"+LSEP+
" CDK "+now+"2D"+LSEP+LSEP+
"$END HDR"+LSEP+
"$CTAB";
rootBlock.append(header).append(LSEP);

//Construct the root structure, the scaffold
String rootCTAB = getCTAB(rootAtc);
rootCTAB = rootCTAB.replaceAll("\nM END\n","");
rootCTAB = rootCTAB.replaceAll(LSEP+"M END"+LSEP,"");
rootBlock.append(rootCTAB).append(LSEP);

//Write the root's LOG lines
Expand Down Expand Up @@ -315,7 +315,7 @@ public void write(IChemObject object) throws CDKException {

} catch (IOException e) {
e.printStackTrace();
throw new CDKException("Unexpected excpetion when writing RGFile.\n"+e.getMessage());
throw new CDKException("Unexpected exception when writing RGFile"+LSEP+e.getMessage());
}

}
Expand Down

0 comments on commit ad706cc

Please sign in to comment.