Search in sources :

Example 31 with Entry

use of org.nextprot.api.core.domain.Entry in project nextprot-api by calipho-sib.

the class EntryPublicationServiceIntegrationTest method testPerformance.

@Ignore
@Test
public void testPerformance() {
    /*  big ones (but not huge)
    		
    		AC			annot count (np1)
    		-----------------------------------
    	    NX_Q8WZ42	23683 // titin excluded
			NX_Q8WXI7	10765 //  also excluded
			NX_Q5VST9	5588
			NX_Q8IVF2	5437
			NX_Q8NF91	5383
			NX_P20930	5147
			NX_P20929	4388
			NX_Q03001	4347
			NX_O75445	4159
			NX_Q685J3	4083
			NX_P51587	4053
			NX_Q9HC84	4043
			
			Results without cache:

			NX_Q5VST9 load=128035ms build=36ms annot=6107 publi=155 
			NX_Q8IVF2 load=129688ms build=16ms annot=6702 publi=130 
			NX_Q8NF91 load=134330ms build=14ms annot=6135 publi=218 
			NX_P20930 load=105603ms build=8ms annot=5524 publi=351 
			NX_P20929 load=52249ms build=8ms annot=5293 publi=146 
			NX_Q03001 load=64498ms build=8ms annot=5373 publi=189 
			NX_O75445 load=34551ms build=6ms annot=4194 publi=220 
			NX_Q685J3 load=31822ms build=3ms annot=4111 publi=113 
			NX_P51587 load=66270ms build=6ms annot=4872 publi=1041 
			NX_Q9HC84 load=44158ms build=3ms annot=4573 publi=189 
			
			=> time for building report is fast enough, max = 36ms , don't know time for loading with cache enabled
			=> 0.036 * 20000 = 720 sec = 12 minutes (if they are all as big as NX_Q5VST9 which is not the case)

			Results with cache:
			
			NX_Q5VST9 load=66ms build=6ms annot=6107 publi=155 
			NX_Q8IVF2 load=285ms build=7ms annot=6702 publi=130 
			NX_Q8NF91 load=368ms build=5ms annot=6135 publi=218 
			NX_P20930 load=100ms build=4ms annot=5524 publi=351 
			NX_P20929 load=130ms build=4ms annot=5293 publi=146 
			NX_Q03001 load=149ms build=3ms annot=5373 publi=189 
			NX_O75445 load=103ms build=4ms annot=4194 publi=220 
			NX_Q685J3 load=78ms build=3ms annot=4111 publi=113 
			NX_P51587 load=118ms build=7ms annot=4872 publi=1041 
			NX_Q9HC84 load=73ms build=3ms annot=4573 publi=189 
			
			=> load time is still more than 10 times slower than building report

    	 */
    List<String> entryAcList = new ArrayList<>(Arrays.asList("NX_Q5VST9", "NX_Q8IVF2", "NX_Q8NF91", "NX_P20930", "NX_P20929", "NX_Q03001", "NX_O75445", "NX_Q685J3", "NX_P51587", "NX_Q9HC84"));
    List<Long> t0 = new ArrayList<>(), tLoad = new ArrayList<>(), tBuild = new ArrayList<>();
    List<Integer> annCnt = new ArrayList<>(), pubCnt = new ArrayList<>(), curCnt = new ArrayList<>(), addCnt = new ArrayList<>();
    int idx = -1;
    for (String ac : entryAcList) {
        idx++;
        t0.add(System.currentTimeMillis());
        Entry entry = entryBuilderService.build(EntryConfig.newConfig(ac).withEverything());
        tLoad.add(System.currentTimeMillis() - t0.get(idx));
        EntryPublications report = entryPublicationService.findEntryPublications(ac);
        tBuild.add(System.currentTimeMillis() - tLoad.get(idx) - t0.get(idx));
        annCnt.add(entry.getAnnotations().size());
        pubCnt.add(entry.getPublications().size());
        curCnt.add(report.getEntryPublicationList(PublicationCategory.CURATED).size());
        addCnt.add(report.getEntryPublicationList(PublicationCategory.ADDITIONAL).size());
        System.out.println(entry.getUniqueName() + " " + "load=" + (tLoad.get(idx)) + "ms " + "build=" + (tBuild.get(idx)) + "ms " + "annot=" + annCnt.get(idx) + " " + "publi=" + pubCnt.get(idx) + " " + "curated=" + curCnt.get(idx) + " " + "additonal=" + addCnt.get(idx) + " ");
    }
    System.out.println("END");
}
Also used : Entry(org.nextprot.api.core.domain.Entry) Ignore(org.junit.Ignore) CoreUnitBaseTest(org.nextprot.api.core.test.base.CoreUnitBaseTest) Test(org.junit.Test)

Example 32 with Entry

use of org.nextprot.api.core.domain.Entry 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)

Example 33 with Entry

use of org.nextprot.api.core.domain.Entry in project nextprot-api by calipho-sib.

the class EntryPartWriterTSVTest method getExpressionProfileOutputString.

