use of org.nextprot.api.core.domain.PeptideUnicity in project nextprot-api by calipho-sib.
the class PeptideUnicityServiceIntegrationTest method testNonUniqueCase2.
@Test
public void testNonUniqueCase2() {
Set<String> isoset = new TreeSet<String>(Arrays.asList("NX_ENTRY1-1", "NX_ENTRY2-1", "NX_ENTRY2-2"));
PeptideUnicity result = peptideUnicityService.getPeptideUnicityFromMappingIsoforms(isoset);
Assert.assertEquals(PeptideUnicity.Value.NOT_UNIQUE, result.getValue());
}
use of org.nextprot.api.core.domain.PeptideUnicity in project nextprot-api by calipho-sib.
the class PeptideUnicityServiceIntegrationTest method testMultiPseudoUnique.
/*
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*
* multiple PSEUDO_UNIQUE cases to see if cache of isoform service is effective
*
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
@Test
public void testMultiPseudoUnique() {
// the 2 isoform have same sequence (same md5) => PSEUDO UNIQUE
long t0;
PeptideUnicity result;
// first call
t0 = System.currentTimeMillis();
Set<String> isoset = new TreeSet<String>(Arrays.asList("NX_P0DN79-1", "NX_P35520-1"));
result = peptideUnicityService.getPeptideUnicityFromMappingIsoforms(isoset);
Assert.assertEquals(PeptideUnicity.Value.PSEUDO_UNIQUE, result.getValue());
long tFirst = System.currentTimeMillis() - t0;
// loop on 100 calls
t0 = System.currentTimeMillis();
for (int i = 0; i < 100; i++) {
String iso = "NX_P35520-" + (i + 2);
isoset.add(iso);
result = peptideUnicityService.getPeptideUnicityFromMappingIsoforms(isoset);
Assert.assertEquals(PeptideUnicity.Value.PSEUDO_UNIQUE, result.getValue());
}
long tNext100 = System.currentTimeMillis() - t0;
System.out.println("time for very first call: " + tFirst + "[ms]");
System.out.println("time for next 100 calls: " + tNext100 + "[ms]");
// line below ok only if cache is cleared before starting the test
// Assert.assertTrue(tFirst > tNext100);
}
use of org.nextprot.api.core.domain.PeptideUnicity in project nextprot-api by calipho-sib.
the class PeptideUnicityServiceIntegrationTest method tesUnicityOfSomeKnownPeptides.
/*
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*
*
*
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
@Test
public void tesUnicityOfSomeKnownPeptides() {
// clear related cache to make sure we have no PeptideUnicity serialization version conflict
cacheManager.getCache("peptide-name-unicity-map").clear();
PeptideUnicity pu;
Set<String> expectedEquivalentIsoSet;
long t0;
// first call
t0 = System.currentTimeMillis();
// [NX_P02771-1]
pu = peptideUnicityService.getPeptideNameUnicityMap().get("NX_PEPT01668698");
Assert.assertEquals(pu.getValue(), PeptideUnicity.Value.UNIQUE);
long tFirst = System.currentTimeMillis() - t0;
// subsequent calls should use cache
t0 = System.currentTimeMillis();
// maps [NX_P02679-1, NX_P02679-2]
pu = peptideUnicityService.getPeptideNameUnicityMap().get("NX_PEPT01410369");
Assert.assertEquals(pu.getValue(), PeptideUnicity.Value.UNIQUE);
// maps [NX_O14815-1, NX_O14815-2, NX_P07384-1, NX_P17655-1, NX_P17655-2]
pu = peptideUnicityService.getPeptideNameUnicityMap().get("NX_PEPT00361176");
Assert.assertEquals(pu.getValue(), PeptideUnicity.Value.NOT_UNIQUE);
// maps [NX_B9A064-1, NX_P0CF74-1, NX_P0CG04-1, NX_P0DOY2-1, NX_P0DOY3-1]
pu = peptideUnicityService.getPeptideNameUnicityMap().get("NX_PEPT00000054");
Assert.assertEquals(pu.getValue(), PeptideUnicity.Value.NOT_UNIQUE);
// maps [NX_P0DMV8-1, NX_P0DMV8-2, NX_P0DMV9-1]
pu = peptideUnicityService.getPeptideNameUnicityMap().get("NX_PEPT01978634");
Assert.assertEquals(pu.getValue(), PeptideUnicity.Value.PSEUDO_UNIQUE);
// SOME mapped isoforms are equivalent: [NX_P0DMV8-1, NX_P0DMV9-1]
expectedEquivalentIsoSet = new TreeSet<>(Arrays.asList("NX_P0DMV8-1", "NX_P0DMV9-1"));
Assert.assertEquals(expectedEquivalentIsoSet, pu.getEquivalentIsoforms());
// maps [NX_P0DP23-1, NX_P0DP24-1, NX_P0DP25-1]
pu = peptideUnicityService.getPeptideNameUnicityMap().get("NX_PEPT01888037");
Assert.assertEquals(pu.getValue(), PeptideUnicity.Value.PSEUDO_UNIQUE);
// equivalent isoforms: ALL mapped isoforms are equivalent: [NX_P0DP23-1, NX_P0DP24-1, NX_P0DP25-1]
expectedEquivalentIsoSet = new TreeSet<>(Arrays.asList("NX_P0DP23-1", "NX_P0DP24-1", "NX_P0DP25-1"));
Assert.assertEquals(expectedEquivalentIsoSet, pu.getEquivalentIsoforms());
long tNext = System.currentTimeMillis() - t0;
System.out.println("time for very first call: " + tFirst + "[ms]");
System.out.println("time for next calls: " + tNext + "[ms]");
// line below ok only if cache is cleared before starting the test
// Assert.assertTrue(tFirst > tNext);
}
use of org.nextprot.api.core.domain.PeptideUnicity in project nextprot-api by calipho-sib.
the class PeptideUnicityServiceIntegrationTest method testUniqueCase2.
@Test
public void testUniqueCase2() {
Set<String> isoset = new TreeSet<String>(Arrays.asList("NX_ENTRY1-1", "NX_ENTRY1-2"));
PeptideUnicity result = peptideUnicityService.getPeptideUnicityFromMappingIsoforms(isoset);
Assert.assertEquals(PeptideUnicity.Value.UNIQUE, result.getValue());
}
use of org.nextprot.api.core.domain.PeptideUnicity in project nextprot-api by calipho-sib.
the class PeptideUnicityServiceIntegrationTest method testNonUniqueCase1.
/*
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*
* NON_UNIQUE cases
*
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
@Test
public void testNonUniqueCase1() {
Set<String> isoset = new TreeSet<String>(Arrays.asList("NX_ENTRY1-1", "NX_ENTRY2-1"));
PeptideUnicity result = peptideUnicityService.getPeptideUnicityFromMappingIsoforms(isoset);
Assert.assertEquals(PeptideUnicity.Value.NOT_UNIQUE, result.getValue());
}
Aggregations