Search in sources :

Example 36 with SequenceVariation

use of org.nextprot.api.commons.bio.variation.prot.SequenceVariation in project nextprot-api by calipho-sib.

the class SequenceVariantHGVSParseSubstitutionTest method testParseAATerSubstitutionFix5.

@Ignore
@Test
public void testParseAATerSubstitutionFix5() throws Exception {
    format = new SequenceVariantHGVSFormat(ParsingMode.PERMISSIVE);
    SequenceVariation pm = format.parse("p.Y553_K558>");
}
Also used : SequenceVariation(org.nextprot.api.commons.bio.variation.prot.SequenceVariation) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 37 with SequenceVariation

use of org.nextprot.api.commons.bio.variation.prot.SequenceVariation in project nextprot-api by calipho-sib.

the class SequenceVariantHGVSParseSubstitutionTest method testParseAATerSubstitutionFixCode1.

@Test
public void testParseAATerSubstitutionFixCode1() throws Exception {
    format = new SequenceVariantHGVSFormat(ParsingMode.PERMISSIVE);
    SequenceVariation pm = format.parse("p.*104E");
    Assert.assertEquals(AminoAcidCode.STOP, pm.getVaryingSequence().getFirstAminoAcid());
    Assert.assertEquals(AminoAcidCode.STOP, pm.getVaryingSequence().getLastAminoAcid());
    Assert.assertEquals(104, pm.getVaryingSequence().getFirstAminoAcidPos());
    Assert.assertTrue(pm.getSequenceChange() instanceof Substitution);
    Assert.assertEquals(AminoAcidCode.GLUTAMIC_ACID, pm.getSequenceChange().getValue());
}
Also used : Substitution(org.nextprot.api.commons.bio.variation.prot.impl.seqchange.Substitution) SequenceVariation(org.nextprot.api.commons.bio.variation.prot.SequenceVariation) Test(org.junit.Test)

Example 38 with SequenceVariation

use of org.nextprot.api.commons.bio.variation.prot.SequenceVariation in project nextprot-api by calipho-sib.

the class SingleFeatureQuerySuccessImpl method addMappedFeature.

public void addMappedFeature(Isoform isoform, int firstIsoPosition, int lastIsoPosition) {
    IsoformFeatureResult result = new IsoformFeatureResult();
    result.setIsoformAccession(isoform.getUniqueName());
    result.setIsoformName(isoform.getMainEntityName().getName());
    result.setBeginIsoformPosition(firstIsoPosition);
    result.setEndIsoformPosition(lastIsoPosition);
    result.setCanonical(isoform.isCanonicalIsoform());
    result.setIsoSpecificFeature(feature.formatIsoSpecificFeature(isoform, firstIsoPosition, lastIsoPosition));
    GeneMasterCodonPosition firstCodonOnMaster = IsoformSequencePositionMapper.getCodonPositionsOnMaster(firstIsoPosition, isoform);
    GeneMasterCodonPosition lastCodonOnMaster = IsoformSequencePositionMapper.getCodonPositionsOnMaster(lastIsoPosition, isoform);
    if (firstCodonOnMaster.isValid() && lastCodonOnMaster.isValid()) {
        result.setBeginMasterPosition(firstCodonOnMaster.getNucleotidePosition(0));
        result.setEndMasterPosition(lastCodonOnMaster.getNucleotidePosition(2));
    }
    SequenceVariation proteinVariation = newIsoformSequenceVariation(feature.getProteinVariation(), firstIsoPosition, lastIsoPosition);
    setVariantSequenceBuildingInfos(result, isoform.getSequence(), proteinVariation);
    data.put(result.getIsoformAccession(), result);
}
Also used : GeneMasterCodonPosition(org.nextprot.api.core.utils.seqmap.GeneMasterCodonPosition) SequenceVariation(org.nextprot.api.commons.bio.variation.prot.SequenceVariation)

Example 39 with SequenceVariation

use of org.nextprot.api.commons.bio.variation.prot.SequenceVariation in project nextprot-api by calipho-sib.

the class IsoformMappingServiceImpl method propagate.

