{"id":44862246,"url":"https://github.com/carbocation/vcfgogt","last_synced_at":"2026-02-17T10:38:48.383Z","repository":{"id":57654525,"uuid":"454441106","full_name":"carbocation/vcfgogt","owner":"carbocation","description":"vcfgo clone focused on genotype parsing","archived":false,"fork":false,"pushed_at":"2022-02-01T15:28:34.000Z","size":556,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"feature/geno-optimized","last_synced_at":"2024-06-20T05:10:52.513Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/carbocation.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-02-01T15:28:05.000Z","updated_at":"2022-02-01T15:28:27.000Z","dependencies_parsed_at":"2022-09-01T01:22:18.428Z","dependency_job_id":null,"html_url":"https://github.com/carbocation/vcfgogt","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/carbocation/vcfgogt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carbocation%2Fvcfgogt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carbocation%2Fvcfgogt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carbocation%2Fvcfgogt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carbocation%2Fvcfgogt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/carbocation","download_url":"https://codeload.github.com/carbocation/vcfgogt/tar.gz/refs/heads/feature/geno-optimized","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carbocation%2Fvcfgogt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29540247,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-17T08:11:05.436Z","status":"ssl_error","status_checked_at":"2026-02-17T08:09:38.860Z","response_time":100,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-02-17T10:38:47.629Z","updated_at":"2026-02-17T10:38:48.375Z","avatar_url":"https://github.com/carbocation.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![GoDoc](https://godoc.org/github.com/brentp/vcfgo?status.svg)](https://godoc.org/github.com/brentp/vcfgo)\n[![Build Status](https://travis-ci.org/brentp/vcfgo.svg)](https://travis-ci.org/brentp/vcfgo)\n[![Coverage Status](https://coveralls.io/repos/brentp/vcfgo/badge.svg)](https://coveralls.io/r/brentp/vcfgo)\n\nvcfgo is a golang library to read, write and manipulate files in the variant call format.\n\n# vcfgo\n--\n    import \"github.com/brentp/vcfgo\"\n\nPackage vcfgo implements a Reader and Writer for variant call format. It eases\nreading, filtering modifying VCF's even if they are not to spec. Example:\n\n## Usage\n\n```go\nf, _ := os.Open(\"examples/test.auto_dom.no_parents.vcf\")\nrdr, err := vcfgo.NewReader(f, false)\nif err != nil {\n    panic(err)\n}\nfor {\n    variant := rdr.Read()\n    if variant == nil {\n        break\n    }\n    fmt.Printf(\"%s\\t%d\\t%s\\t%v\\n\", variant.Chromosome, variant.Pos, variant.Ref(), variant.Alt())\n    dp, err := variant.Info().Get(\"DP\")\n    fmt.Printf(\"depth: %v\\n\", dp.(int))\n    sample := variant.Samples[0]\n    // we can get the PL field as a list (-1 is default in case of missing value)\n    PL, err := variant.GetGenotypeField(sample, \"PL\", -1)\n    if err != nil {\n        panic(err)\n    }\n    fmt.Printf(\"%v\\n\", PL)\n    _ = sample.DP\n}\nfmt.Fprintln(os.Stderr, rdr.Error())\n\n```\n\n## Status\n\n`vcfgo` is well-tested, but still in development. It tries to tolerate, but report\nerrors; after every `rdr.Read()` call, the caller can check `rdr.Error()`\nand get feedback on the errors without stopping execution unless it is explicitly\nrequested to do so.\n\nInfo and sample fields are pre-parsed and stored as `map[string]interface{}` so\ncallers will have to cast to the appropriate type upon retrieval.\n\n#### type Header\n\n```go\ntype Header struct {\n\tSampleNames   []string\n\tInfos         map[string]*Info\n\tSampleFormats map[string]*SampleFormat\n\tFilters       map[string]string\n\tExtras        map[string]string\n\tFileFormat    string\n\t// contid id maps to a map of length, URL, etc.\n\tContigs map[string]map[string]string\n}\n```\n\nHeader holds all the type and format information for the variants.\n\n#### func  NewHeader\n\n```go\nfunc NewHeader() *Header\n```\nNewHeader returns a Header with the requisite allocations.\n\n#### type Info\n\n```go\ntype Info struct {\n\tId          string\n\tDescription string\n\tNumber      string // A G R . ''\n\tType        string // STRING INTEGER FLOAT FLAG CHARACTER UNKONWN\n}\n```\n\nInfo holds the Info and Format fields\n\n#### func (*Info) String\n\n```go\nfunc (i *Info) String() string\n```\nString returns a string representation.\n\n#### type InfoMap\n\n```go\ntype InfoMap map[string]interface{}\n```\n\nInfoMap holds the parsed Info field which can contain floats, ints and lists\nthereof.\n\n#### func (InfoMap) String\n\n```go\nfunc (m InfoMap) String() string\n```\nString returns a string that matches the original info field.\n\n#### type Reader\n\n```go\ntype Reader struct {\n\tHeader *Header\n\n\tLineNumber int64\n}\n```\n\nReader holds information about the current line number (for errors) and The VCF\nheader that indicates the structure of records.\n\n#### func  NewReader\n\n```go\nfunc NewReader(r io.Reader, lazySamples bool) (*Reader, error)\n```\nNewReader returns a Reader.\n\n#### func (*Reader) Clear\n\n```go\nfunc (vr *Reader) Clear()\n```\nClear empties the cache of errors.\n\n#### func (*Reader) Error\n\n```go\nfunc (vr *Reader) Error() error\n```\nError() aggregates the multiple errors that can occur into a single object.\n\n#### func (*Reader) Read\n\n```go\nfunc (vr *Reader) Read() *Variant\n```\nRead returns a pointer to a Variant. Upon reading the caller is assumed to check\nReader.Err()\n\n#### type SampleFormat\n\n```go\ntype SampleFormat Info\n```\n\nSampleFormat holds the type info for Format fields.\n\n#### func (*SampleFormat) String\n\n```go\nfunc (i *SampleFormat) String() string\n```\nString returns a string representation.\n\n#### type SampleGenotype\n\n```go\ntype SampleGenotype struct {\n\tPhased bool\n\tGT     []int\n\tDP     int\n\tGL     []float32\n\tGQ     int\n\tMQ     int\n\tFields map[string]string\n}\n```\n\nSampleGenotype holds the information about a sample. Several fields are\npre-parsed, but all fields are kept in Fields as well.\n\n#### func  NewSampleGenotype\n\n```go\nfunc NewSampleGenotype() *SampleGenotype\n```\nNewSampleGenotype allocates the internals and returns a SampleGenotype\n\n#### func (*SampleGenotype) String\n\n```go\nfunc (sg *SampleGenotype) String(fields []string) string\n```\nString returns the string representation of the sample field.\n\n#### type VCFError\n\n```go\ntype VCFError struct {\n\tMsgs  []string\n\tLines []int64\n}\n```\n\nVCFError satisfies the error interface and allows multiple errors. This is\nuseful because, for example, on a single line, every sample may have a field\nthat doesn't match the description in the header. We want to keep parsing but\nalso let the caller know about the error.\n\n#### func  NewVCFError\n\n```go\nfunc NewVCFError() *VCFError\n```\nNewVCFError allocates the needed ingredients.\n\n#### func (*VCFError) Add\n\n```go\nfunc (e *VCFError) Add(err error, line int64)\n```\nAdd adds an error and the line number within the vcf where the error took place.\n\n#### func (*VCFError) Clear\n\n```go\nfunc (e *VCFError) Clear()\n```\nClear empties the Messages\n\n#### func (*VCFError) Error\n\n```go\nfunc (e *VCFError) Error() string\n```\nError returns a string with all errors delimited by newlines.\n\n#### func (*VCFError) IsEmpty\n\n```go\nfunc (e *VCFError) IsEmpty() bool\n```\nIsEmpty returns true if there no errors stored.\n\n#### type Variant\n\n```go\ntype Variant struct {\n\tChromosome      string\n\tPos        \t\tuint64\n\tId         \t\tstring\n\tRef        \t\tstring\n\tAlt        \t\t[]string\n\tQuality    \t\tfloat32\n\tFilter     \t\tstring\n\tInfo       \t\tInfoMap\n\tFormat     \t\t[]string\n\tSamples    \t\t[]*SampleGenotype\n\tHeader     \t\t*Header\n\tLineNumber \t\tint64\n}\n```\n\nVariant holds the information about a single site. It is analagous to a row in a\nVCF file.\n\n#### func (*Variant) GetGenotypeField\n\n```go\nfunc (v *Variant) GetGenotypeField(g *SampleGenotype, field string, missing interface{}) (interface{}, error)\n```\nGetGenotypeField uses the information from the header to parse the correct time\nfrom a genotype field. It returns an interface that can be asserted to the\nexpected type.\n\n#### func (*Variant) String\n\n```go\nfunc (v *Variant) String() string\n```\nString gives a string representation of a variant\n\n#### type Writer\n\n```go\ntype Writer struct {\n\tio.Writer\n\tHeader *Header\n}\n```\n\nWriter allows writing VCF files.\n\n#### func  NewWriter\n\n```go\nfunc NewWriter(w io.Writer, h *Header) (*Writer, error)\n```\nNewWriter returns a writer after writing the header.\n\n#### func (*Writer) WriteVariant\n\n```go\nfunc (w *Writer) WriteVariant(v *Variant)\n```\nWriteVariant writes a single variant\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarbocation%2Fvcfgogt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcarbocation%2Fvcfgogt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarbocation%2Fvcfgogt/lists"}