use of org.nextprot.api.core.domain.PeptideUnicity in project nextprot-api by calipho-sib.
the class PeptideUnicityServiceIntegrationTest method testPseudoUniqueCase2.
@Test
public void testPseudoUniqueCase2() {
// first 2 isoforms have same sequence (same md5) and other isoforms belong to same entry => PSEUDO UNIQUE
Set<String> isoset = new TreeSet<String>(Arrays.asList("NX_P0DN79-1", "NX_P35520-1", "NX_P35520-2", "NX_P35520-3"));
PeptideUnicity result = peptideUnicityService.getPeptideUnicityFromMappingIsoforms(isoset);
Assert.assertEquals(PeptideUnicity.Value.PSEUDO_UNIQUE, result.getValue());
Set<String> expEquivSet = new TreeSet<String>(Arrays.asList("NX_P0DN79-1", "NX_P35520-1"));
Assert.assertEquals(expEquivSet, result.getEquivalentIsoforms());
}
use of org.nextprot.api.core.domain.PeptideUnicity in project nextprot-api by calipho-sib.
the class PepXServiceImpl method computePeptideUnicityStatus.
/**
* Computes a unicity value for each peptide: UNIQUE, PSEUDO_UNIQUE, NON_UNIQUE
* based on the response returned by pepx (a list of peptide - isoform matches)
* by using the PeptideUnicityService
* @param entries
* @param withVariants
* @return a map with key = peptide sequence, value = unicity value
*/
private Map<String, PeptideUnicity> computePeptideUnicityStatus(List<Entry> entries, boolean withVariants) {
Map<String, Set<String>> pepIsoSetMap = new HashMap<>();
entries.forEach(e -> {
e.getAnnotationsByCategory(AnnotationCategory.PEPX_VIRTUAL_ANNOTATION).stream().filter(a -> a.getVariant() == null || withVariants).forEach(a -> {
String pep = a.getCvTermName();
if (!pepIsoSetMap.containsKey(pep))
pepIsoSetMap.put(pep, new TreeSet<String>());
a.getTargetingIsoformsMap().values().forEach(i -> {
pepIsoSetMap.get(pep).add(i.getIsoformAccession());
});
});
});
Map<String, PeptideUnicity> pepUnicityMap = new HashMap<>();
pepIsoSetMap.entrySet().forEach(e -> {
String pep = e.getKey();
PeptideUnicity pu = peptideUnicityService.getPeptideUnicityFromMappingIsoforms(e.getValue());
pepUnicityMap.put(pep, pu);
});
return pepUnicityMap;
}
use of org.nextprot.api.core.domain.PeptideUnicity in project nextprot-api by calipho-sib.
the class PeptideUnicityServiceImpl method getPeptideNameUnicityMap.
@Override
@Cacheable("peptide-name-unicity-map")
public Map<String, PeptideUnicity> getPeptideNameUnicityMap() {
LOGGER.info("Starting, thread: " + Thread.currentThread().getId());
Map<String, PeptideUnicity> result = new HashMap<>();
List<String> list = peptideMappingDao.findPeptideIsoformMappingsList();
LOGGER.info("Got mapping iso-pep from db, size: " + list.size() + " , thread: " + Thread.currentThread().getId());
for (int i = 0; i < list.size(); i++) {
String row = list.get(i);
String[] fields = row.split(":");
String pep = fields[0];
String[] isolist = fields[1].split(",");
Set<String> mappedIsoSet = new HashSet<>(Arrays.asList(isolist));
PeptideUnicity pu = getPeptideUnicityFromMappingIsoforms(mappedIsoSet);
result.put(pep, pu);
}
LOGGER.info("Computed uncity for peptides, size: " + result.size() + " , thread: " + Thread.currentThread().getId());
LOGGER.info("Done" + " , thread: " + Thread.currentThread().getId());
return result;
}
use of org.nextprot.api.core.domain.PeptideUnicity in project nextprot-api by calipho-sib.
the class PeptideUnicityServiceIntegrationTest method testUniqueCase1.
/*
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*
* UNIQUE cases
*
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
@Test
public void testUniqueCase1() {
Set<String> isoset = new TreeSet<String>(Arrays.asList("NX_ENTRY1-1"));
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 testPseudoUniqueCase1.
/*
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*
* PSEUDO_UNIQUE cases
*
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* Each line in this comment contains a list of isoforms that are known to be identical but in different entries
* If a peptide matches isoforms of multiple entries known as sharing an isoform then the peptide is said PSEUDO_UNIQUE
* NX_A0A087WW87-1,NX_P01614-1
* NX_O43812-1,NX_Q96PT3-2
* NX_Q6S5H4-1,NX_A0JP26-1
* NX_P0DMU8-1,NX_P0DMV0-1,NX_P0DMU7-1
* NX_Q01081-1,NX_P0DN76-1
* NX_B7ZAQ6-1,NX_P0CG08-1
* NX_B0FP48-1,NX_E5RIL1-1
* NX_P0DN79-1,NX_P35520-1
*/
@Test
public void testPseudoUniqueCase1() {
// the 2 isoform have same sequence (same md5) => PSEUDO UNIQUE
Set<String> isoset = new TreeSet<String>(Arrays.asList("NX_P0DN79-1", "NX_P35520-1"));
PeptideUnicity result = peptideUnicityService.getPeptideUnicityFromMappingIsoforms(isoset);
Assert.assertEquals(PeptideUnicity.Value.PSEUDO_UNIQUE, result.getValue());
Assert.assertEquals(isoset, result.getEquivalentIsoforms());
}
Aggregations