Search in sources :

Example 1 with SmallMoleculeReference

use of org.vcell.pathway.SmallMoleculeReference in project vcell by virtualcell.

the class PathwayReaderBiopax3 method addObjectEntityReference.

private EntityReference addObjectEntityReference(Element element) {
    if (element.getChildren().size() == 0) {
        EntityReferenceProxy proxy = new EntityReferenceProxy();
        addAttributes(proxy, element);
        pathwayModel.add(proxy);
        return proxy;
    }
    for (Object child : element.getChildren()) {
        if (child instanceof Element) {
            Element childElement = (Element) child;
            if (childElement.getName().equals("DnaReference")) {
                DnaReference thingie = addObjectDnaReference(childElement);
                pathwayModel.add(thingie);
                return thingie;
            } else if (childElement.getName().equals("DnaRegionReference")) {
                DnaRegionReference thingie = addObjectDnaRegionReference(childElement);
                pathwayModel.add(thingie);
                return thingie;
            } else if (childElement.getName().equals("ProteinReference")) {
                ProteinReference thingie = addObjectProteinReference(childElement);
                pathwayModel.add(thingie);
                return thingie;
            } else if (childElement.getName().equals("RnaReference")) {
                RnaReference thingie = addObjectRnaReference(childElement);
                pathwayModel.add(thingie);
                return thingie;
            } else if (childElement.getName().equals("RnaRegionReference")) {
                RnaRegionReference thingie = addObjectRnaRegionReference(childElement);
                pathwayModel.add(thingie);
                return thingie;
            } else if (childElement.getName().equals("SmallMoleculeReference")) {
                SmallMoleculeReference thingie = addObjectSmallMoleculeReference(childElement);
                pathwayModel.add(thingie);
                return thingie;
            }
        }
    }
    EntityReference entityReference = new EntityReference();
    addAttributes(entityReference, element);
    for (Object child : element.getChildren()) {
        if (child instanceof Element) {
            Element childElement = (Element) child;
            if (!addContentEntityReference(entityReference, element, childElement)) {
                // to self ??
                showUnexpected(childElement);
            }
        }
    }
    pathwayModel.add(entityReference);
    return entityReference;
}
Also used : DnaReference(org.vcell.pathway.DnaReference) DnaRegionReference(org.vcell.pathway.DnaRegionReference) Element(org.jdom.Element) EntityReference(org.vcell.pathway.EntityReference) EntityReferenceProxy(org.vcell.pathway.persistence.BiopaxProxy.EntityReferenceProxy) GroupObject(org.vcell.pathway.GroupObject) BioPaxObject(org.vcell.pathway.BioPaxObject) ProteinReference(org.vcell.pathway.ProteinReference) RnaReference(org.vcell.pathway.RnaReference) RnaRegionReference(org.vcell.pathway.RnaRegionReference) SmallMoleculeReference(org.vcell.pathway.SmallMoleculeReference)

Example 2 with SmallMoleculeReference

use of org.vcell.pathway.SmallMoleculeReference in project vcell by virtualcell.

the class PathwayReaderBiopax3 method addObjectSmallMoleculeReference.

private SmallMoleculeReference addObjectSmallMoleculeReference(Element element) {
    SmallMoleculeReference smallMoleculeReference = new SmallMoleculeReference();
    addAttributes(smallMoleculeReference, element);
    for (Object child : element.getChildren()) {
        if (child instanceof Element) {
            Element childElement = (Element) child;
            if (!addContentSmallMoleculeReference(smallMoleculeReference, element, childElement)) {
                showUnexpected(childElement);
            }
        }
    }
    pathwayModel.add(smallMoleculeReference);
    return smallMoleculeReference;
}
Also used : Element(org.jdom.Element) GroupObject(org.vcell.pathway.GroupObject) BioPaxObject(org.vcell.pathway.BioPaxObject) SmallMoleculeReference(org.vcell.pathway.SmallMoleculeReference)

Example 3 with SmallMoleculeReference

use of org.vcell.pathway.SmallMoleculeReference in project vcell by virtualcell.

the class PathwayProducerBiopax3 method addContentSmallMoleculeReference.

// chemicalFormula 	String 				single
// molecularWeight 	Float 				single
// structure 			ChemicalStructure 	single
private Element addContentSmallMoleculeReference(BioPaxObject bpObject, Element element) {
    element = addContentEntityReference(bpObject, element);
    SmallMoleculeReference ob = (SmallMoleculeReference) bpObject;
    Element tmpElement = null;
    if (ob.getChemicalFormula() != null && ob.getChemicalFormula().length() > 0) {
        tmpElement = new Element("chemicalFormula", bp);
        tmpElement.setAttribute("datatype", schemaString, rdf);
        tmpElement.setText(ob.getChemicalFormula());
        element.addContent(tmpElement);
    }
    if (ob.getMolecularWeight() != null) {
        tmpElement = new Element("molecularWeight", bp);
        tmpElement.setAttribute("datatype", schemaDouble, rdf);
        tmpElement.setText(ob.getMolecularWeight().toString());
        element.addContent(tmpElement);
    }
    if (ob.getStructure() != null) {
        tmpElement = new Element("structure", bp);
        addIDToProperty(tmpElement, ob.getStructure());
        mustPrintObject(ob.getStructure());
        element.addContent(tmpElement);
    }
    return element;
}
Also used : Element(org.jdom.Element) SmallMoleculeReference(org.vcell.pathway.SmallMoleculeReference)

Example 4 with SmallMoleculeReference

use of org.vcell.pathway.SmallMoleculeReference in project vcell by virtualcell.

the class PathwayReader method addObjectSmallMoleculeReference.

private SmallMoleculeReference addObjectSmallMoleculeReference(Element element) {
    SmallMoleculeReference smallMoleculeReference = new SmallMoleculeReference();
    addAttributes(smallMoleculeReference, element);
    for (Object child : element.getChildren()) {
        if (child instanceof Element) {
            Element childElement = (Element) child;
            if (!addContentSmallMoleculeReference(smallMoleculeReference, element, childElement)) {
                showUnexpected(childElement, smallMoleculeReference);
            }
        }
    }
    pathwayModel.add(smallMoleculeReference);
    return smallMoleculeReference;
}
Also used : Element(org.jdom.Element) BioPaxObject(org.vcell.pathway.BioPaxObject) SmallMoleculeReference(org.vcell.pathway.SmallMoleculeReference)

Aggregations

Element (org.jdom.Element)4 SmallMoleculeReference (org.vcell.pathway.SmallMoleculeReference)4 BioPaxObject (org.vcell.pathway.BioPaxObject)3 GroupObject (org.vcell.pathway.GroupObject)2 DnaReference (org.vcell.pathway.DnaReference)1 DnaRegionReference (org.vcell.pathway.DnaRegionReference)1 EntityReference (org.vcell.pathway.EntityReference)1 ProteinReference (org.vcell.pathway.ProteinReference)1 RnaReference (org.vcell.pathway.RnaReference)1 RnaRegionReference (org.vcell.pathway.RnaRegionReference)1 EntityReferenceProxy (org.vcell.pathway.persistence.BiopaxProxy.EntityReferenceProxy)1