Search in sources :

Example 21 with Isoform

use of org.nextprot.api.core.domain.Isoform in project nextprot-api by calipho-sib.

the class SequenceVariantTest method testFormatIsoformSpecifiqueFeatureTypeNonIsoWithSpace.

@Test
public void testFormatIsoformSpecifiqueFeatureTypeNonIsoWithSpace() throws Exception {
    SequenceVariant variant = new SequenceVariant("GTF2A1-p.Gln13Thr");
    Isoform iso = mockIsoform("whatever", "37 kDa", true);
    Assert.assertEquals("iso37_kDa", variant.formatIsoformFeatureName(iso));
}
Also used : Isoform(org.nextprot.api.core.domain.Isoform) Test(org.junit.Test)

Example 22 with Isoform

use of org.nextprot.api.core.domain.Isoform in project nextprot-api by calipho-sib.

the class StatementETLBaseUnitTest method mockIsoform.

private Isoform mockIsoform(String accession, String name, boolean canonical) {
    Isoform isoform = Mockito.mock(Isoform.class);
    when(isoform.getUniqueName()).thenReturn(accession);
    when(isoform.getIsoformAccession()).thenReturn(accession);
    when(isoform.isCanonicalIsoform()).thenReturn(canonical);
    EntityName entityName = Mockito.mock(EntityName.class);
    when(entityName.getName()).thenReturn(name);
    when(isoform.getMainEntityName()).thenReturn(entityName);
    return isoform;
}
Also used : EntityName(org.nextprot.api.core.domain.EntityName) Isoform(org.nextprot.api.core.domain.Isoform)

Example 23 with Isoform

use of org.nextprot.api.core.domain.Isoform in project nextprot-api by calipho-sib.

the class StatementETLBaseUnitTest method init.

@Before
public void init() {
    MockitoAnnotations.initMocks(this);
    mockIsoMapperService();
    List<Isoform> isoformsNX_P43246 = Arrays.asList(mockIsoform("NX_P43246-1", "Iso 1", true), mockIsoform("NX_P43246-2", "Iso 2", true));
    List<Isoform> isoformsNX_P52701 = Arrays.asList(mockIsoform("NX_P52701-1", "GTBP-N", true), mockIsoform("NX_P52701-2", "GTBP-alt", false), mockIsoform("NX_P52701-3", "Iso 3", false), mockIsoform("NX_P52701-4", "Iso 4", false));
    List<Isoform> isoformsNX_Q15858 = Arrays.asList(mockIsoform("NX_Q15858-1", "Iso 1", true), mockIsoform("NX_Q15858-2", "Iso 2", false), mockIsoform("NX_Q15858-3", "Iso 3", false), mockIsoform("NX_Q15858-4", "Iso 4", false));
    Mockito.when(isoformService.findIsoformsByEntryName("NX_P43246")).thenReturn(isoformsNX_P43246);
    Mockito.when(isoformService.findIsoformsByEntryName("NX_P52701")).thenReturn(isoformsNX_P52701);
    Mockito.when(isoformService.findIsoformsByEntryName("NX_Q15858")).thenReturn(isoformsNX_Q15858);
    statementETLServiceMocked = new StatementETLServiceImpl();
    transformerMockedService = new StatementTranformerServiceImpl();
    transformerMockedService.setIsoformMappingService(new IsoformMappingLocalMockImpl());
    transformerMockedService.setIsoformService(isoformService);
    statementETLServiceMocked.setStatementTransformerService(transformerMockedService);
}
Also used : StatementETLServiceImpl(org.nextprot.api.etl.service.impl.StatementETLServiceImpl) Isoform(org.nextprot.api.core.domain.Isoform) IsoformMappingLocalMockImpl(org.nextprot.api.etl.service.impl.IsoformMappingLocalMockImpl) StatementTranformerServiceImpl(org.nextprot.api.etl.service.impl.StatementTranformerServiceImpl) Before(org.junit.Before)

Example 24 with Isoform

use of org.nextprot.api.core.domain.Isoform 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);
    }
}
Also used : SequenceVariation(org.nextprot.api.commons.bio.variation.prot.SequenceVariation) Isoform(org.nextprot.api.core.domain.Isoform)

Example 25 with Isoform

use of org.nextprot.api.core.domain.Isoform in project nextprot-api by calipho-sib.

the class IsoformUtilsTest method createIsoforms.

private List<Isoform> createIsoforms(String... mainNames) {
    List<Isoform> list = new ArrayList<>();
    for (String mainName : mainNames) {
        Isoform isoform = new Isoform();
        EntityName name = new EntityName();
        name.setName(mainName);
        isoform.setMainEntityName(name);
        list.add(isoform);
    }
    return list;
}
Also used : EntityName(org.nextprot.api.core.domain.EntityName) ArrayList(java.util.ArrayList) Isoform(org.nextprot.api.core.domain.Isoform)

Aggregations

Isoform (org.nextprot.api.core.domain.Isoform)44 Test (org.junit.Test)19 Annotation (org.nextprot.api.core.domain.annotation.Annotation)17 PepXIsoformMatch (org.nextprot.api.web.domain.PepXResponse.PepXIsoformMatch)8 Entry (org.nextprot.api.core.domain.Entry)7 CoreUnitBaseTest (org.nextprot.api.core.test.base.CoreUnitBaseTest)7 ArrayList (java.util.ArrayList)6 NextProtException (org.nextprot.api.commons.exception.NextProtException)6 WebUnitBaseTest (org.nextprot.api.web.dbunit.base.mvc.WebUnitBaseTest)6 AnnotationIsoformSpecificity (org.nextprot.api.core.domain.annotation.AnnotationIsoformSpecificity)4 Ignore (org.junit.Ignore)3 EntityName (org.nextprot.api.core.domain.EntityName)3 java.util (java.util)2 Collectors (java.util.stream.Collectors)2 SequenceVariation (org.nextprot.api.commons.bio.variation.prot.SequenceVariation)2 Interaction (org.nextprot.api.core.domain.Interaction)2 AnnotationVariant (org.nextprot.api.core.domain.annotation.AnnotationVariant)2 IsoformService (org.nextprot.api.core.service.IsoformService)2 BinaryInteraction2Annotation (org.nextprot.api.core.utils.BinaryInteraction2Annotation)2 SingleFeatureQuery (org.nextprot.api.isoform.mapper.domain.SingleFeatureQuery)2