Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#1263 Pseudo Atom Labels Expect a Number

master
closed
nobody
1
2012-12-02
2012-10-18
John May
No

When writing pseudo atoms with MDLV2000Writer the writer expects all pseudo atom labels to be of the form 'R1', 'R2' etc. which results in a NumberFormatException if the label is not of this type.

The issue can be seen in this snippet:

if(container.getAtom(f) instanceof IPseudoAtom){
    // an R group is written as R#
    IPseudoAtom pseudoAtom = (IPseudoAtom) container.getAtom(f);
    if (pseudoAtom.getSymbol().equals("R") && pseudoAtom.getLabel().length()>1) {
        line += "R# ";
        if (rgroupList==null) {
            rgroupList = new ArrayList<Integer>();
        }
        Integer rGroupNumber = new Integer(pseudoAtom.getLabel().substring(1)); 
        rgroupList.add(f+1); 
        rgroupList.add(rGroupNumber);
    }
    else
        line 
          += formatMDLString(((IPseudoAtom) container.getAtom(f)).getLabel(), 3);
    }
}

Discussion

  • John May
    John May
    2012-10-18

    [ignore] Does this get posted on the tracker..??

    On 18 Oct 2012, at 12:01, "John May" jwmay@users.sf.net wrote:

    (ignore) final test for explicit filtering..

    bugs:1263 Pseudo Atom Labels Expect a Number

    Status: open Labels: IO MDLV2000Writer Mol Created: Thu Oct 18, 2012 08:45 AM UTC by John May Last Updated: Thu Oct 18, 2012 10:54 AM UTC Owner: nobody

    When writing pseudo atoms with MDLV2000Writer the writer expects all pseudo atom labels to be of the form 'R1', 'R2' etc. which results in a NumberFormatException if the label is not of this type.

    The issue can be seen in this snippet:

    if(container.getAtom(f) instanceof IPseudoAtom){
    // an R group is written as R#
    IPseudoAtom pseudoAtom = (IPseudoAtom) container.getAtom(f);
    if (pseudoAtom.getSymbol().equals("R") && pseudoAtom.getLabel().length()>1) {
    line += "R# ";
    if (rgroupList==null) {
    rgroupList = new ArrayList<Integer>();
    }
    Integer rGroupNumber = new Integer(pseudoAtom.getLabel().substring(1));
    rgroupList.add(f+1);
    rgroupList.add(rGroupNumber);
    }
    else
    line
    += formatMDLString(((IPseudoAtom) container.getAtom(f)).getLabel(), 3);
    }
    }
    Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/cdk/bugs/1263/

    To unsubscribe from further messages, please visit https://sourceforge.net/auth/prefs/

     
    • status: open --> closed
     
  • Patch was applied to master.