Search in sources :

Example 66 with DbXref

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

the class EntryPageServiceImpl method filterXrefInPageView.

@Override
public Entry filterXrefInPageView(String entryName, String pageViewName) {
    Entry entry = entryBuilderService.build(EntryConfig.newConfig(entryName).withEverything());
    PageView pageView = PageViewFactory.valueOf(pageViewName.toUpperCase()).getPageView();
    List<DbXref> xrefs = pageView.getFurtherExternalLinksXrefs(entry);
    entry.setXrefs(xrefs);
    entry.setAnnotations(Collections.emptyList());
    entry.setPublications(Collections.emptyList());
    entry.setExperimentalContexts(Collections.emptyList());
    entry.setIdentifiers(Collections.emptyList());
    entry.setInteractions(Collections.emptyList());
    entry.setEnzymes(Collections.emptyList());
    return entry;
}
Also used : PageView(org.nextprot.api.core.domain.ui.page.PageView) DbXref(org.nextprot.api.core.domain.DbXref) Entry(org.nextprot.api.core.domain.Entry) ValidEntry(org.nextprot.api.core.service.annotation.ValidEntry)

Example 67 with DbXref

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

the class CvTermSolrIndexer method convertToSolrDocument.

@Override
public SolrInputDocument convertToSolrDocument(CvTerm terminology) {
    String ontology = terminology.getOntology();
    if (// CaliphoMisc-194, ignore this ontology
    ontology.equals("OrganelleCv"))
        // CaliphoMisc-194, ignore this ontology
        return null;
    else if (// CaliphoMisc-194, ignore this ontology
    ontology.equals("NextprotAnnotationCv"))
        // CaliphoMisc-194, ignore this ontology
        return null;
    else if (ontology.equals("UniprotFamilyCv"))
        return null;
    SolrInputDocument doc = new SolrInputDocument();
    doc.addField("id", terminology.getId());
    doc.addField("ac", terminology.getAccession());
    String filters = terminology.getOntologyAltname().replaceAll("[ _-]", "").toLowerCase().replaceAll("uniprot", "up").replaceAll("nextprot", "aanp");
    doc.addField("filters", filters);
    doc.addField("name", terminology.getName());
    doc.addField("name_s", terminology.getName().toLowerCase());
    doc.addField("description", terminology.getDescription());
    List<String> synonstrings = terminology.getSynonyms();
    if (synonstrings != null) {
        int i = synonstrings.size();
        StringBuilder sb = new StringBuilder();
        for (String syn : synonstrings) {
            sb.append(syn);
            if (--i != 0)
                sb.append(" | ");
        }
        doc.addField("synonyms", sb.toString());
    }
    List<CvTerm.TermProperty> properties = terminology.getProperties();
    if (properties != null) {
        doc.addField("properties", TerminologyUtils.convertPropertiesToString(properties));
    }
    List<DbXref> xrefs = terminology.getXrefs();
    // If filter is needed alternatively use: terminology.getFilteredXrefs(String category)
    if (xrefs != null) {
        doc.addField("other_xrefs", TerminologyUtils.convertXrefsToSolrString(xrefs));
    }
    return doc;
}
Also used : DbXref(org.nextprot.api.core.domain.DbXref) SolrInputDocument(org.apache.solr.common.SolrInputDocument)

Example 68 with DbXref

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

the class DbXrefDaoImpl method findEntryIdentifierXrefs.

@Override
public Set<DbXref> findEntryIdentifierXrefs(String entryName) {
    SqlParameterSource namedParams = new MapSqlParameterSource("uniqueName", entryName);
    List<DbXref> xrefs = new NamedParameterJdbcTemplate(dsLocator.getDataSource()).query(sqlDictionary.getSQLQuery("dbxref-by-master-via-identifiers"), namedParams, new DbXRefRowMapper(entryName));
    return new HashSet<>(xrefs);
}
Also used : DbXref(org.nextprot.api.core.domain.DbXref) PublicationDbXref(org.nextprot.api.core.domain.PublicationDbXref) MapSqlParameterSource(org.springframework.jdbc.core.namedparam.MapSqlParameterSource) SqlParameterSource(org.springframework.jdbc.core.namedparam.SqlParameterSource) MapSqlParameterSource(org.springframework.jdbc.core.namedparam.MapSqlParameterSource) NamedParameterJdbcTemplate(org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate)

