Fix merge conflicts

This commit is contained in:
Guillermo del Angel 2012-08-16 20:45:52 -04:00
commit b61ecc7c19
69 changed files with 226 additions and 545 deletions

View File

@ -262,18 +262,19 @@ public class ErrorModel {
} }
public String toString() { public String toString() {
String result = "("; StringBuilder result = new StringBuilder("(");
boolean skipComma = true; boolean skipComma = true;
for (double v : probabilityVector.getProbabilityVector()) { for (double v : probabilityVector.getProbabilityVector()) {
if (skipComma) { if (skipComma) {
skipComma = false; skipComma = false;
} }
else { else {
result += ","; result.append(",");
} }
result += String.format("%.4f", v); result.append(String.format("%.4f", v));
} }
return result + ")"; result.append(")");
return result.toString();
} }
public static int getTotalReferenceDepth(HashMap<String, ErrorModel> perLaneErrorModels) { public static int getTotalReferenceDepth(HashMap<String, ErrorModel> perLaneErrorModels) {

View File

@ -145,7 +145,7 @@ public class GeneralPloidyIndelGenotypeLikelihoods extends GeneralPloidyGenotype
List<Integer> numSeenBases = new ArrayList<Integer>(this.alleles.size()); List<Integer> numSeenBases = new ArrayList<Integer>(this.alleles.size());
if (!hasReferenceSampleData) { if (!hasReferenceSampleData) {
final int readCounts[] = new int[pileup.getNumberOfElements()]; final int readCounts[] = new int[pileup.getNumberOfElements()];
readHaplotypeLikelihoods = pairModel.computeGeneralReadHaplotypeLikelihoods(pileup, haplotypeMap, refContext, eventLength, perReadAlleleLikelihoodMap, readCounts); readHaplotypeLikelihoods = pairModel.computeGeneralReadHaplotypeLikelihoods(pileup, haplotypeMap, refContext, eventLength, perReadAlleleLikelihoodMap, readCounts);
n = readHaplotypeLikelihoods.length; n = readHaplotypeLikelihoods.length;

View File

@ -45,32 +45,32 @@ public class UnifiedGenotyperGeneralPloidyIntegrationTest extends WalkerTest {
executeTest("testPoolCaller:"+name+" args=" + args, spec); executeTest("testPoolCaller:"+name+" args=" + args, spec);
} }
@Test(enabled = false) @Test(enabled = true)
public void testBOTH_GGA_Pools() { public void testBOTH_GGA_Pools() {
PC_LSV_Test(String.format(" -maxAltAlleles 2 -ploidy 24 -gt_mode GENOTYPE_GIVEN_ALLELES -out_mode EMIT_ALL_SITES -alleles %s",LSV_ALLELES),"LSV_BOTH_GGA","BOTH","0934f72865388999efec64bd9d4a9b93"); PC_LSV_Test(String.format(" -maxAltAlleles 2 -ploidy 24 -gt_mode GENOTYPE_GIVEN_ALLELES -out_mode EMIT_ALL_SITES -alleles %s",LSV_ALLELES),"LSV_BOTH_GGA","BOTH","0934f72865388999efec64bd9d4a9b93");
} }
@Test(enabled = false) @Test(enabled = true)
public void testINDEL_GGA_Pools() { public void testINDEL_GGA_Pools() {
PC_LSV_Test(String.format(" -maxAltAlleles 1 -ploidy 24 -gt_mode GENOTYPE_GIVEN_ALLELES -out_mode EMIT_ALL_SITES -alleles %s",LSV_ALLELES),"LSV_INDEL_GGA","INDEL","126581c72d287722437274d41b6fed7b"); PC_LSV_Test(String.format(" -maxAltAlleles 1 -ploidy 24 -gt_mode GENOTYPE_GIVEN_ALLELES -out_mode EMIT_ALL_SITES -alleles %s",LSV_ALLELES),"LSV_INDEL_GGA","INDEL","126581c72d287722437274d41b6fed7b");
} }
@Test(enabled = false) @Test(enabled = true)
public void testINDEL_maxAltAlleles2_ploidy3_Pools_noRef() { public void testINDEL_maxAltAlleles2_ploidy3_Pools_noRef() {
PC_LSV_Test_NoRef(" -maxAltAlleles 2 -ploidy 3","LSV_INDEL_DISC_NOREF_p3","INDEL","b543aa1c3efedb301e525c1d6c50ed8d"); PC_LSV_Test_NoRef(" -maxAltAlleles 2 -ploidy 3","LSV_INDEL_DISC_NOREF_p3","INDEL","b543aa1c3efedb301e525c1d6c50ed8d");
} }
@Test(enabled = false) @Test(enabled = true)
public void testINDEL_maxAltAlleles2_ploidy1_Pools_noRef() { public void testINDEL_maxAltAlleles2_ploidy1_Pools_noRef() {
PC_LSV_Test_NoRef(" -maxAltAlleles 2 -ploidy 1","LSV_INDEL_DISC_NOREF_p1","INDEL","55b20557a836bb92688e68f12d7f5dc4"); PC_LSV_Test_NoRef(" -maxAltAlleles 2 -ploidy 1","LSV_INDEL_DISC_NOREF_p1","INDEL","55b20557a836bb92688e68f12d7f5dc4");
} }
@Test(enabled = false) @Test(enabled = true)
public void testMT_SNP_DISCOVERY_sp4() { public void testMT_SNP_DISCOVERY_sp4() {
PC_MT_Test(CEUTRIO_BAM, " -maxAltAlleles 1 -ploidy 8", "MT_SNP_DISCOVERY_sp4","7eb889e8e07182f4c3d64609591f9459"); PC_MT_Test(CEUTRIO_BAM, " -maxAltAlleles 1 -ploidy 8", "MT_SNP_DISCOVERY_sp4","7eb889e8e07182f4c3d64609591f9459");
} }
@Test(enabled = false) @Test(enabled = true)
public void testMT_SNP_GGA_sp10() { public void testMT_SNP_GGA_sp10() {
PC_MT_Test(CEUTRIO_BAM, String.format(" -maxAltAlleles 1 -ploidy 20 -gt_mode GENOTYPE_GIVEN_ALLELES -out_mode EMIT_ALL_SITES -alleles %s",NA12891_CALLS), "MT_SNP_GGA_sp10", "db8114877b99b14f7180fdcd24b040a7"); PC_MT_Test(CEUTRIO_BAM, String.format(" -maxAltAlleles 1 -ploidy 20 -gt_mode GENOTYPE_GIVEN_ALLELES -out_mode EMIT_ALL_SITES -alleles %s",NA12891_CALLS), "MT_SNP_GGA_sp10", "db8114877b99b14f7180fdcd24b040a7");
} }

View File

@ -208,6 +208,7 @@ public class FastaSequenceIndexBuilder {
break; break;
} }
} }
in.close();
return sequenceIndex; return sequenceIndex;
} }
catch (IOException e) { catch (IOException e) {

View File

@ -12,10 +12,10 @@ import java.util.*;
*/ */
public class Bases implements Iterable<Byte> public class Bases implements Iterable<Byte>
{ {
public static byte A = 'A'; public static final byte A = 'A';
public static byte C = 'C'; public static final byte C = 'C';
public static byte G = 'G'; public static final byte G = 'G';
public static byte T = 'T'; public static final byte T = 'T';
public static final Bases instance = new Bases(); public static final Bases instance = new Bases();

View File

@ -55,10 +55,8 @@ public class ArgumentDefinitionGroup implements Iterable<ArgumentDefinition> {
* Does the name of this argument group match the name of another? * Does the name of this argument group match the name of another?
*/ */
public boolean groupNameMatches( ArgumentDefinitionGroup other ) { public boolean groupNameMatches( ArgumentDefinitionGroup other ) {
if( this.groupName == null && other.groupName == null ) if( this.groupName == null )
return true; return other.groupName == null;
if( this.groupName == null && other.groupName != null )
return false;
return this.groupName.equals(other.groupName); return this.groupName.equals(other.groupName);
} }

View File

@ -53,7 +53,7 @@ public abstract class ArgumentTypeDescriptor {
/** /**
* our log, which we want to capture anything from org.broadinstitute.sting * our log, which we want to capture anything from org.broadinstitute.sting
*/ */
protected static Logger logger = Logger.getLogger(ArgumentTypeDescriptor.class); protected static final Logger logger = Logger.getLogger(ArgumentTypeDescriptor.class);
/** /**
* Fetch the given descriptor from the descriptor repository. * Fetch the given descriptor from the descriptor repository.

View File

@ -120,8 +120,8 @@ public abstract class ParsingMethod {
*/ */
private static final String TAG_TEXT = "[\\w\\-\\.\\=]*"; private static final String TAG_TEXT = "[\\w\\-\\.\\=]*";
public static ParsingMethod FullNameParsingMethod = new ParsingMethod(Pattern.compile(String.format("\\s*--(%1$s)(?:\\:(%2$s(?:,%2$s)*))?\\s*",ARGUMENT_TEXT,TAG_TEXT)), public static final ParsingMethod FullNameParsingMethod = new ParsingMethod(Pattern.compile(String.format("\\s*--(%1$s)(?:\\:(%2$s(?:,%2$s)*))?\\s*",ARGUMENT_TEXT,TAG_TEXT)),
ArgumentDefinitions.FullNameDefinitionMatcher) {}; ArgumentDefinitions.FullNameDefinitionMatcher) {};
public static ParsingMethod ShortNameParsingMethod = new ParsingMethod(Pattern.compile(String.format("\\s*-(%1$s)(?:\\:(%2$s(?:,%2$s)*))?\\s*",ARGUMENT_TEXT,TAG_TEXT)), public static final ParsingMethod ShortNameParsingMethod = new ParsingMethod(Pattern.compile(String.format("\\s*-(%1$s)(?:\\:(%2$s(?:,%2$s)*))?\\s*",ARGUMENT_TEXT,TAG_TEXT)),
ArgumentDefinitions.ShortNameDefinitionMatcher) {}; ArgumentDefinitions.ShortNameDefinitionMatcher) {};
} }

View File

@ -233,10 +233,6 @@ public class GenomeAnalysisEngine {
if (args.nonDeterministicRandomSeed) if (args.nonDeterministicRandomSeed)
resetRandomGenerator(System.currentTimeMillis()); resetRandomGenerator(System.currentTimeMillis());
// TODO -- REMOVE ME WHEN WE STOP BCF testing
if ( args.USE_SLOW_GENOTYPES )
GenotypeBuilder.MAKE_FAST_BY_DEFAULT = false;
// if the use specified an input BQSR recalibration table then enable on the fly recalibration // if the use specified an input BQSR recalibration table then enable on the fly recalibration
if (args.BQSR_RECAL_FILE != null) if (args.BQSR_RECAL_FILE != null)
setBaseRecalibration(args.BQSR_RECAL_FILE, args.quantizationLevels, args.disableIndelQuals, args.PRESERVE_QSCORES_LESS_THAN, args.emitOriginalQuals); setBaseRecalibration(args.BQSR_RECAL_FILE, args.quantizationLevels, args.disableIndelQuals, args.PRESERVE_QSCORES_LESS_THAN, args.emitOriginalQuals);
@ -849,20 +845,9 @@ public class GenomeAnalysisEngine {
SAMSequenceDictionary sequenceDictionary, SAMSequenceDictionary sequenceDictionary,
GenomeLocParser genomeLocParser, GenomeLocParser genomeLocParser,
ValidationExclusion.TYPE validationExclusionType) { ValidationExclusion.TYPE validationExclusionType) {
VCFHeader header = null; final RMDTrackBuilder builder = new RMDTrackBuilder(sequenceDictionary,genomeLocParser, validationExclusionType);
if ( getArguments().repairVCFHeader != null ) {
try {
final PositionalBufferedStream pbs = new PositionalBufferedStream(new FileInputStream(getArguments().repairVCFHeader));
header = (VCFHeader)new VCFCodec().readHeader(pbs).getHeaderValue();
pbs.close();
} catch ( IOException e ) {
throw new UserException.CouldNotReadInputFile(getArguments().repairVCFHeader, e);
}
}
RMDTrackBuilder builder = new RMDTrackBuilder(sequenceDictionary,genomeLocParser, header, validationExclusionType); final List<ReferenceOrderedDataSource> dataSources = new ArrayList<ReferenceOrderedDataSource>();
List<ReferenceOrderedDataSource> dataSources = new ArrayList<ReferenceOrderedDataSource>();
for (RMDTriplet fileDescriptor : referenceMetaDataFiles) for (RMDTriplet fileDescriptor : referenceMetaDataFiles)
dataSources.add(new ReferenceOrderedDataSource(fileDescriptor, dataSources.add(new ReferenceOrderedDataSource(fileDescriptor,
builder, builder,

View File

@ -379,19 +379,5 @@ public class GATKArgumentCollection {
@Hidden @Hidden
public boolean generateShadowBCF = false; public boolean generateShadowBCF = false;
// TODO -- remove all code tagged with TODO -- remove me when argument generateShadowBCF is removed // TODO -- remove all code tagged with TODO -- remove me when argument generateShadowBCF is removed
@Argument(fullName="useSlowGenotypes",shortName = "useSlowGenotypes",doc="",required=false)
@Hidden
public boolean USE_SLOW_GENOTYPES = false;
// TODO -- remove all code tagged with TODO -- remove me when argument generateShadowBCF is removed
/**
* The file pointed to by this argument must be a VCF file. The GATK will read in just the header of this file
* and then use the INFO, FORMAT, and FILTER field values from this file to repair the header file of any other
* VCF file that GATK reads in. This allows us to have in effect a master set of header records and use these
* to fill in any missing ones in input VCF files.
*/
@Argument(fullName="repairVCFHeader", shortName = "repairVCFHeader", doc="If provided, whenever we read a VCF file we will use the header in this file to repair the header of the input VCF files", required=false)
public File repairVCFHeader = null;
} }

View File

@ -118,7 +118,7 @@ class WindowedData {
rec.getAlignmentStart(), rec.getAlignmentStart(),
stop); stop);
states = new ArrayList<RMDDataState>(); states = new ArrayList<RMDDataState>();
if (provider != null && provider.getReferenceOrderedData() != null) if (provider.getReferenceOrderedData() != null)
for (ReferenceOrderedDataSource dataSource : provider.getReferenceOrderedData()) for (ReferenceOrderedDataSource dataSource : provider.getReferenceOrderedData())
states.add(new RMDDataState(dataSource, dataSource.seek(range))); states.add(new RMDDataState(dataSource, dataSource.seek(range)));
} }

View File

@ -45,7 +45,6 @@ import org.broadinstitute.sting.utils.file.FileSystemInabilityToLockException;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.LinkedList;
import java.util.List; import java.util.List;
/** /**
@ -56,7 +55,7 @@ public class ReferenceDataSource {
private IndexedFastaSequenceFile reference; private IndexedFastaSequenceFile reference;
/** our log, which we want to capture anything from this class */ /** our log, which we want to capture anything from this class */
protected static org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(ReferenceDataSource.class); protected static final org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(ReferenceDataSource.class);
/** /**
* Create reference data source from fasta file * Create reference data source from fasta file

View File

@ -58,7 +58,7 @@ import java.util.Collection;
/** Shards and schedules data in manageable chunks. */ /** Shards and schedules data in manageable chunks. */
public abstract class MicroScheduler implements MicroSchedulerMBean { public abstract class MicroScheduler implements MicroSchedulerMBean {
protected static Logger logger = Logger.getLogger(MicroScheduler.class); protected static final Logger logger = Logger.getLogger(MicroScheduler.class);
/** /**
* Counts the number of instances of the class that are currently alive. * Counts the number of instances of the class that are currently alive.

View File

@ -66,13 +66,13 @@ public class TreeReducer implements Callable {
* @return Result of the reduce. * @return Result of the reduce.
*/ */
public Object call() { public Object call() {
Object result = null; Object result;
final long startTime = System.currentTimeMillis(); final long startTime = System.currentTimeMillis();
try { try {
if( lhs == null ) if( lhs == null )
result = lhs.get(); result = null;
// todo -- what the hell is this above line? Shouldn't it be the two below? // todo -- what the hell is this above line? Shouldn't it be the two below?
// if( lhs == null ) // if( lhs == null )
// throw new IllegalStateException(String.format("Insufficient data on which to reduce; lhs = %s, rhs = %s", lhs, rhs) ); // throw new IllegalStateException(String.format("Insufficient data on which to reduce; lhs = %s, rhs = %s", lhs, rhs) );

View File

@ -119,7 +119,7 @@ public class ThreadLocalOutputTracker extends OutputTracker {
try { try {
tempFile = File.createTempFile( stub.getClass().getName(), null ); tempFile = File.createTempFile( stub.getClass().getName(), null );
tempFile.deleteOnExit(); //tempFile.deleteOnExit();
} }
catch( IOException ex ) { catch( IOException ex ) {
throw new UserException.BadTmpDir("Unable to create temporary file for stub: " + stub.getClass().getName() ); throw new UserException.BadTmpDir("Unable to create temporary file for stub: " + stub.getClass().getName() );

View File

@ -61,6 +61,7 @@ public class VariantContextWriterStorage implements Storage<VariantContextWriter
protected final File file; protected final File file;
protected OutputStream stream; protected OutputStream stream;
protected final VariantContextWriter writer; protected final VariantContextWriter writer;
boolean closed = false;
/** /**
* Constructs an object which will write directly into the output file provided by the stub. * Constructs an object which will write directly into the output file provided by the stub.
@ -172,10 +173,13 @@ public class VariantContextWriterStorage implements Storage<VariantContextWriter
if(file != null) if(file != null)
logger.debug("Closing temporary file " + file.getAbsolutePath()); logger.debug("Closing temporary file " + file.getAbsolutePath());
writer.close(); writer.close();
closed = true;
} }
public void mergeInto(VariantContextWriterStorage target) { public void mergeInto(VariantContextWriterStorage target) {
try { try {
if ( ! closed )
throw new ReviewedStingException("Writer not closed, but we are merging into the file!");
final String targetFilePath = target.file != null ? target.file.getAbsolutePath() : "/dev/stdin"; final String targetFilePath = target.file != null ? target.file.getAbsolutePath() : "/dev/stdin";
logger.debug(String.format("Merging %s into %s",file.getAbsolutePath(),targetFilePath)); logger.debug(String.format("Merging %s into %s",file.getAbsolutePath(),targetFilePath));
@ -194,6 +198,9 @@ public class VariantContextWriterStorage implements Storage<VariantContextWriter
} }
source.close(); source.close();
file.delete(); // this should be last to aid in debugging when the process fails
} catch (UserException e) {
throw new ReviewedStingException("BUG: intermediate file " + file + " is malformed, got error while reading", e);
} catch (IOException e) { } catch (IOException e) {
throw new UserException.CouldNotReadInputFile(file, "Error reading file in VCFWriterStorage: ", e); throw new UserException.CouldNotReadInputFile(file, "Error reading file in VCFWriterStorage: ", e);
} }

View File

@ -47,6 +47,7 @@ import java.util.List;
public class VCFWriterArgumentTypeDescriptor extends ArgumentTypeDescriptor { public class VCFWriterArgumentTypeDescriptor extends ArgumentTypeDescriptor {
public static final String NO_HEADER_ARG_NAME = "no_cmdline_in_header"; public static final String NO_HEADER_ARG_NAME = "no_cmdline_in_header";
public static final String SITES_ONLY_ARG_NAME = "sites_only"; public static final String SITES_ONLY_ARG_NAME = "sites_only";
public static final String FORCE_BCF = "bcf";
public static final HashSet<String> SUPPORTED_ZIPPED_SUFFIXES = new HashSet<String>(); public static final HashSet<String> SUPPORTED_ZIPPED_SUFFIXES = new HashSet<String>();
// //
@ -96,7 +97,11 @@ public class VCFWriterArgumentTypeDescriptor extends ArgumentTypeDescriptor {
@Override @Override
public List<ArgumentDefinition> createArgumentDefinitions( ArgumentSource source ) { public List<ArgumentDefinition> createArgumentDefinitions( ArgumentSource source ) {
return Arrays.asList( createDefaultArgumentDefinition(source), createNoCommandLineHeaderArgumentDefinition(),createSitesOnlyArgumentDefinition()); return Arrays.asList(
createDefaultArgumentDefinition(source),
createNoCommandLineHeaderArgumentDefinition(),
createSitesOnlyArgumentDefinition(),
createBCFArgumentDefinition() );
} }
/** /**
@ -117,7 +122,7 @@ public class VCFWriterArgumentTypeDescriptor extends ArgumentTypeDescriptor {
public Object createTypeDefault(ParsingEngine parsingEngine,ArgumentSource source, Type type) { public Object createTypeDefault(ParsingEngine parsingEngine,ArgumentSource source, Type type) {
if(!source.isRequired()) if(!source.isRequired())
throw new ReviewedStingException("BUG: tried to create type default for argument type descriptor that can't support a type default."); throw new ReviewedStingException("BUG: tried to create type default for argument type descriptor that can't support a type default.");
VariantContextWriterStub stub = new VariantContextWriterStub(engine, defaultOutputStream, false, argumentSources, false, false); VariantContextWriterStub stub = new VariantContextWriterStub(engine, defaultOutputStream, argumentSources);
engine.addOutput(stub); engine.addOutput(stub);
return stub; return stub;
} }
@ -141,15 +146,15 @@ public class VCFWriterArgumentTypeDescriptor extends ArgumentTypeDescriptor {
if(writerFile == null && !source.isRequired()) if(writerFile == null && !source.isRequired())
throw new MissingArgumentValueException(defaultArgumentDefinition); throw new MissingArgumentValueException(defaultArgumentDefinition);
// Should we compress the output stream?
boolean compress = isCompressed(writerFileName);
boolean skipWritingCmdLineHeader = argumentIsPresent(createNoCommandLineHeaderArgumentDefinition(),matches);
boolean doNotWriteGenotypes = argumentIsPresent(createSitesOnlyArgumentDefinition(),matches);
// Create a stub for the given object. // Create a stub for the given object.
VariantContextWriterStub stub = (writerFile != null) ? new VariantContextWriterStub(engine, writerFile, compress, argumentSources, skipWritingCmdLineHeader, doNotWriteGenotypes) final VariantContextWriterStub stub = (writerFile != null)
: new VariantContextWriterStub(engine, defaultOutputStream, compress, argumentSources, skipWritingCmdLineHeader, doNotWriteGenotypes); ? new VariantContextWriterStub(engine, writerFile, argumentSources)
: new VariantContextWriterStub(engine, defaultOutputStream, argumentSources);
stub.setCompressed(isCompressed(writerFileName));
stub.setDoNotWriteGenotypes(argumentIsPresent(createSitesOnlyArgumentDefinition(),matches));
stub.setSkipWritingCommandLineHeader(argumentIsPresent(createNoCommandLineHeaderArgumentDefinition(),matches));
stub.setForceBCF(argumentIsPresent(createBCFArgumentDefinition(),matches));
// WARNING: Side effects required by engine! // WARNING: Side effects required by engine!
parsingEngine.addTags(stub,getArgumentTags(matches)); parsingEngine.addTags(stub,getArgumentTags(matches));
@ -159,8 +164,8 @@ public class VCFWriterArgumentTypeDescriptor extends ArgumentTypeDescriptor {
} }
/** /**
* Creates the optional compression level argument for the BAM file. * Creates the optional no_header argument for the VCF file.
* @return Argument definition for the BAM file itself. Will not be null. * @return Argument definition for the VCF file itself. Will not be null.
*/ */
private ArgumentDefinition createNoCommandLineHeaderArgumentDefinition() { private ArgumentDefinition createNoCommandLineHeaderArgumentDefinition() {
return new ArgumentDefinition( ArgumentIOType.ARGUMENT, return new ArgumentDefinition( ArgumentIOType.ARGUMENT,
@ -179,8 +184,8 @@ public class VCFWriterArgumentTypeDescriptor extends ArgumentTypeDescriptor {
} }
/** /**
* Creates the optional compression level argument for the BAM file. * Creates the optional sites_only argument definition
* @return Argument definition for the BAM file itself. Will not be null. * @return Argument definition for the VCF file itself. Will not be null.
*/ */
private ArgumentDefinition createSitesOnlyArgumentDefinition() { private ArgumentDefinition createSitesOnlyArgumentDefinition() {
return new ArgumentDefinition( ArgumentIOType.ARGUMENT, return new ArgumentDefinition( ArgumentIOType.ARGUMENT,
@ -198,6 +203,26 @@ public class VCFWriterArgumentTypeDescriptor extends ArgumentTypeDescriptor {
null ); null );
} }
/**
* Creates the optional bcf argument definition
* @return Argument definition for the VCF file itself. Will not be null.
*/
private ArgumentDefinition createBCFArgumentDefinition() {
return new ArgumentDefinition( ArgumentIOType.ARGUMENT,
boolean.class,
FORCE_BCF,
FORCE_BCF,
"force BCF output, regardless of the file's extension",
false,
true,
false,
true,
null,
null,
null,
null );
}
/** /**
* Returns true if the file will be compressed. * Returns true if the file will be compressed.
* @param writerFileName Name of the file * @param writerFileName Name of the file

View File

@ -79,7 +79,7 @@ public class VariantContextWriterStub implements Stub<VariantContextWriter>, Var
/** /**
* Should we emit a compressed output stream? * Should we emit a compressed output stream?
*/ */
private final boolean isCompressed; private boolean isCompressed = false;
/** /**
* A hack: push the argument sources into the VCF header so that the VCF header * A hack: push the argument sources into the VCF header so that the VCF header
@ -90,12 +90,17 @@ public class VariantContextWriterStub implements Stub<VariantContextWriter>, Var
/** /**
* Should the header be written out? A hidden argument. * Should the header be written out? A hidden argument.
*/ */
private final boolean skipWritingCommandLineHeader; private boolean skipWritingCommandLineHeader = false;
/** /**
* Should we not write genotypes even when provided? * Should we not write genotypes even when provided?
*/ */
private final boolean doNotWriteGenotypes; private boolean doNotWriteGenotypes = false;
/**
* Should we force BCF writing regardless of the file extension?
*/
private boolean forceBCF = false;
/** /**
* Connects this stub with an external stream capable of serving the * Connects this stub with an external stream capable of serving the
@ -108,19 +113,13 @@ public class VariantContextWriterStub implements Stub<VariantContextWriter>, Var
* *
* @param engine engine. * @param engine engine.
* @param genotypeFile file to (ultimately) create. * @param genotypeFile file to (ultimately) create.
* @param isCompressed should we compress the output stream?
* @param argumentSources sources. * @param argumentSources sources.
* @param skipWritingCommandLineHeader skip writing header.
* @param doNotWriteGenotypes do not write genotypes.
*/ */
public VariantContextWriterStub(GenomeAnalysisEngine engine, File genotypeFile, boolean isCompressed, Collection<Object> argumentSources, boolean skipWritingCommandLineHeader, boolean doNotWriteGenotypes) { public VariantContextWriterStub(GenomeAnalysisEngine engine, File genotypeFile, Collection<Object> argumentSources) {
this.engine = engine; this.engine = engine;
this.genotypeFile = genotypeFile; this.genotypeFile = genotypeFile;
this.genotypeStream = null; this.genotypeStream = null;
this.isCompressed = isCompressed;
this.argumentSources = argumentSources; this.argumentSources = argumentSources;
this.skipWritingCommandLineHeader = skipWritingCommandLineHeader;
this.doNotWriteGenotypes = doNotWriteGenotypes;
} }
/** /**
@ -128,19 +127,13 @@ public class VariantContextWriterStub implements Stub<VariantContextWriter>, Var
* *
* @param engine engine. * @param engine engine.
* @param genotypeStream stream to (ultimately) write. * @param genotypeStream stream to (ultimately) write.
* @param isCompressed should we compress the output stream?
* @param argumentSources sources. * @param argumentSources sources.
* @param skipWritingCommandLineHeader skip writing header.
* @param doNotWriteGenotypes do not write genotypes.
*/ */
public VariantContextWriterStub(GenomeAnalysisEngine engine, OutputStream genotypeStream, boolean isCompressed, Collection<Object> argumentSources, boolean skipWritingCommandLineHeader, boolean doNotWriteGenotypes) { public VariantContextWriterStub(GenomeAnalysisEngine engine, OutputStream genotypeStream, Collection<Object> argumentSources) {
this.engine = engine; this.engine = engine;
this.genotypeFile = null; this.genotypeFile = null;
this.genotypeStream = new PrintStream(genotypeStream); this.genotypeStream = new PrintStream(genotypeStream);
this.isCompressed = isCompressed;
this.argumentSources = argumentSources; this.argumentSources = argumentSources;
this.skipWritingCommandLineHeader = skipWritingCommandLineHeader;
this.doNotWriteGenotypes = doNotWriteGenotypes;
} }
/** /**
@ -167,6 +160,22 @@ public class VariantContextWriterStub implements Stub<VariantContextWriter>, Var
return isCompressed; return isCompressed;
} }
public void setCompressed(boolean compressed) {
isCompressed = compressed;
}
public void setSkipWritingCommandLineHeader(boolean skipWritingCommandLineHeader) {
this.skipWritingCommandLineHeader = skipWritingCommandLineHeader;
}
public void setDoNotWriteGenotypes(boolean doNotWriteGenotypes) {
this.doNotWriteGenotypes = doNotWriteGenotypes;
}
public void setForceBCF(boolean forceBCF) {
this.forceBCF = forceBCF;
}
/** /**
* Gets the master sequence dictionary from the engine associated with this stub * Gets the master sequence dictionary from the engine associated with this stub
* @link GenomeAnalysisEngine.getMasterSequenceDictionary * @link GenomeAnalysisEngine.getMasterSequenceDictionary
@ -187,7 +196,7 @@ public class VariantContextWriterStub implements Stub<VariantContextWriter>, Var
if ( engine.lenientVCFProcessing() ) options.add(Options.ALLOW_MISSING_FIELDS_IN_HEADER); if ( engine.lenientVCFProcessing() ) options.add(Options.ALLOW_MISSING_FIELDS_IN_HEADER);
if ( indexOnTheFly && ! isCompressed() ) options.add(Options.INDEX_ON_THE_FLY); if ( indexOnTheFly && ! isCompressed() ) options.add(Options.INDEX_ON_THE_FLY);
if ( getFile() != null && VariantContextWriterFactory.isBCFOutput(getFile()) ) if ( forceBCF || (getFile() != null && VariantContextWriterFactory.isBCFOutput(getFile())) )
options.add(Options.FORCE_BCF); options.add(Options.FORCE_BCF);
return options.isEmpty() ? EnumSet.noneOf(Options.class) : EnumSet.copyOf(options); return options.isEmpty() ? EnumSet.noneOf(Options.class) : EnumSet.copyOf(options);

View File

@ -93,7 +93,7 @@ public class GATKRunReport {
/** /**
* our log * our log
*/ */
protected static Logger logger = Logger.getLogger(GATKRunReport.class); protected static final Logger logger = Logger.getLogger(GATKRunReport.class);
@Element(required = false, name = "id") @Element(required = false, name = "id")

View File

@ -85,18 +85,16 @@ public class FeatureManager {
private final PluginManager<FeatureCodec> pluginManager; private final PluginManager<FeatureCodec> pluginManager;
private final Collection<FeatureDescriptor> featureDescriptors = new TreeSet<FeatureDescriptor>(); private final Collection<FeatureDescriptor> featureDescriptors = new TreeSet<FeatureDescriptor>();
private final VCFHeader headerForRepairs;
private final boolean lenientVCFProcessing; private final boolean lenientVCFProcessing;
/** /**
* Construct a FeatureManager without a master VCF header * Construct a FeatureManager without a master VCF header
*/ */
public FeatureManager() { public FeatureManager() {
this(null, false); this(false);
} }
public FeatureManager(final VCFHeader headerForRepairs, final boolean lenientVCFProcessing) { public FeatureManager(final boolean lenientVCFProcessing) {
this.headerForRepairs = headerForRepairs;
this.lenientVCFProcessing = lenientVCFProcessing; this.lenientVCFProcessing = lenientVCFProcessing;
pluginManager = new PluginManager<FeatureCodec>(FeatureCodec.class, "Codecs", "Codec"); pluginManager = new PluginManager<FeatureCodec>(FeatureCodec.class, "Codecs", "Codec");
@ -255,8 +253,6 @@ public class FeatureManager {
((NameAwareCodec)codex).setName(name); ((NameAwareCodec)codex).setName(name);
if ( codex instanceof ReferenceDependentFeatureCodec ) if ( codex instanceof ReferenceDependentFeatureCodec )
((ReferenceDependentFeatureCodec)codex).setGenomeLocParser(genomeLocParser); ((ReferenceDependentFeatureCodec)codex).setGenomeLocParser(genomeLocParser);
if ( codex instanceof VCFCodec )
((VCFCodec)codex).setHeaderForRepairs(headerForRepairs);
if ( codex instanceof AbstractVCFCodec && lenientVCFProcessing ) if ( codex instanceof AbstractVCFCodec && lenientVCFProcessing )
((AbstractVCFCodec)codex).disableOnTheFlyModifications(); ((AbstractVCFCodec)codex).disableOnTheFlyModifications();

View File

@ -89,17 +89,15 @@ public class RMDTrackBuilder { // extends PluginManager<FeatureCodec> {
* please talk through your approach with the SE team. * please talk through your approach with the SE team.
* @param dict Sequence dictionary to use. * @param dict Sequence dictionary to use.
* @param genomeLocParser Location parser to use. * @param genomeLocParser Location parser to use.
* @param headerForRepairs a VCF header that should be used to repair VCF headers. Can be null
* @param validationExclusionType Types of validations to exclude, for sequence dictionary verification. * @param validationExclusionType Types of validations to exclude, for sequence dictionary verification.
*/ */
public RMDTrackBuilder(final SAMSequenceDictionary dict, public RMDTrackBuilder(final SAMSequenceDictionary dict,
final GenomeLocParser genomeLocParser, final GenomeLocParser genomeLocParser,
final VCFHeader headerForRepairs,
ValidationExclusion.TYPE validationExclusionType) { ValidationExclusion.TYPE validationExclusionType) {
this.dict = dict; this.dict = dict;
this.validationExclusionType = validationExclusionType; this.validationExclusionType = validationExclusionType;
this.genomeLocParser = genomeLocParser; this.genomeLocParser = genomeLocParser;
this.featureManager = new FeatureManager(headerForRepairs, GenomeAnalysisEngine.lenientVCFProcessing(validationExclusionType)); this.featureManager = new FeatureManager(GenomeAnalysisEngine.lenientVCFProcessing(validationExclusionType));
} }
/** /**
@ -111,18 +109,6 @@ public class RMDTrackBuilder { // extends PluginManager<FeatureCodec> {
return featureManager; return featureManager;
} }
/**
* Same as full constructor but makes one without a header for repairs
* @param dict
* @param genomeLocParser
* @param validationExclusionType
*/
public RMDTrackBuilder(final SAMSequenceDictionary dict,
final GenomeLocParser genomeLocParser,
ValidationExclusion.TYPE validationExclusionType) {
this(dict, genomeLocParser, null, validationExclusionType);
}
/** /**
* create a RMDTrack of the specified type * create a RMDTrack of the specified type
* *

View File

@ -92,7 +92,7 @@ public abstract class TraversalEngine<M,T,WalkerType extends Walker<M,T>,Provide
GenomeLocSortedSet targetIntervals = null; GenomeLocSortedSet targetIntervals = null;
/** our log, which we want to capture anything from this class */ /** our log, which we want to capture anything from this class */
protected static Logger logger = Logger.getLogger(TraversalEngine.class); protected static final Logger logger = Logger.getLogger(TraversalEngine.class);
protected GenomeAnalysisEngine engine; protected GenomeAnalysisEngine engine;
@ -354,7 +354,7 @@ public abstract class TraversalEngine<M,T,WalkerType extends Walker<M,T>,Provide
synchronized(performanceLogLock) { synchronized(performanceLogLock) {
// Ignore multiple calls to reset the same lock. // Ignore multiple calls to reset the same lock.
if(performanceLogFile != null && performanceLogFile.equals(fileName)) if(performanceLogFile != null && performanceLogFile.equals(file))
return; return;
// Close an existing log // Close an existing log

View File

@ -19,7 +19,7 @@ public class TraverseLoci<M,T> extends TraversalEngine<M,T,LocusWalker<M,T>,Locu
/** /**
* our log, which we want to capture anything from this class * our log, which we want to capture anything from this class
*/ */
protected static Logger logger = Logger.getLogger(TraversalEngine.class); protected static final Logger logger = Logger.getLogger(TraversalEngine.class);
@Override @Override
protected String getTraversalType() { protected String getTraversalType() {

View File

@ -24,7 +24,7 @@ import java.util.List;
public class TraverseReadPairs<M,T> extends TraversalEngine<M,T, ReadPairWalker<M,T>,ReadShardDataProvider> { public class TraverseReadPairs<M,T> extends TraversalEngine<M,T, ReadPairWalker<M,T>,ReadShardDataProvider> {
/** our log, which we want to capture anything from this class */ /** our log, which we want to capture anything from this class */
protected static Logger logger = Logger.getLogger(TraverseReadPairs.class); protected static final Logger logger = Logger.getLogger(TraverseReadPairs.class);
@Override @Override
protected String getTraversalType() { protected String getTraversalType() {

View File

@ -51,7 +51,7 @@ import org.broadinstitute.sting.utils.sam.GATKSAMRecord;
*/ */
public class TraverseReads<M,T> extends TraversalEngine<M,T,ReadWalker<M,T>,ReadShardDataProvider> { public class TraverseReads<M,T> extends TraversalEngine<M,T,ReadWalker<M,T>,ReadShardDataProvider> {
/** our log, which we want to capture anything from this class */ /** our log, which we want to capture anything from this class */
protected static Logger logger = Logger.getLogger(TraverseReads.class); protected static final Logger logger = Logger.getLogger(TraverseReads.class);
@Override @Override
protected String getTraversalType() { protected String getTraversalType() {

View File

@ -72,8 +72,8 @@ public class TandemRepeatAnnotator extends InfoFieldAnnotation implements Standa
return map; return map;
} }
public static final String[] keyNames = {STR_PRESENT, REPEAT_UNIT_KEY,REPEATS_PER_ALLELE_KEY }; protected static final String[] keyNames = {STR_PRESENT, REPEAT_UNIT_KEY,REPEATS_PER_ALLELE_KEY };
public static final VCFInfoHeaderLine[] descriptions = { protected static final VCFInfoHeaderLine[] descriptions = {
new VCFInfoHeaderLine(STR_PRESENT, 0, VCFHeaderLineType.Flag, "Variant is a short tandem repeat"), new VCFInfoHeaderLine(STR_PRESENT, 0, VCFHeaderLineType.Flag, "Variant is a short tandem repeat"),
new VCFInfoHeaderLine(REPEAT_UNIT_KEY, 1, VCFHeaderLineType.String, "Tandem repeat unit (bases)"), new VCFInfoHeaderLine(REPEAT_UNIT_KEY, 1, VCFHeaderLineType.String, "Tandem repeat unit (bases)"),
new VCFInfoHeaderLine(REPEATS_PER_ALLELE_KEY, VCFHeaderLineCount.UNBOUNDED, VCFHeaderLineType.Integer, "Number of times tandem repeat unit is repeated, for each allele (including reference)") }; new VCFInfoHeaderLine(REPEATS_PER_ALLELE_KEY, VCFHeaderLineCount.UNBOUNDED, VCFHeaderLineType.Integer, "Number of times tandem repeat unit is repeated, for each allele (including reference)") };

View File

@ -30,7 +30,6 @@ import org.broadinstitute.sting.gatk.CommandLineGATK;
import org.broadinstitute.sting.gatk.arguments.StandardVariantContextInputArgumentCollection; import org.broadinstitute.sting.gatk.arguments.StandardVariantContextInputArgumentCollection;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext; import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext; import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.datasources.rmd.ReferenceOrderedDataSource;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.RodWalker; import org.broadinstitute.sting.gatk.walkers.RodWalker;
import org.broadinstitute.sting.utils.GenomeLoc; import org.broadinstitute.sting.utils.GenomeLoc;
@ -142,9 +141,6 @@ public class BeagleOutputToVCF extends RodWalker<Integer, Integer> {
hInfo.add(new VCFFilterHeaderLine("BGL_RM_WAS_G", "This 'G' site was set to monomorphic by Beagle")); hInfo.add(new VCFFilterHeaderLine("BGL_RM_WAS_G", "This 'G' site was set to monomorphic by Beagle"));
hInfo.add(new VCFFilterHeaderLine("BGL_RM_WAS_T", "This 'T' site was set to monomorphic by Beagle")); hInfo.add(new VCFFilterHeaderLine("BGL_RM_WAS_T", "This 'T' site was set to monomorphic by Beagle"));
// Open output file specified by output VCF ROD
final List<ReferenceOrderedDataSource> dataSources = this.getToolkit().getRodDataSources();
if ( comp.isBound() ) { if ( comp.isBound() ) {
hInfo.add(new VCFInfoHeaderLine("ACH", 1, VCFHeaderLineType.Integer, "Allele Count from Comparison ROD at this site")); hInfo.add(new VCFInfoHeaderLine("ACH", 1, VCFHeaderLineType.Integer, "Allele Count from Comparison ROD at this site"));
hInfo.add(new VCFInfoHeaderLine("ANH", 1, VCFHeaderLineType.Integer, "Allele Frequency from Comparison ROD at this site")); hInfo.add(new VCFInfoHeaderLine("ANH", 1, VCFHeaderLineType.Integer, "Allele Frequency from Comparison ROD at this site"));

View File

@ -351,7 +351,6 @@ public class ProduceBeagleInput extends RodWalker<Integer, Integer> {
} }
public static class CachingFormatter { public static class CachingFormatter {
private int maxCacheSize = 0;
private String format; private String format;
private LRUCache<Double, String> cache; private LRUCache<Double, String> cache;
@ -379,7 +378,6 @@ public class ProduceBeagleInput extends RodWalker<Integer, Integer> {
} }
public CachingFormatter(String format, int maxCacheSize) { public CachingFormatter(String format, int maxCacheSize) {
this.maxCacheSize = maxCacheSize;
this.format = format; this.format = format;
this.cache = new LRUCache<Double, String>(maxCacheSize); this.cache = new LRUCache<Double, String>(maxCacheSize);
} }

View File

@ -78,9 +78,9 @@ public class FindCoveredIntervals extends ActiveRegionWalker<GenomeLoc, Long> {
public Long reduce(final GenomeLoc value, Long reduce) { public Long reduce(final GenomeLoc value, Long reduce) {
if (value != null) { if (value != null) {
out.println(value.toString()); out.println(value.toString());
return ++reduce; reduce++;
} else }
return reduce; return reduce;
} }
@Override @Override

View File

@ -264,7 +264,7 @@ class SampleStatistics {
return false; return false;
// different contigs // different contigs
if (read.getMateReferenceIndex() != read.getReferenceIndex()) if (!read.getMateReferenceIndex().equals(read.getReferenceIndex()))
return false; return false;
// unmapped // unmapped

View File

@ -104,7 +104,9 @@ public class BAMDiffableReader implements DiffableReader {
InputStream fstream = new BufferedInputStream(new FileInputStream(file)); InputStream fstream = new BufferedInputStream(new FileInputStream(file));
if ( !BlockCompressedInputStream.isValidFile(fstream) ) if ( !BlockCompressedInputStream.isValidFile(fstream) )
return false; return false;
new BlockCompressedInputStream(fstream).read(buffer, 0, BAM_MAGIC.length); final BlockCompressedInputStream BCIS = new BlockCompressedInputStream(fstream);
BCIS.read(buffer, 0, BAM_MAGIC.length);
BCIS.close();
return Arrays.equals(buffer, BAM_MAGIC); return Arrays.equals(buffer, BAM_MAGIC);
} catch ( IOException e ) { } catch ( IOException e ) {
return false; return false;

View File

@ -224,7 +224,7 @@ public class DiffNode extends DiffValue {
// X=(A=A B=B C=(D=D)) // X=(A=A B=B C=(D=D))
String[] parts = tree.split("=", 2); String[] parts = tree.split("=", 2);
if ( parts.length != 2 ) if ( parts.length != 2 )
throw new ReviewedStingException("Unexpected tree structure: " + tree + " parts=" + parts); throw new ReviewedStingException("Unexpected tree structure: " + tree);
String name = parts[0]; String name = parts[0];
String value = parts[1]; String value = parts[1];

View File

@ -90,8 +90,10 @@ public class GATKReportDiffableReader implements DiffableReader {
public boolean canRead(File file) { public boolean canRead(File file) {
try { try {
final String HEADER = GATKReport.GATKREPORT_HEADER_PREFIX; final String HEADER = GATKReport.GATKREPORT_HEADER_PREFIX;
char[] buff = new char[HEADER.length()]; final char[] buff = new char[HEADER.length()];
new FileReader(file).read(buff, 0, HEADER.length()); final FileReader FR = new FileReader(file);
FR.read(buff, 0, HEADER.length());
FR.close();
String firstLine = new String(buff); String firstLine = new String(buff);
return firstLine.startsWith(HEADER); return firstLine.startsWith(HEADER);
} catch (IOException e) { } catch (IOException e) {

View File

@ -188,7 +188,7 @@ public class UnifiedGenotyperEngine {
perReadAlleleLikelihoodMap.clear(); perReadAlleleLikelihoodMap.clear();
final Map<String, AlignmentContext> stratifiedContexts = getFilteredAndStratifiedContexts(UAC, refContext, rawContext, model); final Map<String, AlignmentContext> stratifiedContexts = getFilteredAndStratifiedContexts(UAC, refContext, rawContext, model);
if ( stratifiedContexts == null ) { if ( stratifiedContexts == null ) {
results.add(UAC.OutputMode == OUTPUT_MODE.EMIT_ALL_SITES && UAC.GenotypingMode == GenotypeLikelihoodsCalculationModel.GENOTYPING_MODE.GENOTYPE_GIVEN_ALLELES ? generateEmptyContext(tracker, refContext, stratifiedContexts, rawContext) : null); results.add(UAC.OutputMode == OUTPUT_MODE.EMIT_ALL_SITES && UAC.GenotypingMode == GenotypeLikelihoodsCalculationModel.GENOTYPING_MODE.GENOTYPE_GIVEN_ALLELES ? generateEmptyContext(tracker, refContext, null, rawContext) : null);
} }
else { else {
final VariantContext vc = calculateLikelihoods(tracker, refContext, stratifiedContexts, AlignmentContextUtils.ReadOrientation.COMPLETE, null, true, model, perReadAlleleLikelihoodMap); final VariantContext vc = calculateLikelihoods(tracker, refContext, stratifiedContexts, AlignmentContextUtils.ReadOrientation.COMPLETE, null, true, model, perReadAlleleLikelihoodMap);
@ -207,7 +207,7 @@ public class UnifiedGenotyperEngine {
final List<VariantCallContext> withAllSamples = new ArrayList<VariantCallContext>(calls.size()); final List<VariantCallContext> withAllSamples = new ArrayList<VariantCallContext>(calls.size());
for ( final VariantCallContext call : calls ) { for ( final VariantCallContext call : calls ) {
if ( call == null ) if ( call == null )
withAllSamples.add(call); withAllSamples.add(null);
else { else {
final VariantContext withoutMissing = VariantContextUtils.addMissingSamples(call, allSamples); final VariantContext withoutMissing = VariantContextUtils.addMissingSamples(call, allSamples);
withAllSamples.add(new VariantCallContext(withoutMissing, call.confidentlyCalled, call.shouldEmit)); withAllSamples.add(new VariantCallContext(withoutMissing, call.confidentlyCalled, call.shouldEmit));
@ -258,8 +258,7 @@ public class UnifiedGenotyperEngine {
public VariantCallContext calculateGenotypes(final RefMetaDataTracker tracker, public VariantCallContext calculateGenotypes(final RefMetaDataTracker tracker,
final ReferenceContext refContext, final ReferenceContext refContext,
final AlignmentContext rawContext, final AlignmentContext rawContext,
final VariantContext vc, final VariantContext vc) {
final Map<String,PerReadAlleleLikelihoodMap> perReadAlleleLikelihoodMap) {
final List<GenotypeLikelihoodsCalculationModel.Model> models = getGLModelsToUse(tracker, refContext, rawContext); final List<GenotypeLikelihoodsCalculationModel.Model> models = getGLModelsToUse(tracker, refContext, rawContext);
if ( models.isEmpty() ) { if ( models.isEmpty() ) {
return null; return null;
@ -268,16 +267,21 @@ public class UnifiedGenotyperEngine {
// return the first one // return the first one
final GenotypeLikelihoodsCalculationModel.Model model = models.get(0); final GenotypeLikelihoodsCalculationModel.Model model = models.get(0);
final Map<String, AlignmentContext> stratifiedContexts = getFilteredAndStratifiedContexts(UAC, refContext, rawContext, model); final Map<String, AlignmentContext> stratifiedContexts = getFilteredAndStratifiedContexts(UAC, refContext, rawContext, model);
return calculateGenotypes(tracker, refContext, rawContext, stratifiedContexts, vc, model, perReadAlleleLikelihoodMap); return calculateGenotypes(tracker, refContext, rawContext, stratifiedContexts, vc, model, null);
} }
public VariantCallContext calculateGenotypes(final RefMetaDataTracker tracker, /**
final ReferenceContext refContext, * Compute genotypes at a given locus.
final AlignmentContext rawContext, *
final VariantContext vc) { * @param vc the GL-annotated variant context
return calculateGenotypes(tracker, refContext, rawContext, vc, null); * @return the VariantCallContext object
*/
public VariantCallContext calculateGenotypes(VariantContext vc) {
return calculateGenotypes(null, null, null, null, vc, GenotypeLikelihoodsCalculationModel.Model.valueOf("SNP"), null);
} }
// ---------------------------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------------------------
// //
// Private implementation helpers // Private implementation helpers
// //
@ -684,10 +688,8 @@ public class UnifiedGenotyperEngine {
// if we're genotyping given alleles and we have a requested SNP at this position, do SNP // if we're genotyping given alleles and we have a requested SNP at this position, do SNP
if ( UAC.GenotypingMode == GenotypeLikelihoodsCalculationModel.GENOTYPING_MODE.GENOTYPE_GIVEN_ALLELES ) { if ( UAC.GenotypingMode == GenotypeLikelihoodsCalculationModel.GENOTYPING_MODE.GENOTYPE_GIVEN_ALLELES ) {
final VariantContext vcInput = getVCFromAllelesRod(tracker, refContext, rawContext.getLocation(), false, logger, UAC.alleles); final VariantContext vcInput = getVCFromAllelesRod(tracker, refContext, rawContext.getLocation(), false, logger, UAC.alleles);
if ( vcInput == null ) { if ( vcInput == null )
models.add(GenotypeLikelihoodsCalculationModel.Model.valueOf(modelPrefix+"SNP"));
return models; return models;
}
if ( vcInput.isSNP() ) { if ( vcInput.isSNP() ) {
// ignore SNPs if the user chose INDEL mode only // ignore SNPs if the user chose INDEL mode only

View File

@ -305,7 +305,7 @@ public class ConstrainedMateFixingManager {
} }
public static boolean iSizeTooBigToMove(SAMRecord read, int maxInsertSizeForMovingReadPairs) { public static boolean iSizeTooBigToMove(SAMRecord read, int maxInsertSizeForMovingReadPairs) {
return ( read.getReadPairedFlag() && ! read.getMateUnmappedFlag() && read.getReferenceName() != read.getMateReferenceName() ) // maps to different chromosomes return ( read.getReadPairedFlag() && ! read.getMateUnmappedFlag() && !read.getReferenceName().equals(read.getMateReferenceName()) ) // maps to different chromosomes
|| Math.abs(read.getInferredInsertSize()) > maxInsertSizeForMovingReadPairs; // we won't try to move such a read || Math.abs(read.getInferredInsertSize()) > maxInsertSizeForMovingReadPairs; // we won't try to move such a read
} }

View File

@ -645,7 +645,7 @@ public class PhaseByTransmission extends RodWalker<HashMap<Byte,Integer>, HashMa
bestChildGenotype.clear(); bestChildGenotype.clear();
bestChildGenotype.add(childGenotype.getKey()); bestChildGenotype.add(childGenotype.getKey());
} }
else if(configurationLikelihood == bestConfigurationLikelihood) { else if(MathUtils.compareDoubles(configurationLikelihood, bestConfigurationLikelihood) == 0) {
bestFirstParentGenotype.add(firstParentGenotype.getKey()); bestFirstParentGenotype.add(firstParentGenotype.getKey());
bestSecondParentGenotype.add(secondParentGenotype.getKey()); bestSecondParentGenotype.add(secondParentGenotype.getKey());
bestChildGenotype.add(childGenotype.getKey()); bestChildGenotype.add(childGenotype.getKey());

View File

@ -86,7 +86,7 @@ class PreciseNonNegativeDouble implements Comparable<PreciseNonNegativeDouble> {
if (Math.abs(logValDiff) <= EQUALS_THRESH) if (Math.abs(logValDiff) <= EQUALS_THRESH)
return 0; // this.equals(other) return 0; // this.equals(other)
return new Double(Math.signum(logValDiff)).intValue(); return (int)Math.signum(logValDiff);
} }
public boolean equals(PreciseNonNegativeDouble other) { public boolean equals(PreciseNonNegativeDouble other) {

View File

@ -870,7 +870,7 @@ public class ReadBackedPhasing extends RodWalker<PhasingStatsAndOutput, PhasingS
int useOnLeft, useOnRight; int useOnLeft, useOnRight;
if (numOnLeft <= numOnRight) { if (numOnLeft <= numOnRight) {
int halfToUse = new Double(Math.floor(numToUse / 2.0)).intValue(); // skimp on the left [floor], and be generous with the right side int halfToUse = numToUse / 2; // skimp on the left [floor], and be generous with the right side
useOnLeft = Math.min(halfToUse, numOnLeft); useOnLeft = Math.min(halfToUse, numOnLeft);
useOnRight = Math.min(numToUse - useOnLeft, numOnRight); useOnRight = Math.min(numToUse - useOnLeft, numOnRight);
} }

View File

@ -41,7 +41,7 @@ public class ThetaVariantEvaluator extends VariantEvaluator {
ConcurrentMap<String, Integer> alleleCounts = new ConcurrentHashMap<String, Integer>(); ConcurrentMap<String, Integer> alleleCounts = new ConcurrentHashMap<String, Integer>();
int numHetsHere = 0; int numHetsHere = 0;
float numGenosHere = 0; int numGenosHere = 0;
int numIndsHere = 0; int numIndsHere = 0;
for (final Genotype genotype : vc.getGenotypes()) { for (final Genotype genotype : vc.getGenotypes()) {
@ -68,7 +68,7 @@ public class ThetaVariantEvaluator extends VariantEvaluator {
//only if have one called genotype at least //only if have one called genotype at least
this.numSites++; this.numSites++;
this.totalHet += numHetsHere / numGenosHere; this.totalHet += numHetsHere / (double)numGenosHere;
//compute based on num sites //compute based on num sites
float harmonicFactor = 0; float harmonicFactor = 0;
@ -79,7 +79,7 @@ public class ThetaVariantEvaluator extends VariantEvaluator {
//now compute pairwise mismatches //now compute pairwise mismatches
float numPairwise = 0; float numPairwise = 0;
float numDiffs = 0; int numDiffs = 0;
for (String allele1 : alleleCounts.keySet()) { for (String allele1 : alleleCounts.keySet()) {
int allele1Count = alleleCounts.get(allele1); int allele1Count = alleleCounts.get(allele1);

View File

@ -19,6 +19,8 @@ import java.util.*;
* it computes the AC from the genotypes themselves. If no AC can be computed, 0 is used. * it computes the AC from the genotypes themselves. If no AC can be computed, 0 is used.
*/ */
public class AlleleCount extends VariantStratifier { public class AlleleCount extends VariantStratifier {
int nchrom;
@Override @Override
public void initialize() { public void initialize() {
// we can only work with a single eval VCF, and it must have genotypes // we can only work with a single eval VCF, and it must have genotypes
@ -26,7 +28,8 @@ public class AlleleCount extends VariantStratifier {
throw new UserException.BadArgumentValue("AlleleCount", "AlleleCount stratification only works with a single eval vcf"); throw new UserException.BadArgumentValue("AlleleCount", "AlleleCount stratification only works with a single eval vcf");
// There are 2 x n sample chromosomes for diploids // There are 2 x n sample chromosomes for diploids
int nchrom = getVariantEvalWalker().getSampleNamesForEvaluation().size() * 2; // TODO -- generalize to handle multiple ploidy
nchrom = getVariantEvalWalker().getSampleNamesForEvaluation().size() * 2;
if ( nchrom < 2 ) if ( nchrom < 2 )
throw new UserException.BadArgumentValue("AlleleCount", "AlleleCount stratification requires an eval vcf with at least one sample"); throw new UserException.BadArgumentValue("AlleleCount", "AlleleCount stratification requires an eval vcf with at least one sample");
@ -52,8 +55,10 @@ public class AlleleCount extends VariantStratifier {
} }
// make sure that the AC isn't invalid // make sure that the AC isn't invalid
if ( AC > eval.getCalledChrCount() ) if ( AC > nchrom )
throw new UserException.MalformedVCF(String.format("The AC or MLEAC value (%d) at position %s:%d is larger than the possible called chromosome count (%d)", AC, eval.getChr(), eval.getStart(), eval.getCalledChrCount())); throw new UserException.MalformedVCF(String.format("The AC or MLEAC value (%d) at position %s:%d " +
"is larger than the number of chromosomes over all samples (%d)", AC,
eval.getChr(), eval.getStart(), nchrom));
return Collections.singletonList((Object) AC); return Collections.singletonList((Object) AC);
} else { } else {

View File

@ -177,6 +177,7 @@ public class TrancheManager {
double runningValue = metric.getRunningMetric(i); double runningValue = metric.getRunningMetric(i);
out.printf("%.4f %d %.4f%n", d.lod, score, runningValue); out.printf("%.4f %d %.4f%n", d.lod, score, runningValue);
} }
out.close();
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
throw new UserException.CouldNotCreateOutputFile(f, e); throw new UserException.CouldNotCreateOutputFile(f, e);
} }

View File

@ -31,7 +31,6 @@ import org.broadinstitute.sting.gatk.arguments.StandardVariantContextInputArgume
import org.broadinstitute.sting.gatk.contexts.AlignmentContext; import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext; import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.samples.Sample;
import org.broadinstitute.sting.gatk.walkers.RodWalker; import org.broadinstitute.sting.gatk.walkers.RodWalker;
import org.broadinstitute.sting.gatk.walkers.TreeReducible; import org.broadinstitute.sting.gatk.walkers.TreeReducible;
import org.broadinstitute.sting.gatk.walkers.annotator.ChromosomeCounts; import org.broadinstitute.sting.gatk.walkers.annotator.ChromosomeCounts;
@ -311,10 +310,6 @@ public class SelectVariants extends RodWalker<Integer, Integer> implements TreeR
private File rsIDFile = null; private File rsIDFile = null;
@Hidden
@Argument(fullName="outMVFile", shortName="outMVFile", doc="", required=false)
private String outMVFile = null;
@Hidden @Hidden
@Argument(fullName="fullyDecode", doc="If true, the incoming VariantContext will be fully decoded", required=false) @Argument(fullName="fullyDecode", doc="If true, the incoming VariantContext will be fully decoded", required=false)
private boolean fullyDecode = false; private boolean fullyDecode = false;
@ -369,8 +364,6 @@ public class SelectVariants extends RodWalker<Integer, Integer> implements TreeR
private int positionToAdd = 0; private int positionToAdd = 0;
private RandomVariantStructure [] variantArray; private RandomVariantStructure [] variantArray;
private PrintStream outMVFileStream = null;
//Random number generator for the genotypes to remove //Random number generator for the genotypes to remove
private Random randomGenotypes = new Random(); private Random randomGenotypes = new Random();
@ -528,23 +521,6 @@ public class SelectVariants extends RodWalker<Integer, Integer> implements TreeR
if (MENDELIAN_VIOLATIONS && mv.countViolations(this.getSampleDB().getFamilies(samples),vc) < 1) if (MENDELIAN_VIOLATIONS && mv.countViolations(this.getSampleDB().getFamilies(samples),vc) < 1)
break; break;
if (outMVFile != null){
for( String familyId : mv.getViolationFamilies()){
for(Sample sample : this.getSampleDB().getFamily(familyId)){
if(sample.getParents().size() > 0){
outMVFileStream.format("MV@%s:%d. REF=%s, ALT=%s, AC=%d, momID=%s, dadID=%s, childID=%s, momG=%s, momGL=%s, dadG=%s, dadGL=%s, " +
"childG=%s childGL=%s\n",vc.getChr(), vc.getStart(),
vc.getReference().getDisplayString(), vc.getAlternateAllele(0).getDisplayString(), vc.getCalledChrCount(vc.getAlternateAllele(0)),
sample.getMaternalID(), sample.getPaternalID(), sample.getID(),
vc.getGenotype(sample.getMaternalID()).toBriefString(), vc.getGenotype(sample.getMaternalID()).getLikelihoods().getAsString(),
vc.getGenotype(sample.getPaternalID()).toBriefString(), vc.getGenotype(sample.getPaternalID()).getLikelihoods().getAsString(),
vc.getGenotype(sample.getID()).toBriefString(),vc.getGenotype(sample.getID()).getLikelihoods().getAsString() );
}
}
}
}
if (DISCORDANCE_ONLY) { if (DISCORDANCE_ONLY) {
Collection<VariantContext> compVCs = tracker.getValues(discordanceTrack, context.getLocation()); Collection<VariantContext> compVCs = tracker.getValues(discordanceTrack, context.getLocation());
if (!isDiscordant(vc, compVCs)) if (!isDiscordant(vc, compVCs))
@ -568,7 +544,7 @@ public class SelectVariants extends RodWalker<Integer, Integer> implements TreeR
VariantContext sub = subsetRecord(vc, EXCLUDE_NON_VARIANTS); VariantContext sub = subsetRecord(vc, EXCLUDE_NON_VARIANTS);
if ( REGENOTYPE && sub.isPolymorphicInSamples() && hasPLs(sub) ) { if ( REGENOTYPE && sub.isPolymorphicInSamples() && hasPLs(sub) ) {
final VariantContextBuilder builder = new VariantContextBuilder(UG_engine.calculateGenotypes(null, ref, context, sub)).filters(sub.getFiltersMaybeNull()); final VariantContextBuilder builder = new VariantContextBuilder(UG_engine.calculateGenotypes(sub)).filters(sub.getFiltersMaybeNull());
addAnnotations(builder, sub); addAnnotations(builder, sub);
sub = builder.make(); sub = builder.make();
} }

View File

@ -8,8 +8,6 @@ import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext; import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.RodWalker; import org.broadinstitute.sting.gatk.walkers.RodWalker;
import org.broadinstitute.sting.utils.R.RScriptExecutorException;
import org.broadinstitute.sting.utils.codecs.vcf.VCFConstants;
import org.broadinstitute.sting.utils.codecs.vcf.VCFHeader; import org.broadinstitute.sting.utils.codecs.vcf.VCFHeader;
import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils; import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException; import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
@ -18,7 +16,6 @@ import org.broadinstitute.sting.utils.help.DocumentedGATKFeature;
import org.broadinstitute.sting.utils.text.XReadLines; import org.broadinstitute.sting.utils.text.XReadLines;
import org.broadinstitute.sting.utils.variantcontext.Genotype; import org.broadinstitute.sting.utils.variantcontext.Genotype;
import org.broadinstitute.sting.utils.variantcontext.VariantContext; import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.utils.variantcontext.VariantContextBuilder;
import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils; import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
import java.io.*; import java.io.*;
@ -95,7 +92,6 @@ public class VariantsToBinaryPed extends RodWalker<Integer,Integer> {
// write to the fam file, the first six columns of the standard ped file // write to the fam file, the first six columns of the standard ped file
// first, load data from the input meta data file // first, load data from the input meta data file
Map<String,Map<String,String>> metaValues = new HashMap<String,Map<String,String>>(); Map<String,Map<String,String>> metaValues = new HashMap<String,Map<String,String>>();
Set<String> samplesToUse = new HashSet<String>();
logger.debug("Reading in metadata..."); logger.debug("Reading in metadata...");
try { try {
if ( metaDataFile.getAbsolutePath().endsWith(".fam") ) { if ( metaDataFile.getAbsolutePath().endsWith(".fam") ) {
@ -274,6 +270,7 @@ public class VariantsToBinaryPed extends RodWalker<Integer,Integer> {
inStream.read(readGenotypes); inStream.read(readGenotypes);
outBed.write(readGenotypes); outBed.write(readGenotypes);
} }
inStream.close();
} catch (IOException e) { } catch (IOException e) {
throw new ReviewedStingException("Error reading form temp file for input.",e); throw new ReviewedStingException("Error reading form temp file for input.",e);
} }

View File

@ -372,7 +372,7 @@ public class VariantsToTable extends RodWalker<Integer, Integer> {
// ---------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------
public static abstract class Getter { public abstract String get(VariantContext vc); } public static abstract class Getter { public abstract String get(VariantContext vc); }
public static Map<String, Getter> getters = new HashMap<String, Getter>(); public static final Map<String, Getter> getters = new HashMap<String, Getter>();
static { static {
// #CHROM POS ID REF ALT QUAL FILTER INFO FORMAT // #CHROM POS ID REF ALT QUAL FILTER INFO FORMAT

View File

@ -67,10 +67,10 @@ public class BaseUtils {
public static final byte DELETION_INDEX = 4; public static final byte DELETION_INDEX = 4;
public static final byte NO_CALL_INDEX = 5; // (this is 'N') public static final byte NO_CALL_INDEX = 5; // (this is 'N')
public static int gIndex = BaseUtils.simpleBaseToBaseIndex((byte) 'G'); public static final int aIndex = BaseUtils.simpleBaseToBaseIndex((byte) 'A');
public static int cIndex = BaseUtils.simpleBaseToBaseIndex((byte) 'C'); public static final int cIndex = BaseUtils.simpleBaseToBaseIndex((byte) 'C');
public static int aIndex = BaseUtils.simpleBaseToBaseIndex((byte) 'A'); public static final int gIndex = BaseUtils.simpleBaseToBaseIndex((byte) 'G');
public static int tIndex = BaseUtils.simpleBaseToBaseIndex((byte) 'T'); public static final int tIndex = BaseUtils.simpleBaseToBaseIndex((byte) 'T');
/// In genetics, a transition is a mutation changing a purine to another purine nucleotide (A <-> G) or /// In genetics, a transition is a mutation changing a purine to another purine nucleotide (A <-> G) or
// a pyrimidine to another pyrimidine nucleotide (C <-> T). // a pyrimidine to another pyrimidine nucleotide (C <-> T).

View File

@ -199,9 +199,9 @@ public class MannWhitneyU {
else if ( z > n ) { return 0.0; } else if ( z > n ) { return 0.0; }
else { else {
if ( z > ((double) n) /2 ) { if ( z > ((double) n) /2 ) {
return 1.0-1/((double)Arithmetic.factorial(n))*uniformSumHelper(z, (int) Math.floor(z), n, 0); return 1.0-1/(Arithmetic.factorial(n))*uniformSumHelper(z, (int) Math.floor(z), n, 0);
} else { } else {
return 1/((double)Arithmetic.factorial(n))*uniformSumHelper(z, (int) Math.floor(z), n, 0); return 1/(Arithmetic.factorial(n))*uniformSumHelper(z, (int) Math.floor(z), n, 0);
} }
} }
} }

View File

@ -789,7 +789,7 @@ public class MathUtils {
for (byte v : vals) { for (byte v : vals) {
sum += v; sum += v;
} }
return (byte) Math.floor(sum / vals.length); return (byte) (sum / vals.length);
} }
public static double averageDouble(List<Double> vals) { public static double averageDouble(List<Double> vals) {
@ -1066,7 +1066,6 @@ public class MathUtils {
// the list is assumed *not* to be sorted // the list is assumed *not* to be sorted
final Comparable x = list.get(orderStat); final Comparable x = list.get(orderStat);
ListIterator iterator = list.listIterator();
ArrayList lessThanX = new ArrayList(); ArrayList lessThanX = new ArrayList();
ArrayList equalToX = new ArrayList(); ArrayList equalToX = new ArrayList();
ArrayList greaterThanX = new ArrayList(); ArrayList greaterThanX = new ArrayList();

View File

@ -377,59 +377,6 @@ public class SWPairwiseAlignment {
return w_open+(k-1)*w_extend; // gap return w_open+(k-1)*w_extend; // gap
} }
private void print(int[][] s) {
for ( int i = 0 ; i < s.length ; i++) {
for ( int j = 0; j < s[i].length ; j++ ) {
System.out.printf(" %4d",s[i][j]);
}
System.out.println();
}
}
private void print(double[][] s) {
for ( int i = 0 ; i < s.length ; i++) {
for ( int j = 0; j < s[i].length ; j++ ) {
System.out.printf(" %4g",s[i][j]);
}
System.out.println();
}
}
private void print(int[][] s, String a, String b) {
System.out.print(" ");
for ( int j = 1 ; j < s[0].length ; j++) System.out.printf(" %4c",b.charAt(j-1)) ;
System.out.println();
for ( int i = 0 ; i < s.length ; i++) {
if ( i > 0 ) System.out.print(a.charAt(i-1));
else System.out.print(' ');
System.out.print(" ");
for ( int j = 0; j < s[i].length ; j++ ) {
System.out.printf(" %4d",s[i][j]);
}
System.out.println();
}
}
private void print(double[][] s, String a, String b) {
System.out.print("");
for ( int j = 1 ; j < s[0].length ; j++) System.out.printf(" %4c",b.charAt(j-1)) ;
System.out.println();
for ( int i = 0 ; i < s.length ; i++) {
if ( i > 0 ) System.out.print(a.charAt(i-1));
else System.out.print(' ');
System.out.print(" ");
for ( int j = 0; j < s[i].length ; j++ ) {
System.out.printf(" %2.1f",s[i][j]);
}
System.out.println();
}
}
private void print(double[] s, byte[] a, byte[] b) { private void print(double[] s, byte[] a, byte[] b) {
int n = a.length+1; int n = a.length+1;
int m = b.length+1; int m = b.length+1;

View File

@ -563,7 +563,6 @@ public class Utils {
List<T> t = new ArrayList<T>(c.keySet()); List<T> t = new ArrayList<T>(c.keySet());
Collections.sort(t); Collections.sort(t);
List<V> l = new ArrayList<V>();
List<String> pairs = new ArrayList<String>(); List<String> pairs = new ArrayList<String>();
for ( T k : t ) { for ( T k : t ) {
pairs.add(k + "=" + c.get(k)); pairs.add(k + "=" + c.get(k));

View File

@ -51,7 +51,6 @@ import java.util.Map;
*/ */
public final class BCF2Codec implements FeatureCodec<VariantContext> { public final class BCF2Codec implements FeatureCodec<VariantContext> {
final protected static Logger logger = Logger.getLogger(BCF2Codec.class); final protected static Logger logger = Logger.getLogger(BCF2Codec.class);
private final static boolean FORBID_SYMBOLICS = false;
private final static int ALLOWED_MAJOR_VERSION = 2; private final static int ALLOWED_MAJOR_VERSION = 2;
private final static int MIN_MINOR_VERSION = 1; private final static int MIN_MINOR_VERSION = 1;
@ -178,7 +177,7 @@ public final class BCF2Codec implements FeatureCodec<VariantContext> {
contigNames.add(contig.getID()); contigNames.add(contig.getID());
} }
} else { } else {
throw new UserException.MalformedBCF2("Didn't find any contig lines in BCF2 file header"); error("Didn't find any contig lines in BCF2 file header");
} }
// create the string dictionary // create the string dictionary
@ -271,7 +270,7 @@ public final class BCF2Codec implements FeatureCodec<VariantContext> {
final int nSamples = nFormatSamples & 0x00FFFFF; final int nSamples = nFormatSamples & 0x00FFFFF;
if ( header.getNGenotypeSamples() != nSamples ) if ( header.getNGenotypeSamples() != nSamples )
throw new UserException.MalformedBCF2("GATK currently doesn't support reading BCF2 files with " + error("GATK currently doesn't support reading BCF2 files with " +
"different numbers of samples per record. Saw " + header.getNGenotypeSamples() + "different numbers of samples per record. Saw " + header.getNGenotypeSamples() +
" samples in header but have a record with " + nSamples + " samples"); " samples in header but have a record with " + nSamples + " samples");
@ -343,9 +342,6 @@ public final class BCF2Codec implements FeatureCodec<VariantContext> {
if ( isRef ) ref = alleleBases; if ( isRef ) ref = alleleBases;
alleles.add(allele); alleles.add(allele);
if ( FORBID_SYMBOLICS && allele.isSymbolic() )
throw new ReviewedStingException("LIMITATION: GATK BCF2 codec does not yet support symbolic alleles");
} }
assert ref != null; assert ref != null;
@ -496,7 +492,7 @@ public final class BCF2Codec implements FeatureCodec<VariantContext> {
return gtFieldDecoders.getDecoder(field); return gtFieldDecoders.getDecoder(field);
} }
private final void error(final String message) throws RuntimeException { private void error(final String message) throws RuntimeException {
throw new UserException.MalformedBCF2(String.format("%s, at record %d with position %d:", message, recordNo, pos)); throw new UserException.MalformedBCF2(String.format("%s, at record %d with position %d:", message, recordNo, pos));
} }
} }

View File

@ -49,13 +49,6 @@ public class VCFCodec extends AbstractVCFCodec {
// Our aim is to read in the records and convert to VariantContext as quickly as possible, relying on VariantContext to do the validation of any contradictory (or malformed) record parameters. // Our aim is to read in the records and convert to VariantContext as quickly as possible, relying on VariantContext to do the validation of any contradictory (or malformed) record parameters.
public final static String VCF4_MAGIC_HEADER = "##fileformat=VCFv4"; public final static String VCF4_MAGIC_HEADER = "##fileformat=VCFv4";
/**
* A VCF header the contains master info/filter/format records that we use to 'fill in'
* any missing records from our input VCF header. This allows us to repair headers on
* the fly
*/
private VCFHeader headerForRepairs = null;
/** /**
* @param reader the line reader to take header lines from * @param reader the line reader to take header lines from
* @return the number of header lines * @return the number of header lines
@ -88,8 +81,6 @@ public class VCFCodec extends AbstractVCFCodec {
} }
headerStrings.add(line); headerStrings.add(line);
super.parseHeaderFromLines(headerStrings, version); super.parseHeaderFromLines(headerStrings, version);
if ( headerForRepairs != null )
this.header = repairHeader(this.header, headerForRepairs);
return this.header; return this.header;
} }
else { else {
@ -103,24 +94,6 @@ public class VCFCodec extends AbstractVCFCodec {
throw new TribbleException.InvalidHeader("We never saw the required CHROM header line (starting with one #) for the input VCF file"); throw new TribbleException.InvalidHeader("We never saw the required CHROM header line (starting with one #) for the input VCF file");
} }
private final VCFHeader repairHeader(final VCFHeader readHeader, final VCFHeader masterHeader) {
final Set<VCFHeaderLine> lines = VCFUtils.smartMergeHeaders(Arrays.asList(readHeader, masterHeader), log);
return new VCFHeader(lines, readHeader.getGenotypeSamples());
}
/**
* Tells this VCFCodec to repair the incoming header files with the information in masterHeader
*
* @param headerForRepairs
*/
public void setHeaderForRepairs(final VCFHeader headerForRepairs) {
if ( headerForRepairs != null )
log.info("Using master VCF header to repair missing files from incoming VCFs");
this.headerForRepairs = headerForRepairs;
}
/** /**
* parse the filter string, first checking to see if we already have parsed it in a previous attempt * parse the filter string, first checking to see if we already have parsed it in a previous attempt
* *

View File

@ -38,8 +38,8 @@ import java.util.Map;
* A class representing a key=value entry in the VCF header * A class representing a key=value entry in the VCF header
*/ */
public class VCFHeaderLine implements Comparable { public class VCFHeaderLine implements Comparable {
protected static boolean ALLOW_UNBOUND_DESCRIPTIONS = true; protected static final boolean ALLOW_UNBOUND_DESCRIPTIONS = true;
protected static String UNBOUND_DESCRIPTION = "Not provided in original VCF header"; protected static final String UNBOUND_DESCRIPTION = "Not provided in original VCF header";
private String mKey = null; private String mKey = null;
private String mValue = null; private String mValue = null;
@ -53,7 +53,7 @@ public class VCFHeaderLine implements Comparable {
*/ */
public VCFHeaderLine(String key, String value) { public VCFHeaderLine(String key, String value) {
if ( key == null ) if ( key == null )
throw new IllegalArgumentException("VCFHeaderLine: key cannot be null: key = " + key); throw new IllegalArgumentException("VCFHeaderLine: key cannot be null");
mKey = key; mKey = key;
mValue = value; mValue = value;
} }

View File

@ -135,6 +135,7 @@ public class ForumAPIUtils {
System.out.println(line); System.out.println(line);
} }
br.close();
httpClient.getConnectionManager().shutdown(); httpClient.getConnectionManager().shutdown();
return output; return output;

View File

@ -584,20 +584,39 @@ public class GenericDocumentationHandler extends DocumentedGATKFeatureHandler {
* @return * @return
*/ */
@Requires("enumClass.isEnum()") @Requires("enumClass.isEnum()")
private List<Map<String, Object>> docForEnumArgument(Class enumClass) { private List<Map<String, Object>> docForEnumArgument(final Class enumClass) {
ClassDoc doc = this.getDoclet().getClassDocForClass(enumClass); final ClassDoc doc = this.getDoclet().getClassDocForClass(enumClass);
if (doc == null) // || ! doc.isEnum() ) if ( doc == null )
throw new RuntimeException("Tried to get docs for enum " + enumClass + " but got instead: " + doc); throw new RuntimeException("Tried to get docs for enum " + enumClass + " but got null instead");
List<Map<String, Object>> bindings = new ArrayList<Map<String, Object>>(); final Set<String> enumConstantFieldNames = enumConstantsNames(enumClass);
for (final FieldDoc field : doc.fields(false)) {
bindings.add( final List<Map<String, Object>> bindings = new ArrayList<Map<String, Object>>();
new HashMap<String, Object>() {{ for (final FieldDoc fieldDoc : doc.fields(false)) {
put("name", field.name()); if (enumConstantFieldNames.contains(fieldDoc.name()) )
put("summary", field.commentText()); bindings.add(
}}); new HashMap<String, Object>() {{
put("name", fieldDoc.name());
put("summary", fieldDoc.commentText());
}});
} }
return bindings; return bindings;
} }
/**
* Returns the name of the fields that are enum constants according to reflection
*
* @return a non-null set of fields that are enum constants
*/
private Set<String> enumConstantsNames(final Class enumClass) {
final Set<String> enumConstantFieldNames = new HashSet<String>();
for ( final Field field : enumClass.getFields() ) {
if ( field.isEnumConstant() )
enumConstantFieldNames.add(field.getName());
}
return enumConstantFieldNames;
}
} }

View File

@ -3,6 +3,7 @@ package org.broadinstitute.sting.utils.pileup;
import com.google.java.contract.Ensures; import com.google.java.contract.Ensures;
import com.google.java.contract.Requires; import com.google.java.contract.Requires;
import org.broadinstitute.sting.utils.BaseUtils; import org.broadinstitute.sting.utils.BaseUtils;
import org.broadinstitute.sting.utils.MathUtils;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException; import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import org.broadinstitute.sting.utils.exceptions.UserException; import org.broadinstitute.sting.utils.exceptions.UserException;
import org.broadinstitute.sting.utils.sam.GATKSAMRecord; import org.broadinstitute.sting.utils.sam.GATKSAMRecord;
@ -220,7 +221,7 @@ public class PileupElement implements Comparable<PileupElement> {
if (isDeletion() && (offset + 1 >= read.getReadLength()) ) // deletion in the end of the read if (isDeletion() && (offset + 1 >= read.getReadLength()) ) // deletion in the end of the read
throw new UserException.MalformedBAM(read, String.format("Adjacent I/D events in read %s -- cigar: %s", read.getReadName(), read.getCigarString())); throw new UserException.MalformedBAM(read, String.format("Adjacent I/D events in read %s -- cigar: %s", read.getReadName(), read.getCigarString()));
representativeCount = (isDeletion()) ? Math.round((read.getReducedCount(offset) + read.getReducedCount(offset + 1)) / 2) : read.getReducedCount(offset); representativeCount = (isDeletion()) ? MathUtils.fastRound((read.getReducedCount(offset) + read.getReducedCount(offset + 1)) / 2.0) : read.getReducedCount(offset);
} }
return representativeCount; return representativeCount;
} }

View File

@ -94,8 +94,8 @@ public class RecalDatum {
* @param reportedQuality * @param reportedQuality
*/ */
public RecalDatum(final long _numObservations, final long _numMismatches, final byte reportedQuality) { public RecalDatum(final long _numObservations, final long _numMismatches, final byte reportedQuality) {
if ( numObservations < 0 ) throw new IllegalArgumentException("numObservations < 0"); if ( _numObservations < 0 ) throw new IllegalArgumentException("numObservations < 0");
if ( numMismatches < 0 ) throw new IllegalArgumentException("numMismatches < 0"); if ( _numMismatches < 0 ) throw new IllegalArgumentException("numMismatches < 0");
if ( reportedQuality < 0 ) throw new IllegalArgumentException("reportedQuality < 0"); if ( reportedQuality < 0 ) throw new IllegalArgumentException("reportedQuality < 0");
numObservations = _numObservations; numObservations = _numObservations;

View File

@ -21,7 +21,7 @@ import java.util.Set;
*/ */
public class RecalDatumNode<T extends RecalDatum> { public class RecalDatumNode<T extends RecalDatum> {
private final static double SMALLEST_CHI2_PVALUE = 1e-300; private final static double SMALLEST_CHI2_PVALUE = 1e-300;
protected static Logger logger = Logger.getLogger(RecalDatumNode.class); protected static final Logger logger = Logger.getLogger(RecalDatumNode.class);
/** /**
* fixedPenalty is this value if it's considered fixed * fixedPenalty is this value if it's considered fixed

View File

@ -51,7 +51,7 @@ public class CycleCovariate implements StandardCovariate {
private static final int MAXIMUM_CYCLE_VALUE = 1000; private static final int MAXIMUM_CYCLE_VALUE = 1000;
private static final int CUSHION_FOR_INDELS = 4; private static final int CUSHION_FOR_INDELS = 4;
private static String default_platform = null; private String default_platform = null;
private static final EnumSet<NGSPlatform> DISCRETE_CYCLE_PLATFORMS = EnumSet.of(NGSPlatform.ILLUMINA, NGSPlatform.SOLID, NGSPlatform.PACBIO, NGSPlatform.COMPLETE_GENOMICS); private static final EnumSet<NGSPlatform> DISCRETE_CYCLE_PLATFORMS = EnumSet.of(NGSPlatform.ILLUMINA, NGSPlatform.SOLID, NGSPlatform.PACBIO, NGSPlatform.COMPLETE_GENOMICS);
private static final EnumSet<NGSPlatform> FLOW_CYCLE_PLATFORMS = EnumSet.of(NGSPlatform.LS454, NGSPlatform.ION_TORRENT); private static final EnumSet<NGSPlatform> FLOW_CYCLE_PLATFORMS = EnumSet.of(NGSPlatform.LS454, NGSPlatform.ION_TORRENT);

View File

@ -13,7 +13,7 @@ import org.broadinstitute.sting.utils.NGSPlatform;
*/ */
public class GATKSAMReadGroupRecord extends SAMReadGroupRecord { public class GATKSAMReadGroupRecord extends SAMReadGroupRecord {
public static String LANE_TAG = "LN"; public static final String LANE_TAG = "LN";
// the SAMReadGroupRecord data we're caching // the SAMReadGroupRecord data we're caching
private String mSample = null; private String mSample = null;

View File

@ -53,8 +53,8 @@ public class ReadUtils {
private ReadUtils() { private ReadUtils() {
} }
private static int DEFAULT_ADAPTOR_SIZE = 100; private static final int DEFAULT_ADAPTOR_SIZE = 100;
public static int CLIPPING_GOAL_NOT_REACHED = -1; public static final int CLIPPING_GOAL_NOT_REACHED = -1;
public static int getMeanRepresentativeReadCount(GATKSAMRecord read) { public static int getMeanRepresentativeReadCount(GATKSAMRecord read) {
if (!read.isReducedRead()) if (!read.isReducedRead())

View File

@ -172,7 +172,7 @@ public final class FastGenotype extends Genotype {
* @param values * @param values
* @return * @return
*/ */
private final static boolean validADorPLField(final int[] values) { private static boolean validADorPLField(final int[] values) {
if ( values != null ) if ( values != null )
for ( int v : values ) for ( int v : values )
if ( v < 0 ) if ( v < 0 )

View File

@ -53,8 +53,6 @@ import java.util.*;
*/ */
@Invariant({"alleles != null"}) @Invariant({"alleles != null"})
public final class GenotypeBuilder { public final class GenotypeBuilder {
public static boolean MAKE_FAST_BY_DEFAULT = true;
private String sampleName = null; private String sampleName = null;
private List<Allele> alleles = Collections.emptyList(); private List<Allele> alleles = Collections.emptyList();
@ -67,8 +65,6 @@ public final class GenotypeBuilder {
private String filters = null; private String filters = null;
private int initialAttributeMapSize = 5; private int initialAttributeMapSize = 5;
private boolean useFast = MAKE_FAST_BY_DEFAULT;
private final static Map<String, Object> NO_ATTRIBUTES = private final static Map<String, Object> NO_ATTRIBUTES =
Collections.unmodifiableMap(new HashMap<String, Object>(0)); Collections.unmodifiableMap(new HashMap<String, Object>(0));
@ -78,31 +74,22 @@ public final class GenotypeBuilder {
// //
// ----------------------------------------------------------------- // -----------------------------------------------------------------
public final static Genotype create(final String sampleName, final List<Allele> alleles) { public static Genotype create(final String sampleName, final List<Allele> alleles) {
return new GenotypeBuilder(sampleName, alleles).make(); return new GenotypeBuilder(sampleName, alleles).make();
} }
public final static Genotype create(final String sampleName, public static Genotype create(final String sampleName,
final List<Allele> alleles, final List<Allele> alleles,
final Map<String, Object> attributes) { final Map<String, Object> attributes) {
return new GenotypeBuilder(sampleName, alleles).attributes(attributes).make(); return new GenotypeBuilder(sampleName, alleles).attributes(attributes).make();
} }
protected final static Genotype create(final String sampleName, protected static Genotype create(final String sampleName,
final List<Allele> alleles, final List<Allele> alleles,
final double[] gls) { final double[] gls) {
return new GenotypeBuilder(sampleName, alleles).PL(gls).make(); return new GenotypeBuilder(sampleName, alleles).PL(gls).make();
} }
public final static Genotype create(final String sampleName,
final List<Allele> alleles,
final double log10Perror,
final Map<String, Object> attributes) {
return new GenotypeBuilder(sampleName, alleles)
.GQ(log10Perror == SlowGenotype.NO_LOG10_PERROR ? -1 : (int)(log10Perror * -10))
.attributes(attributes).make();
}
/** /**
* Create a empty builder. Both a sampleName and alleles must be provided * Create a empty builder. Both a sampleName and alleles must be provided
* before trying to make a Genotype from this builder. * before trying to make a Genotype from this builder.
@ -182,23 +169,8 @@ public final class GenotypeBuilder {
*/ */
@Ensures({"result != null"}) @Ensures({"result != null"})
public Genotype make() { public Genotype make() {
if ( useFast ) { final Map<String, Object> ea = extendedAttributes == null ? NO_ATTRIBUTES : extendedAttributes;
final Map<String, Object> ea = extendedAttributes == null ? NO_ATTRIBUTES : extendedAttributes; return new FastGenotype(sampleName, alleles, isPhased, GQ, DP, AD, PL, filters, ea);
return new FastGenotype(sampleName, alleles, isPhased, GQ, DP, AD, PL, filters, ea);
} else {
final Map<String, Object> attributes = new LinkedHashMap<String, Object>();
if ( extendedAttributes != null ) attributes.putAll(extendedAttributes);
final double log10PError = GQ == -1 ? SlowGenotype.NO_LOG10_PERROR : (GQ == 0 ? 0 : GQ / -10.0);
if ( DP != -1 ) attributes.put(VCFConstants.DEPTH_KEY, DP);
if ( AD != null ) attributes.put(VCFConstants.GENOTYPE_ALLELE_DEPTHS, AD);
final double[] log10likelihoods = PL != null ? GenotypeLikelihoods.fromPLs(PL).getAsVector() : null;
return new SlowGenotype(sampleName, alleles, log10PError, filters, attributes, isPhased, log10likelihoods);
}
}
public GenotypeBuilder useFast(boolean useFast) {
this.useFast = useFast;
return this;
} }
/** /**

View File

@ -401,7 +401,7 @@ public class GenotypeLikelihoods {
} }
// An index conversion from the deprecated PL ordering to the new VCF-based ordering for up to 3 alternate alleles // An index conversion from the deprecated PL ordering to the new VCF-based ordering for up to 3 alternate alleles
protected static int[] PLindexConversion = new int[]{0, 1, 3, 6, 2, 4, 7, 5, 8, 9}; protected static final int[] PLindexConversion = new int[]{0, 1, 3, 6, 2, 4, 7, 5, 8, 9};
/** /**
* get the allele index pair for the given PL using the deprecated PL ordering: * get the allele index pair for the given PL using the deprecated PL ordering:

View File

@ -1,193 +0,0 @@
/*
* Copyright (c) 2012, The Broad Institute
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
package org.broadinstitute.sting.utils.variantcontext;
import org.broadinstitute.sting.utils.codecs.vcf.VCFConstants;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import java.util.*;
/**
* This class encompasses all the basic information about a genotype. It is immutable.
*
* @author Mark DePristo
*/
@Deprecated
public class SlowGenotype extends Genotype {
protected CommonInfo commonInfo;
public final static double NO_LOG10_PERROR = CommonInfo.NO_LOG10_PERROR;
protected List<Allele> alleles = null;
protected boolean isPhased = false;
protected SlowGenotype(final String sampleName,
final List<Allele> alleles,
final double log10PError,
final String filters,
final Map<String, Object> attributes,
final boolean isPhased,
final double[] log10Likelihoods) {
super(sampleName, filters);
if ( alleles == null || alleles.isEmpty() )
this.alleles = Collections.emptyList();
else
this.alleles = Collections.unmodifiableList(alleles);
commonInfo = new CommonInfo(sampleName, log10PError, Collections.<String>emptySet(), attributes);
if ( log10Likelihoods != null )
commonInfo.putAttribute(VCFConstants.GENOTYPE_PL_KEY, GenotypeLikelihoods.fromLog10Likelihoods(log10Likelihoods));
this.isPhased = isPhased;
validate();
}
@Override public List<Allele> getAlleles() {
return alleles;
}
@Override public Allele getAllele(int i) {
if ( getType() == GenotypeType.UNAVAILABLE )
throw new ReviewedStingException("Requesting alleles for an UNAVAILABLE genotype");
return alleles.get(i);
}
@Override public boolean isPhased() { return isPhased; }
//
// Useful methods for getting genotype likelihoods for a genotype object, if present
//
@Override public boolean hasLikelihoods() {
return (commonInfo.hasAttribute(VCFConstants.GENOTYPE_PL_KEY) && !commonInfo.getAttribute(VCFConstants.GENOTYPE_PL_KEY).equals(VCFConstants.MISSING_VALUE_v4)) ||
(commonInfo.hasAttribute(VCFConstants.GENOTYPE_LIKELIHOODS_KEY) && !commonInfo.getAttribute(VCFConstants.GENOTYPE_LIKELIHOODS_KEY).equals(VCFConstants.MISSING_VALUE_v4));
}
@Override public GenotypeLikelihoods getLikelihoods() {
GenotypeLikelihoods x = getLikelihoods(VCFConstants.GENOTYPE_PL_KEY, true);
if ( x != null )
return x;
else {
x = getLikelihoods(VCFConstants.GENOTYPE_LIKELIHOODS_KEY, false);
return x;
}
}
private GenotypeLikelihoods getLikelihoods(String key, boolean asPL) {
Object x = commonInfo.getAttribute(key);
if ( x instanceof String ) {
if ( asPL )
return GenotypeLikelihoods.fromPLField((String)x);
else
return GenotypeLikelihoods.fromGLField((String)x);
}
else if ( x instanceof GenotypeLikelihoods ) return (GenotypeLikelihoods)x;
else return null;
}
private final void validate() {
if ( alleles.size() == 0) return;
for ( Allele allele : alleles ) {
if ( allele == null )
throw new IllegalArgumentException("BUG: allele cannot be null in Genotype");
}
}
// ---------------------------------------------------------------------------------------------------------
//
// get routines to access context info fields
//
// ---------------------------------------------------------------------------------------------------------
@Override public boolean hasLog10PError() { return commonInfo.hasLog10PError(); }
@Override public double getLog10PError() { return commonInfo.getLog10PError(); }
@Override
public boolean hasExtendedAttribute(String key) { return commonInfo.hasAttribute(key); }
@Override
public Object getExtendedAttribute(String key) { return commonInfo.getAttribute(key); }
@Override
public Object getExtendedAttribute(String key, Object defaultValue) {
return commonInfo.getAttribute(key, defaultValue);
}
// public String getAttributeAsString(String key, String defaultValue) { return commonInfo.getAttributeAsString(key, defaultValue); }
// public int getAttributeAsInt(String key, int defaultValue) { return commonInfo.getAttributeAsInt(key, defaultValue); }
// public double getAttributeAsDouble(String key, double defaultValue) { return commonInfo.getAttributeAsDouble(key, defaultValue); }
// public boolean getAttributeAsBoolean(String key, boolean defaultValue) { return commonInfo.getAttributeAsBoolean(key, defaultValue); }
@Override
public int[] getPL() {
return hasPL() ? getLikelihoods().getAsPLs() : null;
}
@Override
public boolean hasPL() {
return hasLikelihoods();
}
@Override
public int getDP() {
return commonInfo.getAttributeAsInt(VCFConstants.DEPTH_KEY, -1);
}
@Override
public boolean hasDP() {
return commonInfo.hasAttribute(VCFConstants.DEPTH_KEY);
}
@Override
public int[] getAD() {
if ( hasAD() ) {
return (int[])commonInfo.getAttribute(VCFConstants.GENOTYPE_ALLELE_DEPTHS);
} else
return null;
}
@Override
public boolean hasAD() {
return commonInfo.hasAttribute(VCFConstants.GENOTYPE_ALLELE_DEPTHS);
}
@Override
public int getGQ() {
if ( commonInfo.hasLog10PError() )
return (int)Math.round(commonInfo.getPhredScaledQual());
else
return -1;
}
@Override
public boolean hasGQ() {
return hasLog10PError();
}
@Override
public Map<String, Object> getExtendedAttributes() {
final Map<String, Object> ea = new LinkedHashMap<String, Object>(commonInfo.getAttributes());
for ( final String primary : FastGenotype.PRIMARY_KEYS )
ea.remove(primary);
return ea;
}
}

View File

@ -730,7 +730,7 @@ public class VariantContextUtils {
vcList.remove(k); vcList.remove(k);
// avoid having empty lists // avoid having empty lists
if (vcList.size() == 0) if (vcList.size() == 0)
mappedVCs.remove(vcList); mappedVCs.remove(type);
if ( !mappedVCs.containsKey(vc.getType()) ) if ( !mappedVCs.containsKey(vc.getType()) )
mappedVCs.put(vc.getType(), new ArrayList<VariantContext>()); mappedVCs.put(vc.getType(), new ArrayList<VariantContext>());
mappedVCs.get(vc.getType()).add(otherVC); mappedVCs.get(vc.getType()).add(otherVC);

View File

@ -563,6 +563,6 @@ class VCFWriter extends IndexingVariantContextWriter {
+ " at " + vc.getChr() + ":" + vc.getStart() + " at " + vc.getChr() + ":" + vc.getStart()
+ " but this key isn't defined in the VCFHeader. The GATK now requires all VCFs to have" + " but this key isn't defined in the VCFHeader. The GATK now requires all VCFs to have"
+ " complete VCF headers by default. This error can be disabled with the engine argument" + " complete VCF headers by default. This error can be disabled with the engine argument"
+ " -U LENIENT_VCF_PROCESSING or repair the VCF file header using repairVCFHeader"); + " -U LENIENT_VCF_PROCESSING");
} }
} }

View File

@ -76,7 +76,7 @@ public class VariantRecalibrationWalkersIntegrationTest extends WalkerTest {
VRTest bcfTest = new VRTest(privateTestDir + "vqsr.bcf_test.snps.unfiltered.bcf", VRTest bcfTest = new VRTest(privateTestDir + "vqsr.bcf_test.snps.unfiltered.bcf",
"a8ce3cd3dccafdf7d580bcce7d660a9a", // tranches "a8ce3cd3dccafdf7d580bcce7d660a9a", // tranches
"1cdf8c9ee77d91d1ba7f002573108bad", // recal file "74c10fc15f9739a938b7138909fbde04", // recal file
"62fda105e14b619a1c263855cf56af1d"); // cut VCF "62fda105e14b619a1c263855cf56af1d"); // cut VCF
@DataProvider(name = "VRBCFTest") @DataProvider(name = "VRBCFTest")

View File

@ -148,7 +148,7 @@ public class SelectVariantsIntegrationTest extends WalkerTest {
WalkerTestSpec spec = new WalkerTestSpec( WalkerTestSpec spec = new WalkerTestSpec(
"-T SelectVariants -R " + b36KGReference + " -regenotype -sn NA12892 --variant " + testFile + " -o %s --no_cmdline_in_header", "-T SelectVariants -R " + b36KGReference + " -regenotype -sn NA12892 --variant " + testFile + " -o %s --no_cmdline_in_header",
1, 1,
Arrays.asList("52cb2f150559ca1457e9df7ec153dbb452cb2f150559ca1457e9df7ec153dbb4") Arrays.asList("52cb2f150559ca1457e9df7ec153dbb4")
); );
executeTest("testRegenotype--" + testFile, spec); executeTest("testRegenotype--" + testFile, spec);

View File

@ -92,7 +92,7 @@ public class VCFIntegrationTest extends WalkerTest {
// //
// //
// Tests to ensure that -U LENIENT_VCF_PROCESS and header repairs are working // Tests to ensure that -U LENIENT_VCF_PROCESS
// //
// //
@ -106,11 +106,6 @@ public class VCFIntegrationTest extends WalkerTest {
runVCFWithoutHeaders("-U LENIENT_VCF_PROCESSING", "6de8cb7457154dd355aa55befb943f88", null, true); runVCFWithoutHeaders("-U LENIENT_VCF_PROCESSING", "6de8cb7457154dd355aa55befb943f88", null, true);
} }
@Test
public void testPassingOnVCFWithoutHeadersRepairingHeaders() {
runVCFWithoutHeaders("-repairVCFHeader " + privateTestDir + "vcfexample2.justHeader.vcf", "ff61e9cad6653c7f93d82d391f7ecdcb", null, false);
}
private void runVCFWithoutHeaders(final String moreArgs, final String expectedMD5, final Class expectedException, final boolean disableBCF) { private void runVCFWithoutHeaders(final String moreArgs, final String expectedMD5, final Class expectedException, final boolean disableBCF) {
final String testVCF = privateTestDir + "vcfexample2.noHeader.vcf"; final String testVCF = privateTestDir + "vcfexample2.noHeader.vcf";
final String baseCommand = "-R " + b37KGReference final String baseCommand = "-R " + b37KGReference