Search in sources :

Example 6 with AnnotationVariant

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

the class StatementAnnotationBuilder method setVariantAttributes.

protected void setVariantAttributes(T annotation, Statement variantStatement) {
    String original = variantStatement.getValue(StatementField.VARIANT_ORIGINAL_AMINO_ACID);
    String variant = variantStatement.getValue(StatementField.VARIANT_VARIATION_AMINO_ACID);
    AnnotationVariant annotationVariant = new AnnotationVariant(original, variant.equals("-") ? "" : variant);
    annotation.setVariant(annotationVariant);
}
Also used : AnnotationVariant(org.nextprot.api.core.domain.annotation.AnnotationVariant)

Example 7 with AnnotationVariant

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

the class AnnotationVariantTest method testParse6.

public void testParse6() {
    String rd = "In [GLC3A:UNIPROT_DISEASE:DI-00935] and " + "[GLC1A:UNIPROT_DISEASE:DI-00937]; acts as GLC1A " + "disease modifier in patients also carrying Val-399 mutation in MYOC";
    AnnotationVariant av = new AnnotationVariant("I", "L", rd);
    assertEquals(av.getDescription(), "acts as GLC1A disease modifier in patients also carrying Val-399 mutation in MYOC");
    assertEquals(av.getDiseaseTerms().size(), 2);
    assertEquals(av.getDiseaseTerms().get(0), "DI-00935");
    assertEquals(av.getDiseaseTerms().get(1), "DI-00937");
}
Also used : AnnotationVariant(org.nextprot.api.core.domain.annotation.AnnotationVariant)

Example 8 with AnnotationVariant

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

the class AnnotationVariantTest method testParse3.

public void testParse3() {
    String rd = "In [GLC3A:UNIPROT_DISEASE:DI-00935].";
    AnnotationVariant av = new AnnotationVariant("I", "L", rd);
    assertEquals(av.getDescription(), null);
    assertEquals(av.getDiseaseTerms().size(), 1);
    assertEquals(av.getDiseaseTerms().get(0), "DI-00935");
}
Also used : AnnotationVariant(org.nextprot.api.core.domain.annotation.AnnotationVariant)

Example 9 with AnnotationVariant

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

the class PepXServiceImpl method buildEntryWithVirtualAnnotations.

