Merge branch 'master' of github.com:broadinstitute/gsa-unstable

This commit is contained in:
Eric Banks 2012-12-05 02:00:39 -05:00
commit 0c925856cb
4 changed files with 31 additions and 1 deletions

View File

@ -343,7 +343,7 @@ public class GATKReport {
GATKReportTable table = tables.firstEntry().getValue();
if ( table.getNumColumns() != values.length )
throw new ReviewedStingException("The number of arguments in writeRow() must match the number of columns in the table");
throw new ReviewedStingException("The number of arguments in writeRow() " + values.length + " must match the number of columns in the table" + table.getNumColumns());
final int rowIndex = table.getNumRows();
for ( int i = 0; i < values.length; i++ )

View File

@ -1054,6 +1054,11 @@ public abstract class AbstractReadBackedPileup<RBP extends AbstractReadBackedPil
public FragmentCollection<PileupElement> toFragments() {
return FragmentUtils.create(this);
}
@Override
public ReadBackedPileup copy() {
return new ReadBackedPileupImpl(loc, (PileupElementTracker<PileupElement>) pileupElementTracker.copy());
}
}

View File

@ -34,11 +34,20 @@ import java.util.*;
*/
abstract class PileupElementTracker<PE extends PileupElement> implements Iterable<PE> {
public abstract int size();
public abstract PileupElementTracker<PE> copy();
}
class UnifiedPileupElementTracker<PE extends PileupElement> extends PileupElementTracker<PE> {
private final List<PE> pileup;
@Override
public UnifiedPileupElementTracker<PE> copy() {
UnifiedPileupElementTracker<PE> result = new UnifiedPileupElementTracker<PE>();
for(PE element : pileup)
result.add(element);
return result;
}
public UnifiedPileupElementTracker() { pileup = new LinkedList<PE>(); }
public UnifiedPileupElementTracker(List<PE> pileup) { this.pileup = pileup; }
@ -65,6 +74,14 @@ class PerSamplePileupElementTracker<PE extends PileupElement> extends PileupElem
pileup = new HashMap<String,PileupElementTracker<PE>>();
}
public PerSamplePileupElementTracker<PE> copy() {
PerSamplePileupElementTracker<PE> result = new PerSamplePileupElementTracker<PE>();
for (Map.Entry<String, PileupElementTracker<PE>> entry : pileup.entrySet())
result.addElements(entry.getKey(), entry.getValue());
return result;
}
/**
* Gets a list of all the samples stored in this pileup.
* @return List of samples in this pileup.

View File

@ -283,4 +283,12 @@ public interface ReadBackedPileup extends Iterable<PileupElement>, HasGenomeLoca
* @return
*/
public FragmentCollection<PileupElement> toFragments();
/**
* Creates a full copy (not shallow) of the ReadBacked Pileup
*
* @return
*/
public ReadBackedPileup copy();
}