use of org.nextprot.api.core.domain.Isoform in project nextprot-api by calipho-sib.
the class IsoformUtilsTest method testGetOtherIsoforms.
@Test
public void testGetOtherIsoforms() throws Exception {
Entry entry = entryBuilderService.build(EntryConfig.newConfig("NX_P01308").withTargetIsoforms());
Isoform isoform = entry.getIsoforms().get(0);
Assert.assertTrue(IsoformUtils.getOtherIsoforms(entry, isoform.getUniqueName()).isEmpty());
}
use of org.nextprot.api.core.domain.Isoform in project nextprot-api by calipho-sib.
the class BlastServiceImpl method blastIsoformSequence.
@Override
public BlastProgramOutput blastIsoformSequence(BlastIsoformInput params) {
String isoformAccession = params.getIsoformAccession();
String entryAccession = isoformAccession.split("-")[0];
try {
Isoform isoform = getIsoform(isoformAccession, entryAccession);
params.setSequence(isoform.getSequence());
params.validateSequencePositions();
params.setSequence(params.getSequence().substring(params.getBeginPos() - 1, params.getEndPos()));
params.setTitle(buildTitle(params, isoform, entryAccession));
params.setEntryAccession(entryAccession);
Description queryDescription = new Description();
blastResultUpdaterService.updateDescription(queryDescription, isoformAccession, entryAccession);
params.setDescription(queryDescription);
return blastProteinSequence(params);
} catch (ExceptionWithReason exceptionWithReason) {
return new BlastProgramFailure(params, exceptionWithReason);
}
}
use of org.nextprot.api.core.domain.Isoform in project nextprot-api by calipho-sib.
the class IsoformSequencePositionMapperIntegrationTest method getErrorsDuringPropagationOnVariantsOfSingleEntry.
public int getErrorsDuringPropagationOnVariantsOfSingleEntry(String entry_ac) throws Exception {
Entry entry = entryBuilderService.build(EntryConfig.newConfig(entry_ac).withTargetIsoforms().withAnnotations());
int delCount = 0;
int subCount = 0;
int insCount = 0;
int otherCount = 0;
int errorCount = 0;
for (Annotation a : entry.getAnnotations()) {
if (a.getAPICategory().equals(AnnotationCategory.VARIANT)) {
// for each variant annotation
String ori = a.getVariant().getOriginal();
String mut = a.getVariant().getVariant();
if (ori.length() == 1 && mut.length() == 1) {
subCount++;
} else if (ori.length() == 1 && mut.length() == 0) {
delCount++;
} else if (ori.length() == 0 && mut.length() == 1) {
insCount++;
} else if (sout) {
System.out.println("Other variant:" + a.getUniqueName());
otherCount++;
}
Map<String, Integer> isoExpectedPos = getExpectedPosForEachIsoform(entry, a);
printExpectedPosForEachIsoform(isoExpectedPos, a);
boolean errorOnVariant = false;
for (String iso1name : isoExpectedPos.keySet()) {
Integer iso1ExpectedPos = isoExpectedPos.get(iso1name);
Isoform iso1 = IsoformUtils.getIsoformByName(entry, iso1name);
if (iso1ExpectedPos != null) {
GeneMasterCodonPosition nuPos = IsoformSequencePositionMapper.getCodonPositionsOnMaster(iso1ExpectedPos, iso1);
if (!nuPos.isValid()) {
errorOnVariant = true;
if (sout)
System.out.println("ERROR1: codon positions not found for " + iso1name + " for variant at position: " + iso1ExpectedPos);
continue;
}
printIsoLengthAndRangesNuCount(iso1.getUniqueName(), iso1.getSequence(), iso1.getMasterMapping());
if (sout) {
System.out.println("Starting variant propagation from isoform " + iso1name + " at position " + iso1ExpectedPos);
System.out.println(getSequenceWithHighlighedPos(iso1.getSequence(), iso1ExpectedPos));
}
for (Isoform iso2 : entry.getIsoforms()) {
String iso2name = iso2.getUniqueName();
if (iso2name.equals(iso1name))
continue;
CodonNucleotideIndices nuIdx = IsoformSequencePositionMapper.getCodonNucleotideIndices(nuPos, iso2);
Integer iso2ActualPos = nuIdx.getAminoAcidPosition();
Integer iso2ExpectedPos = isoExpectedPos.get(iso2name);
if (sout)
System.out.println("Variant " + a.getUniqueName() + " position on isoform " + iso2name + " is " + iso2ActualPos);
printIsoLengthAndRangesNuCount(iso2.getUniqueName(), iso2.getSequence(), iso2.getMasterMapping());
if (iso2ExpectedPos != null)
if (sout)
System.out.println("Expected:" + getSequenceWithHighlighedPos(iso2.getSequence(), iso2ExpectedPos));
if (iso2ActualPos != null)
if (sout)
System.out.println("Actual :" + getSequenceWithHighlighedPos(iso2.getSequence(), iso2ActualPos));
if (iso2ActualPos == null && iso2ExpectedPos == null) {
// OK
} else if (iso2ActualPos == null || iso2ExpectedPos == null) {
errorOnVariant = true;
if (sout)
System.out.println("ERROR2: variant position on isoform " + iso2name + " is " + iso2ActualPos + ", expected " + iso2ExpectedPos);
} else if (!iso2ActualPos.equals(iso2ExpectedPos)) {
errorOnVariant = true;
if (sout)
System.out.println("ERROR3: variant position on isoform " + iso2name + " is " + iso2ActualPos + ", expected " + iso2ExpectedPos);
}
}
}
}
if (errorOnVariant)
errorCount++;
if (errorOnVariant)
break;
}
}
if (sout) {
System.out.println("Summary " + entry.getUniqueName());
System.out.println("insCount:" + insCount);
System.out.println("delCount:" + delCount);
System.out.println("subCount:" + subCount);
System.out.println("otherCount:" + otherCount);
System.out.println("errorCount:" + errorCount);
}
return errorCount;
}
use of org.nextprot.api.core.domain.Isoform in project nextprot-api by calipho-sib.
the class IsoformPEFFHeaderBuilderTest method newIsoformPEFFHeaderBuilder.
private IsoformPEFFHeaderBuilder newIsoformPEFFHeaderBuilder(String isoName) {
String entryAccession = isoformService.findEntryAccessionFromIsoformAccession(isoName);
Isoform isoform = isoformService.findIsoform(isoName);
List<Annotation> isoformAnnotations = annotationService.findAnnotations(entryAccession).stream().filter(annotation -> annotation.isSpecificForIsoform(isoName)).collect(Collectors.toList());
Overview overview = overviewService.findOverviewByEntry(entryAccession);
return new IsoformPEFFHeaderBuilder(isoform, isoformAnnotations, overview, terminologyService::findPsiModAccession, terminologyService::findPsiModName);
}
use of org.nextprot.api.core.domain.Isoform in project nextprot-api by calipho-sib.
the class IsoformUtilsTest method testGetOtherIsoforms2.
@Test
public void testGetOtherIsoforms2() throws Exception {
Entry entry = entryBuilderService.build(EntryConfig.newConfig("NX_Q9UI33").withTargetIsoforms());
List<Isoform> others = IsoformUtils.getOtherIsoforms(entry, "NX_Q9UI33-1");
Assert.assertEquals(2, others.size());
for (Isoform isoform : others) {
Assert.assertTrue(isoform.getUniqueName().equals("NX_Q9UI33-2") || isoform.getUniqueName().equals("NX_Q9UI33-3"));
}
}
Aggregations