Search in sources :

Example 26 with Namespace

use of org.jdom.Namespace in project vcell by virtualcell.

the class SEDMLExporter method getSEDMLFile.

public String getSEDMLFile(String sPath) {
    // Create an SEDMLDocument and create the SEDMLModel from the document, so that other details can be added to it in translateBioModel()
    SEDMLDocument sedmlDocument = new SEDMLDocument();
    sedmlDocument.getSedMLModel().setAdditionalNamespaces(Arrays.asList(new Namespace[] { Namespace.getNamespace(SEDMLTags.SBML_NS_PREFIX, SEDMLTags.SBML_NS_L2V4) }));
    sedmlModel = sedmlDocument.getSedMLModel();
    translateBioModelToSedML(sPath);
    // write SEDML document into SEDML writer, so that the SEDML str can be retrieved
    return sedmlDocument.writeDocumentToString();
}
Also used : SEDMLDocument(org.jlibsedml.SEDMLDocument) Namespace(org.jdom.Namespace)

Example 27 with Namespace

use of org.jdom.Namespace in project vcell by virtualcell.

the class PathwayReaderBiopax3 method addObjectBiochemicalReaction.

private BiochemicalReaction addObjectBiochemicalReaction(Element element) {
    Namespace bp = Namespace.getNamespace("bp", "http://www.biopax.org/release/biopax-level3.owl#");
    if (element.getChild("TransportWithBiochemicalReaction", bp) != null) {
        return addObjectTransportWithBiochemicalReaction(element.getChild("TransportWithBiochemicalReaction", bp));
    }
    BiochemicalReaction biochemicalReaction = new BiochemicalReactionImpl();
    addAttributes(biochemicalReaction, element);
    for (Object child : element.getChildren()) {
        if (child instanceof Element) {
            Element childElement = (Element) child;
            if (!addContentBiochemicalReaction(biochemicalReaction, element, childElement)) {
                showUnexpected(childElement);
            }
        }
    }
    pathwayModel.add(biochemicalReaction);
    return biochemicalReaction;
}
Also used : BiochemicalReactionImpl(org.vcell.pathway.BiochemicalReactionImpl) TransportWithBiochemicalReaction(org.vcell.pathway.TransportWithBiochemicalReaction) BiochemicalReaction(org.vcell.pathway.BiochemicalReaction) Element(org.jdom.Element) GroupObject(org.vcell.pathway.GroupObject) BioPaxObject(org.vcell.pathway.BioPaxObject) Namespace(org.jdom.Namespace)

Example 28 with Namespace

use of org.jdom.Namespace in project vcell by virtualcell.

the class DataBaseReferenceReader method getReferenceFromUniProt.

private static String getReferenceFromUniProt(String moleculeID, String dbFormat, String dbStyle) throws ServiceException, DbfConnException, DbfNoEntryFoundException, DbfParamsException, DbfException, InputException, RemoteException {
    String referenceName = null;
    String xmlStr = getXMLFromUniProt(moleculeID, dbFormat, dbStyle);
    // get root
    Element uniprotRoot = XmlUtil.stringToXML(xmlStr, null).getRootElement();
    Namespace uniprotNameSpace = uniprotRoot.getNamespace();
    // get entry
    Element entryElement = uniprotRoot.getChild(UniProt_EntryTag, uniprotNameSpace);
    // get name
    if (entryElement == null) {
        // not a big deal if we cannot get the uniprot name
        return null;
    }
    Element nameElement = entryElement.getChild(Uniprot_NameTag, uniprotNameSpace);
    if (nameElement == null) {
        return null;
    }
    referenceName = nameElement.getText();
    return referenceName;
}
Also used : Element(org.jdom.Element) Namespace(org.jdom.Namespace)

Example 29 with Namespace

use of org.jdom.Namespace in project vcell by virtualcell.

the class DataBaseReferenceReader method getReferenceFromInterpro.

private static String getReferenceFromInterpro(String dbName, String moleculeID, String dbFormat, String dbStyle) throws ServiceException, DbfConnException, DbfNoEntryFoundException, DbfParamsException, DbfException, InputException, RemoteException {
    String referenceName = null;
    String xmlStr = getXMLFromInterpro(dbName, moleculeID, dbFormat, dbStyle);
    // get root
    Element root = XmlUtil.stringToXML(xmlStr, null).getRootElement();
    Namespace nameSpace = root.getNamespace();
    // get entry
    Element entryElement = root.getChild(Interpro_EntryTag, nameSpace);
    // get name
    if (entryElement == null) {
        // not a big deal if we cannot get the interpro name
        return null;
    }
    Element nameElement = entryElement.getChild(Interpro_NameTag, nameSpace);
    if (nameElement == null) {
        return null;
    }
    referenceName = nameElement.getText();
    return referenceName;
}
Also used : Element(org.jdom.Element) Namespace(org.jdom.Namespace)

Example 30 with Namespace

use of org.jdom.Namespace in project vcell by virtualcell.

the class PathwayReader method addObjectPhysicalEntity.

private PhysicalEntity addObjectPhysicalEntity(Element element) {
    PhysicalEntity physicalEntity = new PhysicalEntity();
    Namespace rdf = Namespace.getNamespace("rdf", DefaultNameSpaces.RDF.uri);
    if (element.getAttributes().size() > 0) {
        physicalEntity = new PhysicalEntity();
        addAttributes(physicalEntity, element);
    }
    for (Object child : element.getChildren()) {
        if (child instanceof Element) {
            Element childElement = (Element) child;
            if (!addContentPhysicalEntity(physicalEntity, element, childElement)) {
                showUnexpected(childElement, physicalEntity);
            }
        }
    }
    pathwayModel.add(physicalEntity);
    return physicalEntity;
}
Also used : PhysicalEntity(org.vcell.pathway.PhysicalEntity) Element(org.jdom.Element) BioPaxObject(org.vcell.pathway.BioPaxObject) Namespace(org.jdom.Namespace)

Aggregations

Namespace (org.jdom.Namespace)35 Element (org.jdom.Element)32 Document (org.jdom.Document)7 IOException (java.io.IOException)5 VCDocument (org.vcell.util.document.VCDocument)5 StringReader (java.io.StringReader)4 ArrayList (java.util.ArrayList)4 BioPaxObject (org.vcell.pathway.BioPaxObject)4 Geometry (cbit.vcell.geometry.Geometry)3 Attribute (org.jdom.Attribute)3 ROI (cbit.vcell.VirtualMicroscopy.ROI)2 BioModel (cbit.vcell.biomodel.BioModel)2 MathDescription (cbit.vcell.math.MathDescription)2 ExpressionException (cbit.vcell.parser.ExpressionException)2 Simulation (cbit.vcell.solver.Simulation)2 StringWriter (java.io.StringWriter)2 Vector (java.util.Vector)2 XMLStreamException (javax.xml.stream.XMLStreamException)2 Content (org.jdom.Content)2 JDOMException (org.jdom.JDOMException)2