Killing off some FindBugs 'Usability' issues
This commit is contained in:
parent
611d9b61e2
commit
dac3958461
|
|
@ -142,8 +142,6 @@ 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 numHaplotypes = haplotypeMap.size();
|
|
||||||
|
|
||||||
final int readCounts[] = new int[pileup.getNumberOfElements()];
|
final int readCounts[] = new int[pileup.getNumberOfElements()];
|
||||||
readHaplotypeLikelihoods = pairModel.computeGeneralReadHaplotypeLikelihoods(pileup, haplotypeMap, refContext, eventLength, IndelGenotypeLikelihoodsCalculationModel.getIndelLikelihoodMap(), readCounts);
|
readHaplotypeLikelihoods = pairModel.computeGeneralReadHaplotypeLikelihoods(pileup, haplotypeMap, refContext, eventLength, IndelGenotypeLikelihoodsCalculationModel.getIndelLikelihoodMap(), readCounts);
|
||||||
n = readHaplotypeLikelihoods.length;
|
n = readHaplotypeLikelihoods.length;
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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"));
|
||||||
|
|
|
||||||
|
|
@ -183,7 +183,7 @@ public class UnifiedGenotyperEngine {
|
||||||
for ( final GenotypeLikelihoodsCalculationModel.Model model : models ) {
|
for ( final GenotypeLikelihoodsCalculationModel.Model model : models ) {
|
||||||
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);
|
final VariantContext vc = calculateLikelihoods(tracker, refContext, stratifiedContexts, AlignmentContextUtils.ReadOrientation.COMPLETE, null, true, model);
|
||||||
|
|
@ -202,7 +202,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));
|
||||||
|
|
|
||||||
|
|
@ -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());
|
||||||
|
|
|
||||||
|
|
@ -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") ) {
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -767,7 +767,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) {
|
||||||
|
|
@ -1044,7 +1044,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();
|
||||||
|
|
|
||||||
|
|
@ -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));
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -587,7 +587,7 @@ public class GenericDocumentationHandler extends DocumentedGATKFeatureHandler {
|
||||||
private List<Map<String, Object>> docForEnumArgument(Class enumClass) {
|
private List<Map<String, Object>> docForEnumArgument(Class enumClass) {
|
||||||
ClassDoc doc = this.getDoclet().getClassDocForClass(enumClass);
|
ClassDoc doc = this.getDoclet().getClassDocForClass(enumClass);
|
||||||
if (doc == null) // || ! doc.isEnum() )
|
if (doc == null) // || ! doc.isEnum() )
|
||||||
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>>();
|
List<Map<String, Object>> bindings = new ArrayList<Map<String, Object>>();
|
||||||
for (final FieldDoc field : doc.fields(false)) {
|
for (final FieldDoc field : doc.fields(false)) {
|
||||||
|
|
|
||||||
|
|
@ -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);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue