add a fix so that XL arguments won't cancel out -BTI arguments, fixed a bug for Ben where the ROD -> interval list conversion was throwing an exception, and some old code removal.
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3174 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
7973806716
commit
e682460c1f
|
|
@ -184,7 +184,9 @@ public class GenomeAnalysisEngine {
|
||||||
// if include argument isn't given, create new set of all possible intervals
|
// if include argument isn't given, create new set of all possible intervals
|
||||||
GenomeLocSortedSet includeSortedSet = (argCollection.intervals == null && argCollection.RODToInterval == null ?
|
GenomeLocSortedSet includeSortedSet = (argCollection.intervals == null && argCollection.RODToInterval == null ?
|
||||||
GenomeLocSortedSet.createSetFromSequenceDictionary(this.referenceDataSource.getSequenceDictionary()) :
|
GenomeLocSortedSet.createSetFromSequenceDictionary(this.referenceDataSource.getSequenceDictionary()) :
|
||||||
loadIntervals(argCollection.intervals, argCollection.intervalMerging));
|
loadIntervals(argCollection.intervals,
|
||||||
|
argCollection.intervalMerging,
|
||||||
|
GenomeLocParser.mergeIntervalLocations(checkRODToIntervalArgument(),argCollection.intervalMerging)));
|
||||||
|
|
||||||
// if no exclude arguments, can return parseIntervalArguments directly
|
// if no exclude arguments, can return parseIntervalArguments directly
|
||||||
if (argCollection.excludeIntervals == null)
|
if (argCollection.excludeIntervals == null)
|
||||||
|
|
@ -192,7 +194,7 @@ public class GenomeAnalysisEngine {
|
||||||
|
|
||||||
// otherwise there are exclude arguments => must merge include and exclude GenomeLocSortedSets
|
// otherwise there are exclude arguments => must merge include and exclude GenomeLocSortedSets
|
||||||
else {
|
else {
|
||||||
GenomeLocSortedSet excludeSortedSet = loadIntervals(argCollection.excludeIntervals, argCollection.intervalMerging);
|
GenomeLocSortedSet excludeSortedSet = loadIntervals(argCollection.excludeIntervals, argCollection.intervalMerging, null);
|
||||||
intervals = includeSortedSet.subtractRegions(excludeSortedSet);
|
intervals = includeSortedSet.subtractRegions(excludeSortedSet);
|
||||||
|
|
||||||
// logging messages only printed when exclude (-XL) arguments are given
|
// logging messages only printed when exclude (-XL) arguments are given
|
||||||
|
|
@ -208,16 +210,16 @@ public class GenomeAnalysisEngine {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the intervals relevant to
|
* Loads the intervals relevant to the current execution
|
||||||
* @param argList String representation of arguments; might include 'all', filenames, intervals in samtools
|
* @param argList String representation of arguments; might include 'all', filenames, intervals in samtools
|
||||||
* notation, or a combination of the
|
* notation, or a combination of the
|
||||||
* @param mergingRule Technique to use when merging interval data.
|
* @param mergingRule Technique to use when merging interval data.
|
||||||
|
* @param additionalIntervals a list of additional intervals to add to the returned set. Can be null.
|
||||||
* @return A sorted, merged list of all intervals specified in this arg list.
|
* @return A sorted, merged list of all intervals specified in this arg list.
|
||||||
*/
|
*/
|
||||||
private GenomeLocSortedSet loadIntervals(List<String> argList, IntervalMergingRule mergingRule) {
|
private GenomeLocSortedSet loadIntervals(List<String> argList, IntervalMergingRule mergingRule, List<GenomeLoc> additionalIntervals) {
|
||||||
List<GenomeLoc> rawIntervals = new ArrayList<GenomeLoc>(); // running list of raw GenomeLocs
|
List<GenomeLoc> rawIntervals = (additionalIntervals == null) ? new ArrayList<GenomeLoc>() : additionalIntervals; // running list of raw GenomeLocs
|
||||||
// TODO: Aaron, how do we discriminate between RODs that are for inclusion and RODs that are for exclusion?
|
|
||||||
rawIntervals.addAll(checkRODToIntervalArgument()); // add any RODs-to-intervals we have
|
|
||||||
rawIntervals.addAll(IntervalUtils.parseIntervalArguments(argList));
|
rawIntervals.addAll(IntervalUtils.parseIntervalArguments(argList));
|
||||||
|
|
||||||
// redundant check => default no arguments is null, not empty list
|
// redundant check => default no arguments is null, not empty list
|
||||||
|
|
|
||||||
|
|
@ -317,43 +317,6 @@ public class GenomeLocSortedSet extends AbstractSet<GenomeLoc> {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean addAllRegions(List<GenomeLoc> locations) {
|
|
||||||
this.mArray.addAll(locations);
|
|
||||||
Collections.sort(this.mArray);
|
|
||||||
this.mArray = GenomeLocSortedSet.mergeOverlappingLocations(this.mArray);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* merge a list of genome locs that may be overlapping, returning the list of unique genomic locations
|
|
||||||
*
|
|
||||||
* @param raw the unchecked genome loc list
|
|
||||||
*
|
|
||||||
* @return the list of merged locations
|
|
||||||
*/
|
|
||||||
public static List<GenomeLoc> mergeOverlappingLocations(final List<GenomeLoc> raw) {
|
|
||||||
logger.debug(" Raw locations are: " + Utils.join(", ", raw));
|
|
||||||
if (raw.size() <= 1)
|
|
||||||
return raw;
|
|
||||||
else {
|
|
||||||
ArrayList<GenomeLoc> merged = new ArrayList<GenomeLoc>();
|
|
||||||
Iterator<GenomeLoc> it = raw.iterator();
|
|
||||||
GenomeLoc prev = it.next();
|
|
||||||
while (it.hasNext()) {
|
|
||||||
GenomeLoc curr = it.next();
|
|
||||||
if (prev.contiguousP(curr)) {
|
|
||||||
prev = prev.merge(curr);
|
|
||||||
} else {
|
|
||||||
merged.add(prev);
|
|
||||||
prev = curr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
merged.add(prev);
|
|
||||||
return merged;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* convert this object to a list
|
* convert this object to a list
|
||||||
* @return the lists
|
* @return the lists
|
||||||
|
|
|
||||||
|
|
@ -217,31 +217,4 @@ public class GenomeLocSortedSetUnitTest extends BaseTest {
|
||||||
}
|
}
|
||||||
assertTrue(seqNumber == GenomeLocSortedSetUnitTest.NUMBER_OF_CHROMOSOMES);
|
assertTrue(seqNumber == GenomeLocSortedSetUnitTest.NUMBER_OF_CHROMOSOMES);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testAddAll() {
|
|
||||||
mSortedSet = GenomeLocSortedSet.createSetFromSequenceDictionary(this.header.getSequenceDictionary());
|
|
||||||
GenomeLocSortedSet set = GenomeLocSortedSet.createSetFromSequenceDictionary(this.header.getSequenceDictionary());
|
|
||||||
// we should have sequence
|
|
||||||
assertTrue(mSortedSet.size() == GenomeLocSortedSetUnitTest.NUMBER_OF_CHROMOSOMES);
|
|
||||||
mSortedSet.addAllRegions(set.toList());
|
|
||||||
assertTrue(mSortedSet.size() == GenomeLocSortedSetUnitTest.NUMBER_OF_CHROMOSOMES);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testAddAll2() {
|
|
||||||
mSortedSet = new GenomeLocSortedSet();
|
|
||||||
GenomeLocSortedSet mSortedSet2 = new GenomeLocSortedSet();
|
|
||||||
for (int x=0; x < 200; x = x + 2) {
|
|
||||||
mSortedSet.add(GenomeLocParser.createGenomeLoc(1,x));
|
|
||||||
}
|
|
||||||
assertEquals(100, mSortedSet.size());
|
|
||||||
for (int x=1; x < 201; x = x + 2) {
|
|
||||||
mSortedSet2.add(GenomeLocParser.createGenomeLoc(1,x));
|
|
||||||
}
|
|
||||||
assertEquals(100, mSortedSet2.size());
|
|
||||||
mSortedSet.addAllRegions(mSortedSet2.toList());
|
|
||||||
assertEquals(1, mSortedSet.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue