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 void mapNodeColumn( final EncoreInteraction interaction, final CyRow sourceRow, final CyRow targetRow) { final Map<String, String> accsSource = interaction.getInteractorAccsA(); processNames(sourceRow, accsSource); final Map<String, List<String>> otherSource = interaction.getOtherInteractorAccsA(); processOtherNames(sourceRow, otherSource); final Collection<CrossReference> speciesSource = interaction.getOrganismsA(); // Add Species names if (speciesSource.size() != 0) { CrossReference speciesSourceFirst = speciesSource.iterator().next(); processSpecies(sourceRow, speciesSourceFirst); } // Try to find human-readable gene name guessHumanReadableName(sourceRow); if (targetRow == null) { return; } // If target exists... final Map<String, String> accsTarget = interaction.getInteractorAccsB(); processNames(targetRow, accsTarget); final Map<String, List<String>> otherTarget = interaction.getOtherInteractorAccsB(); processOtherNames(targetRow, otherTarget); final Collection<CrossReference> speciesTarget = interaction.getOrganismsB(); if (speciesTarget.size() != 0) { CrossReference speciesTargetFirst = speciesTarget.iterator().next(); processSpecies(targetRow, speciesTargetFirst); } guessHumanReadableName(targetRow); }