use of org.nextprot.api.core.service.PeptideUnicityService 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;
}
Aggregations