Search in sources :

Example 16 with CvTerm

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

the class ConsistencyResourceTest method shouldFindAllTerms.

@Test
public void shouldFindAllTerms() {
    boolean missingTerms = false;
    List<String> terms = statementDao.findAllDistinctValuesforField(StatementField.ANNOT_CV_TERM_ACCESSION);
    System.out.println("Found " + terms.size() + " distinct terms");
    for (String t : terms) {
        if (t != null) {
            CvTerm term = terminologyService.findCvTermByAccession(t);
            if (term == null) {
                System.err.println("Can t find term " + t);
                missingTerms = true;
            }
        }
    }
    ;
    if (missingTerms)
        Assert.fail();
}
Also used : CvTerm(org.nextprot.api.core.domain.CvTerm) Test(org.junit.Test)

Example 17 with CvTerm

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

the class TerminologyServiceTest method shouldReturnAUniprotDomain.

@Test
public void shouldReturnAUniprotDomain() {
    CvTerm term = this.terminologyService.findCvTermByAccession("DO-00031");
    assertEquals("NextprotDomainCv", term.getOntology());
}
Also used : CvTerm(org.nextprot.api.core.domain.CvTerm) CoreUnitBaseTest(org.nextprot.api.core.test.base.CoreUnitBaseTest) Test(org.junit.Test)

Example 18 with CvTerm

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

the class TerminologyServiceTest method shouldReturnTheHierarchy.

@Test
public void shouldReturnTheHierarchy() {
    CvTerm term = this.terminologyService.findCvTermByAccession("KW-0906");
    // Nuclear pore complex has 3 parents
    assertEquals(3, term.getAncestorAccession().size());
}
Also used : CvTerm(org.nextprot.api.core.domain.CvTerm) CoreUnitBaseTest(org.nextprot.api.core.test.base.CoreUnitBaseTest) Test(org.junit.Test)

Example 19 with CvTerm

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

the class TerminologyServiceTest method shouldReturnACellosaurusTerm.

@Test
public void shouldReturnACellosaurusTerm() {
    CvTerm term = this.terminologyService.findCvTermByAccession("CVCL_J530");
    // System.out.println(term.toString());
    assertEquals("NextprotCellosaurusCv", term.getOntology());
    assertEquals(2, term.getXrefs().size());
}
Also used : CvTerm(org.nextprot.api.core.domain.CvTerm) CoreUnitBaseTest(org.nextprot.api.core.test.base.CoreUnitBaseTest) Test(org.junit.Test)

Example 20 with CvTerm

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

the class TerminologyServiceTest method shouldReturnAllTerms.

@Test
public void shouldReturnAllTerms() {
    int sameascnt = 0, refcnt = 0, maxref = 0;
    List<CvTerm> terms = this.terminologyService.findAllCVTerms();
    assertTrue(terms.size() > 145000);
    for (CvTerm term : terms) {
        List<String> sameas = term.getSameAs();
        if (sameas != null) {
            sameascnt++;
            refcnt = sameas.size();
            if (refcnt > maxref)
                maxref = refcnt;
        }
    }
    assertTrue(sameascnt > 44000);
    assertEquals(64, maxref);
}
Also used : CvTerm(org.nextprot.api.core.domain.CvTerm) CoreUnitBaseTest(org.nextprot.api.core.test.base.CoreUnitBaseTest) Test(org.junit.Test)

Aggregations

CvTerm (org.nextprot.api.core.domain.CvTerm)34 Test (org.junit.Test)9 CoreUnitBaseTest (org.nextprot.api.core.test.base.CoreUnitBaseTest)8 AnnotationEvidence (org.nextprot.api.core.domain.annotation.AnnotationEvidence)5 NextProtException (org.nextprot.api.commons.exception.NextProtException)4 CvTermGraph (org.nextprot.api.core.domain.CvTermGraph)4 Annotation (org.nextprot.api.core.domain.annotation.Annotation)4 MapSqlParameterSource (org.springframework.jdbc.core.namedparam.MapSqlParameterSource)4 NamedParameterJdbcTemplate (org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate)4 SqlParameterSource (org.springframework.jdbc.core.namedparam.SqlParameterSource)4 Publication (org.nextprot.api.core.domain.Publication)3 Supplier (com.google.common.base.Supplier)2 Instant (java.time.Instant)2 java.util (java.util)2 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 Collectors (java.util.stream.Collectors)2 Logger (org.apache.log4j.Logger)2 ApiMethod (org.jsondoc.core.annotation.ApiMethod)2 ConsoleProgressBar (org.nextprot.api.commons.app.ConsoleProgressBar)2