Search in sources :

Example 6 with RnaRegionReference

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

the class PathwayReaderBiopax3 method addObjectRnaRegionReference.

private RnaRegionReference addObjectRnaRegionReference(Element element) {
    if (element.getChildren().size() == 0) {
        RnaRegionReferenceProxy proxy = new RnaRegionReferenceProxy();
        addAttributes(proxy, element);
        pathwayModel.add(proxy);
        return proxy;
    }
    RnaRegionReference rnaRegionReference = new RnaRegionReference();
    addAttributes(rnaRegionReference, element);
    for (Object child : element.getChildren()) {
        if (child instanceof Element) {
            Element childElement = (Element) child;
            if (!addContentRnaRegionReference(rnaRegionReference, element, childElement)) {
                showUnexpected(childElement);
            }
        }
    }
    pathwayModel.add(rnaRegionReference);
    return rnaRegionReference;
}
Also used : Element(org.jdom.Element) RnaRegionReferenceProxy(org.vcell.pathway.persistence.BiopaxProxy.RnaRegionReferenceProxy) GroupObject(org.vcell.pathway.GroupObject) BioPaxObject(org.vcell.pathway.BioPaxObject) RnaRegionReference(org.vcell.pathway.RnaRegionReference)

Example 7 with RnaRegionReference

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

the class PathwayReaderBiopax3 method addContentDnaReference.

private boolean addContentDnaReference(DnaReference dnaReference, Element element, Element childElement) {
    if (addContentEntityReference(dnaReference, element, childElement)) {
        return true;
    }
    /**
     * ArrayList<DnaRegionReference> subRegion
     * BioSource organism
     * ArrayList<RnaRegionReference> subRegion
     * String sequence
     */
    if (childElement.getName().equals("organism")) {
        dnaReference.setOrganism(addObjectBioSource(childElement));
        return true;
    } else if (childElement.getName().equals("dnaSubRegion")) {
        // obsolete
        dnaReference.getDnaSubRegion().add(addObjectDnaRegionReference(childElement));
        return true;
    } else if (childElement.getName().equals("rnaSubRegion")) {
        // obsolete
        dnaReference.getRnaSubRegion().add(addObjectRnaRegionReference(childElement));
        return true;
    } else if (childElement.getName().equals("sequence")) {
        dnaReference.setSequence(childElement.getTextTrim());
        return true;
    } else if (childElement.getName().equals("subRegion")) {
        if (childElement.getChildren().size() == 0) {
            // if there are no children it must be a resource inside another object
            // we don't know yet whether it's DnaRegionReference or RnaRegionReference, we make a proxy for each
            // at the time when we solve the references we'll find out which is fake
            DnaRegionReference dReg = new DnaRegionReferenceProxy();
            addAttributes(dReg, childElement);
            pathwayModel.add(dReg);
            dnaReference.getDnaSubRegion().add(dReg);
            RnaRegionReference rReg = new RnaRegionReferenceProxy();
            addAttributes(rReg, childElement);
            pathwayModel.add(rReg);
            dnaReference.getRnaSubRegion().add(rReg);
            return true;
        } else {
            // it's the real object declaration - we ignore this situation for now
            showIgnored(childElement, "Found NESTED child.");
            return false;
        }
    } else {
        // no match
        return false;
    }
}
Also used : DnaRegionReferenceProxy(org.vcell.pathway.persistence.BiopaxProxy.DnaRegionReferenceProxy) DnaRegionReference(org.vcell.pathway.DnaRegionReference) RnaRegionReferenceProxy(org.vcell.pathway.persistence.BiopaxProxy.RnaRegionReferenceProxy) RnaRegionReference(org.vcell.pathway.RnaRegionReference)

Example 8 with RnaRegionReference

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

the class PathwayProducerBiopax3 method addContentDnaReference.

// subRegion 	DnaRegionReference 	multiple
// subRegion 	RnaRegionReference 	multiple
// sequence 	String 				single
// organism 	BioSource 			single
private Element addContentDnaReference(BioPaxObject bpObject, Element element) {
    element = addContentEntityReference(bpObject, element);
    DnaReference ob = (DnaReference) bpObject;
    Element tmpElement = null;
    if (ob.getDnaSubRegion() != null && ob.getDnaSubRegion().size() > 0) {
        List<DnaRegionReference> list = ob.getDnaSubRegion();
        for (DnaRegionReference item : list) {
            tmpElement = new Element("subRegion", bp);
            addIDToProperty(tmpElement, item);
            mustPrintObject(item);
            element.addContent(tmpElement);
        }
    }
    if (ob.getRnaSubRegion() != null && ob.getRnaSubRegion().size() > 0) {
        List<RnaRegionReference> list = ob.getRnaSubRegion();
        for (RnaRegionReference item : list) {
            tmpElement = new Element("subRegion", bp);
            addIDToProperty(tmpElement, item);
            mustPrintObject(item);
            element.addContent(tmpElement);
        }
    }
    if (ob.getSequence() != null && ob.getSequence().length() > 0) {
        tmpElement = new Element("sequence", bp);
        tmpElement.setAttribute("datatype", schemaString, rdf);
        tmpElement.setText(ob.getSequence());
        element.addContent(tmpElement);
    }
    if (ob.getOrganism() != null) {
        tmpElement = new Element("organism", bp);
        addIDToProperty(tmpElement, ob.getOrganism());
        mustPrintObject(ob.getOrganism());
        element.addContent(tmpElement);
    }
    return element;
}
Also used : DnaReference(org.vcell.pathway.DnaReference) DnaRegionReference(org.vcell.pathway.DnaRegionReference) Element(org.jdom.Element) RnaRegionReference(org.vcell.pathway.RnaRegionReference)

Aggregations

RnaRegionReference (org.vcell.pathway.RnaRegionReference)8 Element (org.jdom.Element)7 DnaRegionReference (org.vcell.pathway.DnaRegionReference)6 BioPaxObject (org.vcell.pathway.BioPaxObject)3 DnaReference (org.vcell.pathway.DnaReference)2 GroupObject (org.vcell.pathway.GroupObject)2 RnaReference (org.vcell.pathway.RnaReference)2 RnaRegionReferenceProxy (org.vcell.pathway.persistence.BiopaxProxy.RnaRegionReferenceProxy)2 EntityReference (org.vcell.pathway.EntityReference)1 ProteinReference (org.vcell.pathway.ProteinReference)1 SmallMoleculeReference (org.vcell.pathway.SmallMoleculeReference)1 DnaRegionReferenceProxy (org.vcell.pathway.persistence.BiopaxProxy.DnaRegionReferenceProxy)1 EntityReferenceProxy (org.vcell.pathway.persistence.BiopaxProxy.EntityReferenceProxy)1