Search in sources :

Example 31 with Isoform

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

the class StatementTranformerServiceImpl method getIsoAccession.

private String getIsoAccession(String featureName, String entryAccession) {
    SequenceVariant sv;
    try {
        sv = new SequenceVariant(featureName);
    } catch (ParseException e) {
        throw new NextProtException(e);
    }
    List<Isoform> isoforms = isoformService.findIsoformsByEntryName(entryAccession);
    Isoform isoSpecific = IsoformUtils.getIsoformByName(isoforms, sv.getIsoformName());
    return isoSpecific.getIsoformAccession();
}
Also used : SequenceVariant(org.nextprot.api.isoform.mapper.domain.impl.SequenceVariant) NextProtException(org.nextprot.api.commons.exception.NextProtException) Isoform(org.nextprot.api.core.domain.Isoform) ParseException(java.text.ParseException)

Example 32 with Isoform

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

the class PeptideMappingServiceIntegrationTest method shouldComputeHTML4Highlight.

@Ignore
@Test
public void shouldComputeHTML4Highlight() throws FileNotFoundException {
    // List<String>entryNames = Arrays.asList(new String[]{"NX_Q8IYL9", "NX_Q66K66", "NX_P01308"});
    // List<String>entryNames = miService.findUniqueNamesOfChromosome("Y");
    // liste Monique
    List<String> entryNames = Arrays.asList(new String[] { "NX_Q6UWW9", "NX_Q04118", "NX_P48165", "NX_P01308", "NX_Q13557" });
    StringBuilder sb = new StringBuilder();
    sb.append("<html><body>\n");
    sb.append("<ul>");
    // sb.append("<span style=\"color:" + chunk.code  + "\">");
    sb.append("<li style=\"color:" + COLOR_NOT_COVERED + "\">" + COLOR_NOT_COVERED + ": no peptide</li>");
    sb.append("<li style=\"color:" + COLOR_PEP_COVERED + "\">" + COLOR_PEP_COVERED + ": peptide</li>");
    sb.append("<li style=\"color:" + COLOR_1_TYPIC_COVERED + "\">" + COLOR_1_TYPIC_COVERED + ": single proteotypic</li>");
    sb.append("<li style=\"color:" + COLOR_N_TYPIC_COVERED + "\">" + COLOR_N_TYPIC_COVERED + ": multiple proteotypic</li>");
    sb.append("</ul>");
    for (String entryName : entryNames) {
        List<Annotation> annotations = this.pmService.findNaturalPeptideMappingAnnotationsByMasterUniqueName(entryName);
        List<Isoform> isoforms = isoService.findIsoformsByEntryName(entryName);
        for (Isoform iso : isoforms) {
            String cpep = computeCoverage(iso, annotations, false, false);
            String ctyp = computeCoverage(iso, annotations, true, false);
            String html = getHighlightHTML(iso, annotations, cpep, ctyp);
            sb.append(html);
        }
    }
    sb.append("</body></html>\n");
    String filename = "./highlight-coverage-peptide-chromosome-y.html";
    PrintWriter out = new PrintWriter(filename);
    out.print(sb.toString());
    out.close();
    System.out.println("Wrote result in file " + filename);
}
Also used : Isoform(org.nextprot.api.core.domain.Isoform) Annotation(org.nextprot.api.core.domain.annotation.Annotation) PrintWriter(java.io.PrintWriter) Ignore(org.junit.Ignore) CoreUnitBaseTest(org.nextprot.api.core.test.base.CoreUnitBaseTest) Test(org.junit.Test)

Example 33 with Isoform

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

the class ByIsoformPositionComparatorTest method mockIsoform.

private static Isoform mockIsoform(boolean isCanonical) {
    Isoform isoform = Mockito.mock(Isoform.class);
    when(isoform.isCanonicalIsoform()).thenReturn(isCanonical);
    return isoform;
}
Also used : Isoform(org.nextprot.api.core.domain.Isoform)

Example 34 with Isoform

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

the class DbXrefServiceImpl method newAnnotationIsoformSpecificityList.

// build isoform specificity from isoforms and annotations and link them to annotations
private List<AnnotationIsoformSpecificity> newAnnotationIsoformSpecificityList(List<Isoform> isoforms, Annotation xrefAnnotation) {
    List<AnnotationIsoformSpecificity> isospecs = new ArrayList<>();
    for (Isoform iso : isoforms) {
        AnnotationIsoformSpecificity isospec = new AnnotationIsoformSpecificity();
        isospec.setAnnotationId(xrefAnnotation.getAnnotationId());
        // According to PAM on Tuesday th 16th in the presence of Pascale and Frederic Nikitin
        isospec.setFirstPosition(null);
        isospec.setLastPosition(null);
        isospec.setIsoformAccession(iso.getIsoformAccession());
        isospec.setSpecificity("UNKNOWN");
        isospecs.add(isospec);
    }
    return isospecs;
}
Also used : AnnotationIsoformSpecificity(org.nextprot.api.core.domain.annotation.AnnotationIsoformSpecificity) Isoform(org.nextprot.api.core.domain.Isoform)

Example 35 with Isoform

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

the class DbXrefServiceImpl method convertXrefsIntoAnnotations.

private List<Annotation> convertXrefsIntoAnnotations(List<DbXref> xrefs, String entryName) {
    List<Isoform> isoforms = isoService.findIsoformsByEntryName(entryName);
    List<Annotation> xrefAnnotations = new ArrayList<>();
    for (DbXref xref : xrefs) {
        xrefAnnotations.add(convertXrefIntoAnnotation(xref, entryName, isoforms));
    }
    return xrefAnnotations;
}
Also used : PublicationDbXref(org.nextprot.api.core.domain.PublicationDbXref) DbXref(org.nextprot.api.core.domain.DbXref) Isoform(org.nextprot.api.core.domain.Isoform) Annotation(org.nextprot.api.core.domain.annotation.Annotation) Xref2Annotation(org.nextprot.api.commons.constants.Xref2Annotation)

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