use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.
the class AnnotationTest method testHighAndLow.
@Test
public void testHighAndLow() {
Annotation a = new Annotation();
List<AnnotationEvidence> evidences = new ArrayList<>();
evidences.add(buildEvidence("high"));
evidences.add(buildEvidence("low"));
a.setEvidences(evidences);
Assert.assertTrue(a.isExpressionLevelDetected().isPresent());
Assert.assertTrue(a.isExpressionLevelDetected().get());
}
use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.
the class AnnotationTest method testEmptyExpressionLevel.
@Test
public void testEmptyExpressionLevel() {
Annotation a = new Annotation();
List<AnnotationEvidence> evidences = new ArrayList<>();
evidences.add(buildEvidence(""));
a.setEvidences(evidences);
Assert.assertTrue(a.isExpressionLevelDetected().isPresent());
Assert.assertTrue(!a.isExpressionLevelDetected().get());
}
use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.
the class AnnotationTest method testOneHigh.
@Test
public void testOneHigh() {
Annotation a = new Annotation();
List<AnnotationEvidence> evidences = new ArrayList<>();
evidences.add(buildEvidence("high"));
a.setEvidences(evidences);
Assert.assertTrue(a.isExpressionLevelDetected().isPresent());
}
use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.
the class EntryUtils method getFunctionInfoWithCanonicalFirst.
public static List<String> getFunctionInfoWithCanonicalFirst(Entry entry) {
List<String> fInfoCanonical = new ArrayList<String>();
List<String> fInfoNonCanonical = new ArrayList<String>();
List<Isoform> isos = entry.getIsoforms();
String canonicalIso = "";
// Get Id of the canonical (swissprotdisplayed) isoform
for (Isoform curriso : isos) if (curriso.isCanonicalIsoform()) {
canonicalIso = curriso.getUniqueName();
break;
}
// Get the function annotation and put it in the right basket
for (Annotation currannot : entry.getAnnotations()) {
if (currannot.getAPICategory().equals(AnnotationCategory.FUNCTION_INFO))
if (currannot.isSpecificForIsoform(canonicalIso))
fInfoCanonical.add(currannot.getDescription());
else
fInfoNonCanonical.add(currannot.getDescription());
}
// Merge the lists in a final unique list with canonical function first
// System.err.println("before: " + fInfoCanonical);
fInfoCanonical.addAll(fInfoNonCanonical);
// System.err.println("after: " + fInfoCanonical);
if (fInfoCanonical.size() == 0) {
Set<Annotation> goFuncSet = new TreeSet<>((e1, e2) -> {
// GOLD over SILVER, then GO_BP over GO_MF, then Alphabetic in term name cf: jira NEXTPROT-1238
int c;
c = e1.getQualityQualifier().compareTo(e2.getQualityQualifier());
if (c == 0)
c = e1.getCategory().compareTo(e2.getCategory());
if (c == 0)
c = e1.getCvTermName().compareTo(e2.getCvTermName());
return c;
});
List<Annotation> annots = entry.getAnnotations();
for (Annotation currannot : annots) {
String category = currannot.getCategory();
if (category.equals("go biological process") || category.equals("go molecular function")) {
goFuncSet.add(currannot);
}
}
int rescnt = 0;
for (Annotation resannot : goFuncSet) {
// Stick term's name in the returned list
if (// avoid unsignificant function if possible
resannot.getCvTermName().equals("protein binding") && goFuncSet.size() > 3)
continue;
if (// return max 3 first annotation descriptions
rescnt++ < 3)
fInfoCanonical.add(resannot.getCvTermName());
else
break;
}
}
return fInfoCanonical;
}
use of org.nextprot.api.core.domain.annotation.Annotation in project nextprot-api by calipho-sib.
the class PepXServiceImpl method findEntriesWithPeptides.
@Override
public List<Entry> findEntriesWithPeptides(String peptides, boolean modeIsoleucine) {
List<Entry> entries = new ArrayList<>();
PepXResponse pepXResponse = getPepXResponse(peptides, modeIsoleucine);
Set<String> entriesNames = pepXResponse.getEntriesNames();
for (String entryName : entriesNames) {
EntryConfig targetIsoconf = EntryConfig.newConfig(entryName).withTargetIsoforms().with("variant").withOverview().withoutAdditionalReferences().withoutProperties();
Entry entry = entryBuilderService.build(targetIsoconf);
List<Annotation> virtualAnnotations = new ArrayList<>();
Set<String> peptidesForEntry = pepXResponse.getPeptidesForEntry(entryName);
for (String peptide : peptidesForEntry) {
PepXEntryMatch pepxEntryMatch = pepXResponse.getPeptideMatch(peptide).getPepxMatchesForEntry(entryName);
if (pepxEntryMatch != null && pepxEntryMatch.getIsoforms() != null && pepxEntryMatch.getIsoforms().size() > 0) {
virtualAnnotations.addAll(buildEntryWithVirtualAnnotations(peptide, modeIsoleucine, pepxEntryMatch.getIsoforms(), entry.getAnnotations(), entry.getIsoforms()));
}
}
if ((virtualAnnotations != null) && (!virtualAnnotations.isEmpty())) {
Entry resultEntry = new Entry(entry.getUniqueName());
// Adds the overview as well
resultEntry.setOverview(entry.getOverview());
resultEntry.setAnnotations(virtualAnnotations);
entries.add(resultEntry);
}
}
// add peptide unicity extra info required to unicity checker and peptide viewer
updateAnnotationsWithPeptideProperties(entries);
return entries;
}
Aggregations