public void mapEdgeColumn(final EncoreInteraction interaction, final CyRow row) { final Set<String> exp = interaction.getExperimentToPubmed().keySet(); row.set(DETECTION_METHOD_ID, new ArrayList<String>(exp)); final List<CrossReference> pubIDs = interaction.getPublicationIds(); final List<String> pubIdList = new ArrayList<String>(); final List<String> pubDBList = new ArrayList<String>(); for (CrossReference pub : pubIDs) { pubIdList.add(pub.getIdentifier()); pubDBList.add(pub.getDatabase()); } if (pubIdList.isEmpty() == false) row.set(PUB_ID, pubIdList); if (pubDBList.isEmpty() == false) row.set(PUB_DB, pubDBList); // Interaction (use UniqueID) row.set(CyEdge.INTERACTION, interaction.getMappingIdDbNames()); final List<Confidence> scores = interaction.getConfidenceValues(); for (Confidence c : scores) { String type = c.getType(); String value = c.getValue(); if (row.getTable().getColumn(type) == null) row.getTable().createColumn(type, Double.class, true); try { double doubleVal = Double.parseDouble(value); row.set(type, doubleVal); } catch (NumberFormatException e) { // logger.warn("Invalid number string: " + value); // Ignore invalid number } } }
public CrossReference toCrossReference(O cvObject) { if (cvObject == null) { throw new IllegalArgumentException("CvObject must not be null. "); } // name of the cv is the fullname String text = cvObject.getFullName() != null ? cvObject.getFullName() : cvObject.getShortLabel(); String identity = cvObject.getIdentifier(); if (identity == null) { throw new NullPointerException( cvObject.getClass().getSimpleName() + "(" + text + ") didn't have an identity"); } final CvObjectXref idXref = findMatchingIdentityXref( cvObject.getXrefs(), identity); // XrefUtils.getIdentityXref(cvObject, CvDatabase.PSI_MI_MI_REF); if (idXref != null) { try { CrossReference ref = crossRefConverter.createCrossReference(idXref, false); ref.setText(text); return ref; } catch (Exception e) { throw new RuntimeException("An exception occured while building a cv object : " + text, e); } } else { CrossReference ref = new CrossReferenceImpl(CrossReferenceConverter.DATABASE_UNKNOWN, identity, text); return ref; } }
private void processSpecies(CyRow row, CrossReference ref) { if (ref != null) { final String name = ref.getText(); final String speciesID = ref.getIdentifier(); row.set(TAXNOMY, speciesID); row.set(TAXNOMY_NAME, name); } }
public int compare(CrossReference cr1, CrossReference cr2) { int idx1 = texts.indexOf(cr1.getText()); int idx2 = texts.indexOf(cr2.getText()); if (idx1 != -1 || idx2 != -1) { matchedAny = true; } int compare = 0; if (idx1 == -1 && idx2 == -1) { compare = 0; } else if (idx1 == -1) { compare = 1; // first is greater } else if (idx2 == -1) { compare = -1; // first is lower } else { compare = idx1 - idx2; // relative to their position in the ordered list of text } return compare; }
public boolean matches(CrossReference cr) { return texts.indexOf(cr.getText()) != -1; }