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")));
}
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);
}
}
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());
}
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());
}
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());
}
Aggregations