genomisc

package module
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: 18 Imported by: 2

README

genomisc

Miscellaneous genomics tools and data structures in golang

HWE

go get github.com/carbocation/genomisc/hwe

HWE computes Exact or Approximate Hardy-Weinberg P value. Fast computes the approximate P value, then if it is significant according to your threshold, it computes the Exact P-value to be certain. This is a pure go implementation with naive algorithms, which can therefore be slow. It uses big.Int and can handle extremely large sample sizes (~hundreds of thousands).

RAMCSV

go get github.com/carbocation/genomisc/ramcsv

RAMCSV consumes a file handle and a csv.Reader (which exists only to provide your csv parsing settings) and allows you to seek back and forth through a CSV file to any line in the file, without having to actually keep the full file in memory.

PRSParser

go get github.com/carbocation/genomisc/prsparser

PRSParser consumes a variety of formats for polygenic scores.

Documentation

Index

Constants

View Source
const (
	Chromosome int = iota
	VariantID
	Morgans
	Coordinate
	Allele1
	Allele2
)

Map columns in the BIM file to their positions

Variables

This section is empty.

Functions

func DetermineDelimiter

func DetermineDelimiter(r io.Reader) rune

DetermineDelimiter returns the single most likely rune that would delimit the values in the reader, assuming a CSV-like file.

func ExpandHome

func ExpandHome(path string) string

ExpandHome expands ~ to its proper path, where appropriate.

func MaybeDecompressReadCloserFromFile

func MaybeDecompressReadCloserFromFile(f io.ReadSeekCloser) (io.ReadCloser, error)

MaybeDecompressReadCloserFromFile detects whether a file-like object (must implement io.Reader, io.Seeker, and io.Closer) is compressed with GZip, Zip, BZip2, XZ, or Z and decompresses it. If not, it returns the file as-is. It uses the seek method to ensure that the reader is reset to the starting byte so that it does not discard bytes.

func MaybeOpenSeekerFromGoogleStorage

func MaybeOpenSeekerFromGoogleStorage(path string, client *storage.Client) (io.ReadSeekCloser, error)

Types

type BIM

type BIM struct {
	// contains filtered or unexported fields
}

func OpenBIM

func OpenBIM(path string) (*BIM, error)

func (*BIM) Close

func (b *BIM) Close() error

func (*BIM) Err

func (b *BIM) Err() error

func (*BIM) Read

func (b *BIM) Read() *BIMRow

type BIMRow

type BIMRow struct {
	Chromosome string
	Coordinate uint32 // Labeled "position" by most applications
	VariantID  string // E.g., RSID
	Allele1    string // Can contain > 1 character
	Allele2    string // Can contain > 1 character

}

type DataType

type DataType byte
const (
	DataTypeInvalid DataType = iota
	DataTypeNoCompression
	DataTypeGzip
	DataTypeZip
	DataTypeXZ
	DataTypeZ
	DataTypeBZip2
)

func DetectDataType

func DetectDataType(r io.Reader) (DataType, error)

DetectDataType attempts to detect the data type of a stream by checking against a set of known data types. Byte code signatures from https://stackoverflow.com/a/19127748/199475

type GSReadSeekCloser

type GSReadSeekCloser struct {
	*storage.ObjectHandle
	Context context.Context
	Closer  *func() error
	// contains filtered or unexported fields
}

Decorates a Google Storage object handle with an io.ReadSeekCloser. Derived from https://github.com/googleapis/google-cloud-go/issues/1124#issuecomment-419070541

func (*GSReadSeekCloser) Close

func (o *GSReadSeekCloser) Close() error

Satisfies io.Closer. If o.close is not set, this is a nop.

func (*GSReadSeekCloser) Read

func (s *GSReadSeekCloser) Read(buf []byte) (int, error)

func (*GSReadSeekCloser) Seek

func (s *GSReadSeekCloser) Seek(offset int64, whence int) (int64, error)

type GSReaderAtCloser

type GSReaderAtCloser struct {
	*storage.ObjectHandle
	Context context.Context
	Closer  *func() error
	Reader  *storage.Reader
}

Decorates a Google Storage object handle with ReadAt

func (*GSReaderAtCloser) Close

func (o *GSReaderAtCloser) Close() error

Satisfies io.Closer. If o.close is not set, this is a nop.

func (*GSReaderAtCloser) Read

func (o *GSReaderAtCloser) Read(p []byte) (n int, err error)

func (*GSReaderAtCloser) ReadAt

func (o *GSReaderAtCloser) ReadAt(p []byte, offset int64) (n int, err error)

ReadAt satisfies io.ReaderAt. Note that this is dependent upon making p a buffer of the desired length to be read by NewRangeReader.