static List<Annotation> buildEntryWithVirtualAnnotations(String peptide, boolean modeIsoleucine, List<PepXIsoformMatch> pepXisoforms, List<Annotation> varAnnotations, List<Isoform> isoforms) {
    List<Annotation> finalAnnotations = new ArrayList<>();
    for (PepXIsoformMatch isoNameAndOptionalPosition : pepXisoforms) {
        String isoformAc = isoNameAndOptionalPosition.getIsoformAccession();
        Annotation annotation = new Annotation();
        annotation.setAnnotationCategory(AnnotationCategory.PEPX_VIRTUAL_ANNOTATION);
        annotation.setCvTermName(peptide);
        annotation.setDescription("This virtual annotation describes the peptide " + peptide + " found in " + isoformAc);
        AnnotationIsoformSpecificity is = new AnnotationIsoformSpecificity();
        is.setIsoformAccession(isoformAc);
        if (isoNameAndOptionalPosition.getPosition() != null) {
            // It means there is a variant!!!
            int startPeptidePosition = isoNameAndOptionalPosition.getPosition();
            int endPeptidePosition = startPeptidePosition + peptide.length();
            List<Annotation> variantAnnotations = AnnotationUtils.filterAnnotationsBetweenPositions(startPeptidePosition, endPeptidePosition, varAnnotations, isoformAc);
            Isoform iso = IsoformUtils.getIsoformByIsoName(isoforms, isoformAc);
            if (iso == null) {
                throw new NextProtException("The variant at " + startPeptidePosition + " is not specific for this isoform " + isoformAc);
            }
            List<Annotation> validAnnotations = filterValidVariantAnnotations(peptide, modeIsoleucine, variantAnnotations, isoformAc, iso.getSequence());
            if ((validAnnotations == null) || validAnnotations.isEmpty()) {
                LOGGER.warn("No valid variants found for isoform " + isoformAc + " at position " + startPeptidePosition + " for peptide " + peptide + " in mode IL:" + modeIsoleucine);
                continue;
            // We used to throw an exception, but now we just skip
            // throw new NextProtException("No valid variants found for isoform " + isoformName + " at position" + startPeptidePosition + " for peptide " + peptide + " in mode IL:" + modeIsoleucine);
            }
            if (validAnnotations.size() > 1) {
                LOGGER.warn("There is more than 1 valid variant (" + validAnnotations.size() + ") for isoform (returning the 1st) " + isoformAc + " between position " + startPeptidePosition + " and " + endPeptidePosition + " for peptide " + peptide + " in mode IL:" + modeIsoleucine);
                // Takes only the first valid
                int startPos = validAnnotations.get(0).getStartPositionForIsoform(isoformAc);
                int endPos = validAnnotations.get(0).getEndPositionForIsoform(isoformAc);
                is.setFirstPosition(startPos);
                is.setLastPosition(endPos);
                AnnotationVariant var = validAnnotations.get(0).getVariant();
                annotation.setVariant(var);
            } else {
                // one variant on that position
                int startPos = validAnnotations.get(0).getStartPositionForIsoform(isoformAc);
                int endPos = validAnnotations.get(0).getEndPositionForIsoform(isoformAc);
                is.setFirstPosition(startPos);
                is.setLastPosition(endPos);
                AnnotationVariant var = validAnnotations.get(0).getVariant();
                annotation.setVariant(var);
            }
        } else {
            // No variant
            Isoform iso = IsoformUtils.getIsoformByIsoName(isoforms, isoformAc);
            String sequence = (iso != null) ? iso.getSequence() : null;
            boolean isPeptideContained = PeptideUtils.isPeptideContainedInTheSequence(peptide, sequence, modeIsoleucine);
            if (!isPeptideContained) {
                LOGGER.warn("PepX returned a peptide (" + peptide + ") for an isoform (" + isoformAc + ") that is not in the current isoform in neXtProt");
                continue;
            }
        // We used to throw an exception, but this would break the program (the algorithm could be improved to detect the specific case where pepx return a peptide of length 6 and generate a real error on other cases)
        // NPreconditions.checkTrue(isPeptideContained, "PepX returned a peptide (" + peptide + ") for an isoform (" + isoformName + ") that is not in the current isoform in neXtProt");
        }
        annotation.addTargetingIsoforms(Arrays.asList(is));
        finalAnnotations.add(annotation);
    }
    return finalAnnotations;
}
Also used : NextProtException(org.nextprot.api.commons.exception.NextProtException) PepXIsoformMatch(org.nextprot.api.web.domain.PepXResponse.PepXIsoformMatch) AnnotationVariant(org.nextprot.api.core.domain.annotation.AnnotationVariant) AnnotationIsoformSpecificity(org.nextprot.api.core.domain.annotation.AnnotationIsoformSpecificity) Isoform(org.nextprot.api.core.domain.Isoform) Annotation(org.nextprot.api.core.domain.annotation.Annotation)

Aggregations

AnnotationVariant (org.nextprot.api.core.domain.annotation.AnnotationVariant)9 Annotation (org.nextprot.api.core.domain.annotation.Annotation)2 AnnotationIsoformSpecificity (org.nextprot.api.core.domain.annotation.AnnotationIsoformSpecificity)2 HashMap (java.util.HashMap)1 NextProtException (org.nextprot.api.commons.exception.NextProtException)1 Isoform (org.nextprot.api.core.domain.Isoform)1 PepXIsoformMatch (org.nextprot.api.web.domain.PepXResponse.PepXIsoformMatch)1