packages feed

sequence-formats 1.11.0.0 → 1.11.0.1

raw patch · 3 files changed

+11/−7 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

Changelog.md view
@@ -1,5 +1,6 @@ # Changelog +- V 1.11.0.1: Allowing missing alternative alleles when converting VCF to FreqSum, and improved error messaging. - V 1.11.0.0: Added support for writing of VCF files, including gzipping. Made some breaking API changes on top, for example   to make the FreqSum data representation safer with respect to Ploidy. Also replaced String types in Eigenstrat and Plink formats to ByteStrings for efficiency. We anyway don't support Unicode with the AttoParsec library. - V 1.10.0.0: Brought gzip-writing support for Eigenstrat and Plink files back to non-breaking API in `writeEigenstrat` and `writePlink`. Client code can safely update from 1.8.X to 1.10.0.0.
sequence-formats.cabal view
@@ -1,5 +1,5 @@ name:                sequence-formats-version:             1.11.0.0+version:             1.11.0.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
src/SequenceFormats/VCF.hs view
@@ -176,13 +176,16 @@ -- |Converts a VCFentry to the simpler FreqSum format vcfToFreqSumEntry :: (MonadThrow m) => VCFentry -> m FreqSumEntry vcfToFreqSumEntry vcfEntry = do-    unless (B.length (vcfRef vcfEntry) == 1) . throwM $ SeqFormatException "multi-site reference allele"-    unless (length (vcfAlt vcfEntry) == 1) . throwM $ SeqFormatException "need exactly one alternative allele"-    unless (B.length (head . vcfAlt $ vcfEntry) == 1) . throwM $ SeqFormatException "multi-site alternative allele"+    unless (B.length (vcfRef vcfEntry) == 1) . throwM . SeqFormatException $+        "multi-site reference allele at " ++ show vcfEntry+    alt <- case vcfAlt vcfEntry of+        [] -> return 'N'+        (a:_) -> if B.length a /= 1+                 then+                    throwM . SeqFormatException $ "multi-site alternative allele at " ++ show vcfEntry+                 else+                    return $ B.head a     let ref = B.head (vcfRef vcfEntry)-    let alt = B.head . head . vcfAlt $ vcfEntry-    unless (ref `elem` ['A', 'C', 'T', 'G', 'N']) . throwM $ SeqFormatException "Invalid Reference Allele"-    unless (alt `elem` ['A', 'C', 'T', 'G', '.']) . throwM $ SeqFormatException "Invalid Alternative Allele"     dosages <- getDosages vcfEntry     return $ FreqSumEntry (vcfChrom vcfEntry) (vcfPos vcfEntry) (vcfId vcfEntry) Nothing ref alt dosages