Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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
- data VCFheader = VCFheader {}
- data VCFentry = VCFentry {
- vcfChrom :: Chrom
- vcfPos :: Int
- vcfId :: Maybe ByteString
- vcfRef :: ByteString
- vcfAlt :: [ByteString]
- vcfQual :: Maybe Double
- vcfFilter :: Maybe ByteString
- vcfInfo :: [ByteString]
- vcfGenotypeInfo :: Maybe ([ByteString], [[ByteString]])
- vcfHeaderParser :: Parser VCFheader
- readVCFfromStdIn :: (MonadIO m, MonadThrow m) => m (VCFheader, Producer VCFentry m ())
- readVCFfromFile :: MonadSafe m => FilePath -> m (VCFheader, Producer VCFentry m ())
- getGenotypes :: MonadThrow m => VCFentry -> m [ByteString]
- getDosages :: MonadThrow m => VCFentry -> m [Maybe (Int, Int)]
- isTransversionSnp :: ByteString -> [ByteString] -> Bool
- vcfToFreqSumEntry :: MonadThrow m => VCFentry -> m FreqSumEntry
- isBiallelicSnp :: ByteString -> [ByteString] -> Bool
- printVCFtoStdOut :: MonadIO m => VCFheader -> Consumer VCFentry m ()
- writeVCFfile :: MonadSafe m => FilePath -> VCFheader -> Consumer VCFentry m ()
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
Constructors
VCFheader | |
Fields
|
A Datatype representing a single VCF entry.
Constructors
VCFentry | |
Fields
|
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 :: MonadThrow m => VCFentry -> m [ByteString] Source #
Extracts the genotype fields (for each sapmle) from a VCF entry
getDosages :: MonadThrow m => VCFentry -> m [Maybe (Int, Int)] Source #
Extracts the dosages (the sum of non-reference alleles) and ploidies per sample
isTransversionSnp :: ByteString -> [ByteString] -> Bool Source #
returns True if the SNp is a biallelic Transversion SNP (i.e. one of GT, GC, AT, AC)
vcfToFreqSumEntry :: MonadThrow m => VCFentry -> m FreqSumEntry Source #
Converts a VCFentry to the simpler FreqSum format
isBiallelicSnp :: ByteString -> [ByteString] -> Bool Source #
returns True if the SNP is biallelic.