Added integration test for beagle and verbose output in UG.
Minor cleanup of VCFRecord code. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2570 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
02e23e2d9c
commit
f99586f91b
|
|
@ -36,6 +36,7 @@ public class VCFRecord implements Variation, VariantBackedByGenotype {
|
||||||
public static final String PASSES_FILTERS = "0";
|
public static final String PASSES_FILTERS = "0";
|
||||||
public static final String EMPTY_INFO_FIELD = ".";
|
public static final String EMPTY_INFO_FIELD = ".";
|
||||||
public static final String EMPTY_ID_FIELD = ".";
|
public static final String EMPTY_ID_FIELD = ".";
|
||||||
|
public static final String EMPTY_ALLELE_FIELD = ".";
|
||||||
public static final String DOUBLE_PRECISION_FORMAT_STRING = "%.2f";
|
public static final String DOUBLE_PRECISION_FORMAT_STRING = "%.2f";
|
||||||
|
|
||||||
// the reference base
|
// the reference base
|
||||||
|
|
@ -75,13 +76,13 @@ public class VCFRecord implements Variation, VariantBackedByGenotype {
|
||||||
* given the values for each of the columns, create a VCF record.
|
* given the values for each of the columns, create a VCF record.
|
||||||
*
|
*
|
||||||
* @param columnValues a mapping of header strings to values
|
* @param columnValues a mapping of header strings to values
|
||||||
* @param formatString the format string for the genotype records
|
* @param genotypeFormatString the format string for the genotype records
|
||||||
* @param genotypeRecords the genotype records
|
* @param genotypeRecords the genotype records
|
||||||
*/
|
*/
|
||||||
public VCFRecord(Map<VCFHeader.HEADER_FIELDS, String> columnValues, String formatString, List<VCFGenotypeRecord> genotypeRecords) {
|
public VCFRecord(Map<VCFHeader.HEADER_FIELDS, String> columnValues, String genotypeFormatString, List<VCFGenotypeRecord> genotypeRecords) {
|
||||||
extractFields(columnValues);
|
extractFields(columnValues);
|
||||||
mGenotypeRecords.addAll(genotypeRecords);
|
mGenotypeRecords.addAll(genotypeRecords);
|
||||||
mGenotypeFormatString = formatString;
|
mGenotypeFormatString = genotypeFormatString;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -385,14 +386,6 @@ public class VCFRecord implements Variation, VariantBackedByGenotype {
|
||||||
return mInfoFields;
|
return mInfoFields;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the number of columnsof data we're storing
|
|
||||||
*/
|
|
||||||
public int getColumnCount() {
|
|
||||||
if (hasGenotypeData()) return mGenotypeRecords.size() + VCFHeader.HEADER_FIELDS.values().length;
|
|
||||||
return VCFHeader.HEADER_FIELDS.values().length;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<VCFGenotypeRecord> getVCFGenotypeRecords() {
|
public List<VCFGenotypeRecord> getVCFGenotypeRecords() {
|
||||||
ArrayList<VCFGenotypeRecord> list = new ArrayList<VCFGenotypeRecord>();
|
ArrayList<VCFGenotypeRecord> list = new ArrayList<VCFGenotypeRecord>();
|
||||||
for ( Genotype g : mGenotypeRecords )
|
for ( Genotype g : mGenotypeRecords )
|
||||||
|
|
@ -450,8 +443,7 @@ public class VCFRecord implements Variation, VariantBackedByGenotype {
|
||||||
}// the formatting string for our genotype records
|
}// the formatting string for our genotype records
|
||||||
|
|
||||||
public void setReferenceBase(char referenceBase) {
|
public void setReferenceBase(char referenceBase) {
|
||||||
// upppercase the character
|
referenceBase = Character.toUpperCase(referenceBase);
|
||||||
referenceBase = (char) ((referenceBase > 96) ? referenceBase - 32 : referenceBase);
|
|
||||||
if (referenceBase != 'A' && referenceBase != 'C' && referenceBase != 'T' && referenceBase != 'G' && referenceBase != 'N')
|
if (referenceBase != 'A' && referenceBase != 'C' && referenceBase != 'T' && referenceBase != 'G' && referenceBase != 'N')
|
||||||
throw new IllegalArgumentException("Reference base must be one of A,C,G,T,N, we saw: " + referenceBase);
|
throw new IllegalArgumentException("Reference base must be one of A,C,G,T,N, we saw: " + referenceBase);
|
||||||
mReferenceBase = referenceBase;
|
mReferenceBase = referenceBase;
|
||||||
|
|
@ -558,9 +550,17 @@ public class VCFRecord implements Variation, VariantBackedByGenotype {
|
||||||
builder.append(FIELD_SEPERATOR);
|
builder.append(FIELD_SEPERATOR);
|
||||||
builder.append(getReferenceBase());
|
builder.append(getReferenceBase());
|
||||||
builder.append(FIELD_SEPERATOR);
|
builder.append(FIELD_SEPERATOR);
|
||||||
String alts = "";
|
List<VCFGenotypeEncoding> alts = getAlternateAlleles();
|
||||||
for (VCFGenotypeEncoding str : getAlternateAlleles()) alts += str.toString() + ",";
|
if ( alts.size() > 0 ) {
|
||||||
builder.append((alts.length() > 0) ? alts.substring(0, alts.length() - 1) + FIELD_SEPERATOR : "." + FIELD_SEPERATOR);
|
builder.append(alts.get(0));
|
||||||
|
for ( int i = 1; i < alts.size(); i++ ) {
|
||||||
|
builder.append(",");
|
||||||
|
builder.append(alts.get(i));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
builder.append(EMPTY_ALLELE_FIELD);
|
||||||
|
}
|
||||||
|
builder.append(FIELD_SEPERATOR);
|
||||||
builder.append(String.format(DOUBLE_PRECISION_FORMAT_STRING, getQual()));
|
builder.append(String.format(DOUBLE_PRECISION_FORMAT_STRING, getQual()));
|
||||||
builder.append(FIELD_SEPERATOR);
|
builder.append(FIELD_SEPERATOR);
|
||||||
builder.append(Utils.join(FILTER_CODE_SEPERATOR, getFilteringCodes()));
|
builder.append(Utils.join(FILTER_CODE_SEPERATOR, getFilteringCodes()));
|
||||||
|
|
|
||||||
|
|
@ -204,4 +204,29 @@ public class UnifiedGenotyperIntegrationTest extends WalkerTest {
|
||||||
|
|
||||||
executeTest(String.format("testMultiTechnologies"), spec);
|
executeTest(String.format("testMultiTechnologies"), spec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// testing verbose and beagle output
|
||||||
|
//
|
||||||
|
// --------------------------------------------------------------------------------------------------------------
|
||||||
|
@Test
|
||||||
|
public void testOtherOutput() {
|
||||||
|
String[] md5s = {"a5dce541f00d3fe364d110f1cae53538", "677963a26f867fbbd5f030cc3df55075", "cea954546a304aa98fc3a18d4305090a"};
|
||||||
|
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
|
||||||
|
"-T UnifiedGenotyper" +
|
||||||
|
" -R " + oneKGLocation + "reference/human_b36_both.fasta" +
|
||||||
|
" -I " + validationDataLocation + "low_coverage_CEU.chr1.10k-11k.bam" +
|
||||||
|
" -varout %s" +
|
||||||
|
" -verbose %s" +
|
||||||
|
" -beagle %s" +
|
||||||
|
" -L 1:10,023,400-10,024,000" +
|
||||||
|
" -bm empirical" +
|
||||||
|
" -gm JOINT_ESTIMATE" +
|
||||||
|
" -vf GELI",
|
||||||
|
3,
|
||||||
|
Arrays.asList(md5s));
|
||||||
|
|
||||||
|
executeTest(String.format("testOtherOutput"), spec);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue