use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.
the class IsoformSequencePositionMapperIntegrationTest method testSingleVariantWithInvalidNucleotideIndice.
@Test
public void testSingleVariantWithInvalidNucleotideIndice() throws Exception {
String entry_ac = "NX_O00115";
String iso_ac = "NX_O00115-1";
String variant_ac = "AN_O00115_000472";
Entry entry = entryBuilderService.build(EntryConfig.newConfig(entry_ac).withTargetIsoforms().withAnnotations());
for (Annotation a : entry.getAnnotations()) {
if (a.getUniqueName().equals(variant_ac)) {
int pos = a.getTargetingIsoformsMap().get(iso_ac).getFirstPosition();
Isoform iso = IsoformUtils.getIsoformByName(entry, iso_ac);
GeneMasterCodonPosition nuPos = IsoformSequencePositionMapper.getCodonPositionsOnMaster(pos, iso);
for (Isoform iso2 : entry.getIsoforms()) {
if (!iso2.equals(iso)) {
CodonNucleotideIndices nuIdx = IsoformSequencePositionMapper.getCodonNucleotideIndices(nuPos, iso2);
// cannot be projected to iso2
Assert.assertEquals(false, nuIdx.has3Nucleotides());
Assert.assertEquals(false, nuIdx.areConsecutive());
Assert.assertEquals(false, nuIdx.areInFrame());
Assert.assertNull(nuIdx.getAminoAcidPosition());
}
}
return;
}
}
Assert.assertTrue(false);
}
use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.
the class DbXrefServiceImpl method convertXrefIntoAnnotation.
private Annotation convertXrefIntoAnnotation(DbXref xref, String entryName, List<Isoform> isoforms) {
Preconditions.checkNotNull(xref.getProperties());
Annotation annotation = new Annotation();
annotation.setAnnotationId(xref.getDbXrefId() + IdentifierOffset.XREF_ANNOTATION_OFFSET);
Xref2Annotation xam = Xref2Annotation.getByDatabaseName(xref.getDatabaseName());
annotation.setCategory(xam.getAnnotCat());
// copy of some xref property
annotation.setDescription(xref.getPropertyValue(xam.getXrefPropName()));
annotation.setQualityQualifier(xam.getQualityQualifier());
annotation.setCvTermName(null);
annotation.setCvTermAccessionCode(null);
annotation.setSynonym(null);
annotation.setUniqueName("AN_" + entryName.substring(3) + "_XR_" + String.valueOf(xref.getDbXrefId()));
annotation.setParentXref(xref);
annotation.setEvidences(Collections.singletonList(newAnnotationEvidence(annotation)));
annotation.addTargetingIsoforms(newAnnotationIsoformSpecificityList(isoforms, annotation));
return annotation;
}
use of org.nextprot.api.core.domain.annotation.Annotation 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();
}
use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.
the class AntibodyMappingDaoTest method testFindAntibodiesById.
@Test
public void testFindAntibodiesById() {
List<Annotation> annotations = this.antibodyMappingDao.findAntibodyMappingAnnotationsById(636535L);
Assert.assertEquals(2, annotations.size());
long tmpId = 4049518L;
long annotId = tmpId + IdentifierOffset.ANTIBODY_MAPPING_ANNOTATION_OFFSET;
long evidenceId = tmpId + IdentifierOffset.ANTIBODY_MAPPING_ANNOTATION_EVIDENCE_OFFSET;
// String annotUniqueName = "AN_"+resultSet.getString("resource_ac")+"_"+annotId; // AN_HPA039796_000890
// old = AN_HPA036302_4049518"
String annotUniqueName = "AN_HPA036302_" + annotId;
Annotation annotation = getAnnotationByUniqueName(annotUniqueName, annotations);
Assert.assertEquals(AnnotationCategory.ANTIBODY_MAPPING, annotation.getAPICategory());
Assert.assertEquals(annotUniqueName, annotation.getUniqueName());
Assert.assertEquals("GOLD", annotation.getQualityQualifier());
Assert.assertEquals(annotId, annotation.getAnnotationId());
Assert.assertEquals(1, annotation.getEvidences().size());
Assert.assertEquals(annotId, annotation.getEvidences().get(0).getAnnotationId());
Assert.assertEquals(17201575, annotation.getEvidences().get(0).getResourceId());
Assert.assertEquals("database", annotation.getEvidences().get(0).getResourceType());
Assert.assertEquals("Human protein atlas", annotation.getEvidences().get(0).getAssignedBy());
Assert.assertEquals("HPA", annotation.getEvidences().get(0).getResourceDb());
Assert.assertEquals("evidence", annotation.getEvidences().get(0).getResourceAssociationType());
Assert.assertEquals("ECO:0000154", annotation.getEvidences().get(0).getEvidenceCodeAC());
Assert.assertTrue(!annotation.getEvidences().get(0).isNegativeEvidence());
Assert.assertEquals(2, annotation.getTargetingIsoformsMap().size());
Assert.assertTrue(annotation.getTargetingIsoformsMap().containsKey("NX_P06213-1"));
Assert.assertTrue(annotation.getTargetingIsoformsMap().containsKey("NX_P06213-2"));
Assert.assertEquals(608, annotation.getTargetingIsoformsMap().get("NX_P06213-1").getFirstPosition().intValue());
Assert.assertEquals(608, annotation.getTargetingIsoformsMap().get("NX_P06213-2").getFirstPosition().intValue());
Assert.assertEquals(742, annotation.getTargetingIsoformsMap().get("NX_P06213-1").getLastPosition().intValue());
Assert.assertEquals(742, annotation.getTargetingIsoformsMap().get("NX_P06213-2").getLastPosition().intValue());
tmpId = 9547085;
annotId = tmpId + IdentifierOffset.ANTIBODY_MAPPING_ANNOTATION_OFFSET;
evidenceId = tmpId + IdentifierOffset.ANTIBODY_MAPPING_ANNOTATION_EVIDENCE_OFFSET;
annotUniqueName = "AN_HPA036303_" + annotId;
// old "AN_HPA036303_9547085"
annotation = getAnnotationByUniqueName(annotUniqueName, annotations);
Assert.assertEquals(AnnotationCategory.ANTIBODY_MAPPING, annotation.getAPICategory());
Assert.assertEquals(annotUniqueName, annotation.getUniqueName());
Assert.assertEquals("GOLD", annotation.getQualityQualifier());
Assert.assertEquals(annotId, annotation.getAnnotationId());
Assert.assertEquals(1, annotation.getEvidences().size());
Assert.assertEquals(annotId, annotation.getEvidences().get(0).getAnnotationId());
Assert.assertEquals(39235676, annotation.getEvidences().get(0).getResourceId());
Assert.assertEquals("database", annotation.getEvidences().get(0).getResourceType());
Assert.assertEquals("HPA", annotation.getEvidences().get(0).getResourceDb());
Assert.assertEquals("Human protein atlas", annotation.getEvidences().get(0).getAssignedBy());
Assert.assertEquals("evidence", annotation.getEvidences().get(0).getResourceAssociationType());
Assert.assertEquals("ECO:0000154", annotation.getEvidences().get(0).getEvidenceCodeAC());
Assert.assertTrue(!annotation.getEvidences().get(0).isNegativeEvidence());
Assert.assertEquals(2, annotation.getTargetingIsoformsMap().size());
Assert.assertTrue(annotation.getTargetingIsoformsMap().containsKey("NX_P06213-1"));
Assert.assertTrue(annotation.getTargetingIsoformsMap().containsKey("NX_P06213-2"));
Assert.assertEquals(246, annotation.getTargetingIsoformsMap().get("NX_P06213-1").getFirstPosition().intValue());
Assert.assertEquals(246, annotation.getTargetingIsoformsMap().get("NX_P06213-2").getFirstPosition().intValue());
Assert.assertEquals(326, annotation.getTargetingIsoformsMap().get("NX_P06213-1").getLastPosition().intValue());
Assert.assertEquals(326, annotation.getTargetingIsoformsMap().get("NX_P06213-2").getLastPosition().intValue());
}
use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.
the class AnnotationDaoTest method shouldSplitTransitPeptideAnnotations.
@Test
public void shouldSplitTransitPeptideAnnotations() {
List<Annotation> annotations = annotationDAO.findAnnotationsByEntryName("NX_Q6P4F2");
List<String> list = new ArrayList<String>();
for (Annotation an : annotations) list.add(an.getCategory());
assertEquals(list.contains(AnnotationCategory.MITOCHONDRIAL_TRANSIT_PEPTIDE.getDbAnnotationTypeName()), true);
assertEquals(list.contains(AnnotationCategory.PEROXISOME_TRANSIT_PEPTIDE.getDbAnnotationTypeName()), true);
assertEquals(annotations.size(), 2);
}
Aggregations