public Iterator<BinaryInteraction> getBinaryInteractionIterator() throws PsimiTabException, IOException { return mitabReader.iterate(getMitab()); } }
public void setBinaryInteractionIterator(InputStream inputStream, boolean hasHeader) throws ClusterServiceException { if ( inputStream != null ) { final PsimiTabReader reader = new PsimiTabReader( ); try { this.binaryInteractionIterator = reader.iterate( inputStream ); } catch ( Exception e ) { throw new ClusterServiceException( "An error occured while read MITAB data", e ); } } }
public void setBinaryInteractionIterator(Reader r, boolean hasHeader) throws ClusterServiceException { if ( r != null ) { final PsimiTabReader reader = new PsimiTabReader( ); try { this.binaryInteractionIterator = reader.iterate( r ); } catch ( Exception e ) { throw new ClusterServiceException( "An error occured while read MITAB data", e ); } } }
/** * Cluster all the binary interactions in the mitab file and save in clustered mitab file * @param mitabFile * @param clusteredMitabFile * @throws IOException * @throws ConverterException */ public void clusterAndComputeMiScoreInteraction(String mitabFile, String clusteredMitabFile) throws IOException, ConverterException { IntActClusterScore clusterScore = new IntActClusterScore(); File mitabAsFile = new File(mitabFile); Iterator<BinaryInteraction> iterator = mitabReader.iterate(new FileInputStream(mitabAsFile)); // the binary interactions to cluster List<BinaryInteraction> interactionToProcess = new ArrayList<BinaryInteraction>(); while (iterator.hasNext()){ interactionToProcess.clear(); while (interactionToProcess.size() < 200 && iterator.hasNext()){ BinaryInteraction interaction = (BinaryInteraction) iterator.next(); interactionToProcess.add(interaction); } clusterScore.setBinaryInteractionIterator(interactionToProcess.iterator()); clusterScore.runService(); } clusterScore.saveCluster(clusteredMitabFile); }
public AbstractInteractionCluster( Reader r, boolean hasHeader ) throws ClusterServiceException { if ( r == null ) { throw new IllegalArgumentException( "You must give a non null MITAB Reader" ); } String [] dbNames; if (mappingIdDbNames.contains(",")){ dbNames = mappingIdDbNames.split(","); } else { dbNames = new String [] {mappingIdDbNames}; } this.binary2Encore = new Binary2Encore(dbNames); final PsimiTabReader reader = new PsimiTabReader( ); try { this.binaryInteractionIterator = reader.iterate( r ); } catch ( Exception e ) { throw new ClusterServiceException( "An error occured while read MITAB data", e ); } }
@Override public void open(ExecutionContext executionContext) throws ItemStreamException { if (clusteredMitabFile == null){ throw new ItemStreamException("The Mitab cluster score item processor needs a clustered mitab file containing the scores to be able to process the non clustered MITAB file"); } PsimiTabReader mitabReader = new PsimiTabReader(); try { Iterator<BinaryInteraction> binaryInteractionIterator = mitabReader.iterate(clusteredMitabFile); while (binaryInteractionIterator.hasNext()){ BinaryInteraction binary = binaryInteractionIterator.next(); Interactor interactorA = binary.getInteractorA(); Interactor interactorB = binary.getInteractorB(); List<Confidence> confidences = binary.getConfidenceValues(); String firstInteractor = extractInteractorIdentifier(interactorA); String secondInteractor = extractInteractorIdentifier(interactorB); Double score = extractClusterScoreFrom(confidences); if (score != null){ scores.put(new BinaryPair(firstInteractor, secondInteractor), score); } } } catch (IOException e) { throw new ItemStreamException("Impossible to read the clustered mitab file " + clusteredMitabFile.getAbsolutePath(), e); } }
Iterator<BinaryInteraction> iterator = psiMiTabReader.iterate(inputStream); boolean isSpeciesA = false; boolean isSpeciesB = false;
Iterator<BinaryInteraction> iterator = mitabReader.iterate(new FileInputStream(mitabAsFile));
/** * 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; }
Iterator<BinaryInteraction> iterator = mitabReader.iterate(new FileInputStream(mitabAsFile));
try{ stream = client.getByInteraction(ID, PsicquicSimpleClient.MITAB25, 0, 1); Iterator<psidev.psi.mi.tab.model.BinaryInteraction> binaryIterator = reader.iterate(stream); if (binaryIterator.hasNext()){ psidev.psi.mi.tab.model.BinaryInteraction<psidev.psi.mi.tab.model.Interactor> binary = binaryIterator.next();