use of org.nextprot.api.core.domain.ChromosomalLocation in project nextprot-api by calipho-sib.
the class ChromosomalLocationComparatorTest method testCompare.
@Test
public void testCompare() throws Exception {
ChromosomalLocationComparator comparator = new ChromosomalLocationComparator();
List<ChromosomalLocation> list = ChromosomalLocationTest.newChromosomalLocations("19p15", "18", "19p15.3", "19p13", "19");
ChromosomalLocation unk = new ChromosomalLocation();
unk.setChromosome("unknown");
unk.setBand("unknown");
list.add(unk);
ChromosomalLocation unkBand = new ChromosomalLocation();
unkBand.setChromosome("X");
unkBand.setBand("unknown");
list.add(unkBand);
ChromosomalLocation unkBand2 = new ChromosomalLocation();
unkBand2.setChromosome("Y");
unkBand2.setBand("");
list.add(unkBand2);
Collections.sort(list, comparator);
assertChromosomalLocation(list.get(0), "18", "");
assertChromosomalLocation(list.get(1), "19", "");
assertChromosomalLocation(list.get(2), "19", "p13");
assertChromosomalLocation(list.get(3), "19", "p15");
assertChromosomalLocation(list.get(4), "19", "p15.3");
assertChromosomalLocation(list.get(5), "X", "unknown");
assertChromosomalLocation(list.get(6), "Y", "");
assertChromosomalLocation(list.get(7), "unknown", "unknown");
}
use of org.nextprot.api.core.domain.ChromosomalLocation in project nextprot-api by calipho-sib.
the class GeneDaoIntegrationTest method buildChromosomalLocation.
private ChromosomalLocation buildChromosomalLocation(String displayName, String geneGeneNames, String masterGeneNames) {
ChromosomalLocation loc = new ChromosomalLocation();
loc.setDisplayName(displayName);
loc.setGeneGeneNames(geneGeneNames);
loc.setMasterGeneNames(masterGeneNames);
return loc;
}
use of org.nextprot.api.core.domain.ChromosomalLocation in project nextprot-api by calipho-sib.
the class GeneDaoIntegrationTest method shouldGetSameValuesFromOldAndNewQueries.
@Test
public void shouldGetSameValuesFromOldAndNewQueries() {
String entryName = "NX_A6NCW0";
List<ChromosomalLocation> locs1;
ChromosomalLocation loc1;
List<ChromosomalLocation> locs2;
ChromosomalLocation loc2;
// old algorithm
locs1 = geneDao.findChromosomalLocationsByEntryNameOld(entryName);
Assert.assertEquals(1, locs1.size());
loc1 = locs1.get(0);
// new algorithm
locs2 = geneDao.findChromosomalLocationsByEntryName(entryName);
Assert.assertEquals(1, locs2.size());
loc2 = locs1.get(0);
// field content comparison
Assert.assertEquals(loc1.getAccession(), loc2.getAccession());
Assert.assertEquals(loc1.getBand(), loc2.getBand());
Assert.assertEquals(loc1.getChromosome(), loc2.getChromosome());
Assert.assertEquals(loc1.isGoldMapping(), loc2.isGoldMapping());
Assert.assertEquals(loc1.getRecommendedName("old"), loc2.getRecommendedName("old"));
Assert.assertEquals(loc1.getFirstPosition(), loc2.getFirstPosition());
Assert.assertEquals(loc1.getLastPosition(), loc2.getLastPosition());
Assert.assertEquals(loc1.getStrand(), loc2.getStrand());
}
use of org.nextprot.api.core.domain.ChromosomalLocation in project nextprot-api by calipho-sib.
the class GeneDaoIntegrationTest method shouldShowDifferenceBetweenOldAndNewImplementation.
@Test
public void shouldShowDifferenceBetweenOldAndNewImplementation() {
ChromosomalLocation loc;
// about 103 locations: Example: NX_A6NJ64
// The displayName is null and displayName is not null
loc = buildChromosomalLocation("RP11-166B2.1", "RP11-166B2.1", null);
Assert.assertEquals("RP11-166B2.1", loc.getRecommendedName("old"));
Assert.assertEquals("unknown", loc.getRecommendedName());
// TODO find other example
// about 3 locations: Example: NX_Q5VWM5
// The displayName is the second option of the masterGeneNames and the second option of the geneGeneNames
loc = buildChromosomalLocation("PRAMEF15", "PRAMEF9 PRAMEF15", "PRAMEF9 PRAMEF15");
Assert.assertEquals("PRAMEF15", loc.getRecommendedName("old"));
Assert.assertEquals("PRAMEF15", loc.getRecommendedName());
}
use of org.nextprot.api.core.domain.ChromosomalLocation in project nextprot-api by calipho-sib.
the class GeneDaoIntegrationTest method shouldHandleCaseWhenSomeOfMultipleUniProtNamesMatchesAreProvided.
// TODO: TO FIX BY PAM
@Ignore
@Test
public void shouldHandleCaseWhenSomeOfMultipleUniProtNamesMatchesAreProvided() {
// Case 3 - about 237 locations
ChromosomalLocation loc;
// (a) In this example: NX_O14603, 2 gene names are in both geneGeneNameas and masterGeneNames: PRY2 PRY => NOT deterministic
// getRecommendedName() returns the first found in the intersection, it is arbitrary,
// the displayName could in this case make the choice deterministic
loc = buildChromosomalLocation("PRY2", "PRY PRY2", "PRYP4 PRYP3 PRY2 PRY");
Assert.assertEquals("PRY2", loc.getRecommendedName("old"));
Assert.assertEquals("PRY", loc.getRecommendedName());
// (b) In this example: NX_Q0WX57, a single gene name is both in geneGeneNameas and masterGeneNames: USP17L30 => deterministic.
// But we see that the ENSG gene name (displayName) prefers the other geneName USP17J
loc = buildChromosomalLocation("USP17J", "USP17J USP17L30", "USP17L30 USP17L25 USP17L29 USP17L28 USP17L27 USP17L26 USP17L24");
Assert.assertEquals("USP17L30", loc.getRecommendedName("old"));
Assert.assertEquals("USP17L30", loc.getRecommendedName());
// (c) In this example NX_Q13066: no gene name are both in geneGeneNameas and masterGeneNames => NOT deterministic
// We choose the first one in masterGeneNames
loc = buildChromosomalLocation(null, null, "GAGE2C GAGE2B");
Assert.assertEquals("GAGE2C", loc.getRecommendedName("old"));
Assert.assertEquals("GAGE2C", loc.getRecommendedName());
loc = buildChromosomalLocation("fakeGene", "fakeGene", "GAGE2C GAGE2B");
Assert.assertEquals("GAGE2C", loc.getRecommendedName("old"));
Assert.assertEquals("GAGE2C", loc.getRecommendedName());
loc = buildChromosomalLocation("fakeGene", "fakeGene fakeGene2", "GAGE2C GAGE2B");
Assert.assertEquals("GAGE2C", loc.getRecommendedName("old"));
Assert.assertEquals("GAGE2C", loc.getRecommendedName());
}
Aggregations