Search in sources :

Example 1 with ChromosomeFieldBuilder

use of org.nextprot.api.tasks.solr.indexer.entry.impl.ChromosomeFieldBuilder in project nextprot-api by calipho-sib.

the class ChromosomeFieldBuilderDiffTest method testGeneBand.

@SuppressWarnings("unchecked")
private void testGeneBand(Entry entry) {
    Fields field = Fields.GENE_BAND;
    ChromosomeFieldBuilder cfb = new ChromosomeFieldBuilder();
    cfb.initializeBuilder(entry);
    Set<String> actualSet = new TreeSet<String>();
    List<String> geneBandValues = cfb.getFieldValue(field, List.class);
    for (String s : geneBandValues) actualSet.addAll(Arrays.asList(s.split(" ")));
    // in the current pam implementation the data is the same
    // but can contains several times the same values and have a different order
    // nevertheless the set of unique values should be the same
    Set<String> expectedSet = new TreeSet<String>();
    List<String> expectedValues = (List<String>) getValueForFieldInCurrentSolrImplementation(entry.getUniqueName(), field);
    for (String s : expectedValues) expectedSet.addAll(Arrays.asList(s.split(" ")));
    // showActualAndExpectedValues(expectedSet,actualSet, "gene_band");
    assertEquals(expectedSet, actualSet);
}
Also used : Fields(org.nextprot.api.solr.index.EntryIndex.Fields) ChromosomeFieldBuilder(org.nextprot.api.tasks.solr.indexer.entry.impl.ChromosomeFieldBuilder) TreeSet(java.util.TreeSet) List(java.util.List)

Example 2 with ChromosomeFieldBuilder

use of org.nextprot.api.tasks.solr.indexer.entry.impl.ChromosomeFieldBuilder in project nextprot-api by calipho-sib.

the class ChromosomeFieldBuilderDiffTest method testChrLocS.

/*
	 * 
	 * The old pam implementation now sorts alphabetically 
	 * the multiple locations retrieved from db before indexing them in chr_loc field
	 * The new alain's implementation does the same as well now
	 * The value of chr_loc_s (sort order value for chr location) is computed 
	 * on the basis of the first location found in chr_loc in both old and new implementation
	 * 
	 */
private void testChrLocS(Entry entry) {
    ChromosomeFieldBuilder cfb = new ChromosomeFieldBuilder();
    cfb.initializeBuilder(entry);
    Integer expectedValue = (Integer) getValueForFieldInCurrentSolrImplementation(entry.getUniqueName(), Fields.CHR_LOC_S);
    Integer actualValue = cfb.getFieldValue(Fields.CHR_LOC_S, Integer.class);
    assertEquals(expectedValue, actualValue);
}
Also used : ChromosomeFieldBuilder(org.nextprot.api.tasks.solr.indexer.entry.impl.ChromosomeFieldBuilder)

Example 3 with ChromosomeFieldBuilder

use of org.nextprot.api.tasks.solr.indexer.entry.impl.ChromosomeFieldBuilder in project nextprot-api by calipho-sib.

the class ChromosomeFieldBuilderDiffTest method testChrLoc.

private void testChrLoc(Entry entry) {
    Fields field = Fields.CHR_LOC;
    ChromosomeFieldBuilder cfb = new ChromosomeFieldBuilder();
    cfb.initializeBuilder(entry);
    // build a set with the list of actual values in field (which are separated by spaces)
    Set<String> actualSet = new TreeSet<String>();
    String actualValue = cfb.getFieldValue(field, String.class);
    actualSet.addAll(Arrays.asList(actualValue.split(" ")));
    // in the current pam implementation the data is the same
    // but can contain several times the same values (and may have a different order)
    // nevertheless the set of unique values should be the same
    Set<String> expectedSet = new TreeSet<String>();
    String expectedValue = (String) getValueForFieldInCurrentSolrImplementation(entry.getUniqueName(), field);
    expectedSet.addAll(Arrays.asList(expectedValue.replace(",", "").split(" ")));
    // showActualAndExpectedValues(expectedSet,actualSet, "chr_loc");
    assertEquals(expectedSet, actualSet);
}
Also used : Fields(org.nextprot.api.solr.index.EntryIndex.Fields) ChromosomeFieldBuilder(org.nextprot.api.tasks.solr.indexer.entry.impl.ChromosomeFieldBuilder) TreeSet(java.util.TreeSet)

Example 4 with ChromosomeFieldBuilder

use of org.nextprot.api.tasks.solr.indexer.entry.impl.ChromosomeFieldBuilder 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"));
}
Also used : Entry(org.nextprot.api.core.domain.Entry) Fields(org.nextprot.api.solr.index.EntryIndex.Fields) ChromosomeFieldBuilder(org.nextprot.api.tasks.solr.indexer.entry.impl.ChromosomeFieldBuilder) SolrBuildIntegrationTest(org.nextprot.api.tasks.solr.indexer.entry.SolrBuildIntegrationTest) Test(org.junit.Test)

Aggregations

ChromosomeFieldBuilder (org.nextprot.api.tasks.solr.indexer.entry.impl.ChromosomeFieldBuilder)4 Fields (org.nextprot.api.solr.index.EntryIndex.Fields)3 TreeSet (java.util.TreeSet)2 List (java.util.List)1 Test (org.junit.Test)1 Entry (org.nextprot.api.core.domain.Entry)1 SolrBuildIntegrationTest (org.nextprot.api.tasks.solr.indexer.entry.SolrBuildIntegrationTest)1