biocore 0.3 → 0.3.1
raw patch · 2 files changed
+12/−9 lines, 2 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Bio.Core.Sequence: seqlabel :: BioSeq s => s -> SeqLabel
- Bio.Core.Sequence: class BioSeq s
+ Bio.Core.Sequence: class BioSeq s where seqid = seqlabel seqheader = seqlabel seqlabel = seqid
Files
- biocore.cabal +1/−1
- src/Bio/Core/Sequence.hs +11/−8
biocore.cabal view
@@ -1,5 +1,5 @@ Name: biocore-Version: 0.3+Version: 0.3.1 License: LGPL Cabal-Version: >= 1.6
src/Bio/Core/Sequence.hs view
@@ -79,23 +79,26 @@ -- represents a biological sequence should implement it. class BioSeq s where seqid :: s -> SeqLabel -- ^ Sequence identifier (typically first word of the header)+ seqid = seqlabel seqheader :: s -> SeqLabel -- ^ Sequence header (may contain whitespace), by convention the -- first word matches the 'seqid'+ seqheader = seqlabel seqdata :: s -> SeqData -- ^ Sequence data seqlength :: s -> Offset -- ^ Sequence length -- slice :: s -> (Offset,Offset) -> s -- ^ Cut a slice of a sequence. -- copy :: s -> s -- ^ Create a copy of a sequence. --- | Deprecated. Instead, use 'seqid' if you want the unique ID, or --- 'seqheader' if you want the FASTA style header with ID and comments.-seqlabel :: BioSeq s => s -> SeqLabel-seqlabel = seqid+ seqlabel :: s -> SeqLabel -- ^ Deprecated. Instead, use 'seqid' if you + -- want the unique ID, or 'seqheader' if you + -- want the FASTA style header with ID and comments.+ seqlabel = seqid + {-# DEPRECATED seqlabel "Warning: 'seqlabel' is deprecated, use 'seqid' or 'seqheader' instead." #-} -- | Any 'BioSeq' can be formatted as Fasta, 60-char lines. toFasta :: BioSeq s => s -> LC.ByteString -- any kind of string-like data type? Use builder?-toFasta s = LC.concat (gt:unSL (seqlabel s):nl:wrap (unSD $ seqdata s))+toFasta s = LC.concat (gt:unSL (seqheader s):nl:wrap (unSD $ seqdata s)) where wrap x = if LC.null x then [] else let (ln,rest) = LC.splitAt 60 x in ln : nl : wrap rest nl = LC.pack "\n" gt = LC.pack ">"@@ -109,7 +112,7 @@ -- | Output Fasta-formatted quality data (.qual files), where quality values are output as -- whitespace-separated integers. toFastaQual :: BioSeqQual s => s -> LC.ByteString-toFastaQual s = LC.concat (gt:unSL (seqlabel s):nl:wrap (L.unpack $ unQD $ seqqual s))+toFastaQual s = LC.concat (gt:unSL (seqheader s):nl:wrap (L.unpack $ unQD $ seqqual s)) where wrap x = if null x then [] else let (ln,rest) = splitAt 20 x in LC.pack (unwords $ map show ln) : nl : wrap rest nl = LC.pack "\n" gt = LC.pack ">"@@ -117,7 +120,7 @@ -- | Output FastQ-formatted data. For simplicity, only the Sanger quality format is supported, -- and only four lines per sequence (i.e. no line breaks in sequence or quality data). toFastQ :: BioSeqQual s => s -> LC.ByteString-toFastQ s = LC.unlines [LC.cons '@' (unSL $ seqlabel s)+toFastQ s = LC.unlines [LC.cons '@' (unSL $ seqid s) , unSD (seqdata s)- , LC.cons '+' (unSL $ seqlabel s)+ , LC.cons '+' (unSL $ seqid s) , L.map (+33) (unQD $ seqqual s)]