sequence-formats-1.6.1: A package with basic parsing utilities for several Bioinformatic data formats.
Safe HaskellNone
LanguageHaskell2010

SequenceFormats.VCF

Description

A module to help with parsing VCF files. The VCF format is defined here: https://en.wikipedia.org/wiki/Variant_Call_Format

Synopsis

Documentation

data VCFheader Source #

A datatype to represent the VCF Header. Most comments are simply parsed as entire lines, but the very last comment line, containing the sample names, is separated out

Constructors

VCFheader 

Fields

Instances

Instances details
Show VCFheader Source # 
Instance details

Defined in SequenceFormats.VCF

data VCFentry Source #

A Datatype representing a single VCF entry.

Constructors

VCFentry 

Fields

Instances

Instances details
Eq VCFentry Source # 
Instance details

Defined in SequenceFormats.VCF

Show VCFentry Source # 
Instance details

Defined in SequenceFormats.VCF

readVCFfromStdIn :: (MonadIO m, MonadThrow m) => m (VCFheader, Producer VCFentry m ()) Source #

Reading a VCF from StdIn. Returns a VCFHeader and a Producer over VCFentries.

readVCFfromFile :: MonadSafe m => FilePath -> m (VCFheader, Producer VCFentry m ()) Source #

Reading a VCF from a file. Returns a VCFHeader and a Producer over VCFentries.

readVCFfromProd :: MonadThrow m => Producer ByteString m () -> m (VCFheader, Producer VCFentry m ()) Source #

reads a VCFheader and VCFentries from a text producer.

getGenotypes :: VCFentry -> Either String [ByteString] Source #

Extracts the genotype fields (for each sapmle) from a VCF entry

getDosages :: VCFentry -> Either String [Maybe Int] Source #

Extracts the dosages (the sum of non-reference alleles) per sample (returns a Left Error if it fails.)

isTransversionSnp :: ByteString -> [ByteString] -> Bool Source #

returns True if the SNp is a biallelic Transversion SNP (i.e. one of GT, GC, AT, AC)

vcfToFreqSumEntry :: VCFentry -> Either String FreqSumEntry Source #

Converts a VCFentry to the simpler FreqSum format (returns a Left Error if it fails.)

isBiallelicSnp :: ByteString -> [ByteString] -> Bool Source #

returns True if the SNP is biallelic.