Multi-sample calls now have associated meta-data (SLOD, allele freq), which wil
l soon actually be used... git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1820 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
db642fd08b
commit
b28446acac
|
|
@ -0,0 +1,47 @@
|
||||||
|
package org.broadinstitute.sting.utils.genotype;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ebanks
|
||||||
|
* <p/>
|
||||||
|
* Class GenotypeMetaData
|
||||||
|
* <p/>
|
||||||
|
* represents the meta data for a genotype object.
|
||||||
|
*/
|
||||||
|
public class GenotypeMetaData {
|
||||||
|
|
||||||
|
// the strand score lod
|
||||||
|
private double mSLOD;
|
||||||
|
|
||||||
|
// the allele frequency
|
||||||
|
private double mAlleleFrequency;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* create a basic genotype meta data pbject, given the following fields
|
||||||
|
*
|
||||||
|
* @param strandLOD the strand score lod
|
||||||
|
* @param alleleFrequency the allele frequency
|
||||||
|
*/
|
||||||
|
public GenotypeMetaData(double strandLOD, double alleleFrequency) {
|
||||||
|
mSLOD = strandLOD;
|
||||||
|
mAlleleFrequency = alleleFrequency;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get the strand lod
|
||||||
|
*
|
||||||
|
* @return the strand lod
|
||||||
|
*/
|
||||||
|
public double getSLOD() {
|
||||||
|
return mSLOD;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get the allele frequency
|
||||||
|
*
|
||||||
|
* @return the allele frequency
|
||||||
|
*/
|
||||||
|
public double getAlleleFrequency() {
|
||||||
|
return mAlleleFrequency;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -56,7 +56,7 @@ public interface GenotypeWriter {
|
||||||
* add a multi-sample call if we support it
|
* add a multi-sample call if we support it
|
||||||
* @param genotypes the list of genotypes, that are backed by sample information
|
* @param genotypes the list of genotypes, that are backed by sample information
|
||||||
*/
|
*/
|
||||||
public void addMultiSampleCall(List<Genotype> genotypes);
|
public void addMultiSampleCall(List<Genotype> genotypes, GenotypeMetaData metadata);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true if we support multisample, false otherwise
|
* @return true if we support multisample, false otherwise
|
||||||
|
|
|
||||||
|
|
@ -161,7 +161,7 @@ public class GeliAdapter implements GenotypeWriter {
|
||||||
* @param genotypes the list of genotypes, that are backed by sample information
|
* @param genotypes the list of genotypes, that are backed by sample information
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void addMultiSampleCall( List<Genotype> genotypes) {
|
public void addMultiSampleCall( List<Genotype> genotypes, GenotypeMetaData metadata) {
|
||||||
throw new UnsupportedOperationException("Geli binary doesn't support multisample calls");
|
throw new UnsupportedOperationException("Geli binary doesn't support multisample calls");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@ public class GeliTextWriter implements GenotypeWriter {
|
||||||
* @param genotypes the list of genotypes, that are backed by sample information
|
* @param genotypes the list of genotypes, that are backed by sample information
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void addMultiSampleCall(List<Genotype> genotypes) {
|
public void addMultiSampleCall(List<Genotype> genotypes, GenotypeMetaData metadata) {
|
||||||
throw new UnsupportedOperationException("Geli text doesn't support multisample calls");
|
throw new UnsupportedOperationException("Geli text doesn't support multisample calls");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -299,7 +299,7 @@ public class GLFWriter implements GenotypeWriter {
|
||||||
* @param genotypes the list of genotypes, that are backed by sample information
|
* @param genotypes the list of genotypes, that are backed by sample information
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void addMultiSampleCall(List<Genotype> genotypes) {
|
public void addMultiSampleCall(List<Genotype> genotypes, GenotypeMetaData metadata) {
|
||||||
throw new UnsupportedOperationException("GLF writer doesn't support multisample calls");
|
throw new UnsupportedOperationException("GLF writer doesn't support multisample calls");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ public class TabularLFWriter implements GenotypeWriter {
|
||||||
* @param genotypes the list of genotypes, that are backed by sample information
|
* @param genotypes the list of genotypes, that are backed by sample information
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void addMultiSampleCall(List<Genotype> genotypes) {
|
public void addMultiSampleCall(List<Genotype> genotypes, GenotypeMetaData metadata) {
|
||||||
throw new UnsupportedOperationException("Tabular LF doesn't support multisample calls");
|
throw new UnsupportedOperationException("Tabular LF doesn't support multisample calls");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,7 @@ package org.broadinstitute.sting.utils.genotype.vcf;
|
||||||
|
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
import org.broadinstitute.sting.utils.Utils;
|
import org.broadinstitute.sting.utils.Utils;
|
||||||
import org.broadinstitute.sting.utils.genotype.Genotype;
|
import org.broadinstitute.sting.utils.genotype.*;
|
||||||
import org.broadinstitute.sting.utils.genotype.GenotypeWriter;
|
|
||||||
import org.broadinstitute.sting.utils.genotype.ReadBacked;
|
|
||||||
import org.broadinstitute.sting.utils.genotype.SampleBacked;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
|
@ -91,7 +88,7 @@ public class VCFGenotypeWriterAdapter implements GenotypeWriter {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void addGenotypeCall(Genotype call) {
|
public void addGenotypeCall(Genotype call) {
|
||||||
addMultiSampleCall(Arrays.asList(call));
|
addMultiSampleCall(Arrays.asList(call), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -117,7 +114,7 @@ public class VCFGenotypeWriterAdapter implements GenotypeWriter {
|
||||||
* @param genotypes the list of genotypes, that are backed by sample information
|
* @param genotypes the list of genotypes, that are backed by sample information
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void addMultiSampleCall(List<Genotype> genotypes) {
|
public void addMultiSampleCall(List<Genotype> genotypes, GenotypeMetaData metadata) {
|
||||||
if (!mInitialized)
|
if (!mInitialized)
|
||||||
lazyInitialize(genotypes, mFile, mStream);
|
lazyInitialize(genotypes, mFile, mStream);
|
||||||
|
|
||||||
|
|
@ -150,6 +147,8 @@ public class VCFGenotypeWriterAdapter implements GenotypeWriter {
|
||||||
params.addAlternateBase(allele);
|
params.addAlternateBase(allele);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO -- use the GenotypeMetaData object if it's not null
|
||||||
|
|
||||||
VCFGenotypeRecord record = new VCFGenotypeRecord(((SampleBacked) gtype).getSampleName(),
|
VCFGenotypeRecord record = new VCFGenotypeRecord(((SampleBacked) gtype).getSampleName(),
|
||||||
alleles,
|
alleles,
|
||||||
VCFGenotypeRecord.PHASE.UNPHASED,
|
VCFGenotypeRecord.PHASE.UNPHASED,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue