Search in sources :

Example 11 with PeptideUnicity

use of org.nextprot.api.core.domain.PeptideUnicity in project nextprot-api by calipho-sib.

the class PeptideMappingServiceImpl method attachPeptidePropertiesToAnnotations.

static void attachPeptidePropertiesToAnnotations(List<Annotation> annotations, Map<String, PeptideUnicity> pepNamePuMap) {
    for (Annotation annot : annotations) {
        String pepName = getMappingAnnotationPeptideName(annot);
        PeptideUnicity pu = pepNamePuMap.get(pepName);
        String proteotypicValue = pu.getValue().equals(PeptideUnicity.Value.NOT_UNIQUE) ? "N" : "Y";
        String unicityValue = pu.getValue().name();
        annot.addProperty(createAnnotationProperty(annot.getAnnotationId(), pepName, PropertyApiModel.NAME_PEPTIDE_PROTEOTYPICITY, proteotypicValue));
        annot.addProperty(createAnnotationProperty(annot.getAnnotationId(), pepName, PropertyApiModel.NAME_PEPTIDE_UNICITY, unicityValue));
    }
}
Also used : PeptideUnicity(org.nextprot.api.core.domain.PeptideUnicity)

Example 12 with PeptideUnicity

use of org.nextprot.api.core.domain.PeptideUnicity in project nextprot-api by calipho-sib.

the class PepXServiceImpl method updateAnnotationsWithPeptideProperties.

private void updateAnnotationsWithPeptideProperties(List<Entry> entries) {
    // peptide unicity over wildtype isoforms
    Map<String, PeptideUnicity> puMap = computePeptideUnicityStatus(entries, false);
    // peptide unicity over variant isoforms
    Map<String, PeptideUnicity> puVarMap = computePeptideUnicityStatus(entries, true);
    entries.forEach(e -> {
        e.getAnnotations().forEach(a -> {
            String pep = a.getCvTermName();
            PeptideUnicity pu = puMap.get(pep);
            if (pu != null) {
                // store peptide proteotypicity (Y/N) & unicity (UNIQUE,PSEUDO_UNIQUE,NON_UNIQUE) over wildtype isoforms
                String proteotypicValue = pu.getValue().equals(PeptideUnicity.Value.NOT_UNIQUE) ? "N" : "Y";
                a.addProperty(buildAnnotationProperty(PropertyApiModel.NAME_PEPTIDE_PROTEOTYPICITY, proteotypicValue));
                a.addProperty(buildAnnotationProperty(PropertyApiModel.NAME_PEPTIDE_UNICITY, pu.getValue().name()));
                // store the set of equivalent isoforms (if any) matched by the peptide
                if (pu.getEquivalentIsoforms() != null && pu.getEquivalentIsoforms().size() > 0) {
                    a.setSynonyms(new ArrayList<String>(pu.getEquivalentIsoforms()));
                }
            }
            PeptideUnicity puVar = puVarMap.get(pep);
            if (puVar != null) {
                // store peptide unicity over variant isoforms
                a.addProperty(buildAnnotationProperty(PropertyApiModel.NAME_PEPTIDE_UNICITY_WITH_VARIANTS, puVar.getValue().name()));
            }
        });
    });
}
Also used : PeptideUnicity(org.nextprot.api.core.domain.PeptideUnicity)

Aggregations

PeptideUnicity (org.nextprot.api.core.domain.PeptideUnicity)12 Test (org.junit.Test)8 CoreUnitBaseTest (org.nextprot.api.core.test.base.CoreUnitBaseTest)8 TreeSet (java.util.TreeSet)7 BufferedReader (java.io.BufferedReader)1 IOException (java.io.IOException)1 InputStreamReader (java.io.InputStreamReader)1 URL (java.net.URL)1 URLConnection (java.net.URLConnection)1 java.util (java.util)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Log (org.apache.commons.logging.Log)1 LogFactory (org.apache.commons.logging.LogFactory)1 AnnotationCategory (org.nextprot.api.commons.constants.AnnotationCategory)1 PropertyApiModel (org.nextprot.api.commons.constants.PropertyApiModel)1 NextProtException (org.nextprot.api.commons.exception.NextProtException)1 Entry (org.nextprot.api.core.domain.Entry)1 Isoform (org.nextprot.api.core.domain.Isoform)1 Annotation (org.nextprot.api.core.domain.annotation.Annotation)1