1 #ifndef gamgee__variant_builder__guard
2 #define gamgee__variant_builder__guard
21 template<
class FIELD_TYPE>
26 void set(
const FIELD_TYPE value) { m_field_value = value; m_is_set =
true; }
28 bool is_set()
const {
return m_is_set; }
29 void clear() { m_is_set =
false; }
32 FIELD_TYPE m_field_value;
1324 bool m_enable_validation;
1326 void build_from_scratch(
const std::shared_ptr<bcf1_t>& new_variant_body)
const;
1327 void post_build_validation(
const std::shared_ptr<bcf1_t>& new_variant_body)
const;
VariantBuilder & set_integer_individual_field(const std::string &tag, const VariantBuilderMultiSampleVector< int32_t > &values_for_all_samples)
Set an integer individual field for all samples at once by name using an efficient flattened (one-dim...
Definition: variant_builder.cpp:258
VariantBuilder & remove_id()
Clear the ID field (if set)
Definition: variant_builder.cpp:108
VariantBuilder & set_alignment_start(const uint32_t alignment_start)
Set the alignment start position.
Definition: variant_builder.cpp:47
VariantBuilder & set_alt_alleles(const std::vector< std::string > &alt_alleles)
Set the alt alleles.
Definition: variant_builder.cpp:77
void set(const FIELD_TYPE value)
Definition: variant_builder.h:26
VariantBuilder & set_chromosome(const uint32_t chromosome)
Set the chromosome by index.
Definition: variant_builder.cpp:36
VariantBuilder & set_ref_allele(const std::string &ref_allele)
Set the reference allele.
Definition: variant_builder.cpp:67
FIELD_TYPE field_value() const
Definition: variant_builder.h:27
VariantBuilder & set_integer_shared_field(const std::string &tag, const int32_t value)
Set a single-valued integer shared field by field name.
Definition: variant_builder.cpp:129
~VariantBuilder()=default
VariantBuilder & remove_filters()
Clear filters (if set)
Definition: variant_builder.cpp:118
VariantBuilderCoreField()
Definition: variant_builder.h:24
VariantBuilder & remove_alignment_stop()
Clear the alignment stop value (if set)
Definition: variant_builder.cpp:98
VariantBuilder & set_boolean_shared_field(const std::string &tag)
Set a boolean (flag) shared field by field name.
Definition: variant_builder.cpp:179
Helper class for VariantBuilder to manage the fields belonging to the shared region of Variant record...
Definition: variant_builder_shared_region.h:56
VariantBuilderMultiSampleVector< float > get_float_multi_sample_vector(const uint32_t num_samples, const uint32_t max_values_per_sample) const
Get a pre-initialized/padded VariantBuilderMultiSampleVector for use with the more-efficient float in...
Definition: variant_builder.cpp:497
VariantBuilder & remove_shared_field(const std::string &tag)
Remove a shared field by field name.
Definition: variant_builder.cpp:195
VariantBuilder & set_genotypes(const VariantBuilderMultiSampleVector< int32_t > &genotypes_for_all_samples)
Set the genotypes (GT) field for all samples at once using an efficient flattened (one-dimensional) v...
Definition: variant_builder.cpp:222
void clear()
Definition: variant_builder.h:29
Class that allows you to efficiently prepare multi-sample data for setting individual fields in Varia...
Definition: variant_builder_multi_sample_vector.h:40
VariantBuilder: construct Variant records from scratch (and, coming soon, from existing Variant recor...
Definition: variant_builder.h:164
VariantBuilder & set_string_shared_field(const std::string &tag, const std::string &value)
Set a string shared field by field name.
Definition: variant_builder.cpp:169
VariantBuilder & set_alignment_stop(const uint32_t alignment_stop)
Set the alignment stop position.
Definition: variant_builder.cpp:52
VariantBuilder & remove_individual_fields(const std::vector< std::string > &tags)
Remove multiple individual fields by field name.
Definition: variant_builder.cpp:472
VariantBuilder & clear()
Clear all field values in this builder to prepare it for the next build operation.
Definition: variant_builder.cpp:523
Internal VariantBuilder class to represent "core" (non-data-region) fields such as the alignment star...
Definition: variant_builder.h:22
Variant build() const
Create a new Variant record using the current state of the builder.
Definition: variant_builder.cpp:510
VariantBuilder & set_float_shared_field(const std::string &tag, const float value)
Set a single-valued float shared field by field name.
Definition: variant_builder.cpp:149
Definition: exceptions.h:9
Helper class for VariantBuilder to manage the fields belonging to the individual region of Variant re...
Definition: variant_builder_individual_region.h:23
VariantBuilderMultiSampleVector< int32_t > get_integer_multi_sample_vector(const uint32_t num_samples, const uint32_t max_values_per_sample) const
Get a pre-initialized/padded VariantBuilderMultiSampleVector for use with the more-efficient integer ...
Definition: variant_builder.cpp:493
VariantBuilderMultiSampleVector< int32_t > get_genotype_multi_sample_vector(const uint32_t num_samples, const uint32_t max_values_per_sample) const
Get a pre-initialized/padded VariantBuilderMultiSampleVector for use with the more-efficient GT field...
Definition: variant_builder.cpp:489
VariantBuilder & set_genotype(const std::string &sample, const std::vector< int32_t > &genotype)
Set the genotypes (GT) field for a single sample by sample name, copying the genotype before encoding...
Definition: variant_builder.cpp:372
VariantBuilder & remove_individual_field(const std::string &tag)
Remove an individual field by field name.
Definition: variant_builder.cpp:462
VariantBuilder & set_filters(const std::vector< std::string > &filters)
Set the filters using filter names.
Definition: variant_builder.cpp:82
VariantBuilder & set_enable_validation(const bool enable_validation)
Disable or enable all validation checks in this builder.
Definition: variant_builder.cpp:23
Utility class to manipulate a Variant record.
Definition: variant.h:29
VariantBuilder & remove_qual()
Clear the qual field (if set)
Definition: variant_builder.cpp:103
bool is_set() const
Definition: variant_builder.h:28
VariantHeader header() const
Return the Variant header for this builder.
Definition: variant_builder.h:193
VariantBuilder & set_qual(const float qual)
Set the Phred-scaled site quality (probability that the site is not reference)
Definition: variant_builder.cpp:57
VariantBuilder(const VariantHeader &header)
Construct a new VariantBuilder given a VariantHeader.
Definition: variant_builder.cpp:12
VariantBuilder & set_id(const std::string &id)
Set the variant ID field.
Definition: variant_builder.cpp:62
VariantBuilder & set_alt_allele(const std::string &alt_allele)
Set the alt allele.
Definition: variant_builder.cpp:72
VariantBuilder & remove_alt_alleles()
Clear alt alleles (if set)
Definition: variant_builder.cpp:113
VariantBuilder & remove_shared_fields(const std::vector< std::string > &tags)
Remove multiple shared fields by field name.
Definition: variant_builder.cpp:205
VariantBuilder & set_float_individual_field(const std::string &tag, const VariantBuilderMultiSampleVector< float > &values_for_all_samples)
Set a float individual field for all samples at once by name using an efficient flattened (one-dimens...
Definition: variant_builder.cpp:302
VariantBuilder & operator=(VariantBuilder &&other)=default
VariantBuilder & set_string_individual_field(const std::string &tag, const std::vector< std::string > &values_for_all_samples)
Set a string individual field for all samples at once by name, copying the provided values...
Definition: variant_builder.cpp:346