type ReaderAtCloser

type ReaderAtCloser interface {
	io.Reader
	io.ReaderAt
	io.Closer
}

Directories

Path Synopsis
cmd
animateunjitter
animateunjitter removes lines from a sorted manifest in a fashion that avoids returning to a previously seen series_number.
animateunjitter removes lines from a sorted manifest in a fashion that avoids returning to a previously seen series_number.
bimmanglesnpids
bimmanglesnpids is designed to handle a specific situation where you want to mangle rsids intentionally.
bimmanglesnpids is designed to handle a specific situation where you want to mangle rsids intentionally.
bolt2ldhub
Convert BOLT-LMM input into input satisfactory for ldhub
Convert BOLT-LMM input into input satisfactory for ldhub
clinvartab2bigquery
clinvar2bigquery is designed to take clinvar data, filter it using criteria that are useful to my line of work, and then format it so that it can be ingested in bigquery.
clinvar2bigquery is designed to take clinvar data, filter it using criteria that are useful to my line of work, and then format it so that it can be ingested in bigquery.
deleteunknown
Deletes files from `folder` not matching names found in `permitted-list`, with `suffix` optionally being appended to `permitted-list` to facilitate matching.
Deletes files from `folder` not matching names found in `permitted-list`, with `suffix` optionally being appended to `permitted-list` to facilitate matching.
dicom-mip
dicom-mip produces maximum intensity projections, as well as average intensity projections and .mp4 videos of the projections through the 3D block of voxels from sagittal and coronal projections.
dicom-mip produces maximum intensity projections, as well as average intensity projections and .mp4 videos of the projections through the 3D block of voxels from sagittal and coronal projections.
dicom2las
dicom2las converts DICOM files to LAS files (LASer format), which is a [format for point clouds](https://en.wikipedia.org/wiki/LAS_file_format).
dicom2las converts DICOM files to LAS files (LASer format), which is a [format for point clouds](https://en.wikipedia.org/wiki/LAS_file_format).
genes2sites
MendelOverlap performs permutation to quantify surprise at the number of GWAS loci that overlap with Mendelian genes for your trait of interest.
MendelOverlap performs permutation to quantify surprise at the number of GWAS loci that overlap with Mendelian genes for your trait of interest.
gtf2tsv
gtf2tsv flattens a gtf file to a tsv seems to require a 2-pass approach
gtf2tsv flattens a gtf file to a tsv seems to require a 2-pass approach
mendeloverlap
MendelOverlap performs permutation to quantify surprise at the number of GWAS loci that overlap with Mendelian genes for your trait of interest.
MendelOverlap performs permutation to quantify surprise at the number of GWAS loci that overlap with Mendelian genes for your trait of interest.
nearbygenes
nearbygenes finds all genes whose transcript start sites are within a given radius of a given chr:pos.
nearbygenes finds all genes whose transcript start sites are within a given radius of a given chr:pos.
nearestgene
nearestgene finds the single gene whose transcript start site is closest to a given chr:pos.
nearestgene finds the single gene whose transcript start site is closest to a given chr:pos.
pixeloverlap
pixeloverlap computes overlap/agreement metrics between two images drawn with an encoding compatible with the overlay.LabeledPixelToID function.
pixeloverlap computes overlap/agreement metrics between two images drawn with an encoding compatible with the overlay.LabeledPixelToID function.
pixeloverlapsummary
pixeloverlapsummary is a convenience tool to summarize the output of pixeloverlap by label
pixeloverlapsummary is a convenience tool to summarize the output of pixeloverlap by label
pixelqc
colqc performs qc on columnar data (the output of pixelcounter)
colqc performs qc on columnar data (the output of pixelcounter)
pixelreplace
pixelreplace replaces specific pixel-label IDs from the overlay package with specified replacement labels.
pixelreplace replaces specific pixel-label IDs from the overlay package with specified replacement labels.
pngreplace
pngreplace replaces specific pixel-labels from the overlay package with specified replacement labels.
pngreplace replaces specific pixel-labels from the overlay package with specified replacement labels.
pngupsample
pngupsample ingests a PNG and parameters that indicate (1) how to resize pixels and (2) which subset of the image to upsample, then produces the subsetted, upsampled PNG.
pngupsample ingests a PNG and parameters that indicate (1) how to resize pixels and (2) which subset of the image to upsample, then produces the subsetted, upsampled PNG.
compileinfoprint is imported for the side effect of printing the compileinfo to os.StdErr
compileinfoprint is imported for the side effect of printing the compileinfo to os.StdErr
example
bim
ukbb2csv

Jump to

Keyboard shortcuts

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