Java Code Examples for htsjdk.variant.variantcontext.VariantContext#Type
The following examples show how to use
htsjdk.variant.variantcontext.VariantContext#Type .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GenotypeConcordanceSummaryMetrics.java From picard with MIT License | 6 votes |
public GenotypeConcordanceSummaryMetrics(final VariantContext.Type variantType, final GenotypeConcordanceCounts concordanceCounts, final String truthSample, final String callSample, final boolean missingSitesFlag) { this.VARIANT_TYPE = variantType; this.TRUTH_SAMPLE = truthSample; this.CALL_SAMPLE = callSample; final GenotypeConcordanceSchemeFactory schemeFactory = new GenotypeConcordanceSchemeFactory(); final GenotypeConcordanceScheme scheme = schemeFactory.getScheme(missingSitesFlag); scheme.validateScheme(); concordanceCounts.validateCountsAgainstScheme(scheme); this.HET_SENSITIVITY = concordanceCounts.getSensitivity(scheme, GenotypeConcordanceCounts.HET_TRUTH_STATES); this.HET_PPV = concordanceCounts.Ppv(scheme, GenotypeConcordanceCounts.HET_CALL_STATES); this.HET_SPECIFICITY = Double.NaN; this.HOMVAR_SENSITIVITY = concordanceCounts.getSensitivity(scheme, GenotypeConcordanceCounts.HOM_VAR_TRUTH_STATES); this.HOMVAR_PPV = concordanceCounts.Ppv(scheme, GenotypeConcordanceCounts.HOM_VAR_CALL_STATES); this.HOMVAR_SPECIFICITY = Double.NaN; this.VAR_SENSITIVITY = concordanceCounts.getSensitivity(scheme, GenotypeConcordanceCounts.VAR_TRUTH_STATES); this.VAR_PPV = concordanceCounts.Ppv(scheme, GenotypeConcordanceCounts.VAR_CALL_STATES); this.VAR_SPECIFICITY = concordanceCounts.getSpecificity(scheme, GenotypeConcordanceCounts.VAR_TRUTH_STATES); this.GENOTYPE_CONCORDANCE = concordanceCounts.calculateGenotypeConcordance(scheme, missingSitesFlag); this.NON_REF_GENOTYPE_CONCORDANCE = concordanceCounts.calculateNonRefGenotypeConcordance(scheme, missingSitesFlag); }
Example 2
Source File: GenotypeConcordanceContingencyMetrics.java From picard with MIT License | 6 votes |
public GenotypeConcordanceContingencyMetrics(final VariantContext.Type variantType, final GenotypeConcordanceCounts concordanceCounts, final String truthSample, final String callSample, final boolean missingSitesFlag) { this.VARIANT_TYPE = variantType; this.TRUTH_SAMPLE = truthSample; this.CALL_SAMPLE = callSample; final GenotypeConcordanceSchemeFactory schemeFactory = new GenotypeConcordanceSchemeFactory(); final GenotypeConcordanceScheme scheme = schemeFactory.getScheme(missingSitesFlag); scheme.validateScheme(); concordanceCounts.validateCountsAgainstScheme(scheme); Map<ContingencyState, Long> counts = concordanceCounts.getContingencyStateCounts(scheme); this.TP_COUNT = counts.get(ContingencyState.TP); this.TN_COUNT = counts.get(ContingencyState.TN); this.FP_COUNT = counts.get(ContingencyState.FP); this.FN_COUNT = counts.get(ContingencyState.FN); this.EMPTY_COUNT = counts.get(ContingencyState.EMPTY); }
Example 3
Source File: BasicSomaticShortMutationValidator.java From gatk with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * @param genotype The genotype to test whether we can attempt to validate. Never {@code null} * @param referenceAllele The reference allele (from parent VariantContext). Never {@code null} * @return whether this class can even attempt a validation of the genotype in question. */ public static boolean isAbleToValidateGenotype(final Genotype genotype, final Allele referenceAllele) { Utils.nonNull(genotype); Utils.nonNull(referenceAllele); // In order to proceed, we have some assumptions: // - The genotype has a ploidy of 2 // - The genotype is a simple indel or a xNP // - The first allele of the genotype is reference final boolean isDiploid = genotype.getAlleles().size() == 2; final boolean doesGenotypeHaveReference = genotype.getAllele(0).equals(referenceAllele); final boolean isReferenceNotSymbolic = !referenceAllele.isSymbolic(); final VariantContext.Type variantType = GATKVariantContextUtils.typeOfVariant(genotype.getAllele(0), genotype.getAllele(1)); final boolean isValidatableVariantType = VALIDATABLE_TYPES.contains(variantType) && !GATKVariantContextUtils.isComplexIndel(genotype.getAllele(0), genotype.getAllele(1)); final boolean hasKnownCoverage = genotype.hasAD() && (genotype.getAD().length == 2); final boolean isValidateable = (isDiploid && doesGenotypeHaveReference && isValidatableVariantType && hasKnownCoverage && isReferenceNotSymbolic); if (!isValidateable) { logger.info("Cannot validate genotype: " + genotype + " ploidy2: " + isDiploid + " genotypeHasReferenceAllele: " + doesGenotypeHaveReference + " validatableVariant: " + isValidatableVariantType + " hasCompleteAD field: " + hasKnownCoverage + " isNonSymbolicReference: " + isReferenceNotSymbolic); } return isValidateable; }
Example 4
Source File: SelectVariants.java From gatk with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Prepare the type inclusion list to be used by the type filter */ private Set<VariantContext.Type> createSampleTypeInclusionList() { // if user specified types to include, add these, otherwise, add all possible variant context types to list of vc types to include if (typesToInclude.isEmpty()) { selectedTypes.addAll(Arrays.asList(VariantContext.Type.values())); } else { selectedTypes.addAll(typesToInclude); } // Exclude types take precedence over include - remove specified exclude types selectedTypes.removeAll(typesToExclude); return selectedTypes; }
Example 5
Source File: ConcordanceSummaryRecord.java From gatk-protected with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override protected ConcordanceSummaryRecord createRecord(final DataLine dataLine) { final VariantContext.Type type = VariantContext.Type.valueOf(dataLine.get(VARIANT_TYPE_COLUMN_NAME)); final long truePositives = Long.parseLong(dataLine.get(TRUE_POSITIVE_COLUMN_NAME)); final long falsePositives = Long.parseLong(dataLine.get(FALSE_POSITIVE_COLUMN_NAME)); final long falseNegatives = Long.parseLong(dataLine.get(FALSE_NEGATIVE_COLUMN_NAME)); return new ConcordanceSummaryRecord(type, truePositives, falsePositives, falseNegatives); }
Example 6
Source File: ConcordanceSummaryRecord.java From gatk with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override protected ConcordanceSummaryRecord createRecord(final DataLine dataLine) { final VariantContext.Type type = VariantContext.Type.valueOf(dataLine.get(VARIANT_TYPE_COLUMN_NAME)); final long truePositives = Long.parseLong(dataLine.get(TRUE_POSITIVE_COLUMN_NAME)); final long falsePositives = Long.parseLong(dataLine.get(FALSE_POSITIVE_COLUMN_NAME)); final long falseNegatives = Long.parseLong(dataLine.get(FALSE_NEGATIVE_COLUMN_NAME)); return new ConcordanceSummaryRecord(type, truePositives, falsePositives, falseNegatives); }
Example 7
Source File: InfoConcordanceRecord.java From gatk with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override protected InfoConcordanceRecord createRecord(DataLine dataLine) { VariantContext.Type type = VariantContext.Type.valueOf(dataLine.get(VARIANT_TYPE_COLUMN_NAME)); String evalKey = dataLine.get(EVAL_INFO_KEY); String trueKey = dataLine.get(TRUE_INFO_KEY); double mean = Double.parseDouble(dataLine.get(MEAN_DIFFERENCE)); double std = Double.parseDouble(dataLine.get(STD_DIFFERENCE)); return new InfoConcordanceRecord(type, evalKey, trueKey, mean, std); }
Example 8
Source File: ConcordanceSummaryRecord.java From gatk-protected with BSD 3-Clause "New" or "Revised" License | 4 votes |
public ConcordanceSummaryRecord(final VariantContext.Type type, final long truePositives, final long falsePositives, final long falseNegatives){ this.type = type; this.truePositives = truePositives; this.falsePositives = falsePositives; this.falseNegatives = falseNegatives; }
Example 9
Source File: VariantTypesVariantFilter.java From gatk with BSD 3-Clause "New" or "Revised" License | 4 votes |
public VariantTypesVariantFilter(Set<VariantContext.Type> includeTypes) { Utils.nonNull(includeTypes); sampleTypes = includeTypes; }
Example 10
Source File: VariantTypesVariantFilter.java From gatk with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public boolean test(final VariantContext vc) { final VariantContext.Type vcSampleType = vc.getType(); return sampleTypes.contains(vcSampleType); }
Example 11
Source File: ConcordanceSummaryRecord.java From gatk with BSD 3-Clause "New" or "Revised" License | 4 votes |
public ConcordanceSummaryRecord(final VariantContext.Type type, final long truePositives, final long falsePositives, final long falseNegatives){ this.type = type; this.truePositives = truePositives; this.falsePositives = falsePositives; this.falseNegatives = falseNegatives; }
Example 12
Source File: VariantType.java From gatk with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void initialize() { for (VariantContext.Type t : VariantContext.Type.values()) states.add(t.toString()); }
Example 13
Source File: InfoConcordanceRecord.java From gatk with BSD 3-Clause "New" or "Revised" License | 3 votes |
/** * Record keeps track of concordance between values from INFO-field keys of a VCF. * * @param type SNP or INDEL * @param evalKey The INFO field key from the eval VCF * @param trueKey The INFO field key from the truth VCF * @param mean The mean of the differences in values for these INFO fields. * @param std The standard deviation of the differences in values for these INFO fields. */ public InfoConcordanceRecord(VariantContext.Type type, String evalKey, String trueKey, double mean, double std) { this.type = type; this.evalKey = evalKey; this.trueKey = trueKey; this.mean = mean; this.std = std; }
Example 14
Source File: InfoConcordanceRecord.java From gatk with BSD 3-Clause "New" or "Revised" License | 2 votes |
/** * * @return Variant type (e.g. SNP or INDEL) */ public VariantContext.Type getVariantType() { return this.type; }
Example 15
Source File: ConcordanceSummaryRecord.java From gatk-protected with BSD 3-Clause "New" or "Revised" License | votes |
public VariantContext.Type getVariantType() { return type; }
Example 16
Source File: ConcordanceSummaryRecord.java From gatk with BSD 3-Clause "New" or "Revised" License | votes |
public VariantContext.Type getVariantType() { return type; }