Examples of Xref


Examples of org.obolibrary.oboformat.model.Xref

    public void expandXrefs() {
        for (Frame f : sourceOBODoc.getTermFrames()) {
            String id = f.getTagValue(OboFormatTag.TAG_ID, String.class);
            Collection<Clause> clauses = f.getClauses(OboFormatTag.TAG_XREF);
            for (Clause c : clauses) {
                Xref x = c.getValue(Xref.class);
                if (x != null) {
                    String xid = x.getIdref();
                    String s = getIDSpace(xid);
                    if (treatMap.containsKey(s)) {
                        treatMap.get(s).expand(f, id, xid);
                    }
                }
View Full Code Here

Examples of org.obolibrary.oboformat.model.Xref

        if (!id.isEmpty()) {
            id = removeTrailingWS(id);
            if (id.contains(" ")) {
                warn("accepting bad xref with spaces:" + id);
            }
            Xref xref = new Xref(id);
            cl.addXref(xref);
            parseZeroOrMoreWs();
            if (stream.peekCharIs('"')) {
                stream.consume("\"");
                xref.setAnnotation(getParseUntilAdv("\""));
            }
            return true;
        }
        return false;
    }
View Full Code Here

Examples of org.obolibrary.oboformat.model.Xref

        id = id.trim();
        if (id.contains(" ")) {
            warn("accepting bad xref with spaces:<" + id + '>');
        }
        id = id.replaceAll(" +\\Z", "");
        @SuppressWarnings("null")
        Xref xref = new Xref(id);
        cl.addValue(xref);
        parseZeroOrMoreWs();
        if (stream.peekCharIs('"')) {
            stream.consume("\"");
            xref.setAnnotation(getParseUntilAdv("\""));
        }
        return true;
    }
View Full Code Here

Examples of org.obolibrary.oboformat.model.Xref

        Frame partOf = d2.getTypedefFrame("part_of");
        Collection<Clause> xrcs = partOf.getClauses(OboFormatTag.TAG_XREF);
        boolean okBfo = false;
        boolean okOboRel = false;
        for (Clause c : xrcs) {
            Xref value = c.getValue(Xref.class);
            if (value.getIdref().equals("BFO:0000050")) {
                okBfo = true;
            }
            if (value.getIdref().equals("OBO_REL:part_of")) {
                okOboRel = true;
            }
        }
        assertTrue(okBfo);
        assertTrue(okOboRel);
View Full Code Here

Examples of org.obolibrary.oboformat.model.Xref

        Clause defClause = frame.getClause(OboFormatTag.TAG_DEF);
        assertNotNull(defClause);
        Collection<Xref> xrefs = defClause.getXrefs();
        assertEquals(2, xrefs.size());
        Iterator<Xref> iterator = xrefs.iterator();
        Xref xref1 = iterator.next();
        assertEquals("RESID:AA0151", xref1.getIdref());
        String annotation = xref1.getAnnotation();
        assertEquals("variant", annotation);
        Xref xref2 = iterator.next();
        assertEquals("UniMod:148", xref2.getIdref());
        String original = readResource("db_xref_comments.obo");
        String renderedOboString = renderOboToString(obodoc);
        assertEquals(original, renderedOboString);
    }
View Full Code Here

Examples of org.obolibrary.oboformat.model.Xref

    }

    @SuppressWarnings("null")
    private static void writeXRefClause(@Nonnull Clause clause,
            @Nonnull BufferedWriter writer) throws IOException {
        Xref xref = clause.getValue(Xref.class);
        if (xref != null) {
            StringBuilder sb = new StringBuilder();
            sb.append(clause.getTag());
            sb.append(": ");
            String idref = xref.getIdref();
            int colonPos = idref.indexOf(':');
            if (colonPos > 0) {
                sb.append(escapeOboString(idref.substring(0, colonPos),
                        EscapeMode.xref));
                sb.append(':');
                sb.append(escapeOboString(idref.substring(colonPos + 1),
                        EscapeMode.xref));
            } else {
                sb.append(escapeOboString(idref, EscapeMode.xref));
            }
            String annotation = xref.getAnnotation();
            if (annotation != null) {
                sb.append(" \"");
                sb.append(escapeOboString(annotation, EscapeMode.quotes));
                sb.append('"');
            }
View Full Code Here

Examples of org.obolibrary.oboformat.model.Xref

        List<Xref> sortedXrefs = new ArrayList<>(xrefs);
        Collections.sort(sortedXrefs, XrefComparator.INSTANCE);
        sb.append(" [");
        Iterator<Xref> xrefsIterator = sortedXrefs.iterator();
        while (xrefsIterator.hasNext()) {
            Xref current = xrefsIterator.next();
            String idref = current.getIdref();
            int colonPos = idref.indexOf(':');
            if (colonPos > 0) {
                sb.append(escapeOboString(idref.substring(0, colonPos),
                        EscapeMode.xrefList));
                sb.append(':');
                sb.append(escapeOboString(idref.substring(colonPos + 1),
                        EscapeMode.xrefList));
            } else {
                sb.append(escapeOboString(idref, EscapeMode.xrefList));
            }
            String annotation = current.getAnnotation();
            if (annotation != null) {
                sb.append(' ');
                sb.append('"');
                sb.append(escapeOboString(annotation, EscapeMode.quotes));
                sb.append('"');
View Full Code Here

Examples of org.obolibrary.oboformat.model.Xref

        @Nullable
        private static String toStringRepresentation(@Nullable Object obj) {
            String s = null;
            if (obj != null) {
                if (obj instanceof Xref) {
                    Xref xref = (Xref) obj;
                    s = xref.getIdref() + ' ' + xref.getAnnotation();
                } else if (obj instanceof String) {
                    s = (String) obj;
                } else {
                    s = obj.toString();
                }
View Full Code Here

Examples of org.patika.mada.util.XRef

   */
  private void extractReferences()
  {
    for (xref xr : cmp.getXREF())
    {
      this.addReference(new XRef(xr));
    }
  }
View Full Code Here

Examples of org.patika.mada.util.XRef

          if (id.length() < 1) continue;
         
          String dbtext = Character.isDigit(id.charAt(0)) ?
            XRef.ENTREZ_GENE : XRef.UNIPROT;

          refs.add(new XRef(dbtext + ":" + id));
        }
      }
    }

    if (!refs.isEmpty())
    {
      try
      {
        main.lockWithMessage("Querying Pathway Commons Database ...");

        PathwayCommonsIOHandler ioHandler = new PathwayCommonsIOHandler(new SimpleIOHandler());
        Map<String, String> pathToID = new HashMap<String, String>();
        List<String> resultPathways = new ArrayList<String>();

        XRef xr = XRef.getFirstRef(refs,
          new String[]{XRef.CPATH, XRef.ENTREZ_GENE, XRef.UNIPROT});

        refs.clear();
        if (xr != null)
        {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.