prsparser

package
v0.0.0-...-66a4754 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2022 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Layouts = map[string]Layout{
	"AVKNG2018": {
		Delimiter:       '\t',
		Comment:         '#',
		ColEffectAllele: 1,
		ColAllele1:      5,
		ColAllele2:      6,
		ColChromosome:   3,
		ColPosition:     4,
		ColScore:        2,
		ColSNP:          -1,
		Parser:          &defaultParseRow,
	},
	"LDPRED": {
		Delimiter:       ' ',
		Comment:         '#',
		ColEffectAllele: 4,
		ColAllele1:      3,
		ColAllele2:      4,
		ColChromosome:   0,
		ColPosition:     1,
		ColScore:        6,
		ColSNP:          -1,
		Parser:          &ldpredParseRow,
	},
	"BOLTBGEN": {
		Delimiter:       '\t',
		Comment:         '#',
		ColEffectAllele: 4,
		ColAllele1:      5,
		ColAllele2:      4,
		ColChromosome:   1,
		ColPosition:     2,
		ColScore:        10,
		ColSNP:          -1,
		Parser:          &defaultParseRow,
	},
}

Functions

func LayoutNames

func LayoutNames() string

Types

type Allele

type Allele = bgen.Allele

type Layout

type Layout struct {
	Delimiter       rune
	Comment         rune
	ColEffectAllele int
	ColAllele1      int
	ColAllele2      int
	ColChromosome   int
	ColPosition     int
	ColScore        int
	ColSNP          int
	Parser          *func(layout *Layout, row []string) (PRS, error)
}

type PRS

type PRS struct {
	EffectAllele Allele
	Allele1      Allele
	Allele2      Allele
	Chromosome   string
	Position     int
	Score        float64
	SNP          string
}

func DefaultParseRow

func DefaultParseRow(layout *Layout, row []string) (PRS, error)

func (PRS) AllowSNP

func (p PRS) AllowSNP() bool

AllowSNP is a heuristic that suggests whether the SNP field should be used included in a lookup *even when* the Position is known

func (PRS) UseSNP

func (p PRS) UseSNP() bool

UseSNP is a heuristic that suggests whether the SNP field should be used for a lookup instead of the Position.

type PRSParser

type PRSParser struct {
	CSVReaderSettings *csv.Reader
	Layout            *Layout
}

func New

func New(layout string) (*PRSParser, error)

func NewWithLayout

func NewWithLayout(layout *Layout) (*PRSParser, error)

func (*PRSParser) ParseRow

func (prsp *PRSParser) ParseRow(row []string) (PRS, error)

Jump to

Keyboard shortcuts

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