List of usage examples for org.apache.commons.collections15.iterators ArrayIterator ArrayIterator
public ArrayIterator(final Object array)
From source file:edu.berkeley.compbio.phyloutils.NearestNodeFinder.java
public static void main(String[] argv) throws IOException, NoSuchNodeException { //service.setGreengenesRawFilename(argv[0]); service.setHugenholtzFilename(argv[0]); //service.setSynonymService(NcbiTaxonomyClient.getInstance()); service.init();/*w w w . ja va2 s . c o m*/ final int[] targetIds = IntArrayReader.read(argv[1]); int[] queryIds = IntArrayReader.read(argv[2]); final double minDistance = Double.parseDouble(argv[3]); // implement leave-one-out at any level Map<Integer, Double> results = Parallel.map(new ArrayIterator(queryIds), new Function<Integer, Double>() { public Double apply(Integer queryId) { try { double best = Double.MAX_VALUE; for (int targetId : targetIds) { double d = service.minDistanceBetween(queryId, targetId); if (d >= minDistance) { best = Math.min(best, d); } } return best; } catch (NoSuchNodeException e) { throw new Error(e); } } }); String outfileName = argv[4]; PrintWriter out = new PrintWriter(outfileName); out.println("id\tdist"); for (Map.Entry<Integer, Double> entry : results.entrySet()) { out.println(entry.getKey() + "\t" + entry.getValue()); } out.close(); }
From source file:logicProteinHypernetwork.analysis.pis.MultiPIS.java
public Iterator<NetworkEntity> iterator() { return new ArrayIterator<NetworkEntity>(entities); }
From source file:hypernetwork.constraints.Competition.java
@Override public Iterator<Constraint> iterator() { return new ArrayIterator<Constraint>(constraint); }
From source file:proteinHypernetwork.interactions.Interaction.java
/** * Iterate over the interactors./*from w ww. j a v a 2 s . c o m*/ * * @return an iterator */ @Override public Iterator<Interactor> iterator() { return new ArrayIterator(interactors); }