public double[] getScores(){ if(this.getInteractionMapping() == null){ runService(); } int scoreListSize = this.getInteractionMapping().size(); double [] scores = new double[scoreListSize]; int i = 0; for(EncoreInteraction eI:this.getInteractionMapping().values()){ List<Confidence> confidenceValues = eI.getConfidenceValues(); Double score = null; for(Confidence confidenceValue:confidenceValues){ if(confidenceValue.getType().equalsIgnoreCase(getScoreName())){ score = Double.parseDouble(confidenceValue.getValue()); } } if(score == null){ logger.error("No score for this interaction: " + eI.getId()); } scores[i] = score; i++; } return scores; }
public void saveScores(String fileName){ if(this.getInteractionMapping() == null || this.interactionMapping.isEmpty()){ runService(); Map<Integer, EncoreInteraction> interactionMapping = getInteractionMapping(); String delimiter = ",";
/** * Save clustered results including scores in mitab files * @param interactionClusterScore */ private void saveMitabOutputFile(InteractionClusterScore interactionClusterScore) throws IOException, PsimiTabException { /* Retrieve results */ Map<Integer, EncoreInteraction> interactionMapping = interactionClusterScore.getInteractionMapping(); PsimiTabWriter writer = new PsimiTabWriter(PsimiTabVersion.v2_5); BufferedWriter outputWriter = new BufferedWriter(new FileWriter(mitabOutputFile)); try{ if (header){ writer.writeMitabHeader(outputWriter); } Encore2Binary iConverter = new Encore2Binary(interactionClusterScore.getMappingIdDbNames()); for(Integer mappingId:interactionMapping.keySet()){ EncoreInteraction eI = interactionMapping.get(mappingId); BinaryInteraction bI = iConverter.getBinaryInteractionForScoring(eI); writer.write(bI, outputWriter); } } finally { outputWriter.close(); } }
for(Integer interactionId:this.getInteractionMapping().keySet()){ logger.debug("Get encore interaction object"); EncoreInteraction eI = this.getInteractionMapping().get(interactionId); logger.debug("= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ="); logger.debug("IntA: "+ eI.getInteractorA() + " , IntB: " + eI.getInteractorB());