bedgovcf

package
v0.0.0-...-9905510 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Header []ConfigHeaderStruct        // Additional headers to add to the VCF
	Chrom  ConfigStandardFieldStruct   // The chromosome field
	Pos    ConfigStandardFieldStruct   // The position field
	Id     ConfigStandardFieldStruct   // The ID field
	Ref    ConfigStandardFieldStruct   // The reference field
	Alt    ConfigStandardFieldStruct   // The alt field
	Qual   ConfigStandardFieldStruct   // The quality field
	Filter ConfigStandardFieldStruct   // The filter field
	Info   SliceConfigInfoFormatStruct // The info fields
	Format SliceConfigInfoFormatStruct // The format fields
}

The main config struct

func ReadConfig

func ReadConfig(configString string) (error, Config)

Read the configuration file, cast it to its struct and validate

type ConfigHeaderStruct

type ConfigHeaderStruct struct {
	Name        string // The name of the header line
	Content     string // The content of the header line
	Description string // The description of the header line
}

The struct for the additional headers

type ConfigInfoFormatStruct

type ConfigInfoFormatStruct struct {
	Name        string // The name of the current INFO or FORMAT field
	Value       string // The value to use
	Prefix      string // The prefix to add to each value
	Description string // The description of the field
	Number      string // The number of values that can be included in the INFO field (e.g. 1, 2, A, R)
	Type        string // The type of the header field (e.g. Integer, Float, Character, Flag)
}

The struct for the info and format fields

type ConfigStandardFieldStruct

type ConfigStandardFieldStruct struct {
	Value   string               // The value to use
	Prefix  string               // The prefix to add to each value
	Options []ConfigHeaderStruct // The different options possible (only for ALT and FILTER)
}

The struct for the standard fields

type Header struct {
	HeaderLines []HeaderLine // All conventional header lines
	Version     string       // The version of the VCF file
	Sample      string       // The sample name
}

The struct for the header

func (Header) String

func (h Header) String() string

Convert the VCF header to a string

type HeaderLine

type HeaderLine struct {
	Category    string // The category of header line (e.g INFO, FORMAT, FILTER)
	Id          string // The ID of the header line (e.g. SVLEN, GT, END)
	Number      string // The number of values that can be included in the INFO field (e.g. 1, 2, A, R)
	Type        string // The type of the header field (e.g. Integer, Float, Character, Flag)
	Description string // The description of the header line
	Length      string // The length of the contig (only for contig header lines)
	Content     string // The content of the header line (only for non usual header lines)
}

The struct for one header line

func (HeaderLine) String

func (h HeaderLine) String() string

Convert the VCF header line to a string

type SliceConfigInfoFormatStruct

type SliceConfigInfoFormatStruct []ConfigInfoFormatStruct

type SliceVariantInfoFormat

type SliceVariantInfoFormat []VariantInfoFormat

The map for the info and format fields

type Variant

type Variant struct {
	Chrom  string                 // The chromosome
	Pos    string                 // The position
	Id     string                 // The ID
	Ref    string                 // The reference allele
	Alt    string                 // The alternative allele
	Qual   string                 // The quality
	Filter string                 // The filter
	Info   SliceVariantInfoFormat // The info fields
	Format SliceVariantInfoFormat // The format fields
}

The struct for one variant

func (Variant) String

func (v Variant) String(count int) string

Convert a variant to a string

type VariantInfoFormat

type VariantInfoFormat struct {
	Name   string // The name of the current INFO or FORMAT field
	Number string // The number of values that can be included in the INFO field (e.g. 1, 2, A, R)
	Type   string // The type of the header field (e.g. Integer, Float, Character, Flag)
	Value  string // The value of the field
}

The struct for one info or format field

type Vcf

type Vcf struct {
	Header   Header    // The header of the VCF
	Variants []Variant // The variants of the VCF
}

The main VCF struct

func (*Vcf) AddVariants

func (v *Vcf) AddVariants(cCtx *cli.Context, config Config) error

Read the BED file and add the variants to the VCF struct

func (*Vcf) SetHeader

func (v *Vcf) SetHeader(cCtx *cli.Context, config Config) error

Set the header of the VCF struct according to the config and fai

func (*Vcf) Write

func (v *Vcf) Write(cCtx *cli.Context) error

Write the VCF struct to stdout or a file

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL