better method names for read based reference ordered data access.
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3069 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
49117819f5
commit
5079f35e40
|
|
@ -79,7 +79,7 @@ public class ReadMetaDataTracker {
|
||||||
else
|
else
|
||||||
set = queue.get(loc).getSet(name);
|
set = queue.get(loc).getSet(name);
|
||||||
if (set != null && set.size() > 0)
|
if (set != null && set.size() > 0)
|
||||||
ret.put(position,set);
|
ret.put(position, set);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
|
@ -98,9 +98,9 @@ public class ReadMetaDataTracker {
|
||||||
for (Long location : mapping.keySet()) {
|
for (Long location : mapping.keySet()) {
|
||||||
if (location >= start && location <= stop)
|
if (location >= start && location <= stop)
|
||||||
if (cl != null)
|
if (cl != null)
|
||||||
ret.put(location,mapping.get(location).getSet(cl));
|
ret.put(location, mapping.get(location).getSet(cl));
|
||||||
else
|
else
|
||||||
ret.put(location,mapping.get(location).getSet(name));
|
ret.put(location, mapping.get(location).getSet(name));
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
@ -110,7 +110,7 @@ public class ReadMetaDataTracker {
|
||||||
*
|
*
|
||||||
* @return a mapping of read offset to ROD(s)
|
* @return a mapping of read offset to ROD(s)
|
||||||
*/
|
*/
|
||||||
public Map<Long, Collection<ReferenceOrderedDatum>> getPositionMapping() {
|
public Map<Long, Collection<ReferenceOrderedDatum>> getReadOffsetMapping() {
|
||||||
return createReadAlignment(record, mapping, null, null);
|
return createReadAlignment(record, mapping, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -119,7 +119,7 @@ public class ReadMetaDataTracker {
|
||||||
*
|
*
|
||||||
* @return a mapping of genome loc position to ROD(s)
|
* @return a mapping of genome loc position to ROD(s)
|
||||||
*/
|
*/
|
||||||
public Map<Long, Collection<ReferenceOrderedDatum>> getGenomeLocMapping() {
|
public Map<Long, Collection<ReferenceOrderedDatum>> getContigOffsetMapping() {
|
||||||
return createGenomeLocAlignment(record, mapping, null, null);
|
return createGenomeLocAlignment(record, mapping, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -128,7 +128,7 @@ public class ReadMetaDataTracker {
|
||||||
*
|
*
|
||||||
* @return a mapping of read offset to ROD(s)
|
* @return a mapping of read offset to ROD(s)
|
||||||
*/
|
*/
|
||||||
public Map<Long, Collection<ReferenceOrderedDatum>> getPositionMapping(String name) {
|
public Map<Long, Collection<ReferenceOrderedDatum>> getReadOffsetMapping(String name) {
|
||||||
return createReadAlignment(record, mapping, null, name);
|
return createReadAlignment(record, mapping, null, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -137,7 +137,7 @@ public class ReadMetaDataTracker {
|
||||||
*
|
*
|
||||||
* @return a mapping of genome loc position to ROD(s)
|
* @return a mapping of genome loc position to ROD(s)
|
||||||
*/
|
*/
|
||||||
public Map<Long, Collection<ReferenceOrderedDatum>> getGenomeLocMapping(String name) {
|
public Map<Long, Collection<ReferenceOrderedDatum>> getContigOffsetMapping(String name) {
|
||||||
return createGenomeLocAlignment(record, mapping, null, name);
|
return createGenomeLocAlignment(record, mapping, null, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -146,7 +146,7 @@ public class ReadMetaDataTracker {
|
||||||
*
|
*
|
||||||
* @return a mapping of read offset to ROD(s)
|
* @return a mapping of read offset to ROD(s)
|
||||||
*/
|
*/
|
||||||
public Map<Long, Collection<ReferenceOrderedDatum>> getPositionMapping(Class cl) {
|
public Map<Long, Collection<ReferenceOrderedDatum>> getReadOffsetMapping(Class cl) {
|
||||||
return createReadAlignment(record, mapping, cl, null);
|
return createReadAlignment(record, mapping, cl, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -155,7 +155,7 @@ public class ReadMetaDataTracker {
|
||||||
*
|
*
|
||||||
* @return a mapping of genome loc position to ROD(s)
|
* @return a mapping of genome loc position to ROD(s)
|
||||||
*/
|
*/
|
||||||
public Map<Long, Collection<ReferenceOrderedDatum>> getGenomeLocMapping(Class cl) {
|
public Map<Long, Collection<ReferenceOrderedDatum>> getContigOffsetMapping(Class cl) {
|
||||||
return createGenomeLocAlignment(record, mapping, cl, null);
|
return createGenomeLocAlignment(record, mapping, cl, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,11 +43,10 @@ import java.util.*;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author aaron
|
* @author aaron
|
||||||
*
|
* <p/>
|
||||||
* Class ReadBasedReferenceOrderedViewTest
|
* Class ReadBasedReferenceOrderedViewTest
|
||||||
*
|
* <p/>
|
||||||
* test out the ReadBasedReferenceOrderedView class
|
* test out the ReadBasedReferenceOrderedView class
|
||||||
*/
|
*/
|
||||||
public class ReadBasedReferenceOrderedViewTest extends BaseTest {
|
public class ReadBasedReferenceOrderedViewTest extends BaseTest {
|
||||||
|
|
@ -75,18 +74,18 @@ public class ReadBasedReferenceOrderedViewTest extends BaseTest {
|
||||||
for (int x = 1; x < 11; x++) {
|
for (int x = 1; x < 11; x++) {
|
||||||
SAMRecord rec = ArtificialSAMUtils.createArtificialRead(header, "name", 0, x, 10);
|
SAMRecord rec = ArtificialSAMUtils.createArtificialRead(header, "name", 0, x, 10);
|
||||||
}
|
}
|
||||||
GenomeLoc start = GenomeLocParser.createGenomeLoc(0,0,0);
|
GenomeLoc start = GenomeLocParser.createGenomeLoc(0, 0, 0);
|
||||||
List<RMDDataState> list = new ArrayList<RMDDataState>();
|
List<RMDDataState> list = new ArrayList<RMDDataState>();
|
||||||
list.add(new RMDDataState(null, new FakePeekingRODIterator(start,"fakeName")));
|
list.add(new RMDDataState(null, new FakePeekingRODIterator(start, "fakeName")));
|
||||||
ReadBasedReferenceOrderedView view = new ReadBasedReferenceOrderedView(new WindowedData(list));
|
ReadBasedReferenceOrderedView view = new ReadBasedReferenceOrderedView(new WindowedData(list));
|
||||||
|
|
||||||
for (SAMRecord rec : records) {
|
for (SAMRecord rec : records) {
|
||||||
ReadMetaDataTracker tracker = view.getReferenceOrderedDataForRead(rec);
|
ReadMetaDataTracker tracker = view.getReferenceOrderedDataForRead(rec);
|
||||||
Map<Long, Collection<ReferenceOrderedDatum>> map = tracker.getPositionMapping();
|
Map<Long, Collection<ReferenceOrderedDatum>> map = tracker.getReadOffsetMapping();
|
||||||
for (Long i : map.keySet()) {
|
for (Long i : map.keySet()) {
|
||||||
Assert.assertEquals(1,map.get(i).size());
|
Assert.assertEquals(1, map.get(i).size());
|
||||||
}
|
}
|
||||||
Assert.assertEquals(10,map.keySet().size());
|
Assert.assertEquals(10, map.keySet().size());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -100,9 +99,11 @@ class FakePeekingRODIterator implements LocationAwareSeekableRODIterator {
|
||||||
private GenomeLoc location;
|
private GenomeLoc location;
|
||||||
private ReadMetaDataTrackerTest.FakeRODatum curROD;
|
private ReadMetaDataTrackerTest.FakeRODatum curROD;
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
public FakePeekingRODIterator(GenomeLoc startingLoc, String name) {
|
public FakePeekingRODIterator(GenomeLoc startingLoc, String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.location = GenomeLocParser.createGenomeLoc(startingLoc.getContigIndex(),startingLoc.getStart()+1,startingLoc.getStop()+1);;
|
this.location = GenomeLocParser.createGenomeLoc(startingLoc.getContigIndex(), startingLoc.getStart() + 1, startingLoc.getStop() + 1);
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -131,8 +132,8 @@ class FakePeekingRODIterator implements LocationAwareSeekableRODIterator {
|
||||||
@Override
|
@Override
|
||||||
public RODRecordList next() {
|
public RODRecordList next() {
|
||||||
System.err.println("Next -> " + location);
|
System.err.println("Next -> " + location);
|
||||||
curROD = new ReadMetaDataTrackerTest.FakeRODatum(location,name);
|
curROD = new ReadMetaDataTrackerTest.FakeRODatum(location, name);
|
||||||
location = GenomeLocParser.createGenomeLoc(location.getContigIndex(),location.getStart()+1,location.getStop()+1);
|
location = GenomeLocParser.createGenomeLoc(location.getContigIndex(), location.getStart() + 1, location.getStop() + 1);
|
||||||
FakeRODRecordList list = new FakeRODRecordList();
|
FakeRODRecordList list = new FakeRODRecordList();
|
||||||
list.add(curROD);
|
list.add(curROD);
|
||||||
return list;
|
return list;
|
||||||
|
|
|
||||||
|
|
@ -75,9 +75,9 @@ public class ReadMetaDataTrackerTest extends BaseTest {
|
||||||
|
|
||||||
// count the positions
|
// count the positions
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (Long x : tracker.getPositionMapping().keySet()) {
|
for (Long x : tracker.getReadOffsetMapping().keySet()) {
|
||||||
count++;
|
count++;
|
||||||
Assert.assertEquals(2, tracker.getPositionMapping().get(x).size());
|
Assert.assertEquals(2, tracker.getReadOffsetMapping().get(x).size());
|
||||||
}
|
}
|
||||||
Assert.assertEquals(10, count);
|
Assert.assertEquals(10, count);
|
||||||
}
|
}
|
||||||
|
|
@ -89,9 +89,9 @@ public class ReadMetaDataTrackerTest extends BaseTest {
|
||||||
|
|
||||||
// count the positions
|
// count the positions
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (Long x : tracker.getPositionMapping().keySet()) {
|
for (Long x : tracker.getReadOffsetMapping().keySet()) {
|
||||||
count++;
|
count++;
|
||||||
Assert.assertEquals(1, tracker.getPositionMapping().get(x).size());
|
Assert.assertEquals(1, tracker.getReadOffsetMapping().get(x).size());
|
||||||
}
|
}
|
||||||
Assert.assertEquals(10, count);
|
Assert.assertEquals(10, count);
|
||||||
}
|
}
|
||||||
|
|
@ -103,7 +103,7 @@ public class ReadMetaDataTrackerTest extends BaseTest {
|
||||||
|
|
||||||
// count the positions
|
// count the positions
|
||||||
int count = 0;
|
int count = 0;
|
||||||
Map<Long, Collection<ReferenceOrderedDatum>> map = tracker.getPositionMapping("default");
|
Map<Long, Collection<ReferenceOrderedDatum>> map = tracker.getReadOffsetMapping("default");
|
||||||
for (Long x : map.keySet()) {
|
for (Long x : map.keySet()) {
|
||||||
count++;
|
count++;
|
||||||
Assert.assertEquals(1, map.get(x).size());
|
Assert.assertEquals(1, map.get(x).size());
|
||||||
|
|
@ -117,7 +117,7 @@ public class ReadMetaDataTrackerTest extends BaseTest {
|
||||||
ReadMetaDataTracker tracker = getRMDT(1, nameSet, false); // create both RODs of the same type
|
ReadMetaDataTracker tracker = getRMDT(1, nameSet, false); // create both RODs of the same type
|
||||||
// count the positions
|
// count the positions
|
||||||
int count = 0;
|
int count = 0;
|
||||||
Map<Long, Collection<ReferenceOrderedDatum>> map = tracker.getPositionMapping(FakeRODatum.class);
|
Map<Long, Collection<ReferenceOrderedDatum>> map = tracker.getReadOffsetMapping(FakeRODatum.class);
|
||||||
for (Long x : map.keySet()) {
|
for (Long x : map.keySet()) {
|
||||||
count++;
|
count++;
|
||||||
Assert.assertEquals(2, map.get(x).size());
|
Assert.assertEquals(2, map.get(x).size());
|
||||||
|
|
@ -126,6 +126,7 @@ public class ReadMetaDataTrackerTest extends BaseTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Test this test can be uncommented to determine the speed impacts of any changes to the RODs for reads system
|
// @Test this test can be uncommented to determine the speed impacts of any changes to the RODs for reads system
|
||||||
|
|
||||||
public void filterByMassiveDupType() {
|
public void filterByMassiveDupType() {
|
||||||
|
|
||||||
for (int y = 0; y < 20; y++) {
|
for (int y = 0; y < 20; y++) {
|
||||||
|
|
@ -135,7 +136,7 @@ public class ReadMetaDataTrackerTest extends BaseTest {
|
||||||
ReadMetaDataTracker tracker = getRMDT(1, nameSet, false); // create both RODs of the same type
|
ReadMetaDataTracker tracker = getRMDT(1, nameSet, false); // create both RODs of the same type
|
||||||
// count the positions
|
// count the positions
|
||||||
int count = 0;
|
int count = 0;
|
||||||
Map<Long, Collection<ReferenceOrderedDatum>> map = tracker.getPositionMapping(FakeRODatum.class);
|
Map<Long, Collection<ReferenceOrderedDatum>> map = tracker.getReadOffsetMapping(FakeRODatum.class);
|
||||||
for (Long x : map.keySet()) {
|
for (Long x : map.keySet()) {
|
||||||
count++;
|
count++;
|
||||||
Assert.assertEquals(y + 2, map.get(x).size());
|
Assert.assertEquals(y + 2, map.get(x).size());
|
||||||
|
|
@ -154,7 +155,7 @@ public class ReadMetaDataTrackerTest extends BaseTest {
|
||||||
|
|
||||||
// count the positions
|
// count the positions
|
||||||
int count = 0;
|
int count = 0;
|
||||||
Map<Long, Collection<ReferenceOrderedDatum>> map = tracker.getPositionMapping(Fake2RODatum.class);
|
Map<Long, Collection<ReferenceOrderedDatum>> map = tracker.getReadOffsetMapping(Fake2RODatum.class);
|
||||||
for (long x : map.keySet()) {
|
for (long x : map.keySet()) {
|
||||||
count++;
|
count++;
|
||||||
Assert.assertEquals(1, map.get(x).size());
|
Assert.assertEquals(1, map.get(x).size());
|
||||||
|
|
@ -168,9 +169,9 @@ public class ReadMetaDataTrackerTest extends BaseTest {
|
||||||
|
|
||||||
// count the positions
|
// count the positions
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (Long x : tracker.getPositionMapping().keySet()) {
|
for (Long x : tracker.getReadOffsetMapping().keySet()) {
|
||||||
count++;
|
count++;
|
||||||
Assert.assertEquals(1, tracker.getPositionMapping().get(x).size());
|
Assert.assertEquals(1, tracker.getReadOffsetMapping().get(x).size());
|
||||||
}
|
}
|
||||||
Assert.assertEquals(2, count);
|
Assert.assertEquals(2, count);
|
||||||
}
|
}
|
||||||
|
|
@ -181,9 +182,9 @@ public class ReadMetaDataTrackerTest extends BaseTest {
|
||||||
|
|
||||||
// count the positions
|
// count the positions
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (Long x : tracker.getGenomeLocMapping().keySet()) {
|
for (Long x : tracker.getContigOffsetMapping().keySet()) {
|
||||||
count++;
|
count++;
|
||||||
Assert.assertEquals(1, tracker.getGenomeLocMapping().get(x).size());
|
Assert.assertEquals(1, tracker.getContigOffsetMapping().get(x).size());
|
||||||
}
|
}
|
||||||
Assert.assertEquals(10, count);
|
Assert.assertEquals(10, count);
|
||||||
}
|
}
|
||||||
|
|
@ -219,9 +220,7 @@ public class ReadMetaDataTrackerTest extends BaseTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/** for testing, we want a fake rod with a different classname, for the get-by-class-name functions */
|
||||||
* for testing, we want a fake rod with a different classname, for the get-by-class-name functions
|
|
||||||
*/
|
|
||||||
static public class Fake2RODatum extends FakeRODatum {
|
static public class Fake2RODatum extends FakeRODatum {
|
||||||
|
|
||||||
public Fake2RODatum(GenomeLoc location, String name) {
|
public Fake2RODatum(GenomeLoc location, String name) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue