use of org.nextprot.api.core.domain.Entry in project nextprot-api by calipho-sib.
the class IsoformSequencePositionMapperTest method positionOnIso1ShouldNotMapToIso2.
@Test
public void positionOnIso1ShouldNotMapToIso2() throws Exception {
Entry entry = entryBuilderService.build(EntryConfig.newConfig("NX_P38398").withTargetIsoforms());
Integer position = IsoformSequencePositionMapper.getProjectedPosition(IsoformUtils.getIsoformByName(entry, "NX_P38398-1"), 1812, IsoformUtils.getIsoformByName(entry, "NX_P38398-2"));
Assert.assertNull(position);
}
use of org.nextprot.api.core.domain.Entry 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)
*/
}
use of org.nextprot.api.core.domain.Entry 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.Entry in project nextprot-api by calipho-sib.
the class EntryPartExporterImplTest method testPartialSortOrderForExpressionProfile.
@Test
public void testPartialSortOrderForExpressionProfile() throws Exception {
// the sort order defined fro expression-profile is :
// alpha(term name), alpha(eco_name), alpha(expression level), temporal(stage accession)
// here we test that the 3 first criteria are correct
String subpart = "expression-profile";
EntryPartExporter exporter = EntryPartExporterImpl.fromSubPart(subpart);
Entry entry = entryBuilderService.build(EntryConfig.newConfig("NX_P01308").with(subpart));
List<Row> rows = exporter.exportRows(entry);
String lastSortKey = "";
for (Row r : rows) {
String termName = r.getValue(exporter.getColumnIndex(Header.TERM_NAME));
String ecoName = r.getValue(exporter.getColumnIndex(Header.ECO_NAME));
String exprLevel = r.getValue(exporter.getColumnIndex(Header.EXPRESSION_LEVEL));
String sortKey = termName + "\t" + ecoName + "\t" + exprLevel;
int result = lastSortKey.compareTo(sortKey);
// System.out.println("result:"+ result + "for: " + sortKey); // + " " + stage + " -" + stageAc);
Assert.assertTrue(result <= 0);
lastSortKey = sortKey;
}
}
use of org.nextprot.api.core.domain.Entry in project nextprot-api by calipho-sib.
the class EntryPageServiceTest method proteomicPageShouldFilterPhosphoSitePlusDb.
@Test
public void proteomicPageShouldFilterPhosphoSitePlusDb() {
String entryAC = "NX_P52701";
Entry filteredEntry = entryPageService.filterXrefInPageView(entryAC, "proteomics");
Assert.assertTrue(filteredEntry.getXrefs().stream().anyMatch(x -> x.getDatabaseName().equals("PhosphoSitePlus")));
}
Aggregations