Search in sources :

Example 1 with SequenceVariation

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

the class SequenceVariantTest method shouldExtractGeneNameAndProteinVariation.

@Test
public void shouldExtractGeneNameAndProteinVariation() throws Exception {
    SequenceVariant variant = new SequenceVariant("SCN11A-p.Lys1710Thr");
    Assert.assertEquals("SCN11A", variant.getGeneName());
    SequenceVariation variation = variant.getProteinVariation();
    Assert.assertEquals("p.Lys1710Thr", variant.getFormattedVariation());
    Assert.assertEquals(AminoAcidCode.LYSINE, variation.getVaryingSequence().getFirstAminoAcid());
    Assert.assertEquals(1710, variation.getVaryingSequence().getFirstAminoAcidPos());
    Assert.assertTrue(variant.isValidGeneName(mockEntryWithGenes("SCN11A", "SCN12A", "SNS2")));
}
Also used : SequenceVariation(org.nextprot.api.commons.bio.variation.prot.SequenceVariation) Test(org.junit.Test)

Example 2 with SequenceVariation

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

the class SequenceFeatureValidator method checkFeatureChangingAminoAcids.

/**
 * Check that first and last amino-acid(s) described by the feature exists on isoform sequence at given positions
 * Part of the contract a validator should implement to validate a feature on an isoform sequence.
 */
private void checkFeatureChangingAminoAcids(SequenceFeature sequenceFeature) throws FeatureQueryException {
    SequenceVariation variation = sequenceFeature.getProteinVariation();
    Isoform isoform = sequenceFeature.getIsoform(entry);
    // do check only position for STOP code
    if (sequenceFeature.getProteinVariation().getVaryingSequence().getFirstAminoAcid() == AminoAcidCode.STOP) {
        checkIsoformPos(isoform, variation.getVaryingSequence().getFirstAminoAcidPos() - 1, query, false);
    } else {
        checkIsoformPosAndAminoAcids(isoform, variation.getVaryingSequence().getFirstAminoAcidPos(), variation.getVaryingSequence().getFirstAminoAcid().get1LetterCode(), query);
    }
    if (sequenceFeature.getProteinVariation().getVaryingSequence().getLastAminoAcid() == AminoAcidCode.STOP) {
        checkIsoformPos(isoform, variation.getVaryingSequence().getLastAminoAcidPos() - 1, query, false);
    } else {
        checkIsoformPosAndAminoAcids(isoform, variation.getVaryingSequence().getLastAminoAcidPos(), variation.getVaryingSequence().getLastAminoAcid().get1LetterCode(), query);
    }
}
Also used : SequenceVariation(org.nextprot.api.commons.bio.variation.prot.SequenceVariation) Isoform(org.nextprot.api.core.domain.Isoform)

Example 3 with SequenceVariation

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

the class SequenceVariationImplTest method testBuildFrameshift.

@Test
public void testBuildFrameshift() throws Exception {
    SequenceVariation pm = new SequenceVariationImpl.FluentBuilding().selectAminoAcid(AminoAcidCode.METHIONINE, 682).thenFrameshift(AminoAcidCode.ALANINE, 2).build();
    Assert.assertEquals(AminoAcidCode.METHIONINE, pm.getVaryingSequence().getFirstAminoAcid());
    Assert.assertEquals(682, pm.getVaryingSequence().getFirstAminoAcidPos());
    Assert.assertEquals(AminoAcidCode.METHIONINE, pm.getVaryingSequence().getLastAminoAcid());
    Assert.assertEquals(682, pm.getVaryingSequence().getLastAminoAcidPos());
    Assert.assertTrue(pm.getSequenceChange() instanceof Frameshift);
    Assert.assertEquals(AminoAcidCode.ALANINE, ((Frameshift.Change) pm.getSequenceChange().getValue()).getChangedAminoAcid());
    Assert.assertEquals(2, ((Frameshift.Change) pm.getSequenceChange().getValue()).getNewTerminationPosition());
}
Also used : SequenceVariation(org.nextprot.api.commons.bio.variation.prot.SequenceVariation) Test(org.junit.Test)

Example 4 with SequenceVariation

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

the class SequenceVariationImplTest method testBuildAADeletion.

@Test
public void testBuildAADeletion() throws Exception {
    SequenceVariation pm = new SequenceVariationImpl.FluentBuilding().selectAminoAcid(AminoAcidCode.LYSINE, 73).thenDelete().build();
    Assert.assertEquals(AminoAcidCode.LYSINE, pm.getVaryingSequence().getFirstAminoAcid());
    Assert.assertEquals(73, pm.getVaryingSequence().getFirstAminoAcidPos());
    Assert.assertEquals(AminoAcidCode.LYSINE, pm.getVaryingSequence().getLastAminoAcid());
    Assert.assertEquals(73, pm.getVaryingSequence().getLastAminoAcidPos());
    Assert.assertTrue(pm.getSequenceChange() instanceof Deletion);
    Assert.assertNull(pm.getSequenceChange().getValue());
}
Also used : SequenceVariation(org.nextprot.api.commons.bio.variation.prot.SequenceVariation) Test(org.junit.Test)

Example 5 with SequenceVariation

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

the class SequenceVariationImplTest method testBuildDeletion1AaAndInsertion1.

@Test
public void testBuildDeletion1AaAndInsertion1() throws Exception {
    SequenceVariation pm = new SequenceVariationImpl.FluentBuilding().selectAminoAcid(AminoAcidCode.THREONINE, 399).thenDeleteAndInsert(AminoAcidCode.LEUCINE).build();
    Assert.assertEquals(AminoAcidCode.THREONINE, pm.getVaryingSequence().getFirstAminoAcid());
    Assert.assertEquals(399, pm.getVaryingSequence().getFirstAminoAcidPos());
    Assert.assertEquals(AminoAcidCode.THREONINE, pm.getVaryingSequence().getLastAminoAcid());
    Assert.assertEquals(399, pm.getVaryingSequence().getLastAminoAcidPos());
    Assert.assertTrue(pm.getSequenceChange() instanceof DeletionAndInsertion);
    Assert.assertArrayEquals(new AminoAcidCode[] { AminoAcidCode.LEUCINE }, (AminoAcidCode[]) pm.getSequenceChange().getValue());
}
Also used : SequenceVariation(org.nextprot.api.commons.bio.variation.prot.SequenceVariation) AminoAcidCode(org.nextprot.api.commons.bio.AminoAcidCode) 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