public void saveScoreInMitab(String fileName) throws IOException { saveResultsInMitab(fileName); }
public void saveScores(){ fileName = "scores.txt"; saveScores(fileName); }
/** * Initialises the weight of each method and decrease the weight of imaging techniques. * PCA has a weight of 1.5 instead of 2 */ private void initializeMethodWeights_PCA_1_5(){ HashMap<String,Float> customOntologyMethodScores = new HashMap<String,Float>(); customOntologyMethodScores.put("MI:0013", 3f); // cv1 // biophysical customOntologyMethodScores.put("MI:0090", 1.5f); // cv2 // protein complementation assay customOntologyMethodScores.put("MI:0254", 0.3f); // cv3 // genetic interference customOntologyMethodScores.put("MI:0255", 0.3f); // cv4 // post transcriptional interference customOntologyMethodScores.put("MI:0401", 3f); // cv5 // biochemical customOntologyMethodScores.put("MI:0428", 0.6f); // cv6 // imagining technique customOntologyMethodScores.put("unknown", 0.1f); // cv7 // unknown super.setCustomOntologyMethodScores(customOntologyMethodScores); }
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; }
/** * Execute takslet step * @param arg0 * @param arg1 * @return * @throws Exception */ public RepeatStatus execute(StepContribution arg0, ChunkContext arg1) throws Exception { // do some checking there this.checkOutputMitabFile(); this.checkInputMitabFile(); /* Get mitab file */ PsimiTabReader mitabReader = new PsimiTabReader(); InteractionClusterScore interactionClusterScore = new InteractionClusterScore(); interactionClusterScore.setScoreName(scoreName); /* Get binaryInteractions from mitab file */ interactionClusterScore.setBinaryInteractionIterator(mitabReader.iterate(mitabInputFile)); /* Run cluster using list of binary interactions as input */ interactionClusterScore.setMappingIdDbNames(databaseToCluster); interactionClusterScore.runService(); /* Save mitab clustered data in files */ saveMitabOutputFile(interactionClusterScore); /* task finsihed */ return RepeatStatus.FINISHED; }
/** * 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()); logger.warn("Confidence value problem: " + confidenceValue.getValue()); } else { if(confidenceValue.getType().equalsIgnoreCase(getScoreName())){ confidenceValue.setValue(scoreResult.toString()); intactPsiscore = true; Confidence confidenceValue = new ConfidenceImpl(); confidenceValue.setValue(scoreResult.toString()); confidenceValue.setType(getScoreName()); eI.addConfidenceValue(confidenceValue);
@Override public void runService() { if (this.miscore == null){ this.miscore = new MIScore(); } runService(this.miscore); }
/** * The best weight for the interactions types is direct interaction : 5. */ public void setDirectInteractionWeight_5(){ Map<String,Float> customOntologyTypeScores = new HashMap<String,Float>(); customOntologyTypeScores.put("MI:0208", 0.25f); customOntologyTypeScores.put("MI:0403", 0.2f); // colocalization customOntologyTypeScores.put("MI:0914", 1f); customOntologyTypeScores.put("MI:0915", 2f); customOntologyTypeScores.put("MI:0407", 5f); customOntologyTypeScores.put("unknown", 0.1f); super.setCustomOntologyTypeScores(customOntologyTypeScores); }
protected void runService(MIScore scoreGenerator) { logger.debug("runService"); if(scoreGenerator.isUseOls() == false){ MIO = new MIOntology(false); } super.runService(); processScore(); }
public void saveScores(String fileName){ if(this.getInteractionMapping() == null || this.interactionMapping.isEmpty()){ runService(); Map<Integer, EncoreInteraction> interactionMapping = getInteractionMapping(); String delimiter = ","; if(confidenceValue.getType().equalsIgnoreCase(getScoreName())){ score = confidenceValue.getValue();
@Override public void saveResultsInMitab(String fileName){ /* Retrieve results */ try { logger.info("Saving MITAB ... " + fileName); super.saveScores(fileName); } catch (Exception e) { logger.error("It is not possible to write the results in the mitab file " + fileName); e.printStackTrace(); } if(scoreList == null){ getScoresPerInteraction(); } try{ // Create file logger.info("Saving scores on ... " + fileName + "_log.txt"); FileWriter fstream = new FileWriter(fileName + "_log.txt"); BufferedWriter out = new BufferedWriter(fstream); try{ out.write(scoreListCSV); } finally { //Close the output stream out.close(); } }catch (Exception e){//Catch exception if any logger.error("Error: " + e.getMessage()); } }
/** * Initialises the weight of each method and decrease the weight of imaging techniques */ private void initializeMethodWeights(){ HashMap<String,Float> customOntologyMethodScores = new HashMap<String,Float>(); customOntologyMethodScores.put("MI:0013", 3f); // cv1 // biophysical customOntologyMethodScores.put("MI:0090", 2f); // cv2 // protein complementation assay customOntologyMethodScores.put("MI:0254", 0.3f); // cv3 // genetic interference customOntologyMethodScores.put("MI:0255", 0.3f); // cv4 // post transcriptional interference customOntologyMethodScores.put("MI:0401", 3f); // cv5 // biochemical customOntologyMethodScores.put("MI:0428", 0.6f); // cv6 // imagining technique customOntologyMethodScores.put("unknown", 0.1f); // cv7 // unknown super.setCustomOntologyMethodScores(customOntologyMethodScores); }
/** * The best weight for the interactions types is direct interaction : 3. */ public void setDirectInteractionWeight_3(){ Map<String,Float> customOntologyTypeScores = new HashMap<String,Float>(); customOntologyTypeScores.put("MI:0208", 0.08f); // genetic interaction customOntologyTypeScores.put("MI:0403", 0.05f); // colocalization customOntologyTypeScores.put("MI:0914", 0.33f); // association customOntologyTypeScores.put("MI:0915", 0.67f); // physical association customOntologyTypeScores.put("MI:0407", 1.00f); // direct interaction customOntologyTypeScores.put("unknown", 0.03f); // unknown super.setCustomOntologyTypeScores(customOntologyTypeScores); }