use of org.nextprot.api.core.domain.CvTerm in project nextprot-api by calipho-sib.
the class TerminologyService method findCvTermXrefAccessionList.
/**
* Get the list of xref(s) accession found for the specific database
*
* @param cvTermAccession the cvterm accession
* @param databaseName the database name of the
* @return a xref accessions list
*/
default List<String> findCvTermXrefAccessionList(String cvTermAccession, String databaseName) {
Preconditions.checkNotNull(cvTermAccession);
CvTerm term = findCvTermByAccession(cvTermAccession);
List<String> accessions = new ArrayList<>();
if (term != null && term.getXrefs() != null) {
return term.getXrefs().stream().filter(xref -> xref.getDatabaseName().equals(databaseName)).map(DbXref::getAccession).collect(Collectors.toList());
}
return accessions;
}
use of org.nextprot.api.core.domain.CvTerm in project nextprot-api by calipho-sib.
the class TerminologyServiceTest method shouldReturnAValidCategory.
@Test
public void shouldReturnAValidCategory() {
CvTerm term = this.terminologyService.findCvTermByAccession("DO-00861");
String propval = "";
for (CvTerm.TermProperty property : term.getProperties()) {
if (property.getPropertyName().equals("Feature category"))
propval = property.getPropertyValue();
}
assertEquals("zinc finger", propval);
}
use of org.nextprot.api.core.domain.CvTerm in project nextprot-api by calipho-sib.
the class TerminologyServiceTest method shouldReturnAUniprotKeywordId.
@Test
public void shouldReturnAUniprotKeywordId() {
CvTerm term = this.terminologyService.findCvTermByAccession("KW-0732");
assertEquals("UniprotKeywordCv", term.getOntology());
}
use of org.nextprot.api.core.domain.CvTerm in project nextprot-api by calipho-sib.
the class TerminologyServiceTest method shouldReturnAGOTerm.
@Test
public void shouldReturnAGOTerm() {
CvTerm term = this.terminologyService.findCvTermByAccession("GO:2000145");
// System.out.println(term.toString());
assertEquals("GoBiologicalProcessCv", term.getOntology());
assertEquals(2, term.getSynonyms().size());
}
use of org.nextprot.api.core.domain.CvTerm in project nextprot-api by calipho-sib.
the class TerminologyServiceTest method searchCvtermWithUndefinedXrefs.
// @Test
public void searchCvtermWithUndefinedXrefs() {
Map<String, List<String>> map = new HashMap<>();
// for (CvTerm cvTerm : terminologyService.findAllCVTerms()) {
for (CvTerm cvTerm : terminologyService.findCvTermsByOntology("UniprotPtmCv")) {
if (cvTerm.getXrefs() == null || cvTerm.getXrefs().isEmpty()) {
if (!map.containsKey(cvTerm.getOntology())) {
map.put(cvTerm.getOntology(), new ArrayList<>());
}
map.get(cvTerm.getOntology()).add(cvTerm.getAccession());
// System.err.println(cvTerm.getAccession()+"\t"+cvTerm.getOntology());
}
}
Collections.sort(map.get("UniprotPtmCv"));
System.out.println(map.get("UniprotPtmCv"));
}
Aggregations