private void collectXrefIdIfDbLike(final Xref x, final String dbStartsWith, final Set<String> set) { String db = x.getDb(); String id = x.getId(); if (db != null && id != null && !id.isEmpty()) { db = db.toLowerCase(); if (db.startsWith(dbStartsWith)) { //for a (PR/NAR) HGNC case, call HGNC.getSymbol(id) mapping if (db.startsWith("hgnc")) id = HGNC.getSymbol(id); if (id != null) set.add(id); } } }
String id = ref.getId();
id = x.getId(); // + ((ver!=null) ? "_" + ver : ""); if(x instanceof RelationshipXref) { RelationshipTypeVocabulary v = ((RelationshipXref)x).getRelationshipType();
/** * Gets the NCBI Taxonomy ID. * * @param bpe BioPAX element * @return taxonomyId, or -1, if not available. */ private static int getOrganismTaxonomyId(CyNetwork network, BioPAXElement bpe) { int taxonomyId = -1; try { Object bs = getValue(bpe, "organism"); if (bs instanceof BioSource) { Set<Xref> xrefs = ((BioSource)bs).getXref(); if(!xrefs.isEmpty()) { Xref tx = xrefs.iterator().next(); taxonomyId = Integer.parseInt(tx.getId()); } } } catch (Exception e) { taxonomyId = -1; } return taxonomyId; }
db = x.getDb(); String ver = x.getIdVersion(); id = x.getId(); // + ((ver!=null) ? "_" + ver : ""); if(x instanceof RelationshipXref) { RelationshipTypeVocabulary v = ((RelationshipXref)x).getRelationshipType();
/** * Gets the NCBI Taxonomy ID. * @param bpe BioPAX element * * @return taxonomyId, or -1, if not available. */ public static int getOrganismTaxonomyId(BioPAXElement bpe) { int taxonomyId = -1; try { Object bs = getValue(bpe, "organism"); if (bs instanceof BioSource) { Set<Xref> xrefs = ((BioSource)bs).getXref(); if(!xrefs.isEmpty()) { Xref tx = xrefs.iterator().next(); taxonomyId = Integer.parseInt(tx.getId()); } } } catch (Exception e) { taxonomyId = -1; } return taxonomyId; }
if (source.equals("sbo") || source.equals("go") || source.equals("mi") || source.equals("ec")) { interaction.setOntology(new Ontology(xref.getDb(), xref.getDbVersion(), xref.getId(), xref.getIdVersion())); } else if (source.equals("pubmed")) { interaction.setPublication(new Publication(xref.getDb(), xref.getId())); } else { interaction.setXref(new org.opencb.bionetdb.core.models.Xref(xref.getDb(), xref.getDbVersion(), xref.getId(), xref.getIdVersion()));
/** * Searches for gene symbol in Xref. * @param xref Xref to search * @return gene symbol */ private String extractGeneSymbol(Xref xref) { if (xref.getDb() != null && ( xref.getDb().equalsIgnoreCase("HGNC Symbol") || xref.getDb().equalsIgnoreCase("Gene Symbol") || xref.getDb().equalsIgnoreCase("HGNC"))) { String ref = xref.getId(); if (ref != null) { ref = ref.trim(); if (ref.contains(":")) ref = ref.substring(ref.indexOf(":") + 1); if (ref.contains("_")) ref = ref.substring(ref.indexOf("_") + 1); // if the reference is an HGNC ID, then convert it to a symbol if (!HGNC.containsSymbol(ref) && Character.isDigit(ref.charAt(0))) { ref = HGNC.getSymbol(ref); } } return ref; } return null; }
private org.opencb.bionetdb.core.models.Dna createDna(BioPAXElement bioPAXElement) { org.opencb.bionetdb.core.models.Dna dna = new org.opencb.bionetdb.core.models.Dna(); Dna dnaBP = (Dna) bioPAXElement; // Common properties setPhysicalEntityCommonProperties(dnaBP, dna); // Dna properties if (dnaBP.getEntityReference() != null) { EntityReference entityReference = dnaBP.getEntityReference(); // altIds for (String name : entityReference.getName()) { org.opencb.bionetdb.core.models.Xref xref = new org.opencb.bionetdb.core.models.Xref(); xref.setSource(REACTOME_FEAT + "biopax"); xref.setId(name); dna.setXref(xref); } // description dna.setDescription(new ArrayList<>(entityReference.getComment())); // xref Set<Xref> xrefs = entityReference.getXref(); for (Xref xref : xrefs) { org.opencb.bionetdb.core.models.Xref x = new org.opencb.bionetdb.core.models.Xref(); x.setSource(xref.getDb()); x.setSourceVersion(xref.getDbVersion()); x.setId(xref.getId()); x.setIdVersion(xref.getIdVersion()); dna.setXref(x); } } return dna; }
private Map<String, String> calculateIdMapings(Model model) { Map<String, String> idMappings = new HashMap<String, String>(); final Set<SimplePhysicalEntity> proteins = model.getObjects(SimplePhysicalEntity.class); for (SimplePhysicalEntity protein : proteins) { final String protRefId = protein.getEntityReference().getRDFId(); for (Xref xref : protein.getXref()) { if ("uniprotkb".equals(xref.getDb())) { String newId = IDENTIFIERS_ORG + "uniprot/" + xref.getId(); idMappings.put(protRefId, newId); break; } else if ("chebi".equals(xref.getDb())) { String newId = IDENTIFIERS_ORG + xref.getDb() + "/" + xref.getId(); idMappings.put(protRefId, newId); break; } } } return idMappings; }
private org.opencb.bionetdb.core.models.Protein createProtein(BioPAXElement bioPAXElement) { org.opencb.bionetdb.core.models.Protein protein = new org.opencb.bionetdb.core.models.Protein(); Protein proteinBP = (Protein) bioPAXElement; // Common properties setPhysicalEntityCommonProperties(proteinBP, protein); // Protein properties if (proteinBP.getEntityReference() != null) { EntityReference entityReference = proteinBP.getEntityReference(); // altIds for (String name : entityReference.getName()) { org.opencb.bionetdb.core.models.Xref xref = new org.opencb.bionetdb.core.models.Xref(); xref.setSource(REACTOME_FEAT + "biopax"); xref.setId(name); protein.setXref(xref); } // description protein.setDescription(new ArrayList<>(entityReference.getComment())); // xref Set<Xref> xrefs = entityReference.getXref(); for (Xref xref : xrefs) { org.opencb.bionetdb.core.models.Xref x = new org.opencb.bionetdb.core.models.Xref(); x.setSource(xref.getDb()); x.setSourceVersion(xref.getDbVersion()); x.setId(xref.getId()); x.setIdVersion(xref.getIdVersion()); protein.setXref(x); } } return protein; }
/** * Searches for the gene symbol of the given EntityReference. * @param pr to search for a symbol * @return symbol */ protected String getGeneSymbol(ProteinReference pr) { for (Xref xr : pr.getXref()) { String db = xr.getDb(); if (db != null) { db = db.toLowerCase(); if (db.startsWith("hgnc")) { String id = xr.getId(); if (id != null) { String symbol = HGNC.getSymbol(id); if (symbol != null && !symbol.isEmpty()) { return symbol; } } } } } return null; }
private org.opencb.bionetdb.core.models.Rna createRna(BioPAXElement bioPAXElement) { org.opencb.bionetdb.core.models.Rna rna = new org.opencb.bionetdb.core.models.Rna(); Rna rnaBP = (Rna) bioPAXElement; // Common properties setPhysicalEntityCommonProperties(rnaBP, rna); // Rna properties if (rnaBP.getEntityReference() != null) { EntityReference entityReference = rnaBP.getEntityReference(); // altIds for (String name : entityReference.getName()) { org.opencb.bionetdb.core.models.Xref xref = new org.opencb.bionetdb.core.models.Xref(); xref.setSource(REACTOME_FEAT + "biopax"); xref.setId(name); rna.setXref(xref); } // description rna.setDescription(new ArrayList<>(entityReference.getComment())); // xref Set<Xref> xrefs = entityReference.getXref(); for (Xref xref : xrefs) { org.opencb.bionetdb.core.models.Xref x = new org.opencb.bionetdb.core.models.Xref(); x.setSource(xref.getDb()); x.setSourceVersion(xref.getDbVersion()); x.setId(xref.getId()); x.setIdVersion(xref.getIdVersion()); rna.setXref(x); } } return rna; }
private static void createSpecialXrefAttribute(BioPAXElement resource, CyNetwork network, CyNode node, Xref link) { final String db = link.getDb().toUpperCase().trim(); final String id = link.getId().trim(); if(db.equalsIgnoreCase("HGNC SYMBOL") //- official primary db name || db.startsWith("HGNC") || db.startsWith("HUGO GENE") || db.startsWith("GENE SYMBOL") || db.startsWith("GENE NAME")) { String exists = network.getRow(node).get("GENE SYMBOL", String.class); //won't replace any existing value (added first) if (exists == null && !id.startsWith("HGNC:")) //ignore HGNC:12345 IDs AttributeUtil.set(network, node, "GENE SYMBOL", id, String.class); } else if(db.equalsIgnoreCase("NCBI GENE") //main (official) db name || db.equalsIgnoreCase("ENTREZ GENE") || db.equalsIgnoreCase("GENE ID")) { String exists = network.getRow(node).get("NCBI GENE", String.class); //won't replace any existing value (added first) if (exists == null) AttributeUtil.set(network, node, "NCBI GENE", id, String.class); } else if(db.startsWith("UNIPROT") || db.startsWith("SWISSPROT") || db.startsWith("SWISS-PROT")) { String exists = network.getRow(node).get("UNIPROT", String.class); //won't replace if found if (exists == null) AttributeUtil.set(network, node, "UNIPROT", id, String.class); } }
x.setSource(xref.getDb()); x.setSourceVersion(xref.getDbVersion()); x.setId(xref.getId()); x.setIdVersion(xref.getIdVersion()); smallMolecule.setXref(x);
/** * Gets the NCBI Taxonomy ID. * * @param bpe BioPAX element * @return taxonomyId, or -1, if not available. */ public static int getOrganismTaxonomyId(BioPAXElement bpe) { int taxonomyId = -1; if(bpe instanceof physicalEntityParticipant) { return getOrganismTaxonomyId(((physicalEntityParticipant)bpe).getPHYSICAL_ENTITY()); } try { Object bs = getValue(bpe, "ORGANISM", "organism"); if (bs instanceof BioSource) { Set<Xref> xrefs = ((BioSource)bs).getXref(); if(!xrefs.isEmpty()) { Xref tx = xrefs.iterator().next(); taxonomyId = Integer.parseInt(tx.getId()); } } else if(bs instanceof bioSource){ taxonomyId = Integer.parseInt(((bioSource)bs).getTAXON_XREF().getID()); } } catch (Exception e) { taxonomyId = -1; } return taxonomyId; }
String id = x.getId(); if (id != null) { if (!xrefHelper.canCheckIdFormatIn(preferedDbName)) {
id = x.getId(); if(x instanceof RelationshipXref) { RelationshipTypeVocabulary v = ((RelationshipXref)x).getRelationshipType();