Search in sources :

Example 6 with AnnotationEvidence

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

the class AntibodyResourceIdsServiceImpl method findAllAntibodyIdsByMasterId.

@Override
public List<Long> findAllAntibodyIdsByMasterId(String uniqueName) {
    Long masterId = masterIdentifierService.findIdByUniqueName(uniqueName);
    List<Annotation> annotations = antibodyMappingDao.findAntibodyMappingAnnotationsById(masterId);
    Set<Long> names = new HashSet<>();
    for (Annotation annotation : annotations) {
        for (AnnotationEvidence evidence : annotation.getEvidences()) {
            names.add(evidence.getResourceId());
        }
    }
    return new ImmutableList.Builder<Long>().addAll(new ArrayList<>(names)).build();
}
Also used : AnnotationEvidence(org.nextprot.api.core.domain.annotation.AnnotationEvidence) ArrayList(java.util.ArrayList) Annotation(org.nextprot.api.core.domain.annotation.Annotation) HashSet(java.util.HashSet)

Example 7 with AnnotationEvidence

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

the class PeptideMappingDaoIntegrationTest method shouldReturn_Some_Expected_Evidences.

@Test
public void shouldReturn_Some_Expected_Evidences() {
    List<String> names = new ArrayList<>();
    String pepName1 = "NX_PEPT01967984";
    names.add(pepName1);
    Map<String, List<AnnotationEvidence>> evMap = this.peptideMappingDao.findPeptideAnnotationEvidencesMap(names, true);
    // 1 peptide name key excpected
    assertTrue(evMap.size() == 1);
    // 1 PeptideAtlas evidence expected
    assertTrue(evMap.get(pepName1).size() == 1);
    AnnotationEvidence ev = evMap.get(pepName1).get(0);
    // setup later by service !
    assertTrue(ev.getAnnotationId() == 0L);
    System.out.println("assigned by:" + ev.getAssignedBy());
    assertTrue(ev.getEvidenceId() > IdentifierOffset.PEPTIDE_MAPPING_ANNOTATION_EVIDENCE_OFFSET);
    assertTrue(ev.getAssignedBy().startsWith("PeptideAtlas"));
    assertTrue(ev.getEvidenceCodeAC().startsWith("ECO"));
    assertTrue(ev.getEvidenceCodeName().length() > 0);
    assertTrue(ev.getQualityQualifier().length() > 0);
    assertTrue(ev.getResourceAccession().equals("PAp05117553"));
    assertTrue(ev.getResourceType().equals("database"));
}
Also used : AnnotationEvidence(org.nextprot.api.core.domain.annotation.AnnotationEvidence) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) CoreUnitBaseTest(org.nextprot.api.core.test.base.CoreUnitBaseTest) Test(org.junit.Test)

Example 8 with AnnotationEvidence

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

the class AnnotationTest method testNoEvidence.

/*
	 * this case seems to occur (in dev at least)
	 */
@Test
public void testNoEvidence() {
    Annotation a = new Annotation();
    List<AnnotationEvidence> evidences = new ArrayList<>();
    a.setEvidences(evidences);
    Assert.assertTrue(!a.isExpressionLevelDetected().isPresent());
}
Also used : AnnotationEvidence(org.nextprot.api.core.domain.annotation.AnnotationEvidence) ArrayList(java.util.ArrayList) Annotation(org.nextprot.api.core.domain.annotation.Annotation) Test(org.junit.Test)

Example 9 with AnnotationEvidence

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

the class AnnotationTest method testTwoHigh.

@Test
public void testTwoHigh() {
    Annotation a = new Annotation();
    List<AnnotationEvidence> evidences = new ArrayList<>();
    evidences.add(buildEvidence("high"));
    evidences.add(buildEvidence("high"));
    a.setEvidences(evidences);
    Assert.assertTrue(a.isExpressionLevelDetected().isPresent());
    Assert.assertTrue(a.isExpressionLevelDetected().get());
}
Also used : AnnotationEvidence(org.nextprot.api.core.domain.annotation.AnnotationEvidence) ArrayList(java.util.ArrayList) Annotation(org.nextprot.api.core.domain.annotation.Annotation) Test(org.junit.Test)

Example 10 with AnnotationEvidence

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

the class AnnotationTest method testHighAndLow.

@Test
public void testHighAndLow() {
    Annotation a = new Annotation();
    List<AnnotationEvidence> evidences = new ArrayList<>();
    evidences.add(buildEvidence("high"));
    evidences.add(buildEvidence("low"));
    a.setEvidences(evidences);
    Assert.assertTrue(a.isExpressionLevelDetected().isPresent());
    Assert.assertTrue(a.isExpressionLevelDetected().get());
}
Also used : AnnotationEvidence(org.nextprot.api.core.domain.annotation.AnnotationEvidence) ArrayList(java.util.ArrayList) Annotation(org.nextprot.api.core.domain.annotation.Annotation) Test(org.junit.Test)

Aggregations

AnnotationEvidence (org.nextprot.api.core.domain.annotation.AnnotationEvidence)39 Annotation (org.nextprot.api.core.domain.annotation.Annotation)28 Test (org.junit.Test)23 ArrayList (java.util.ArrayList)16 CoreUnitBaseTest (org.nextprot.api.core.test.base.CoreUnitBaseTest)11 AnnotationIsoformSpecificity (org.nextprot.api.core.domain.annotation.AnnotationIsoformSpecificity)7 CvTerm (org.nextprot.api.core.domain.CvTerm)6 AnnotationCategory (org.nextprot.api.commons.constants.AnnotationCategory)5 Collectors (java.util.stream.Collectors)4 BioObject (org.nextprot.api.core.domain.BioObject)4 java.util (java.util)3 List (java.util.List)3 NextProtException (org.nextprot.api.commons.exception.NextProtException)3 DbXref (org.nextprot.api.core.domain.DbXref)3 AnnotationEvidenceProperty (org.nextprot.api.core.domain.annotation.AnnotationEvidenceProperty)3 AnnotationProperty (org.nextprot.api.core.domain.annotation.AnnotationProperty)3 Supplier (com.google.common.base.Supplier)2 Logger (org.apache.log4j.Logger)2 IdentifierOffset (org.nextprot.api.commons.constants.IdentifierOffset)2 StringUtils (org.nextprot.api.commons.utils.StringUtils)2