use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.
the class ObjectAnnotationSimilarityPredicateTest method shouldBeSimilar.
@Test
public void shouldBeSimilar() throws Exception {
AnnotationSimilarityPredicate predicate = new ObjectSimilarityPredicate(Annotation::getAPICategory);
Assert.assertTrue(predicate.isSimilar(mockAnnotation(AnnotationCategory.VARIANT), mockAnnotation(AnnotationCategory.VARIANT)));
}
use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.
the class ObjectAnnotationSimilarityPredicateTest method sameObjectShouldBeSimilar.
@Test
public void sameObjectShouldBeSimilar() throws Exception {
AnnotationSimilarityPredicate predicate = new ObjectSimilarityPredicate(Annotation::getAPICategory);
Annotation annot = mockAnnotation(AnnotationCategory.VARIANT);
Assert.assertTrue(predicate.isSimilar(annot, annot));
}
use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.
the class ObjectAnnotationSimilarityPredicateTest method shouldBeDifferent.
@Test
public void shouldBeDifferent() throws Exception {
AnnotationSimilarityPredicate predicate = new ObjectSimilarityPredicate(Annotation::getAPICategory);
Assert.assertFalse(predicate.isSimilar(mockAnnotation(AnnotationCategory.VARIANT), mockAnnotation(AnnotationCategory.MUTAGENESIS)));
}
use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.
the class RawStatementDaoTest method findModificationEffectCategory.
@Test
public void findModificationEffectCategory() {
AnnotationCategory category = AnnotationCategory.PHENOTYPIC_VARIATION;
Annotation isoAnnotation = new Annotation();
isoAnnotation.setAnnotationCategory(category);
assertEquals(isoAnnotation.getCategory(), "phenotypic-variation");
}
use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.
the class IsoformSequencePositionMapperIntegrationTest method testSingleVariantPositionOnMaster.
@Test
public void testSingleVariantPositionOnMaster() throws Exception {
// just to be aware of difference between db info and api info
String entry_ac = "NX_P01308";
String iso_ac = "NX_P01308-1";
String variant_ac = "AN_P01308_001747";
int expectedBeginPosOnMaster = 502;
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);
if (sout) {
System.out.println("isoform position : " + pos);
System.out.println("nuPos is valid : " + nuPos.isValid());
System.out.println("master position according to iso mapper service : " + nuPos.getNucleotidePosition(0));
System.out.println("master position according to table identifier_feature_position : " + expectedBeginPosOnMaster);
System.out.println("master first_position for Anne : " + (nuPos.getNucleotidePosition(0) - 1));
}
// we then have to gie the last_positon to Anne, there are 2 cases:
// case 1: original AAs = single AA
// => master last_positon fo Anne = first_position for Anne + 3
// case 2: original AAs length has more than one AAs
// compute position on master of last AA (same process as above), return nuPos(0)-1 found for iso pos)
// we expect a difference of 1 between what we have in db and what we have from api
Assert.assertEquals(new Integer(expectedBeginPosOnMaster + 1), new Integer(nuPos.getNucleotidePosition(0)));
return;
}
}
Assert.assertTrue(false);
/*
* SQL to get master position for this variant
*
select a.unique_name, a.cv_annotation_type_id, pfp.first_pos,pfp.last_pos,ifp.first_pos as master_frist_pos, ifp.last_pos as master_last_pos from sequence_identifiers si
inner join annotations a on (a.identifier_id=si.identifier_id)
inner join annotation_protein_assoc apa on (a.annotation_id=apa.annotation_id)
inner join protein_feature_positions pfp on (apa.assoc_id=pfp.annotation_protein_id)
inner join identifier_feature_positions ifp on (ifp.annotation_id=a.annotation_id)
where si.unique_name='NX_P01308'
and pfp.first_pos=20;
SQL result:
unique_name cv_annotation_type_id first_pos last_pos master_frist_pos master_last_pos
AN_P01308_001839 1027 20 21 430 433
(1 row)
*/
}
Aggregations