/** * Create a fully resolved GenotypeContext containing genotypes * * @param genotypes our genotypes in arbitrary * @return an mutable GenotypeContext containing genotypes */ public static final GenotypesContext create(final ArrayList<Genotype> genotypes) { return genotypes == null ? NO_GENOTYPES : new GenotypesContext(genotypes); }
/** * Basic creation routine * @return an empty, mutable GenotypeContext with initial capacity for nGenotypes */ public static final GenotypesContext create(final int nGenotypes) { return new GenotypesContext(nGenotypes); }
/** * Basic creation routine * @return an empty, mutable GenotypeContext */ public static final GenotypesContext create() { return new GenotypesContext(); }
/** * Basic creation routine * @return an empty, mutable GenotypeContext */ public static final GenotypesContext create() { return new GenotypesContext(); }
/** * Basic creation routine * @return an empty, mutable GenotypeContext with initial capacity for nGenotypes */ public static final GenotypesContext create(final int nGenotypes) { return new GenotypesContext(nGenotypes); }
/** * Create a fully resolved GenotypeContext containing genotypes * * @param genotypes our genotypes in arbitrary * @return an mutable GenotypeContext containing genotypes */ public static final GenotypesContext create(final ArrayList<Genotype> genotypes) { return genotypes == null ? NO_GENOTYPES : new GenotypesContext(genotypes); }
/** * Create a fully resolved GenotypeContext containing genotypes, sample lookup table, * and sorted sample names * * @param genotypes our genotypes in arbitrary * @param sampleNameToOffset map optimized for efficient lookup. Each genotype in genotypes must have its * sample name in sampleNameToOffset, with a corresponding integer value that indicates the offset of that * genotype in the vector of genotypes * @param sampleNamesInOrder a list of sample names, one for each genotype in genotypes, sorted in alphabetical * order. * @return an mutable GenotypeContext containing genotypes with already present lookup data */ public static final GenotypesContext create(final ArrayList<Genotype> genotypes, final Map<String, Integer> sampleNameToOffset, final List<String> sampleNamesInOrder) { return new GenotypesContext(genotypes, sampleNameToOffset, sampleNamesInOrder); }
/** * Create a fully resolved GenotypeContext containing genotypes, sample lookup table, * and sorted sample names * * @param genotypes our genotypes in arbitrary * @param sampleNameToOffset map optimized for efficient lookup. Each genotype in genotypes must have its * sample name in sampleNameToOffset, with a corresponding integer value that indicates the offset of that * genotype in the vector of genotypes * @param sampleNamesInOrder a list of sample names, one for each genotype in genotypes, sorted in alphabetical * order. * @return an mutable GenotypeContext containing genotypes with already present lookup data */ public static final GenotypesContext create(final ArrayList<Genotype> genotypes, final Map<String, Integer> sampleNameToOffset, final List<String> sampleNamesInOrder) { return new GenotypesContext(genotypes, sampleNameToOffset, sampleNamesInOrder); }
/** * Basic creation routine * @return an empty, mutable GenotypeContext */ @Ensures({"result != null"}) public static final GenotypesContext create() { return new GenotypesContext(); }
/** * Create a fully resolved GenotypeContext containing genotypes * * @param genotypes our genotypes in arbitrary * @return an mutable GenotypeContext containing genotypes */ @Requires({"genotypes != null"}) @Ensures({"result != null"}) public static final GenotypesContext create(final ArrayList<Genotype> genotypes) { return genotypes == null ? NO_GENOTYPES : new GenotypesContext(genotypes); }
/** * Basic creation routine * @return an empty, mutable GenotypeContext with initial capacity for nGenotypes */ @Requires("nGenotypes >= 0") @Ensures({"result != null"}) public static final GenotypesContext create(final int nGenotypes) { return new GenotypesContext(nGenotypes); }
/** * Create a fully resolved GenotypeContext containing genotypes, sample lookup table, * and sorted sample names * * @param genotypes our genotypes in arbitrary * @param sampleNameToOffset map optimized for efficient lookup. Each genotype in genotypes must have its * sample name in sampleNameToOffset, with a corresponding integer value that indicates the offset of that * genotype in the vector of genotypes * @param sampleNamesInOrder a list of sample names, one for each genotype in genotypes, sorted in alphabetical * order. * @return an mutable GenotypeContext containing genotypes with already present lookup data */ @Requires({"genotypes != null", "sampleNameToOffset != null", "sampleNamesInOrder != null"}) @Ensures({"result != null"}) public static final GenotypesContext create(final ArrayList<Genotype> genotypes, final Map<String, Integer> sampleNameToOffset, final List<String> sampleNamesInOrder) { return new GenotypesContext(genotypes, sampleNameToOffset, sampleNamesInOrder); }
private final void fullyDecodeGenotypes(final VariantContextBuilder builder, final VCFHeader header) { final GenotypesContext gc = new GenotypesContext(); for ( final Genotype g : getGenotypes() ) { gc.add(fullyDecodeGenotypes(g, header)); } builder.genotypesNoValidation(gc); }
private final void fullyDecodeGenotypes(final VariantContextBuilder builder, final VCFHeader header) { final GenotypesContext gc = new GenotypesContext(); for ( final Genotype g : getGenotypes() ) { gc.add(fullyDecodeGenotypes(g, header)); } builder.genotypesNoValidation(gc); }
private final void fullyDecodeGenotypes(final VariantContextBuilder builder, final VCFHeader header) { final GenotypesContext gc = new GenotypesContext(); for ( final Genotype g : getGenotypes() ) { gc.add(fullyDecodeGenotypes(g, header)); } builder.genotypesNoValidation(gc); }
private VariantContext createTestVariantContext(final List<Allele> alleles, final Map<String, Object> attributes, final Genotype... genotypes) { final EnumSet<VariantContext.Validation> toValidate = EnumSet.noneOf(VariantContext.Validation.class); final Set<String> filters = null; final boolean fullyDecoded = false; // no genotypes needs to use GenotypesContext.NO_GENOTYPES, // otherwise we build up a GenotypesContext from the passed genotypes final GenotypesContext gc; if (genotypes == null || genotypes.length == 0) { gc = GenotypesContext.NO_GENOTYPES; } else { gc = new GenotypesContext(); for (final Genotype genotype : genotypes) { gc.add(genotype); } } // most of the fields are not important to the tests, we just need alleles and gc set properly return new VariantContext("genotypes", VCFConstants.EMPTY_ID_FIELD, snpLoc, snpLocStart, snpLocStop, alleles, gc, VariantContext.NO_LOG10_PERROR, filters, attributes, fullyDecoded, toValidate); }
private static void addGenotypeTests( final VariantContext site, Genotype ... genotypes ) { // for each sites VC, we are going to add create two root genotypes. // The first is the primary, and will be added to each new test // The second is variable. In some tests it's absent (testing 1 genotype), in others it is duplicated // 1 once, 10, 100, or 1000 times to test scaling final VariantContextBuilder builder = new VariantContextBuilder(site); // add a single context builder.genotypes(genotypes[0]); add(builder); if ( genotypes.length > 1 ) { // add all add(builder.genotypes(Arrays.asList(genotypes))); // add all with the last replicated 10x and 100x times for ( int nCopiesOfLast : Arrays.asList(10, 100, 1000) ) { final GenotypesContext gc = new GenotypesContext(); final Genotype last = genotypes[genotypes.length-1]; for ( int i = 0; i < genotypes.length - 1; i++ ) gc.add(genotypes[i]); for ( int i = 0; i < nCopiesOfLast; i++ ) gc.add(new GenotypeBuilder(last).name("copy" + i).make()); add(builder.genotypes(gc)); } } }