Bugfixes on way to a working refactored VariantContext

This commit is contained in:
Mark DePristo 2011-11-15 16:42:50 -05:00
parent 2b2514dad2
commit 231c47c039
3 changed files with 5 additions and 7 deletions

View File

@ -129,9 +129,8 @@ class PhasingUtils {
List<String> mergedIDs = new ArrayList<String>();
if ( vc1.hasID() ) mergedIDs.add(vc1.getID());
if ( vc2.hasID() ) mergedIDs.add(vc2.getID());
String mergedID = Utils.join(VCFConstants.ID_FIELD_SEPARATOR, mergedIDs);
String mergedID = mergedIDs.isEmpty() ? VCFConstants.EMPTY_ID_FIELD : Utils.join(VCFConstants.ID_FIELD_SEPARATOR, mergedIDs);
// TODO -- FIX ID
VariantContext mergedVc = new VariantContext(mergedName, mergedID, vc1.getChr(), vc1.getStart(), vc2.getEnd(), mergeData.getAllMergedAlleles(), mergedGenotypes, mergedNegLog10PError, mergedFilters, mergedAttribs);
mergedAttribs = new HashMap<String, Object>(mergedVc.getAttributes());

View File

@ -1126,9 +1126,11 @@ public class ReadBackedPhasingWalker extends RodWalker<PhasingStatsAndOutput, Ph
private double negLog10PError;
private Set<String> filters;
private Map<String, Object> attributes;
private String id;
public UnfinishedVariantContext(VariantContext vc) {
this.name = vc.getSource();
this.id = vc.getID();
this.contig = vc.getChr();
this.start = vc.getStart();
this.stop = vc.getEnd();
@ -1140,7 +1142,7 @@ public class ReadBackedPhasingWalker extends RodWalker<PhasingStatsAndOutput, Ph
}
public VariantContext toVariantContext() {
return new VariantContext(name, VCFConstants.EMPTY_ID_FIELD, contig, start, stop, alleles, genotypes, negLog10PError, filters, attributes);
return new VariantContext(name, id, contig, start, stop, alleles, genotypes, negLog10PError, filters, attributes);
}
public GenomeLoc getLocation() {

View File

@ -70,9 +70,6 @@ public class GenotypeCollection implements List<Genotype> {
return new GenotypeCollection(nGenotypes, false);
}
// todo -- differentiate between empty constructor and copy constructor
// todo -- create constructor (Genotype ... genotypes)
public static final GenotypeCollection create(final ArrayList<Genotype> genotypes) {
return genotypes == null ? NO_GENOTYPES : new GenotypeCollection(genotypes, false);
}
@ -82,7 +79,7 @@ public class GenotypeCollection implements List<Genotype> {
}
public static final GenotypeCollection copy(final GenotypeCollection toCopy) {
return create(toCopy.genotypes);
return create(new ArrayList<Genotype>(toCopy.genotypes));
}
public static final GenotypeCollection copy(final Collection<Genotype> toCopy) {