/** * Calculate scores for each entry in the EntrySet. The scores are added to the EntrySet directly * and the scoring report will be returned. * * @param entrySet the entry set where the scores will be added to * @return scoring report * @throws PsiscoreException */ public List<String> calculateScores(EntrySet entrySet) throws PsiscoreException { if (entrySet.getEntries() == null) { throw new PsiscoreException("EntrySet does not contain any entries", new PsiscoreFault()); } List<String> report = new ArrayList<String>(); int scored = 0; int unscored = 0; int totalConfidences = 0; // go over all entries Iterator<Entry> it = entrySet.getEntries().iterator(); scoringParameters.setScoresAdded(false); while (it.hasNext()) { Entry entry = it.next(); // and go over all interactions in that entry Collection<Interaction> interactions = entry.getInteractions(); for (Iterator<Interaction> interactionIt = interactions.iterator(); interactionIt.hasNext(); ) { Interaction interaction = interactionIt.next(); Collection<Confidence> confidences = null; // and request the scores for that interaction try { confidences = getInteractionScores(interaction); } catch (ScoringException e) { report.add(e.getMessage()); } // confidences = null; if (confidences == null || confidences.size() == 0) { unscored++; } else if (confidences.size() > 0) { scoringParameters.setScoresAdded(true); scored++; totalConfidences += confidences.size(); interaction.getConfidences().addAll(confidences); } } } report.add( totalConfidences + " confidences scores added for " + scored + " interactions, nothing added for " + unscored + " interactions"); return report; }
/** Perform Mapping. */ public void doMapping() { // Create Entry Set and Entry entrySet = new EntrySet(); entrySet.setLevel(2); entrySet.setVersion(5); EntrySet.Entry entry = new EntrySet.Entry(); // Get Interactor List EntrySet.Entry.InteractorList interactorList = getInteractorList(); // Get Interaction List EntrySet.Entry.InteractionList interactionList = getInteractionList(); // Add to Entry node entry.setInteractorList(interactorList); entry.setInteractionList(interactionList); entrySet.getEntry().add(entry); }