sequence-formats 1.7.1 → 1.8.0.0
raw patch · 5 files changed
+99/−67 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- SequenceFormats.VCF: VCFentry :: Chrom -> Int -> Maybe ByteString -> ByteString -> [ByteString] -> Double -> Maybe ByteString -> [ByteString] -> [ByteString] -> [[ByteString]] -> VCFentry
+ SequenceFormats.VCF: VCFentry :: Chrom -> Int -> Maybe ByteString -> ByteString -> [ByteString] -> Maybe Double -> Maybe ByteString -> [ByteString] -> [ByteString] -> [[ByteString]] -> VCFentry
- SequenceFormats.VCF: [vcfQual] :: VCFentry -> Double
+ SequenceFormats.VCF: [vcfQual] :: VCFentry -> Maybe Double
Files
- Changelog.md +1/−0
- sequence-formats.cabal +91/−61
- src/SequenceFormats/VCF.hs +4/−3
- test/SequenceFormats/VCFSpec.hs +2/−2
- testDat/example.vcf +1/−1
Changelog.md view
@@ -1,5 +1,6 @@ # Changelog +- V 1.8.0.0: Fixed a bug in the VCF parser that would not accept missing values in QUAL fields (even though the spec explicitly allows for it). This also changed the VCF row structure data type - V 1.7.1: Made compatible with latest GHC - V 1.7.0: Bumped major version for breaking change (correct mistake from 1.6.7.0). Also correct lower pvp-bounds on hackage to be compatible with LTS-18.28. - V 1.6.7.0:
sequence-formats.cabal view
@@ -1,65 +1,95 @@-name: sequence-formats-version: 1.7.1-synopsis: A package with basic parsing utilities for several Bioinformatic data formats.-description: Contains utilities to parse and write Eigenstrat, Fasta, FreqSum, VCF, Plink and other file formats used in population genetics analyses.-license: GPL-3-license-file: LICENSE-author: Stephan Schiffels-maintainer: stephan.schiffels@mac.com-category: Bioinformatics-build-type: Simple-cabal-version: >=1.10-Homepage: https://github.com/stschiff/sequence-formats-Bug-Reports: https://github.com/stschiff/sequence-formats/issues+cabal-version: >=1.10+name: sequence-formats+version: 1.8.0.0+license: GPL-3+license-file: LICENSE+maintainer: stephan.schiffels@mac.com+author: Stephan Schiffels+homepage: https://github.com/stschiff/sequence-formats+bug-reports: https://github.com/stschiff/sequence-formats/issues+synopsis:+ A package with basic parsing utilities for several Bioinformatic data formats. -extra-source-files: README.md,- Changelog.md,- testDat/example.bim,- testDat/example.bed- testDat/example.eigenstratgeno,- testDat/example.fasta,- testDat/example.freqsum,- testDat/example.histogram.txt,- testDat/example.ind,- testDat/example.snp,- testDat/example.vcf,- testDat/example.pileup- testDat/example.fam- testDat/example.plink.bed- testDat/example.plink.fam- testDat/example.plink.bim+description:+ Contains utilities to parse and write Eigenstrat, Fasta, FreqSum, VCF, Plink and other file formats used in population genetics analyses. +category: Bioinformatics+build-type: Simple+extra-source-files:+ README.md+ Changelog.md+ testDat/example.bim+ testDat/example.bed+ testDat/example.eigenstratgeno+ testDat/example.fasta+ testDat/example.freqsum+ testDat/example.histogram.txt+ testDat/example.ind+ testDat/example.snp+ testDat/example.vcf+ testDat/example.pileup+ testDat/example.fam+ testDat/example.plink.bed+ testDat/example.plink.fam+ testDat/example.plink.bim+ library- exposed-modules: SequenceFormats.RareAlleleHistogram,- SequenceFormats.FreqSum,- SequenceFormats.Fasta,- SequenceFormats.VCF,- SequenceFormats.Eigenstrat,- SequenceFormats.Plink,- SequenceFormats.Utils,- SequenceFormats.Pileup,- SequenceFormats.Bed,- SequenceFormats.Genomic- hs-source-dirs: src- build-depends: base >= 4.7 && < 5, containers, errors, attoparsec, pipes,- transformers, bytestring, lens-family,- pipes-bytestring, foldl, exceptions, pipes-safe,- pipes-attoparsec, vector- default-language: Haskell2010+ exposed-modules:+ SequenceFormats.RareAlleleHistogram+ SequenceFormats.FreqSum+ SequenceFormats.Fasta+ SequenceFormats.VCF+ SequenceFormats.Eigenstrat+ SequenceFormats.Plink+ SequenceFormats.Utils+ SequenceFormats.Pileup+ SequenceFormats.Bed+ SequenceFormats.Genomic -Test-Suite sequenceFormatTests- type: exitcode-stdio-1.0- main-is: Spec.hs- hs-source-dirs: test- build-depends: base, sequence-formats, foldl, pipes, pipes-safe, tasty, vector,- transformers, tasty-hunit, bytestring, containers, hspec- other-modules: SequenceFormats.EigenstratSpec,- SequenceFormats.BedSpec,- SequenceFormats.FastaSpec,- SequenceFormats.FreqSumSpec,- SequenceFormats.RareAlleleHistogramSpec,- SequenceFormats.UtilsSpec,- SequenceFormats.PlinkSpec,- SequenceFormats.VCFSpec,- SequenceFormats.PileupSpec- default-language: Haskell2010+ hs-source-dirs: src+ default-language: Haskell2010+ build-depends:+ base >=4.7 && <5,+ containers,+ errors,+ attoparsec,+ pipes,+ transformers,+ bytestring,+ lens-family,+ pipes-bytestring,+ foldl,+ exceptions,+ pipes-safe,+ pipes-attoparsec,+ vector++test-suite sequenceFormatTests+ type: exitcode-stdio-1.0+ main-is: Spec.hs+ hs-source-dirs: test+ other-modules:+ SequenceFormats.EigenstratSpec+ SequenceFormats.BedSpec+ SequenceFormats.FastaSpec+ SequenceFormats.FreqSumSpec+ SequenceFormats.RareAlleleHistogramSpec+ SequenceFormats.UtilsSpec+ SequenceFormats.PlinkSpec+ SequenceFormats.VCFSpec+ SequenceFormats.PileupSpec++ default-language: Haskell2010+ build-depends:+ base,+ sequence-formats,+ foldl,+ pipes,+ pipes-safe,+ tasty,+ vector,+ transformers,+ tasty-hunit,+ bytestring,+ containers,+ hspec
src/SequenceFormats/VCF.hs view
@@ -47,7 +47,7 @@ vcfId :: Maybe B.ByteString, -- ^The SNP ID if non-missing vcfRef :: B.ByteString, -- ^ The reference allele (supports also multi-character alleles for Indels) vcfAlt :: [B.ByteString], -- ^The alternative alleles, each one possible of multiple characters - vcfQual :: Double, -- ^The quality value+ vcfQual :: Maybe Double, -- ^The quality value vcfFilter :: Maybe B.ByteString, -- ^The Filter value, if non-missing. vcfInfo :: [B.ByteString], -- ^A list of Info fields vcfFormatString :: [B.ByteString], -- ^A list of format tags@@ -92,17 +92,18 @@ vcfEntryParser = vcfEntryParserFull <|> vcfEntryParserTruncated where vcfEntryParserFull = VCFentry <$> (Chrom <$> word) <* sp <*> A.decimal <* sp <*> parseId <*- sp <*> word <* sp <*> parseAlternativeAlleles <* sp <*> A.double <* sp <*> parseFilter <* + sp <*> word <* sp <*> parseAlternativeAlleles <* sp <*> parseQual <* sp <*> parseFilter <* sp <*> parseInfoFields <* sp <*> parseFormatStrings <* sp <*> parseGenotypeInfos <* A.endOfLine vcfEntryParserTruncated = VCFentry <$> (Chrom <$> word) <* sp <*> A.decimal <* sp <*> parseId <*- sp <*> word <* sp <*> parseAlternativeAlleles <* sp <*> A.double <* sp <*> parseFilter <*+ sp <*> word <* sp <*> parseAlternativeAlleles <* sp <*> parseQual <* sp <*> parseFilter <* sp <*> parseInfoFields <*> pure [] <*> pure [] <* A.endOfLine sp = A.satisfy (\c -> c == ' ' || c == '\t') parseId = (parseDot *> pure Nothing) <|> (Just <$> word) parseDot = A.char '.' parseAlternativeAlleles = (parseDot *> pure []) <|> (parseAllele `A.sepBy1` A.char ',') parseAllele = A.takeTill (\c -> c == ',' || isSpace c)+ parseQual = (parseDot *> pure Nothing) <|> (Just <$> A.double) parseFilter = (parseDot *> pure Nothing) <|> (Just <$> word) parseInfoFields = (parseDot *> pure []) <|> (parseInfoField `A.sepBy1` A.char ';') parseInfoField = A.takeTill (\c -> c == ';' || isSpace c)
test/SequenceFormats/VCFSpec.hs view
@@ -36,12 +36,12 @@ vcfRows !! 6 `shouldBe` vcf7 vcf1 :: VCFentry-vcf1 = VCFentry (Chrom "1") 10492 (Just "testId") "C" ["T"] 15.0302 Nothing ["DP=28", "PV4=1,1,0.30985,1"]+vcf1 = VCFentry (Chrom "1") 10492 (Just "testId") "C" ["T"] (Just 15.0302) Nothing ["DP=28", "PV4=1,1,0.30985,1"] ["GT", "PL"] [["0/0", "0,3,37"], ["0/0", "0,6,67"], ["0/1", "51,0,28"], ["0/0", "0,54,255"], ["0/0", "0,9,83"]] vcf7 :: VCFentry-vcf7 = VCFentry (Chrom "2") 30923 Nothing "G" [] 110.112 Nothing ["DP=5", "FQ=-28.9619"]+vcf7 = VCFentry (Chrom "2") 30923 Nothing "G" [] Nothing Nothing ["DP=5", "FQ=-28.9619"] ["GT", "PL"] [["1/1", "0,0,0"], ["1/1", "0,0,0"], ["1/1", "40,6,0"], ["1/1", "105,9,0"], ["1/1", "0,0,0"]] testGetGenotypes :: Spec
testDat/example.vcf view
@@ -24,4 +24,4 @@ 2 14933 . G A 51.2451 . DP=60.215796;PV4=0.49427,1,1,1 GT:PL 0/0:0,6,39 0/1:25,0,48 0/0:0,18,118 0/1:69,0,163 0/0:0,12,80 2 16495 . G C 7.29715 . DP=47.27107;AC1=2;PV4=0.540781,0.244272,1,0.0352549 GT:PL 0/0:0,9,9 0/1:23,3,0 0/0:0,4,9 0/1:27,0,46 0/0:0,9,21 2 20144 . G A 15.7039 . DP=121;AC1=3;PV4=1,1,1,1 GT:PL 0/0:0,5,81 0/1:33,0,47 0/1:9,0,21 0/0:0,182,122 0/1:18,0,27-2 30923 . G . 110.112 . DP=5;FQ=-28.9619 GT:PL 1/1:0,0,0 1/1:0,0,0 1/1:40,6,0 1/1:105,9,0 1/1:0,0,0+2 30923 . G . . . DP=5;FQ=-28.9619 GT:PL 1/1:0,0,0 1/1:0,0,0 1/1:40,6,0 1/1:105,9,0 1/1:0,0,0