use of org.nextprot.api.core.domain.Entry in project nextprot-api by calipho-sib.
the class GenerateSolrAnnotationIndexGold method start.
@Override
public void start(String[] args) {
MasterIdentifierService MasterEntryService = getBean(MasterIdentifierService.class);
EntryBuilderService entryBuilderService = getBean(EntryBuilderService.class);
int ecnt = 0;
String solrServer = System.getProperty("solr.server");
NPreconditions.checkNotNull(solrServer, "Please set solr.server variable. For example: java -Dsolr.server=\"http://localhost:8983/solr/npentries1gold\"");
logger.info("Solr server: " + solrServer);
EntryGoldSolrIndexer indexer = new EntryGoldSolrIndexer(solrServer);
// Get an access to some needed services
indexer.setTerminologyservice(getBean(TerminologyService.class));
indexer.setEntryBuilderService(getBean(EntryBuilderService.class));
// Remove previous indexes
logger.info("removing all solr entries records");
indexer.clearDatabase("");
Set<String> allentryids;
System.err.println("getting all entries from API");
logger.info("getting all entries from API");
long start = System.currentTimeMillis();
allentryids = MasterEntryService.findUniqueNames();
System.err.println("indexing " + allentryids.size() + " entries...");
logger.info("indexing " + allentryids.size() + " entries...");
for (String id : allentryids) {
ecnt++;
Entry currentry = entryBuilderService.buildWithEverything(id);
indexer.add(currentry);
if ((ecnt % 1000) == 0)
logger.info(ecnt + " entries GOLD-indexed...");
}
indexer.addRemaing();
logger.info("comitting");
indexer.commit();
logger.info(ecnt + " entries GOLD-indexed in " + (System.currentTimeMillis() - start) / 1000 + " seconds...END");
}
use of org.nextprot.api.core.domain.Entry in project nextprot-api by calipho-sib.
the class ChromosomeFieldBuilderDiffTest method testChromsomalLocation.
@Test
public void testChromsomalLocation() {
for (int i = 0; i < 10; i++) {
Entry entry = getEntry(i);
System.out.println(entry.getUniqueName());
testChrLoc(entry);
testChrLocS(entry);
testGeneBand(entry);
}
}
use of org.nextprot.api.core.domain.Entry in project nextprot-api by calipho-sib.
the class ChromosomeFieldBuilderIntegrationTest method testChrLoc.
@Test
public void testChrLoc() {
Fields field = Fields.CHR_LOC;
String entryName = "NX_Q06124";
Entry entry = entryBuilderService.build(EntryConfig.newConfig(entryName).withChromosomalLocations());
ChromosomeFieldBuilder cfb = new ChromosomeFieldBuilder();
cfb.initializeBuilder(entry);
String chrLocValue = cfb.getFieldValue(field, String.class);
assertTrue(chrLocValue.contains("12q24.13"));
}
use of org.nextprot.api.core.domain.Entry in project nextprot-api by calipho-sib.
the class AnnotationFieldBuilderGoldDiffTest method testGoldAnnotations.
@Ignore
@Test
public void testGoldAnnotations() {
// Since the functional tests are already done in the various fieldbuilder diff tests we will only test
// the fields that have quality qualifiers (GOs, PTMs, variants and expression...
String[] test_list = { "NX_Q13158", "NX_Q06830", "NX_Q7Z6P3", "NX_E5RQL4", "NX_Q14721", "NX_Q7Z6P3", "NX_Q7Z713", "NX_P22102", "NX_O00115", "NX_Q13286", "NX_Q9UNK4", "NX_Q9NWT6" };
for (int i = 0; i < test_list.length; i++) {
// for(int i=0; i < 120; i++){
Entry entry = getEntry(test_list[i]);
// Entry entry = getEntry(i); // 'random' entry
// Entry entry = getEntry("NX_P20592");
System.out.println(entry.getUniqueName());
testGoldAnnotations(entry);
}
}
use of org.nextprot.api.core.domain.Entry in project nextprot-api by calipho-sib.
the class AnnotationExporter method calcAnnotationStatsFromEntryAccessions.
private void calcAnnotationStatsFromEntryAccessions(List<String> entryAccessions) {
statisticsMap.clear();
for (String entryAccession : entryAccessions) {
Entry entry = entryBuilderService.build(EntryConfig.newConfig(entryAccession).withAnnotations());
// statement rows
for (Annotation annotation : entry.getAnnotations()) {
if (!statisticsMap.containsKey(annotation.getAPICategory())) {
statisticsMap.put(annotation.getAPICategory(), new NpBedMergingStats());
}
NpBedMergingStats stats = statisticsMap.get(annotation.getAPICategory());
// sb.append(config.fields.stream().map(statement::getValue).collect(Collectors.joining("\t"))).append("\n");
String annotationHash = annotation.getAnnotationHash();
String uniqueName = annotation.getUniqueName();
// bed integrated with np1
if (annotationHash != null) {
// merged
if (!uniqueName.equals(annotationHash)) {
stats.addAnnot(NpBedMergingStats.AnnotType.MERGED, annotation);
} else // not merged
{
stats.addAnnot(NpBedMergingStats.AnnotType.UNMERGED_BED, annotation);
}
} else // np1
{
stats.addAnnot(NpBedMergingStats.AnnotType.UNMERGED_NP, annotation);
}
}
}
}
Aggregations