@Test public void readTaxonomy() throws IOException { TestOpenTreeListener testTaxonListener = new TestOpenTreeListener(); InputStream inputStream = getClass().getResourceAsStream("/ott/taxonomy.tsv"); assertThat(inputStream, is(notNullValue())); OpenTreeUtil.readTaxonomy(testTaxonListener, inputStream); assertThat(testTaxonListener.getCount(), is(5579788)); }
public static void readTaxonomy(OpenTreeListener listener, InputStream inputStream) throws IOException { LabeledCSVParser parser = CSVTSVUtil.createLabeledCSVParser(CSVTSVUtil.createCSVParse(IOUtils.toBufferedInputStream(inputStream), '\t')); while (parser.getLine() != null) { String taxonId = parser.getValueByLabel("uid"); String[] externalIds = StringUtils.split(parser.getValueByLabel("sourceinfo"), ","); for (String otherTaxonId : externalIds) { listener.taxonSameAs(taxonId, otherTaxonId); } } }
OpenTreeUtil { public static void readTaxonomy(OpenTreeListener listener, InputStream inputStream) throws IOException { LabeledCSVParser parser = CSVTSVUtil.createLabeledCSVParser(CSVTSVUtil.createCSVParse(IOUtils.toBufferedInputStream(inputStream), '\t')); while (parser.getLine() != null) { String taxonId = parser.getValueByLabel("uid"); String[] externalIds = StringUtils.split(parser.getValueByLabel("sourceinfo"), ","); for (String otherTaxonId : externalIds) { listener.taxonSameAs(taxonId, otherTaxonId); } } } }
OpenTreeUtil { public static void readTaxonomy(OpenTreeListener listener, InputStream inputStream) throws IOException { LabeledCSVParser parser = CSVTSVUtil.createLabeledCSVParser(CSVTSVUtil.createCSVParse(IOUtils.toBufferedInputStream(inputStream), '\t')); while (parser.getLine() != null) { String taxonId = parser.getValueByLabel("uid"); String[] externalIds = StringUtils.split(parser.getValueByLabel("sourceinfo"), ","); for (String otherTaxonId : externalIds) { listener.taxonSameAs(taxonId, otherTaxonId); } } }  }
OpenTreeUtil { public static void readTaxonomy(OpenTreeListener listener, InputStream inputStream) throws IOException { LabeledCSVParser parser = CSVTSVUtil.createLabeledCSVParser(CSVTSVUtil.createCSVParse(IOUtils.toBufferedInputStream(inputStream), '\t')); while (parser.getLine() != null) { String taxonId = parser.getValueByLabel("uid"); String[] externalIds = StringUtils.split(parser.getValueByLabel("sourceinfo"), ","); for (String otherTaxonId : externalIds) { listener.taxonSameAs(taxonId, otherTaxonId); } } }  static void readTaxonomy(OpenTreeListener listener, InputStream inputStream); static void extractIdsFromTree(TaxonListener listener, InputStream inputStream); }
OpenTreeUtil { public static void readTaxonomy(OpenTreeListener listener, InputStream inputStream) throws IOException { LabeledCSVParser parser = CSVTSVUtil.createLabeledCSVParser(CSVTSVUtil.createCSVParse(IOUtils.toBufferedInputStream(inputStream), '\t')); while (parser.getLine() != null) { String taxonId = parser.getValueByLabel("uid"); String[] externalIds = StringUtils.split(parser.getValueByLabel("sourceinfo"), ","); for (String otherTaxonId : externalIds) { listener.taxonSameAs(taxonId, otherTaxonId); } } }  static void readTaxonomy(OpenTreeListener listener, InputStream inputStream); static void extractIdsFromTree(TaxonListener listener, InputStream inputStream);  }