use of org.nextprot.api.commons.bio.AminoAcidCode in project nextprot-api by calipho-sib.
the class FrameshiftHGVSFormat method parseWithMode.
@Override
public SequenceVariation parseWithMode(String source, SequenceVariationBuilder.FluentBuilding builder, ParsingMode mode) throws ParseException {
Matcher m = PATTERN.matcher(source);
if (m.matches()) {
AminoAcidCode affectedAA = AminoAcidCode.parseAminoAcidCode(StringUtils.concat(m.group(1), m.group(2)));
int affectedAAPos = Integer.parseInt(m.group(3));
AminoAcidCode newAA = AminoAcidCode.parseAminoAcidCode(StringUtils.concat(m.group(4), m.group(5)));
int shift = Integer.parseInt(m.group(6));
if (shift <= 1)
throw new ParseException("the description of a frame shift variant can not contain " + "“fsTer1”, such a variant is a nonsense variant (see Substitution). The shortest frame shift variant " + "possible contains 'fsTer2' (see http://varnomen.hgvs.org/recommendations/protein/variant/frameshift/)", 0);
return builder.selectAminoAcid(affectedAA, affectedAAPos).thenFrameshift(newAA, shift).build();
}
return null;
}
use of org.nextprot.api.commons.bio.AminoAcidCode in project nextprot-api by calipho-sib.
the class SubstitutionHGVSFormat method parseWithMode.
@Override
public SequenceVariation parseWithMode(String source, SequenceVariationBuilder.FluentBuilding builder, ParsingMode mode) throws ParseException {
Matcher m = PATTERN.matcher(source);
if (m.matches()) {
AminoAcidCode affectedAA = AminoAcidCode.parseAminoAcidCode(StringUtils.concat(m.group(1), m.group(2)));
int affectedAAPos = Integer.parseInt(m.group(3));
AminoAcidCode substitutedAA = AminoAcidCode.parseAminoAcidCode(StringUtils.concat(m.group(4), m.group(5)));
return builder.selectAminoAcid(affectedAA, affectedAAPos).thenSubstituteWith(substitutedAA).build();
}
return null;
}
use of org.nextprot.api.commons.bio.AminoAcidCode in project nextprot-api by calipho-sib.
the class DeletionHGVSFormat 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));
if (m.group(4) == null) {
return builder.selectAminoAcid(affectedAAFirst, affectedAAPosFirst).thenDelete().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).thenDelete().build();
}
return null;
}
use of org.nextprot.api.commons.bio.AminoAcidCode in project nextprot-api by calipho-sib.
the class ExtensionInitiationHGVSFormat method parseWithMode.
@Override
public SequenceVariation parseWithMode(String source, SequenceVariationBuilder.FluentBuilding builder, ParsingMode mode) throws ParseException {
Matcher m = PATTERN.matcher(source);
if (m.matches()) {
AminoAcidCode newAminoAcid = AminoAcidCode.METHIONINE;
if (m.group(1) != null) {
newAminoAcid = AminoAcidCode.parseAminoAcidCode(m.group(1));
}
int newUpstreamPos = Integer.parseInt(m.group(2));
return builder.selectAminoAcid(AminoAcidCode.METHIONINE, 1).thenInitiationExtension(newUpstreamPos, newAminoAcid).build();
}
return null;
}
use of org.nextprot.api.commons.bio.AminoAcidCode in project nextprot-api by calipho-sib.
the class ExtensionTerminationHGVSFormat method parseWithMode.
@Override
public SequenceVariation parseWithMode(String source, SequenceVariationBuilder.FluentBuilding builder, ParsingMode mode) throws ParseException {
Matcher m = PATTERN.matcher(source);
if (m.matches()) {
int affectedStopPos = Integer.parseInt(m.group(1));
AminoAcidCode newAminoAcid = AminoAcidCode.parseAminoAcidCode(m.group(2));
int newDownstreamPos = Integer.parseInt(m.group(3));
return builder.selectAminoAcid(AminoAcidCode.STOP, affectedStopPos).thenTerminationExtension(newDownstreamPos, newAminoAcid).build();
}
return null;
}
Aggregations