@Test
public void getExpressionProfileOutputString() throws Exception {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    String subpart = "expression-profile";
    Entry entry = entryBuilderService.build(EntryConfig.newConfig("NX_P01308").with(subpart));
    EntryPartWriterTSV writer = new EntryPartWriterTSV(EntryPartExporterImpl.fromSubPart(subpart), baos);
    writer.write(entry);
    String output = baos.toString(StandardCharsets.UTF_8.name());
    baos.close();
    String[] headers = output.split("\n");
    Assert.assertTrue(headers.length > 534);
    Assert.assertEquals("ENTRY_ACCESSION\tCATEGORY\tTERM_ACCESSION\tTERM_NAME\tQUALITY\tECO_ACCESSION\tECO_NAME\tNEGATIVE\tEXPRESSION_LEVEL\tSTAGE_ACCESSION\tSTAGE_NAME\tSOURCE\tURL", headers[0]);
}
Also used : EntryPartWriterTSV(org.nextprot.api.core.export.EntryPartWriterTSV) Entry(org.nextprot.api.core.domain.Entry) ByteArrayOutputStream(java.io.ByteArrayOutputStream) CoreUnitBaseTest(org.nextprot.api.core.test.base.CoreUnitBaseTest) Test(org.junit.Test)

Example 34 with Entry

use of org.nextprot.api.core.domain.Entry in project nextprot-api by calipho-sib.

the class EntryPartWriterXLSTest method getExpressionProfileOutputString.

@Test
public void getExpressionProfileOutputString() throws Exception {
    File tempFile = testFolder.newFile("out.xls");
    OutputStream fos = new FileOutputStream(tempFile);
    String subpart = "expression-profile";
    Entry entry = entryBuilderService.build(EntryConfig.newConfig("NX_P01308").with(subpart));
    EntryPartWriterXLS writer = new EntryPartWriterXLS(EntryPartExporterImpl.fromSubPart(subpart), fos);
    writer.write(entry);
    fos.close();
    assertCountsEquals(571, 13, tempFile);
}
Also used : Entry(org.nextprot.api.core.domain.Entry) EntryPartWriterXLS(org.nextprot.api.core.export.EntryPartWriterXLS) CoreUnitBaseTest(org.nextprot.api.core.test.base.CoreUnitBaseTest) Test(org.junit.Test)

Example 35 with Entry

use of org.nextprot.api.core.domain.Entry in project nextprot-api by calipho-sib.

the class AnnotationFieldBuilderDiffTest method testAnnotationsAndFunctionalDescriptions.

@Test
public void testAnnotationsAndFunctionalDescriptions() {
    String[] test_list = { "NX_Q8IWA4", "NX_O00115", "NX_Q7Z6P3", "NX_E5RQL4", "NX_Q12809", "NX_Q7Z6P3", "NX_Q7Z713", "NX_P35499", "NX_P22102", "NX_Q8IYV9", "NX_O00116", "NX_Q7Z713", "NX_O15056", "NX_P35498", "NX_Q99250", "NX_Q9NY46", "NX_P43246", "NX_Q9UQD0", "NX_P52701", "NX_P54278" };
    String[] BEDtest_list = { "NX_P35498", "NX_Q99250", "NX_Q9NY46", "NX_P35499", "NX_Q14524", "NX_Q01118", "NX_Q9UQD0", "NX_Q15858", "NX_Q9Y5Y9", "NX_Q9UI33", "NX_P38398", "NX_P51587", "NX_P16422", "NX_P40692", "NX_Q9UHC1", "NX_P43246", "NX_P52701", "NX_P54278" };
    for (int i = 0; i < test_list.length; i++) {
        Entry entry = getEntry(test_list[i]);
        // Entry entry = getEntry(i); // 'random' entry
        System.out.println(entry.getUniqueName());
        testFunctionalDesc(entry);
        testAnnotations(entry);
    }
}
Also used : Entry(org.nextprot.api.core.domain.Entry) Test(org.junit.Test) SolrDiffTest(org.nextprot.api.tasks.solr.indexer.entry.SolrDiffTest)

Aggregations

Entry (org.nextprot.api.core.domain.Entry)60 Test (org.junit.Test)38 CoreUnitBaseTest (org.nextprot.api.core.test.base.CoreUnitBaseTest)16 Annotation (org.nextprot.api.core.domain.annotation.Annotation)9 Isoform (org.nextprot.api.core.domain.Isoform)8 EntryConfig (org.nextprot.api.core.service.fluent.EntryConfig)8 WebIntegrationBaseTest (org.nextprot.api.web.dbunit.base.mvc.WebIntegrationBaseTest)8 EntryBuilderService (org.nextprot.api.core.service.EntryBuilderService)6 Autowired (org.springframework.beans.factory.annotation.Autowired)6 Assert (org.junit.Assert)4 Ignore (org.junit.Ignore)4 AnnotationCategory (org.nextprot.api.commons.constants.AnnotationCategory)4 DbXref (org.nextprot.api.core.domain.DbXref)4 ArrayList (java.util.ArrayList)3 PropertyApiModel (org.nextprot.api.commons.constants.PropertyApiModel)3 SolrDiffTest (org.nextprot.api.tasks.solr.indexer.entry.SolrDiffTest)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 IOException (java.io.IOException)2 PrintWriter (java.io.PrintWriter)2 java.util (java.util)2