Example 69 with DbXref

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

the class DbXrefDaoImpl method findEntryInteractionInteractantsXrefs.

@Override
public Set<DbXref> findEntryInteractionInteractantsXrefs(String entryName) {
    SqlParameterSource namedParams = new MapSqlParameterSource("uniqueName", entryName);
    List<DbXref> xrefs = new NamedParameterJdbcTemplate(dsLocator.getDataSource()).query(sqlDictionary.getSQLQuery("dbxref-by-master-via-interactions-interactants"), namedParams, new DbXRefRowMapper(entryName));
    return new HashSet<>(xrefs);
}
Also used : DbXref(org.nextprot.api.core.domain.DbXref) PublicationDbXref(org.nextprot.api.core.domain.PublicationDbXref) MapSqlParameterSource(org.springframework.jdbc.core.namedparam.MapSqlParameterSource) SqlParameterSource(org.springframework.jdbc.core.namedparam.SqlParameterSource) MapSqlParameterSource(org.springframework.jdbc.core.namedparam.MapSqlParameterSource) NamedParameterJdbcTemplate(org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate)

Example 70 with DbXref

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

the class DbXrefDaoImpl method findAntibodyXrefs.

@Override
public Set<DbXref> findAntibodyXrefs(List<Long> ids) {
    SqlParameterSource namedParams = new MapSqlParameterSource("ids", ids);
    List<DbXref> xrefs = new NamedParameterJdbcTemplate(dsLocator.getDataSource()).query(sqlDictionary.getSQLQuery("dbxref-by-antibody-ids"), namedParams, new DbXRefRowMapper());
    return new HashSet<>(xrefs);
}
Also used : DbXref(org.nextprot.api.core.domain.DbXref) PublicationDbXref(org.nextprot.api.core.domain.PublicationDbXref) MapSqlParameterSource(org.springframework.jdbc.core.namedparam.MapSqlParameterSource) SqlParameterSource(org.springframework.jdbc.core.namedparam.SqlParameterSource) MapSqlParameterSource(org.springframework.jdbc.core.namedparam.MapSqlParameterSource) NamedParameterJdbcTemplate(org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate)

Aggregations

DbXref (org.nextprot.api.core.domain.DbXref)146 Test (org.junit.Test)118 PublicationDbXref (org.nextprot.api.core.domain.PublicationDbXref)12 MapSqlParameterSource (org.springframework.jdbc.core.namedparam.MapSqlParameterSource)7 NamedParameterJdbcTemplate (org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate)7 SqlParameterSource (org.springframework.jdbc.core.namedparam.SqlParameterSource)7 DbXrefConverterTest.createDbXref (org.nextprot.api.core.service.dbxref.conv.DbXrefConverterTest.createDbXref)5 Entry (org.nextprot.api.core.domain.Entry)4 Xref2Annotation (org.nextprot.api.commons.constants.Xref2Annotation)3 AnnotationEvidence (org.nextprot.api.core.domain.annotation.AnnotationEvidence)3 DbXrefURLResolverDelegateTest (org.nextprot.api.core.service.dbxref.resolver.DbXrefURLResolverDelegateTest)3 CoreUnitBaseTest (org.nextprot.api.core.test.base.CoreUnitBaseTest)3 WebIntegrationBaseTest (org.nextprot.api.web.dbunit.base.mvc.WebIntegrationBaseTest)3 ImmutableList (com.google.common.collect.ImmutableList)2 Isoform (org.nextprot.api.core.domain.Isoform)2 Annotation (org.nextprot.api.core.domain.annotation.Annotation)2 PageView (org.nextprot.api.core.domain.ui.page.PageView)2 EnsemblXrefPropertyConverter (org.nextprot.api.core.service.dbxref.conv.EnsemblXrefPropertyConverter)2 Preconditions (com.google.common.base.Preconditions)1 Multimap (com.google.common.collect.Multimap)1