// TODO: refactor this method, it is too complex (probably a propagator object with strategy pattern for the mapping)
private void propagate(SingleFeatureQuerySuccessImpl successResults) throws ParseException {
    SingleFeatureQuery query = successResults.getQuery();
    query.setPropagableFeature(true);
    SequenceFeature isoFeature = successResults.getIsoformSequenceFeature();
    Isoform featureIsoform = isoFeature.getIsoform(successResults.getEntry());
    SequenceVariation variation = isoFeature.getProteinVariation();
    OriginalAminoAcids originalAminoAcids = getOriginalAminoAcids(featureIsoform.getSequence(), variation);
    GeneMasterCodonPosition originalFirstMasterCodonPos = IsoformSequencePositionMapper.getCodonPositionsOnMaster(originalAminoAcids.getFirstAAPos(), featureIsoform);
    GeneMasterCodonPosition originalLastMasterCodonPos = IsoformSequencePositionMapper.getCodonPositionsOnMaster(originalAminoAcids.getLastAAPos(), featureIsoform);
    // try to propagate the feature to other isoforms
    for (Isoform otherIsoform : IsoformUtils.getOtherIsoforms(successResults.getEntry(), featureIsoform.getIsoformAccession())) {
        Integer firstIsoPos = IsoformSequencePositionMapper.getProjectedPosition(featureIsoform, originalAminoAcids.getFirstAAPos(), otherIsoform);
        Integer lastIsoPos = IsoformSequencePositionMapper.getProjectedPosition(featureIsoform, originalAminoAcids.getLastAAPos(), otherIsoform);
        boolean propagable = false;
        if (firstIsoPos != null && lastIsoPos != null) {
            if (variation.getVaryingSequence().isMultipleAminoAcids()) {
                int originalSequenceLength = lastIsoPos - firstIsoPos + 1;
                int isoformSequenceLength = originalAminoAcids.getAas().length();
                if (originalSequenceLength == isoformSequenceLength) {
                    String isoformSequence = otherIsoform.getSequence().substring(firstIsoPos - 1, lastIsoPos);
                    if (isoformSequence.equals(originalAminoAcids.getAas())) {
                        GeneMasterCodonPosition firstMasterCodonPos = IsoformSequencePositionMapper.getCodonPositionsOnMaster(firstIsoPos, otherIsoform);
                        GeneMasterCodonPosition lastMasterCodonPos = IsoformSequencePositionMapper.getCodonPositionsOnMaster(lastIsoPos, otherIsoform);
                        propagable = firstMasterCodonPos.getNucleotidePosition(0).intValue() == originalFirstMasterCodonPos.getNucleotidePosition(0) && lastMasterCodonPos.getNucleotidePosition(2).intValue() == originalLastMasterCodonPos.getNucleotidePosition(2);
                    }
                }
            } else // check a single amino-acid
            {
                propagable = IsoformSequencePositionMapper.checkAminoAcidsFromPosition(otherIsoform, firstIsoPos, originalAminoAcids.getAas());
            }
        }
        if (propagable) {
            addPropagation(otherIsoform, firstIsoPos, lastIsoPos, originalAminoAcids.isExtensionTerminal(), successResults);
        } else {
            successResults.addUnmappedFeature(otherIsoform);
        }
    }
}
Also used : SingleFeatureQuery(org.nextprot.api.isoform.mapper.domain.SingleFeatureQuery) GeneMasterCodonPosition(org.nextprot.api.core.utils.seqmap.GeneMasterCodonPosition) SequenceVariation(org.nextprot.api.commons.bio.variation.prot.SequenceVariation) SequenceFeature(org.nextprot.api.isoform.mapper.domain.SequenceFeature) Isoform(org.nextprot.api.core.domain.Isoform)

Example 40 with SequenceVariation

use of org.nextprot.api.commons.bio.variation.prot.SequenceVariation in project nextprot-api by calipho-sib.

the class SequenceVariantTest method shouldExtractGeneNameAndProteinVariation2.

@Test
public void shouldExtractGeneNameAndProteinVariation2() throws Exception {
    SequenceVariant variant = new SequenceVariant("WT1-iso4-p.Phe154Ser");
    Assert.assertEquals("WT1", variant.getGeneName());
    SequenceVariation variation = variant.getProteinVariation();
    Assert.assertEquals("p.Phe154Ser", variant.getFormattedVariation());
    Assert.assertEquals(AminoAcidCode.PHENYLALANINE, variation.getVaryingSequence().getFirstAminoAcid());
    Assert.assertEquals(154, variation.getVaryingSequence().getFirstAminoAcidPos());
    Assert.assertTrue(variant.isValidGeneName(mockEntryWithGenes("WT1")));
}
Also used : SequenceVariation(org.nextprot.api.commons.bio.variation.prot.SequenceVariation) Test(org.junit.Test)

Aggregations

SequenceVariation (org.nextprot.api.commons.bio.variation.prot.SequenceVariation)88 Test (org.junit.Test)85 SequenceVariationImpl (org.nextprot.api.commons.bio.variation.prot.impl.SequenceVariationImpl)31 AminoAcidCode (org.nextprot.api.commons.bio.AminoAcidCode)18 Substitution (org.nextprot.api.commons.bio.variation.prot.impl.seqchange.Substitution)6 Ignore (org.junit.Ignore)2 Frameshift (org.nextprot.api.commons.bio.variation.prot.impl.seqchange.Frameshift)2 Isoform (org.nextprot.api.core.domain.Isoform)2 GeneMasterCodonPosition (org.nextprot.api.core.utils.seqmap.GeneMasterCodonPosition)2 SequenceFeature (org.nextprot.api.isoform.mapper.domain.SequenceFeature)1 SingleFeatureQuery (org.nextprot.api.isoform.mapper.domain.SingleFeatureQuery)1