Search in sources :

Example 1 with Row

use of org.nextprot.api.core.export.EntryPartExporter.Row in project nextprot-api by calipho-sib.

the class EntryPartExporterImplTest method testPartialSortOrderForExpressionProfile.

@Test
public void testPartialSortOrderForExpressionProfile() throws Exception {
    // the sort order defined fro expression-profile is :
    // alpha(term name), alpha(eco_name), alpha(expression level), temporal(stage accession)
    // here we test that the 3 first criteria are correct
    String subpart = "expression-profile";
    EntryPartExporter exporter = EntryPartExporterImpl.fromSubPart(subpart);
    Entry entry = entryBuilderService.build(EntryConfig.newConfig("NX_P01308").with(subpart));
    List<Row> rows = exporter.exportRows(entry);
    String lastSortKey = "";
    for (Row r : rows) {
        String termName = r.getValue(exporter.getColumnIndex(Header.TERM_NAME));
        String ecoName = r.getValue(exporter.getColumnIndex(Header.ECO_NAME));
        String exprLevel = r.getValue(exporter.getColumnIndex(Header.EXPRESSION_LEVEL));
        String sortKey = termName + "\t" + ecoName + "\t" + exprLevel;
        int result = lastSortKey.compareTo(sortKey);
        // System.out.println("result:"+ result + "for: " + sortKey); //  + " " +  stage + " -" + stageAc);
        Assert.assertTrue(result <= 0);
        lastSortKey = sortKey;
    }
}
Also used : Entry(org.nextprot.api.core.domain.Entry) Row(org.nextprot.api.core.export.EntryPartExporter.Row) CoreUnitBaseTest(org.nextprot.api.core.test.base.CoreUnitBaseTest) Test(org.junit.Test)

Example 2 with Row

use of org.nextprot.api.core.export.EntryPartExporter.Row in project nextprot-api by calipho-sib.

the class EntryPartExporterImplTest method getColumnsForEntryNX_P01308.

@Test
public void getColumnsForEntryNX_P01308() throws Exception {
    EntryPartExporter exporter = new EntryPartExporterImpl.Builder().addColumns(Header.EXPRESSION_LEVEL, Header.STAGE_ACCESSION, Header.STAGE_NAME).build();
    String subpart = "expression-profile";
    Entry entry = entryBuilderService.build(EntryConfig.newConfig("NX_P01308").with(subpart));
    List<Row> rows = exporter.exportRows(entry);
    Assert.assertTrue(rows.size() > 533);
    Assert.assertEquals(13, rows.get(0).size());
}
Also used : Entry(org.nextprot.api.core.domain.Entry) Row(org.nextprot.api.core.export.EntryPartExporter.Row) CoreUnitBaseTest(org.nextprot.api.core.test.base.CoreUnitBaseTest) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 Entry (org.nextprot.api.core.domain.Entry)2 Row (org.nextprot.api.core.export.EntryPartExporter.Row)2 CoreUnitBaseTest (org.nextprot.api.core.test.base.CoreUnitBaseTest)2