use of org.nextprot.api.isoform.mapper.domain.SingleFeatureQuery in project nextprot-api by calipho-sib.
the class IsoformMappingLocalMockImpl method main.
public static void main(String[] args) {
IsoformMappingLocalMockImpl mi = new IsoformMappingLocalMockImpl();
FeatureQueryResult fq = mi.propagateFeature(new SingleFeatureQuery("SCN9A-iso3-p.Met932Leu", "variant", null));
}
use of org.nextprot.api.isoform.mapper.domain.SingleFeatureQuery 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);
}
}
}
use of org.nextprot.api.isoform.mapper.domain.SingleFeatureQuery in project nextprot-api by calipho-sib.
the class IsoformMappingServiceTest method shouldValidateWithNullAccession.
@Test
public void shouldValidateWithNullAccession() throws Exception {
FeatureQueryResult result = service.validateFeature(new SingleFeatureQuery("SCN11A-p.Leu1158Pro", AnnotationCategory.VARIANT.getApiTypeName(), null));
assertIsoformFeatureValid(result, "NX_Q9UI33-1", 1158, 1158, true);
Assert.assertEquals("NX_Q9UI33", result.getQuery().getAccession());
}
use of org.nextprot.api.isoform.mapper.domain.SingleFeatureQuery in project nextprot-api by calipho-sib.
the class IsoformMappingServiceTest method shouldPropagateVariantToAllValidIsoforms.
@Test
public void shouldPropagateVariantToAllValidIsoforms() throws Exception {
FeatureQueryResult result = service.propagateFeature(new SingleFeatureQuery("SCN11A-p.Lys1710Thr", AnnotationCategory.VARIANT.getApiTypeName(), "NX_Q9UI33"));
assertIsoformFeatureValid(result, "NX_Q9UI33-1", 1710, 1710, true);
assertIsoformFeatureValid(result, "NX_Q9UI33-2", null, null, false);
assertIsoformFeatureValid(result, "NX_Q9UI33-3", 1672, 1672, true);
}
use of org.nextprot.api.isoform.mapper.domain.SingleFeatureQuery in project nextprot-api by calipho-sib.
the class IsoformMappingServiceTest method shouldMap2IsoformsContainingLastAA.
@Test
public void shouldMap2IsoformsContainingLastAA() throws Exception {
SingleFeatureQuery query = new SingleFeatureQuery("SDHD-p.*160Leuext*3", AnnotationCategory.VARIANT.getApiTypeName(), "");
FeatureQueryResult result = service.propagateFeature(query);
assertIsoformFeatureValid(result, "NX_O14521-1", 160, 160, true);
assertIsoformFeatureValid(result, "NX_O14521-2", 121, 121, true);
assertIsoformFeatureValid(result, "NX_O14521-3", null, null, false);
assertIsoformFeatureValid(result, "NX_O14521-4", null, null, false);
}
Aggregations