Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
A module to help with parsing VCF files. The VCF format is defined here: https://en.wikipedia.org/wiki/Variant_Call_Format
Synopsis
- data VCFheader = VCFheader {
- vcfHeaderComments :: [String]
- vcfSampleNames :: [String]
- data VCFentry = VCFentry {
- vcfChrom :: Chrom
- vcfPos :: Int
- vcfId :: Maybe ByteString
- vcfRef :: ByteString
- vcfAlt :: [ByteString]
- vcfQual :: Maybe Double
- vcfFilter :: Maybe ByteString
- vcfInfo :: [ByteString]
- vcfFormatString :: [ByteString]
- vcfGenotypeInfo :: [[ByteString]]
- readVCFfromStdIn :: (MonadIO m, MonadThrow m) => m (VCFheader, Producer VCFentry m ())
- readVCFfromFile :: MonadSafe m => FilePath -> m (VCFheader, Producer VCFentry m ())
- getGenotypes :: VCFentry -> Either String [ByteString]
- getDosages :: VCFentry -> Either String [Maybe Int]
- isTransversionSnp :: ByteString -> [ByteString] -> Bool
- vcfToFreqSumEntry :: VCFentry -> Either String FreqSumEntry
- isBiallelicSnp :: ByteString -> [ByteString] -> Bool
Documentation
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
VCFheader | |
|
A Datatype representing a single VCF entry.
VCFentry | |
|
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.
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.