use of org.nextprot.api.commons.bio.AminoAcidCode in project nextprot-api by calipho-sib.
the class InsertionHGVSFormat method parseWithMode.
@Override
public SequenceVariation parseWithMode(String source, SequenceVariationBuilder.FluentBuilding builder, ParsingMode mode) throws ParseException {
Matcher m = PATTERN.matcher(source);
if (m.matches()) {
AminoAcidCode affectedAAFirst = AminoAcidCode.parseAminoAcidCode(StringUtils.concat(m.group(1), m.group(2)));
int affectedAAPosFirst = Integer.parseInt(m.group(3));
AminoAcidCode affectedAALast = AminoAcidCode.parseAminoAcidCode(StringUtils.concat(m.group(4), m.group(5)));
int affectedAAPosLast = Integer.parseInt(m.group(6));
if (affectedAAPosLast != (affectedAAPosFirst + 1)) {
throw new ParseException("should contain two flanking residues, e.g. Lys23 and Leu24", 0);
}
AminoAcidCode[] insertedAAs = AminoAcidCode.valueOfAminoAcidCodeSequence(m.group(7));
return builder.selectAminoAcidRange(affectedAAFirst, affectedAAPosFirst, affectedAALast, affectedAAPosLast).thenInsert(insertedAAs).build();
}
return null;
}
use of org.nextprot.api.commons.bio.AminoAcidCode in project nextprot-api by calipho-sib.
the class SingleModificationBEDFormat method parse.
@Override
public SequenceVariation parse(String source, SequenceVariationBuilder.FluentBuilding builder) throws ParseException {
Matcher m = PATTERN.matcher(source);
if (m.matches()) {
AminoAcidModification aaChange = AminoAcidModification.valueOfAminoAcidModification(m.group(1));
AminoAcidCode affectedAA = AminoAcidCode.parseAminoAcidCode(m.group(2) + ((m.group(3) != null) ? m.group(3) : ""));
int affectedAAPos = Integer.parseInt(m.group(4));
return builder.selectAminoAcid(affectedAA, affectedAAPos).thenAddModification(aaChange).build();
}
return null;
}
use of org.nextprot.api.commons.bio.AminoAcidCode in project nextprot-api by calipho-sib.
the class DuplicationHGVSFormat method parseWithMode.
@Override
public SequenceVariation parseWithMode(String source, SequenceVariationBuilder.FluentBuilding builder, ParsingMode mode) throws ParseException {
Matcher m = PATTERN.matcher(source);
if (m.matches()) {
AminoAcidCode affectedAAFirst = AminoAcidCode.parseAminoAcidCode(StringUtils.concat(m.group(1), m.group(2)));
int affectedAAPosFirst = Integer.parseInt(m.group(3));
if (m.group(4) == null) {
return builder.selectAminoAcid(affectedAAFirst, affectedAAPosFirst).thenDuplicate().build();
}
AminoAcidCode affectedAALast = AminoAcidCode.parseAminoAcidCode(StringUtils.concat(m.group(4), m.group(5)));
int affectedAAPosLast = Integer.parseInt(m.group(6));
return builder.selectAminoAcidRange(affectedAAFirst, affectedAAPosFirst, affectedAALast, affectedAAPosLast).thenDuplicate().build();
}
return null;
}
use of org.nextprot.api.commons.bio.AminoAcidCode in project nextprot-api by calipho-sib.
the class DeletionInsertionHGVSFormat method parseWithMode.
@Override
public SequenceVariation parseWithMode(String source, SequenceVariationBuilder.FluentBuilding builder, ParsingMode mode) throws ParseException {
Matcher m = (mode == ParsingMode.STRICT) ? PATTERN.matcher(source) : PATTERN_PERMISSIVE.matcher(source);
if (m.matches()) {
AminoAcidCode affectedAAFirst = AminoAcidCode.parseAminoAcidCode(StringUtils.concat(m.group(1), m.group(2)));
int affectedAAPosFirst = Integer.parseInt(m.group(3));
AminoAcidCode[] insertedAAs = AminoAcidCode.valueOfAminoAcidCodeSequence(m.group(7));
if (m.group(4) == null) {
return builder.selectAminoAcid(affectedAAFirst, affectedAAPosFirst).thenDeleteAndInsert(insertedAAs).build();
}
AminoAcidCode affectedAALast = AminoAcidCode.parseAminoAcidCode(StringUtils.concat(m.group(4), m.group(5)));
int affectedAAPosLast = Integer.parseInt(m.group(6));
return builder.selectAminoAcidRange(affectedAAFirst, affectedAAPosFirst, affectedAALast, affectedAAPosLast).thenDeleteAndInsert(insertedAAs).build();
}
return null;
}
use of org.nextprot.api.commons.bio.AminoAcidCode in project nextprot-api by calipho-sib.
the class IsoformMappingServiceTest method shouldNotValidateIncorrectAAVariantIsoform.
@Test
public void shouldNotValidateIncorrectAAVariantIsoform() throws Exception {
FeatureQueryResult result = service.validateFeature(new SingleFeatureQuery("SCN11A-p.Met1158Pro", AnnotationCategory.VARIANT.getApiTypeName(), "NX_Q9UI33"));
SingleFeatureQuery query = Mockito.mock(SingleFeatureQuery.class);
when(query.getAccession()).thenReturn("NX_Q9UI33");
when(query.getFeature()).thenReturn("SCN11A-p.Met1158Pro");
assertIsoformFeatureNotValid((FeatureQueryFailure) result, new UnexpectedFeatureQueryAminoAcidException(query, 1158, new AminoAcidCode[] { AminoAcidCode.LEUCINE }, new AminoAcidCode[] { AminoAcidCode.METHIONINE }));
}
Aggregations