// test fails because biojava returns features in a random order
  public void testProcess2() throws Exception {
    String input =
        IOUtils.toString(getClass().getClassLoader().getResourceAsStream("embl_test_2.embl"));

    MockItemWriter itemWriter = new MockItemWriter(new HashMap());
    BioJavaFlatFileConverter converter = new BioJavaFlatFileConverter(itemWriter);
    converter.process(new StringReader(input));
    converter.close();
    System.out.println(itemWriter.getItems());
    Set expected = readItemSet("embl_test_2.xml");
    assertEquals(expected, itemWriter.getItems());
  }
  public void testProcess() throws Exception {
    File srcFile = new File(getClass().getClassLoader().getResource("SGD_features.tab").toURI());
    converter.setCurrentFile(srcFile);
    converter.process(new FileReader(srcFile));

    converter.close();

    // uncomment to write out a new target items file
    // writeItemsFile(itemWriter.getItems(), "sgd-tgt-items.xml");

    Set<org.intermine.xml.full.Item> expected = readItemSet("SgdIdentifiersConverterTest.xml");
    assertEquals(expected, itemWriter.getItems());
  }
예제 #3
0
  public void testProcess() throws Exception {
    File srcFile =
        new File(getClass().getClassLoader().getResource("RefGenomeOrthologs.txt").toURI());
    converter.setCurrentFile(srcFile);
    converter.setPantherOrganisms("9606 10116 7227 10090");
    converter.process(new FileReader(srcFile));

    converter.close();

    // uncomment to write out a new target items file
    // writeItemsFile(itemWriter.getItems(), "panther-tgt-items.xml");

    Set<org.intermine.xml.full.Item> expected = readItemSet("PantherConverterTest_tgt.xml");
    assertEquals(expected, itemWriter.getItems());
  }
예제 #4
0
  public void testProcess() throws Exception {
    String ENDL = System.getProperty("line.separator");
    String input =
        "Gene WB ID\tGene Public Name\tPhenotype WB ID\tPhenotype Primary Name\tPhenotype Short Name\tPhenotype Is Observed\tPhenotype Is Not Observed\tPhenotype Penetrance From (%)\tPhenotype Penetrance To (%)\tRNAi WB ID\tRNAi Remark\tPubMed ID"
            + ENDL
            + "WBGene00000516\tcki-1\tWBPhenotype0000202\talae_abnormal\t\t1\t\t\t\tWBRNAi00064855\tclone does not match to the reported genomic sequence\t9716524"
            + ENDL
            + "WBGene00006974\tzen-4\tWBPhenotype0000765\tspindle_elongation_integrity_abnormal_early_emb\tEmb\t\t1\t27\t27\tWBRNAi00063891\t\t9693365";

    File file = new File("wormrnai-final.txt");

    MockItemWriter itemWriter = new MockItemWriter(new HashMap());
    RNAiConverter converter = new RNAiConverter(itemWriter, Model.getInstanceByName("genomic"));
    converter.setCurrentFile(file);
    converter.process(new StringReader(input));
    converter.close();

    // uncomment to write out a new target items file
    // writeItemsFile(itemWriter.getItems(), "RNAiConverterTest.xml");

    Set expected = readItemSet("RNAiConverterTest.xml");

    assertEquals(expected, itemWriter.getItems());
  }
  public void testFlyRegHandlerNewFormat() throws Exception {
    String gff =
        "2L\tREDfly\tregulatory_region\t2456365\t2456372\t.\t.\t.\tID=\"Unspecified_dpp:REDFLY:TF000068\"; Dbxref=\"Flybase:FBgn0000490, PMID:8543160, REDfly:644, FlyBase:\"; Evidence=footprint/binding assay; factor=Unspecified; target=dpp\n"
            + "2L\tREDfly\tregulatory_region\t2456352\t2456369\t.\t.\t.\tID=\"dl_dpp:REDFLY:TF000069\"; Dbxref=\"Flybase:FBgn0000490, PMID:8458580, REDfly:645, FlyBase:FBgn0000463\"; Evidence=footprint/binding assay; factor=dl; target=dpp\n"
            + "2L\tREDfly\tregulatory_region\t2456423\t2456433\t.\t.\t.\tID=\"Unspecified_dpp:REDFLY:TF000067\"; Dbxref=\"Flybase:FBgn0000490, PMID:8543160, REDfly:643, FlyBase:\"; Evidence=footprint/binding assay; factor=Unspecified; target=dpp\n";

    BufferedReader srcReader = new BufferedReader(new StringReader(gff));
    converter.parse(srcReader);
    converter.storeAll();

    // uncomment to write a new target items files
    // writeItemsFile(writer.getItems(), "flyreg-tgt-items-newformat.xml");

    Set<Item> expected = readItemSet("FlyRegGFF3RecordHandlerNewFormatTest.xml");

    assertEquals(expected, writer.getItems());
  }
  /** @throws Exception e */
  public void testProcess() throws Exception {

    ClassLoader loader = getClass().getClassLoader();
    String input = IOUtils.toString(loader.getResourceAsStream(TEST_FILE));

    File currentFile = new File(getClass().getClassLoader().getResource(TEST_FILE).toURI());
    converter.setCurrentFile(currentFile);
    converter.setEnsemblcomparaOrganisms("10116 6239 7227");
    converter.setEnsemblcomparaHomologues("9606");
    converter.process(new StringReader(input));
    converter.close();

    // uncomment to write out a new target items file
    // writeItemsFile(itemWriter.getItems(), "ensembl-compara-tgt-items.xml");

    Set<org.intermine.xml.full.Item> expected = readItemSet("EnsemblComparaConverterTest_tgt.xml");
    assertEquals(expected, itemWriter.getItems());
  }
예제 #7
0
  public void test1() throws Exception {
    OboConverter converter =
        new OboConverter(itemWriter, model, "", "SO", "http://www.flymine.org", "OntologyTerm");
    OboTerm a = new OboTerm("SO:42", "parent");
    OboTerm b = new OboTerm("SO:43", "child");
    OboTerm c = new OboTerm("SO:44", "partof");
    OboTerm d = new OboTerm("SO:45", "obsolete");
    d.setObsolete(true);
    c.addSynonym(new OboTermSynonym("syn2", "exact_synonym"));
    b.addSynonym(new OboTermSynonym("syn1", "narrow_synonym"));
    b.addSynonym(new OboTermSynonym("syn2", "exact_synonym"));
    d.addSynonym(new OboTermSynonym("syn2", "exact_synonym"));
    d.addSynonym(new OboTermSynonym("syn3", "narrow_synonym"));
    OboRelation r1 = new OboRelation("SO:43", "SO:42", new OboTypeDefinition("is_a", "is_a", true));
    OboRelation r2 =
        new OboRelation("SO:44", "SO:43", new OboTypeDefinition("part_of", "part_of", true));
    OboRelation r3 = new OboRelation("SO:43", "SO:45", new OboTypeDefinition("is_a", "is_a", true));

    converter.setOboTerms(Arrays.asList(new OboTerm[] {a, b, c, d}));
    converter.setOboRelations(Arrays.asList(new OboRelation[] {r1, r2, r3}));
    converter.storeItems();
    // writeItemsFile(itemWriter.getItems(), "obo-converter-tgt.xml");
    assertEquals(readItemSet("OboConverterTest.xml"), itemWriter.getItems());
  }