hs-samtools (empty) → 0.5.0.2
raw patch · 62 files changed
+5903/−0 lines, 62 filesdep +asciidep +attoparsecdep +base
Dependencies added: ascii, attoparsec, base, bitvec, bytestring, containers, crypton, generic-deriving, hs-samtools, pcre-heavy, regex-tdfa, streamly, streamly-bytestring, streamly-core
Files
- CHANGELOG.md +62/−0
- LICENSE +30/−0
- hs-samtools.cabal +173/−0
- src/Data/SAM/Version1_6/Alignment.hs +46/−0
- src/Data/SAM/Version1_6/Alignment/BOPT.hs +278/−0
- src/Data/SAM/Version1_6/Alignment/Base.hs +151/−0
- src/Data/SAM/Version1_6/Base.hs +80/−0
- src/Data/SAM/Version1_6/Header.hs +54/−0
- src/Data/SAM/Version1_6/Header/CO.hs +47/−0
- src/Data/SAM/Version1_6/Header/HD.hs +133/−0
- src/Data/SAM/Version1_6/Header/PG.hs +177/−0
- src/Data/SAM/Version1_6/Header/RG.hs +366/−0
- src/Data/SAM/Version1_6/Header/SQ.hs +271/−0
- src/Data/SAM/Version1_6/Read/Base.hs +97/−0
- src/Data/SAM/Version1_6/Read/Error.hs +241/−0
- src/Data/SAM/Version1_6/Read/Parser/Alignment/AOPT.hs +78/−0
- src/Data/SAM/Version1_6/Read/Parser/Alignment/BOPT.hs +172/−0
- src/Data/SAM/Version1_6/Read/Parser/Alignment/Base.hs +191/−0
- src/Data/SAM/Version1_6/Read/Parser/Alignment/FOPT.hs +80/−0
- src/Data/SAM/Version1_6/Read/Parser/Alignment/HOPT.hs +80/−0
- src/Data/SAM/Version1_6/Read/Parser/Alignment/IOPT.hs +80/−0
- src/Data/SAM/Version1_6/Read/Parser/Alignment/ZOPT.hs +78/−0
- src/Data/SAM/Version1_6/Read/Parser/Header/CO/Base.hs +71/−0
- src/Data/SAM/Version1_6/Read/Parser/Header/HD/Base.hs +89/−0
- src/Data/SAM/Version1_6/Read/Parser/Header/HD/GO.hs +75/−0
- src/Data/SAM/Version1_6/Read/Parser/Header/HD/SO.hs +75/−0
- src/Data/SAM/Version1_6/Read/Parser/Header/HD/SS.hs +75/−0
- src/Data/SAM/Version1_6/Read/Parser/Header/HD/VN.hs +75/−0
- src/Data/SAM/Version1_6/Read/Parser/Header/PG/Base.hs +99/−0
- src/Data/SAM/Version1_6/Read/Parser/Header/PG/CL.hs +70/−0
- src/Data/SAM/Version1_6/Read/Parser/Header/PG/DS.hs +70/−0
- src/Data/SAM/Version1_6/Read/Parser/Header/PG/ID.hs +70/−0
- src/Data/SAM/Version1_6/Read/Parser/Header/PG/PN.hs +70/−0
- src/Data/SAM/Version1_6/Read/Parser/Header/PG/PP.hs +70/−0
- src/Data/SAM/Version1_6/Read/Parser/Header/PG/VN.hs +70/−0
- src/Data/SAM/Version1_6/Read/Parser/Header/RG/BC.hs +70/−0
- src/Data/SAM/Version1_6/Read/Parser/Header/RG/Base.hs +131/−0
- src/Data/SAM/Version1_6/Read/Parser/Header/RG/CN.hs +70/−0
- src/Data/SAM/Version1_6/Read/Parser/Header/RG/DS.hs +70/−0
- src/Data/SAM/Version1_6/Read/Parser/Header/RG/DT.hs +70/−0
- src/Data/SAM/Version1_6/Read/Parser/Header/RG/FO.hs +75/−0
- src/Data/SAM/Version1_6/Read/Parser/Header/RG/ID.hs +70/−0
- src/Data/SAM/Version1_6/Read/Parser/Header/RG/KS.hs +70/−0
- src/Data/SAM/Version1_6/Read/Parser/Header/RG/LB.hs +70/−0
- src/Data/SAM/Version1_6/Read/Parser/Header/RG/PG.hs +70/−0
- src/Data/SAM/Version1_6/Read/Parser/Header/RG/PI.hs +70/−0
- src/Data/SAM/Version1_6/Read/Parser/Header/RG/PL.hs +75/−0
- src/Data/SAM/Version1_6/Read/Parser/Header/RG/PM.hs +70/−0
- src/Data/SAM/Version1_6/Read/Parser/Header/RG/PU.hs +70/−0
- src/Data/SAM/Version1_6/Read/Parser/Header/RG/SM.hs +70/−0
- src/Data/SAM/Version1_6/Read/Parser/Header/SQ/AH.hs +70/−0
- src/Data/SAM/Version1_6/Read/Parser/Header/SQ/AN.hs +75/−0
- src/Data/SAM/Version1_6/Read/Parser/Header/SQ/AS.hs +70/−0
- src/Data/SAM/Version1_6/Read/Parser/Header/SQ/Base.hs +114/−0
- src/Data/SAM/Version1_6/Read/Parser/Header/SQ/DS.hs +70/−0
- src/Data/SAM/Version1_6/Read/Parser/Header/SQ/LN.hs +75/−0
- src/Data/SAM/Version1_6/Read/Parser/Header/SQ/M5.hs +70/−0
- src/Data/SAM/Version1_6/Read/Parser/Header/SQ/SN.hs +75/−0
- src/Data/SAM/Version1_6/Read/Parser/Header/SQ/SP.hs +70/−0
- src/Data/SAM/Version1_6/Read/Parser/Header/SQ/TP.hs +75/−0
- src/Data/SAM/Version1_6/Read/Parser/Header/SQ/UR.hs +70/−0
- test/Main.hs +4/−0
+ CHANGELOG.md view
@@ -0,0 +1,62 @@+# Revision history for hs-samtools++## 0.1.0.0 -- 2023-08-12++* First version. Released on an unsuspecting world.++## 0.1.0.1 -- 2023-08-12++* Added package bounds for ascii, bytestring, containers, crypton, and flatparse.++## 0.2.0.0 -- 2023-08-13++* Added Eq, Generic, Show and Typeable classes/instances to Data.SAM.Version1_6.Header.CO, Data.SAM.Version1_6.Header.HD, Data.SAM.Version1_6.Header.PG, Data.SAM.Version1_6.Header.RG, Data.SAM.Version1_6.Header.SQ data types.++## 0.2.0.1 -- 2023-08-13++* Removed unnecessary Eq and Show instance comments.++## 0.3.0.0 -- 2023-08-14++* Created Data.SAM.Version1_6.Alignment and Data.SAM.Version1_6.Header (re-exports).+* Renamed Data.SAM.Version1_6.Internal to Data.SAM.Version1_6.Base.+* Added Data.SAM.Version1_6.Alignment.Base and Data.SAM.Version1_6.Alignment.BOPT.++## 0.3.1.0 -- 2023-08-14++* Added SAM_V1_6_Alignment_BOPT_Float(..) to Data.SAM.Version1_6.Alignment.BOPT.++## 0.4.0.0 -- 2023-08-16++* Added comments to SAM_V1_6_Alignment(..) in Data.SAM.Version1_6.Alignment.Base.+* Changed sam_v1_6_alignment_flag (SAM_V1_6_Alignment(..)) from Int to Vector Bit in Data.SAM.Version1_6.Alignment.Base.++## 0.4.0.1 -- 2023-08-16++* Fixed comments to SAM_V1_6_Alignment(..) in Data.SAM.Version1_6.Alignment.Base.++## 0.4.0.2 -- 2023-08-16++* Fixed comments to SAM_V1_6_Alignment(..) in Data.SAM.Version1_6.Alignment.Base.++## 0.4.0.3 -- 2023-08-16++* Fixed comments to SAM_V1_6_Alignment(..) in Data.SAM.Version1_6.Alignment.Base.++## 0.4.0.4 -- 2023-08-17++* Added comment to sam_v1_6_alignment (SAM_V1_6(..)) in Data.SAM.Version1_6.Base.++## 0.5.0.0 -- 2023-09-01++* Added attoparsec parsers for alignment and header section of SAM_V1_6(..).+* Added attoparsec parser for SAM_V1_6(..).+* Added SAM_V1_6(..) reading functionality.++## 0.5.0.1 -- 2023-09-01++* Fix documentation for readSAM_V1_6.++## 0.5.0.2 -- 2023-09-01++* Fix/update lots of documentation across entire codebase.
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright (c) 2023, Matthew Mosior++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Matthew Mosior nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ hs-samtools.cabal view
@@ -0,0 +1,173 @@+cabal-version: 3.0+-- The cabal-version field refers to the version of the .cabal specification,+-- and can be different from the cabal-install (the tool) version and the+-- Cabal (the library) version you are using. As such, the Cabal (the library)+-- version used must be equal or greater than the version stated in this field.+-- Starting from the specification version 2.2, the cabal-version field must be+-- the first thing in the cabal file.++-- Initial package description 'hs-samtools' generated by+-- 'cabal init'. For further documentation, see:+-- http://haskell.org/cabal/users-guide/+--+-- The name of the package.+name: hs-samtools++-- The package version.+-- See the Haskell package versioning policy (PVP) for standards+-- guiding when and how versions should be incremented.+-- https://pvp.haskell.org+-- PVP summary: +-+------- breaking API changes+-- | | +----- non-breaking API additions+-- | | | +--- code changes with no API change+version: 0.5.0.2++-- A short (one-line) description of the package.+synopsis: Read and write SAM, BAM, and CRAM files.++-- A longer description of the package.+description: A SAM, BAM, and CRAM file decoder/encoded along with various related functionality associated with these file formats.++-- The license under which the package is released.+license: BSD-3-Clause++-- The file containing the license text.+license-file: LICENSE++-- The package author(s).+author: Matthew Mosior++-- An email address to which users can send suggestions, bug reports, and patches.+maintainer: mattm.github@gmail.com++-- A copyright notice.+-- copyright:+category: Bioinformatics+build-type: Simple++-- Extra doc files to be distributed with the package, such as a CHANGELOG or a README.+extra-doc-files: CHANGELOG.md++-- Extra source files to be distributed with the package, such as examples, or a tutorial module.+-- extra-source-files:++common warnings+ ghc-options: -Wall++library+ -- Import common warning flags.+ import: warnings++ -- Modules exported by the library.+ exposed-modules: Data.SAM.Version1_6.Base,+ Data.SAM.Version1_6.Alignment,+ Data.SAM.Version1_6.Alignment.Base,+ Data.SAM.Version1_6.Alignment.BOPT,+ Data.SAM.Version1_6.Header, + Data.SAM.Version1_6.Header.CO,+ Data.SAM.Version1_6.Header.HD,+ Data.SAM.Version1_6.Header.PG,+ Data.SAM.Version1_6.Header.RG,+ Data.SAM.Version1_6.Header.SQ,+ Data.SAM.Version1_6.Read.Base,+ Data.SAM.Version1_6.Read.Error,+ Data.SAM.Version1_6.Read.Parser.Alignment.Base,+ Data.SAM.Version1_6.Read.Parser.Alignment.AOPT,+ Data.SAM.Version1_6.Read.Parser.Alignment.IOPT,+ Data.SAM.Version1_6.Read.Parser.Alignment.FOPT,+ Data.SAM.Version1_6.Read.Parser.Alignment.ZOPT,+ Data.SAM.Version1_6.Read.Parser.Alignment.HOPT,+ Data.SAM.Version1_6.Read.Parser.Alignment.BOPT,+ Data.SAM.Version1_6.Read.Parser.Header.HD.Base,+ Data.SAM.Version1_6.Read.Parser.Header.HD.VN,+ Data.SAM.Version1_6.Read.Parser.Header.HD.SO,+ Data.SAM.Version1_6.Read.Parser.Header.HD.GO,+ Data.SAM.Version1_6.Read.Parser.Header.HD.SS,+ Data.SAM.Version1_6.Read.Parser.Header.SQ.Base,+ Data.SAM.Version1_6.Read.Parser.Header.SQ.SN,+ Data.SAM.Version1_6.Read.Parser.Header.SQ.LN,+ Data.SAM.Version1_6.Read.Parser.Header.SQ.AH,+ Data.SAM.Version1_6.Read.Parser.Header.SQ.AN,+ Data.SAM.Version1_6.Read.Parser.Header.SQ.AS,+ Data.SAM.Version1_6.Read.Parser.Header.SQ.DS,+ Data.SAM.Version1_6.Read.Parser.Header.SQ.M5,+ Data.SAM.Version1_6.Read.Parser.Header.SQ.SP,+ Data.SAM.Version1_6.Read.Parser.Header.SQ.TP,+ Data.SAM.Version1_6.Read.Parser.Header.SQ.UR,+ Data.SAM.Version1_6.Read.Parser.Header.RG.Base,+ Data.SAM.Version1_6.Read.Parser.Header.RG.ID,+ Data.SAM.Version1_6.Read.Parser.Header.RG.BC,+ Data.SAM.Version1_6.Read.Parser.Header.RG.CN,+ Data.SAM.Version1_6.Read.Parser.Header.RG.DS,+ Data.SAM.Version1_6.Read.Parser.Header.RG.DT,+ Data.SAM.Version1_6.Read.Parser.Header.RG.FO,+ Data.SAM.Version1_6.Read.Parser.Header.RG.KS,+ Data.SAM.Version1_6.Read.Parser.Header.RG.LB,+ Data.SAM.Version1_6.Read.Parser.Header.RG.PG,+ Data.SAM.Version1_6.Read.Parser.Header.RG.PI,+ Data.SAM.Version1_6.Read.Parser.Header.RG.PL,+ Data.SAM.Version1_6.Read.Parser.Header.RG.PM,+ Data.SAM.Version1_6.Read.Parser.Header.RG.PU,+ Data.SAM.Version1_6.Read.Parser.Header.RG.SM,+ Data.SAM.Version1_6.Read.Parser.Header.PG.Base,+ Data.SAM.Version1_6.Read.Parser.Header.PG.ID,+ Data.SAM.Version1_6.Read.Parser.Header.PG.PN,+ Data.SAM.Version1_6.Read.Parser.Header.PG.CL,+ Data.SAM.Version1_6.Read.Parser.Header.PG.PP,+ Data.SAM.Version1_6.Read.Parser.Header.PG.DS,+ Data.SAM.Version1_6.Read.Parser.Header.PG.VN,+ Data.SAM.Version1_6.Read.Parser.Header.CO.Base++ -- Modules included in this library but not exported.+ -- other-modules:++ -- LANGUAGE extensions used by modules in this package.+ -- other-extensions:++ -- Other library packages from which modules are imported.+ build-depends: base ^>=4.17.1.0,+ ascii >= 1.7.0 && < 1.8,+ attoparsec >= 0.14.4 && < 0.15,+ bitvec >= 1.1.4 && < 1.2,+ bytestring >= 0.11.4 && < 0.12,+ containers >= 0.6.7 && < 0.7,+ crypton >= 0.33 && < 0.34,+ generic-deriving >= 1.14.5 && < 1.15,+ pcre-heavy >= 1.0.0 && < 1.1,+ regex-tdfa >= 1.3.2 && < 1.4,+ streamly >= 0.9.0 && < 0.10,+ streamly-bytestring >= 0.2.0 && < 0.3,+ streamly-core >= 0.1.0 && < 0.2 ++ -- Directories containing source files.+ hs-source-dirs: src++ -- Base language which the package is written in.+ default-language: Haskell2010++test-suite hs-samtools-test+ -- Import common warning flags.+ import: warnings++ -- Base language which the package is written in.+ default-language: Haskell2010++ -- Modules included in this executable, other than Main.+ -- other-modules:++ -- LANGUAGE extensions used by modules in this package.+ -- other-extensions:++ -- The interface type and version of the test suite.+ type: exitcode-stdio-1.0++ -- Directories containing source files.+ hs-source-dirs: test++ -- The entrypoint to the test suite.+ main-is: Main.hs++ -- Test dependencies.+ build-depends:+ base ^>=4.17.1.0,+ hs-samtools
+ src/Data/SAM/Version1_6/Alignment.hs view
@@ -0,0 +1,46 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# Language QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Alignment+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Alignment ( -- * SAM version 1.6 alignment mandatory and optional data types (RE-EXPORT)+ module Data.SAM.Version1_6.Alignment.Base+ ) where++-- | Re-exports.+import Data.SAM.Version1_6.Alignment.Base
+ src/Data/SAM/Version1_6/Alignment/BOPT.hs view
@@ -0,0 +1,278 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# Language QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Alignment.BOPT+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Alignment.BOPT ( -- * SAM version 1.6 alignment optional fields data type+ SAM_V1_6_Alignment_BOPT(..),+ SAM_V1_6_Alignment_BOPT_Int8(..),+ SAM_V1_6_Alignment_BOPT_Word8(..),+ SAM_V1_6_Alignment_BOPT_Int16(..),+ SAM_V1_6_Alignment_BOPT_Word16(..),+ SAM_V1_6_Alignment_BOPT_Int32(..),+ SAM_V1_6_Alignment_BOPT_Word32(..),+ SAM_V1_6_Alignment_BOPT_Float(..)+ ) where++import Data.Data+import Data.Int+import Data.Sequence+import Data.Word+import Generics.Deriving.Base+++-- | Custom SAM (version 1.6) @"SAM_V1_6_Alignment_BOPT"@ data type.+--+-- See section 1.5 of the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+data SAM_V1_6_Alignment_BOPT = SAM_V1_6_Alignment_BOPT { sam_v1_6_alignment_bopt_int8 :: Maybe SAM_V1_6_Alignment_BOPT_Int8+ , sam_v1_6_alignment_bopt_word8 :: Maybe SAM_V1_6_Alignment_BOPT_Word8+ , sam_v1_6_alignment_bopt_int16 :: Maybe SAM_V1_6_Alignment_BOPT_Int16+ , sam_v1_6_alignment_bopt_word16 :: Maybe SAM_V1_6_Alignment_BOPT_Word16+ , sam_v1_6_alignment_bopt_int32 :: Maybe SAM_V1_6_Alignment_BOPT_Int32+ , sam_v1_6_alignment_bopt_word32 :: Maybe SAM_V1_6_Alignment_BOPT_Word32+ , sam_v1_6_alignment_bopt_float :: Maybe SAM_V1_6_Alignment_BOPT_Float+ }+ deriving (Generic,Typeable)++instance Show SAM_V1_6_Alignment_BOPT where+ show (SAM_V1_6_Alignment_BOPT int8+ word8+ int16+ word16+ int32+ word32+ float+ ) =+ "SAM_V1_6_Alignment_BOPT { " +++ "sam_v1_6_alignment_bopt_int8 = " +++ (show int8) +++ " , sam_v1_6_alignment_bopt_word8 = " +++ (show word8) +++ " , sam_v1_6_alignment_bopt_int16 = " +++ (show int16) +++ " , sam_v1_6_alignment_bopt_word16 = " +++ (show word16) +++ " , sam_v1_6_alignment_bopt_int32 = " +++ (show int32) +++ " , sam_v1_6_alignment_bopt_word32 = " +++ (show word32) +++ " , sam_v1_6_alignment_bopt_float = " +++ (show float) +++ " }"++-- | __c__CsSiIf of the last optional field (type B).+--+-- See section 1.5 of the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+data SAM_V1_6_Alignment_BOPT_Int8 = SAM_V1_6_Alignment_BOPT_Int8 { sam_v1_6_alignment_bopt_int8_tag :: Seq Word8+ , sam_v1_6_alignment_bopt_int8_type :: Word8+ , sam_v1_6_alignment_bopt_int8_value :: Seq Int8+ }+ deriving (Generic,Typeable)++instance Eq SAM_V1_6_Alignment_BOPT_Int8 where+ SAM_V1_6_Alignment_BOPT_Int8 sam_v1_6_alignment_bopt_int8_tag1 sam_v1_6_alignment_bopt_int8_type1 sam_v1_6_alignment_bopt_int8_value1 == SAM_V1_6_Alignment_BOPT_Int8 sam_v1_6_alignment_bopt_int8_tag2 sam_v1_6_alignment_bopt_int8_type2 sam_v1_6_alignment_bopt_int8_value2 = sam_v1_6_alignment_bopt_int8_tag1 == sam_v1_6_alignment_bopt_int8_tag2 && sam_v1_6_alignment_bopt_int8_type1 == sam_v1_6_alignment_bopt_int8_type2 && sam_v1_6_alignment_bopt_int8_value1 == sam_v1_6_alignment_bopt_int8_value2++instance Show SAM_V1_6_Alignment_BOPT_Int8 where+ show (SAM_V1_6_Alignment_BOPT_Int8 tag+ bopttype+ value+ ) =+ "SAM_V1_6_Alignment_BOPT_Int8 { " +++ "tag = " +++ (show tag) +++ " , type = " +++ (show bopttype) +++ " , value = " +++ (show value) +++ " }"++-- | c__C__sSiIf of the last optional field (type B).+--+-- See section 1.5 of the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+data SAM_V1_6_Alignment_BOPT_Word8 = SAM_V1_6_Alignment_BOPT_Word8 { sam_v1_6_alignment_bopt_word8_tag :: Seq Word8+ , sam_v1_6_alignment_bopt_word8_type :: Word8+ , sam_v1_6_alignment_bopt_word8_value :: Seq Word8+ }+ deriving (Generic,Typeable)++instance Eq SAM_V1_6_Alignment_BOPT_Word8 where+ SAM_V1_6_Alignment_BOPT_Word8 sam_v1_6_alignment_bopt_word8_tag1 sam_v1_6_alignment_bopt_word8_type1 sam_v1_6_alignment_bopt_word8_value1 == SAM_V1_6_Alignment_BOPT_Word8 sam_v1_6_alignment_bopt_word8_tag2 sam_v1_6_alignment_bopt_word8_type2 sam_v1_6_alignment_bopt_word8_value2 = sam_v1_6_alignment_bopt_word8_tag1 == sam_v1_6_alignment_bopt_word8_tag2 && sam_v1_6_alignment_bopt_word8_type1 == sam_v1_6_alignment_bopt_word8_type2 && sam_v1_6_alignment_bopt_word8_value1 == sam_v1_6_alignment_bopt_word8_value2++instance Show SAM_V1_6_Alignment_BOPT_Word8 where+ show (SAM_V1_6_Alignment_BOPT_Word8 tag+ bopttype+ value+ ) =+ "SAM_V1_6_Alignment_BOPT_Word8 { " +++ "tag = " +++ (show tag) +++ " , type = " +++ (show bopttype) +++ " , value = " +++ (show value) +++ " }"++-- | cC__s__SiIf of the last optional field (type B).+--+-- See section 1.5 of the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+data SAM_V1_6_Alignment_BOPT_Int16 = SAM_V1_6_Alignment_BOPT_Int16 { sam_v1_6_alignment_bopt_int16_tag :: Seq Word8+ , sam_v1_6_alignment_bopt_int16_type :: Word8+ , sam_v1_6_alignment_bopt_int16_value :: Seq Int16+ }+ deriving (Generic,Typeable)++instance Eq SAM_V1_6_Alignment_BOPT_Int16 where+ SAM_V1_6_Alignment_BOPT_Int16 sam_v1_6_alignment_bopt_int16_tag1 sam_v1_6_alignment_bopt_int16_type1 sam_v1_6_alignment_bopt_int16_value1 == SAM_V1_6_Alignment_BOPT_Int16 sam_v1_6_alignment_bopt_int16_tag2 sam_v1_6_alignment_bopt_int16_type2 sam_v1_6_alignment_bopt_int16_value2 = sam_v1_6_alignment_bopt_int16_tag1 == sam_v1_6_alignment_bopt_int16_tag2 && sam_v1_6_alignment_bopt_int16_type1 == sam_v1_6_alignment_bopt_int16_type2 && sam_v1_6_alignment_bopt_int16_value1 == sam_v1_6_alignment_bopt_int16_value2++instance Show SAM_V1_6_Alignment_BOPT_Int16 where+ show (SAM_V1_6_Alignment_BOPT_Int16 tag+ bopttype+ value+ ) =+ "SAM_V1_6_Alignment_BOPT_Int16 { " +++ "tag = " +++ (show tag) +++ " , type = " +++ (show bopttype) +++ " , value = " +++ (show value) +++ " }"++-- | cCs__S__iIf of the last optional field (type B).+--+-- See section 1.5 of the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+data SAM_V1_6_Alignment_BOPT_Word16 = SAM_V1_6_Alignment_BOPT_Word16 { sam_v1_6_alignment_bopt_word16_tag :: Seq Word8+ , sam_v1_6_alignment_bopt_word16_type :: Word8+ , sam_v1_6_alignment_bopt_word16_value :: Seq Word16+ }+ deriving (Generic,Typeable)++instance Eq SAM_V1_6_Alignment_BOPT_Word16 where+ SAM_V1_6_Alignment_BOPT_Word16 sam_v1_6_alignment_bopt_word16_tag1 sam_v1_6_alignment_bopt_word16_type1 sam_v1_6_alignment_bopt_word16_value1 == SAM_V1_6_Alignment_BOPT_Word16 sam_v1_6_alignment_bopt_word16_tag2 sam_v1_6_alignment_bopt_word16_type2 sam_v1_6_alignment_bopt_word16_value2 = sam_v1_6_alignment_bopt_word16_tag1 == sam_v1_6_alignment_bopt_word16_tag2 && sam_v1_6_alignment_bopt_word16_type1 == sam_v1_6_alignment_bopt_word16_type2 && sam_v1_6_alignment_bopt_word16_value1 == sam_v1_6_alignment_bopt_word16_value2++instance Show SAM_V1_6_Alignment_BOPT_Word16 where+ show (SAM_V1_6_Alignment_BOPT_Word16 tag+ bopttype+ value+ ) =+ "SAM_V1_6_Alignment_BOPT_Word16 { " +++ "tag = " +++ (show tag) +++ " , type = " +++ (show bopttype) +++ " , value = " +++ (show value) +++ " }"++-- | cCsS__i__If of the last optional field (type B).+--+-- See section 1.5 of the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+data SAM_V1_6_Alignment_BOPT_Int32 = SAM_V1_6_Alignment_BOPT_Int32 { sam_v1_6_alignment_bopt_int32_tag :: Seq Word8+ , sam_v1_6_alignment_bopt_int32_type :: Word8+ , sam_v1_6_alignment_bopt_int32_value :: Seq Int32+ }+ deriving (Generic,Typeable)++instance Eq SAM_V1_6_Alignment_BOPT_Int32 where+ SAM_V1_6_Alignment_BOPT_Int32 sam_v1_6_alignment_bopt_int32_tag1 sam_v1_6_alignment_bopt_int32_type1 sam_v1_6_alignment_bopt_int32_value1 == SAM_V1_6_Alignment_BOPT_Int32 sam_v1_6_alignment_bopt_int32_tag2 sam_v1_6_alignment_bopt_int32_type2 sam_v1_6_alignment_bopt_int32_value2 = sam_v1_6_alignment_bopt_int32_tag1 == sam_v1_6_alignment_bopt_int32_tag2 && sam_v1_6_alignment_bopt_int32_type1 == sam_v1_6_alignment_bopt_int32_type2 && sam_v1_6_alignment_bopt_int32_value1 == sam_v1_6_alignment_bopt_int32_value2++instance Show SAM_V1_6_Alignment_BOPT_Int32 where+ show (SAM_V1_6_Alignment_BOPT_Int32 tag+ bopttype+ value+ ) =+ "SAM_V1_6_Alignment_BOPT_Int32 { " +++ "tag = " +++ (show tag) +++ " , type = " +++ (show bopttype) +++ " , value = " +++ (show value) +++ " }"++-- | cCsSi__I__f of the last optional field (type B).+--+-- See section 1.5 of the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+data SAM_V1_6_Alignment_BOPT_Word32 = SAM_V1_6_Alignment_BOPT_Word32 { sam_v1_6_alignment_bopt_word32_tag :: Seq Word8+ , sam_v1_6_alignment_bopt_word32_type :: Word8+ , sam_v1_6_alignment_bopt_word32_value :: Seq Word32+ }+ deriving (Generic,Typeable)++instance Eq SAM_V1_6_Alignment_BOPT_Word32 where+ SAM_V1_6_Alignment_BOPT_Word32 sam_v1_6_alignment_bopt_word32_tag1 sam_v1_6_alignment_bopt_word32_type1 sam_v1_6_alignment_bopt_word32_value1 == SAM_V1_6_Alignment_BOPT_Word32 sam_v1_6_alignment_bopt_word32_tag2 sam_v1_6_alignment_bopt_word32_type2 sam_v1_6_alignment_bopt_word32_value2 = sam_v1_6_alignment_bopt_word32_tag1 == sam_v1_6_alignment_bopt_word32_tag2 && sam_v1_6_alignment_bopt_word32_type1 == sam_v1_6_alignment_bopt_word32_type2 && sam_v1_6_alignment_bopt_word32_value1 == sam_v1_6_alignment_bopt_word32_value2++instance Show SAM_V1_6_Alignment_BOPT_Word32 where+ show (SAM_V1_6_Alignment_BOPT_Word32 tag+ bopttype+ value+ ) =+ "SAM_V1_6_Alignment_BOPT_Word32 { " +++ "tag = " +++ (show tag) +++ " , type = " +++ (show bopttype) +++ " , value = " +++ (show value) +++ " }"++-- | cCsSiI__f__ of the last optional field (type B).+--+-- See section 1.5 of the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+data SAM_V1_6_Alignment_BOPT_Float = SAM_V1_6_Alignment_BOPT_Float { sam_v1_6_alignment_bopt_float_tag :: Seq Word8+ , sam_v1_6_alignment_bopt_float_type :: Word8+ , sam_v1_6_alignment_bopt_float_value :: Seq Float+ }+ deriving (Generic,Typeable)++instance Eq SAM_V1_6_Alignment_BOPT_Float where+ SAM_V1_6_Alignment_BOPT_Float sam_v1_6_alignment_bopt_float_tag1 sam_v1_6_alignment_bopt_float_type1 sam_v1_6_alignment_bopt_float_value1 == SAM_V1_6_Alignment_BOPT_Float sam_v1_6_alignment_bopt_float_tag2 sam_v1_6_alignment_bopt_float_type2 sam_v1_6_alignment_bopt_float_value2 = sam_v1_6_alignment_bopt_float_tag1 == sam_v1_6_alignment_bopt_float_tag2 && sam_v1_6_alignment_bopt_float_type1 == sam_v1_6_alignment_bopt_float_type2 && sam_v1_6_alignment_bopt_float_value1 == sam_v1_6_alignment_bopt_float_value2++instance Show SAM_V1_6_Alignment_BOPT_Float where+ show (SAM_V1_6_Alignment_BOPT_Float tag+ bopttype+ value+ ) =+ "SAM_V1_6_Alignment_BOPT_Float { " +++ "tag = " +++ (show tag) +++ " , type = " +++ (show bopttype) +++ " , value = " +++ (show value) +++ " }"
+ src/Data/SAM/Version1_6/Alignment/Base.hs view
@@ -0,0 +1,151 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# Language QuasiQuotes #-}+{-# OPTIONS_GHC -fno-warn-name-shadowing #-}++-- |+-- Module : Data.SAM.Version1_6.Alignment.Base+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Alignment.Base ( -- * SAM version 1.6 alignment mandatory and optional data types+ SAM_V1_6_Alignment(..)+ ) where++import Data.SAM.Version1_6.Alignment.BOPT++import Data.ByteString+import Data.Data+import Data.Sequence+import Data.Word+import Generics.Deriving.Base++-- | Custom SAM (version 1.6) @"SAM_V1_6_Alignment"@ data type.+--+-- See section 1.4 and 1.5 of the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+data SAM_V1_6_Alignment = SAM_V1_6_Alignment { sam_v1_6_alignment_qname :: ByteString -- ^ Query template NAME.+ -- reads/segments having identical QNAME are regarded to come from+ -- the same template. A QNAME ‘*’ indicates the information+ -- is unavailable. In a SAM file, a read may+ -- occupy multiple alignment lines, when its alignment is chimeric+ -- or when multiple mappings are given.+ , sam_v1_6_alignment_flag :: Int -- ^ Combination of bitwise FLAGs.+ , sam_v1_6_alignment_rname :: ByteString -- ^ Reference sequence NAME of the alignment.+ -- If @SQ header lines are present, RNAME (if not+ -- ‘*’) must be present in one of the SQ-SN tag.+ -- An unmapped segment without coordinate has a ‘*’ at+ -- this field. However, an unmapped segment may also have+ -- an ordinary coordinate such that it can be+ -- placed at a desired position after sorting.+ -- If RNAME is ‘*’, no assumptions can be made about POS+ -- and CIGAR.+ , sam_v1_6_alignment_pos :: Integer -- ^ 1-based leftmost mapping POSition of the first CIGAR+ -- operation that “consumes” a reference+ -- base. The first base in a reference sequence has coordinate 1.+ -- POS is set as 0 for an unmapped read without coordinate.+ -- If POS is 0, no assumptions can be made about RNAME and CIGAR.+ , sam_v1_6_alignment_mapq :: Int -- ^ MAPping Quality. It equals −10 log10 Pr{mapping position is wrong},+ -- rounded to the nearest integer. A value 255 indicates that the+ -- mapping quality is not available.+ , sam_v1_6_alignment_cigar :: ByteString -- ^ CIGAR string (set ‘*’ if unavailable).+ , sam_v1_6_alignment_rnext :: ByteString -- ^ Reference sequence name of the primary alignment of the+ -- NEXT read in the template. For the last read, the next read+ -- is the first read in the template. If @SQ header lines are present,+ -- RNEXT (if not ‘*’ or ‘=’) must be present in one of the SQ-SN tag.+ -- This field is set as ‘*’ when the information is unavailable,+ -- and set as ‘=’ if RNEXT is identical RNAME. If not ‘=’ and the next+ -- read in the template has one primary mapping (see also bit 0x100 in FLAG),+ -- this field is identical to RNAME at the primary line of the next read.+ -- If RNEXT is ‘*’, no assumptions can be made on PNEXT and bit 0x20.+ , sam_v1_6_alignment_pnext :: Integer -- ^ 1-based Position of the primary alignment of the NEXT read in+ -- the template. Set as 0 when the information is unavailable.+ -- This field equals POS at the primary line of the next read.+ -- If PNEXT is 0, no assumptions can be made on RNEXT and bit 0x20.+ , sam_v1_6_alignment_tlen :: Integer -- ^ signed observed Template LENgth. For primary reads where the primary+ -- alignments of all reads in the template are mapped to the same reference+ -- sequence, the absolute value of TLEN equals the distance between the+ -- mapped end of the template and the mapped start of the template,+ -- inclusively (i.e., end − start + 1).+ -- Note that mapped base is defined to be one that aligns to the+ -- reference as described by CIGAR, hence excludes soft-clipped bases.+ -- The TLEN field is positive for the leftmost segment of the template,+ -- negative for the rightmost, and the sign for any middle segment is undefined.+ -- If segments cover the same coordinates then the choice of which is leftmost+ -- and rightmost is arbitrary, but the two ends must still have differing signs.+ -- It is set as 0 for a single-segment template or when the information+ -- is unavailable (e.g., when the first or last segment of a multi-segment+ -- template is unmapped or when the two are mapped to+ -- different reference sequences).+ , sam_v1_6_alignment_seq :: ByteString -- ^ segment SEQuence. This field can be a ‘*’ when the sequence+ -- is not stored. If not a ‘*’, the length of the sequence must+ -- equal the sum of lengths of M/I/S/=/X operations in CIGAR.+ -- An ‘=’ denotes the base is identical to the reference base.+ -- No assumptions can be made on the letter cases.+ , sam_v1_6_alignment_qual :: ByteString -- ^ ASCII of base QUALity plus 33 (same as the quality string+ -- in the Sanger FASTQ format). A base quality is the phred-scaled+ -- base error probability which equals −10 log10 Pr{base is wrong}.+ -- This field can be a ‘*’ when quality is not stored.+ -- If not a ‘*’, SEQ must not be a ‘*’ and the length of the quality+ -- string ought to equal the length of SEQ.+ , sam_v1_6_alignment_aopt :: Maybe ByteString -- ^ A - [!-~] - Printable characters.+ , sam_v1_6_alignment_iopt :: Maybe Integer -- ^ i - [-+]?[0-9]+ - Signed integer.+ , sam_v1_6_alignment_fopt :: Maybe Float -- ^ f - [-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)? - Single-precision floating number.+ , sam_v1_6_alignment_zopt :: Maybe ByteString -- ^ Z - [ !-~]* - Printable string, including space.+ , sam_v1_6_alignment_hopt :: Maybe (Seq Word8) -- ^ H - ([0-9A-F][0-9A-F])* - Byte array in the Hex format.+ , sam_v1_6_alignment_bopt :: Maybe SAM_V1_6_Alignment_BOPT -- ^ B - [cCsSiIf]​(,[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)* - Integer or numeric array.+ }+ deriving (Generic,Typeable)++instance Show SAM_V1_6_Alignment where+ show (SAM_V1_6_Alignment qname flag rname pos mapq cigar rnext pnext tlen seq qual aopt iopt fopt zopt hopt bopt) =+ "SAM_V1_6_Alignment { " +++ "qname = " +++ (show qname) +++ " , flag = " +++ (show flag) +++ " , rname = " +++ (show rname) +++ " , pos = " +++ (show pos) +++ " , mapq = " +++ (show mapq) +++ " , cigar = " +++ (show cigar) +++ " , rnext = " +++ (show rnext) +++ " , pnext = " +++ (show pnext) +++ " , tlen = " +++ (show tlen) +++ " , seq = " +++ (show seq) +++ " , qual = " +++ (show qual) +++ " , aopt = " +++ ( show aopt) +++ " , iopt = " +++ (show iopt) +++ " , fopt = " +++ (show fopt) +++ " , zopt = " +++ (show zopt) +++ " , hopt = " +++ (show hopt) +++ " , bopt = " +++ (show bopt) +++ " }"
+ src/Data/SAM/Version1_6/Base.hs view
@@ -0,0 +1,80 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# Language QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Base+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Base ( -- * SAM version 1.6 data type+ SAM_V1_6(..)+ ) where++import Data.SAM.Version1_6.Alignment+import Data.SAM.Version1_6.Header++import Data.Data+import Data.Sequence+import Generics.Deriving.Base++-- | Custom @"SAM_V1_6"@ (SAM version 1.6) data type.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+data SAM_V1_6 = SAM_V1_6 { sam_v1_6_file_level_metadata :: Maybe SAM_V1_6_File_Level_Metadata -- ^ File-level metadata.+ -- Optional. If present,+ -- there must be only one+ -- @HD line and it must be+ -- the first line of the file. + , sam_v1_6_reference_sequence_dictionary :: Maybe (Seq SAM_V1_6_Reference_Sequence_Dictionary) -- ^ Reference sequence dictionary.+ -- The order of @SQ lines defines the+ -- alignment sorting order.+ , sam_v1_6_read_group :: Maybe (Seq SAM_V1_6_Read_Group) -- ^ Read group.+ -- Unordered multiple @RG+ -- lines are allowed.+ , sam_v1_6_program :: Maybe SAM_V1_6_Program -- ^ Program.+ , sam_v1_6_one_line_comment :: Maybe (Seq SAM_V1_6_One_Line_Comment) -- ^ One-line text comment.+ -- Unordered multiple @CO lines+ -- are allowed. UTF-8 encoding+ -- may be used.+ , sam_v1_6_alignment :: Seq SAM_V1_6_Alignment -- ^ The alignment section (mandatory+ -- and optional fields).+ }+ deriving (Generic,Typeable)++instance Show SAM_V1_6 where+ show (SAM_V1_6 file_level_metadata+ reference_sequence_dictionary+ read_group program+ one_line_comment+ alignment+ ) =+ "SAM_V1_6 { " +++ "file_level_metadata = " +++ (show file_level_metadata) +++ " , reference_sequence_dictionary = " +++ (show reference_sequence_dictionary) +++ " , read_group = " +++ (show read_group) +++ " , program = " +++ (show program) +++ " , one_line_comment = " +++ (show one_line_comment) +++ " , alignment = " +++ (show alignment) +++ " }"
+ src/Data/SAM/Version1_6/Header.hs view
@@ -0,0 +1,54 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# Language QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Header+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Header ( -- * SAM version 1.6 header section data type (RE-EXPORT)+ module Data.SAM.Version1_6.Header.CO,+ module Data.SAM.Version1_6.Header.HD,+ module Data.SAM.Version1_6.Header.PG,+ module Data.SAM.Version1_6.Header.RG,+ module Data.SAM.Version1_6.Header.SQ+ ) where++-- | Re-exports.+import Data.SAM.Version1_6.Header.CO+import Data.SAM.Version1_6.Header.HD+import Data.SAM.Version1_6.Header.PG+import Data.SAM.Version1_6.Header.RG+import Data.SAM.Version1_6.Header.SQ
+ src/Data/SAM/Version1_6/Header/CO.hs view
@@ -0,0 +1,47 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# Language QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Header.CO+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Header.CO ( -- * SAM version 1.6 One-line text comment data type+ SAM_V1_6_One_Line_Comment(..)+ ) where++import Data.ByteString+import Data.Data+import Generics.Deriving.Base++-- | Custom SAM (version 1.6) @"SAM_V1_6_One_Line_Comment"@ data type.+--+-- See section 1.3 of the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+data SAM_V1_6_One_Line_Comment = SAM_V1_6_One_Line_Comment { sam_v1_6_one_line_comment_value :: ByteString+ }+ deriving (Generic,Typeable)++instance Eq SAM_V1_6_One_Line_Comment where+ SAM_V1_6_One_Line_Comment sam_v1_6_one_line_comment_value1 == SAM_V1_6_One_Line_Comment sam_v1_6_one_line_comment_value2 = sam_v1_6_one_line_comment_value1 == sam_v1_6_one_line_comment_value2++instance Show SAM_V1_6_One_Line_Comment where+ show (SAM_V1_6_One_Line_Comment value) = "SAM_V1_6_One_Line_Comment { " +++ "value = " +++ (show value) +++ " }"
+ src/Data/SAM/Version1_6/Header/HD.hs view
@@ -0,0 +1,133 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# Language QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Header.HD+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Header.HD ( -- * SAM version 1.6 File-level metadata data type+ SAM_V1_6_File_Level_Metadata(..),+ -- * SAM version 1.6 File-Level Metadata data types+ SAM_V1_6_File_Level_Metadata_Format_Version(..),+ SAM_V1_6_File_Level_Metadata_Sorting_Order(..),+ SAM_V1_6_File_Level_Metadata_Alignment_Grouping(..),+ SAM_V1_6_File_Level_Metadata_SubSorting_Order(..)+ ) where++import Data.ByteString+import Data.Data+import Data.Sequence+import Data.Word+import Generics.Deriving.Base++-- | Custom SAM (version 1.6) @"SAM_V1_6_File_Level_Metadata"@ data type.+--+-- See section 1.3 of the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+data SAM_V1_6_File_Level_Metadata = SAM_V1_6_File_Level_Metadata { sam_v1_6_file_level_metadata_format_version :: SAM_V1_6_File_Level_Metadata_Format_Version+ , sam_v1_6_file_level_metadata_sorting_order :: Maybe SAM_V1_6_File_Level_Metadata_Sorting_Order+ , sam_v1_6_file_level_metadata_alignment_grouping :: Maybe SAM_V1_6_File_Level_Metadata_Alignment_Grouping+ , sam_v1_6_file_level_metadata_subsorting_order :: Maybe SAM_V1_6_File_Level_Metadata_SubSorting_Order+ }+ deriving (Generic,Typeable)++instance Show SAM_V1_6_File_Level_Metadata where+ show (SAM_V1_6_File_Level_Metadata version sorting_order alignment_grouping subsorting_order) =+ "SAM_V1_6_File_Level_Metadata { " +++ "version = " +++ (show version) +++ " , sorting_order = " +++ (show sorting_order) +++ " , alignment_grouping = " +++ (show alignment_grouping) +++ " , subsorting_order = " +++ (show subsorting_order) +++ " }" ++-- | VN tag for @"SAM_V1_6_File_Level_Metadata"@.+data SAM_V1_6_File_Level_Metadata_Format_Version = SAM_V1_6_File_Level_Metadata_Format_Version { sam_v1_6_file_level_metadata_format_version_tag :: Seq Word8+ , sam_v1_6_file_level_metadata_format_version_value :: ByteString+ }+ deriving (Generic,Typeable)++instance Eq SAM_V1_6_File_Level_Metadata_Format_Version where+ SAM_V1_6_File_Level_Metadata_Format_Version sam_v1_6_file_level_metadata_format_version_tag1 sam_v1_6_file_level_metadata_format_version_value1 == SAM_V1_6_File_Level_Metadata_Format_Version sam_v1_6_file_level_metadata_format_version_tag2 sam_v1_6_file_level_metadata_format_version_value2 = sam_v1_6_file_level_metadata_format_version_tag1 == sam_v1_6_file_level_metadata_format_version_tag2 && sam_v1_6_file_level_metadata_format_version_value1 == sam_v1_6_file_level_metadata_format_version_value2++instance Show SAM_V1_6_File_Level_Metadata_Format_Version where+ show (SAM_V1_6_File_Level_Metadata_Format_Version tag value) =+ "SAM_V1_6_File_Level_Metadata_Format_Version { " +++ "tag = " +++ (show tag) +++ " , value = " +++ (show value) +++ " }"++-- | SO tag for @"SAM_V1_6_File_Level_Metadata"@.+data SAM_V1_6_File_Level_Metadata_Sorting_Order = SAM_V1_6_File_Level_Metadata_Sorting_Order { sam_v1_6_file_level_metadata_sorting_order_tag :: Seq Word8+ , sam_v1_6_file_level_metadata_sorting_order_value :: ByteString+ }+ deriving (Generic,Typeable)++instance Eq SAM_V1_6_File_Level_Metadata_Sorting_Order where+ SAM_V1_6_File_Level_Metadata_Sorting_Order sam_v1_6_file_level_metadata_sorting_order_tag1 sam_v1_6_file_level_metadata_sorting_order_value1 == SAM_V1_6_File_Level_Metadata_Sorting_Order sam_v1_6_file_level_metadata_sorting_order_tag2 sam_v1_6_file_level_metadata_sorting_order_value2 = sam_v1_6_file_level_metadata_sorting_order_tag1 == sam_v1_6_file_level_metadata_sorting_order_tag2 && sam_v1_6_file_level_metadata_sorting_order_value1 == sam_v1_6_file_level_metadata_sorting_order_value2++instance Show SAM_V1_6_File_Level_Metadata_Sorting_Order where+ show (SAM_V1_6_File_Level_Metadata_Sorting_Order tag value) =+ "SAM_V1_6_File_Level_Metadata_Sorting_Order { " +++ "tag = " +++ (show tag) +++ " , value = " +++ (show value) +++ " }"++-- | GO tag for @"SAM_V1_6_File_Level_Metadata"@.+data SAM_V1_6_File_Level_Metadata_Alignment_Grouping = SAM_V1_6_File_Level_Metadata_Alignment_Grouping { sam_v1_6_file_level_metadata_alignment_grouping_tag :: Seq Word8+ , sam_v1_6_file_level_metadata_alignment_grouping_value :: ByteString+ }+ deriving (Generic,Typeable)++instance Eq SAM_V1_6_File_Level_Metadata_Alignment_Grouping where+ SAM_V1_6_File_Level_Metadata_Alignment_Grouping sam_v1_6_file_level_metadata_alignment_grouping_tag1 sam_v1_6_file_level_metadata_alignment_grouping_value1 == SAM_V1_6_File_Level_Metadata_Alignment_Grouping sam_v1_6_file_level_metadata_alignment_grouping_tag2 sam_v1_6_file_level_metadata_alignment_grouping_value2 = sam_v1_6_file_level_metadata_alignment_grouping_tag1 == sam_v1_6_file_level_metadata_alignment_grouping_tag2 && sam_v1_6_file_level_metadata_alignment_grouping_value1 == sam_v1_6_file_level_metadata_alignment_grouping_value2++instance Show SAM_V1_6_File_Level_Metadata_Alignment_Grouping where+ show (SAM_V1_6_File_Level_Metadata_Alignment_Grouping tag value) =+ "SAM_V1_6_File_Level_Metadata_Alignment_Grouping { " +++ "tag = " +++ (show tag) +++ " , value = " +++ (show value) +++ " }"++-- | SS tag for @"SAM_V1_6_File_Level_Metadata"@.+data SAM_V1_6_File_Level_Metadata_SubSorting_Order = SAM_V1_6_File_Level_Metadata_SubSorting_Order { sam_v1_6_file_level_metadata_subsorting_order_tag :: Seq Word8+ , sam_v1_6_file_level_metadata_subsorting_order_value :: ByteString+ }+ deriving (Generic,Typeable)++instance Eq SAM_V1_6_File_Level_Metadata_SubSorting_Order where+ SAM_V1_6_File_Level_Metadata_SubSorting_Order sam_v1_6_file_level_metadata_subsorting_order_tag1 sam_v1_6_file_level_metadata_subsorting_order_value1 == SAM_V1_6_File_Level_Metadata_SubSorting_Order sam_v1_6_file_level_metadata_subsorting_order_tag2 sam_v1_6_file_level_metadata_subsorting_order_value2 = sam_v1_6_file_level_metadata_subsorting_order_tag1 == sam_v1_6_file_level_metadata_subsorting_order_tag2 && sam_v1_6_file_level_metadata_subsorting_order_value1 == sam_v1_6_file_level_metadata_subsorting_order_value2++instance Show SAM_V1_6_File_Level_Metadata_SubSorting_Order where+ show (SAM_V1_6_File_Level_Metadata_SubSorting_Order tag value) =+ "SAM_V1_6_File_Level_Metadata_SubSorting_Order { " +++ "tag = " +++ (show tag) +++ " , value = " +++ (show value) +++ " }"
+ src/Data/SAM/Version1_6/Header/PG.hs view
@@ -0,0 +1,177 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# Language QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Header.PG+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Header.PG ( -- * SAM version 1.6 program data type+ SAM_V1_6_Program(..),+ -- * SAM version 1.6 program data types+ SAM_V1_6_Program_Record_Identifier(..),+ SAM_V1_6_Program_Name(..),+ SAM_V1_6_Program_Command_Line(..),+ SAM_V1_6_Program_Previous_PG_ID(..),+ SAM_V1_6_Program_Description(..),+ SAM_V1_6_Program_Version(..)+ ) where++import Data.ByteString+import Data.Data+import Data.Sequence+import Data.Word+import Generics.Deriving.Base++-- | Custom SAM (version 1.6) @"SAM_V1_6_Program"@ data type.+--+-- See section 1.3 of the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+data SAM_V1_6_Program = SAM_V1_6_Program { sam_v1_6_program_record_identifier :: SAM_V1_6_Program_Record_Identifier+ , sam_v1_6_program_name :: Maybe SAM_V1_6_Program_Name+ , sam_v1_6_program_command_line :: Maybe SAM_V1_6_Program_Command_Line+ , sam_v1_6_program_previous_pg_id :: Maybe SAM_V1_6_Program_Previous_PG_ID+ , sam_v1_6_program_description :: Maybe SAM_V1_6_Program_Description+ , sam_v1_6_program_version :: Maybe SAM_V1_6_Program_Version+ }+ deriving (Generic,Typeable)++instance Show SAM_V1_6_Program where+ show (SAM_V1_6_Program record_identifier name command_line previous_pg_id description version) =+ "SAM_V1_6_Program { " +++ "record_identifier = " +++ (show record_identifier) +++ " , name = " +++ (show name) +++ " , command_line = " +++ (show command_line) +++ " , previous_pg_id = " +++ (show previous_pg_id) +++ " , description = " +++ (show description) +++ " , version = " +++ (show version) +++ " }"++-- | ID tag for @"SAM_V1_6_Program"@.+data SAM_V1_6_Program_Record_Identifier = SAM_V1_6_Program_Record_Identifier { sam_v1_6_program_record_identifier_tag :: Seq Word8+ , sam_v1_6_program_record_identifier_value :: ByteString+ }+ deriving (Generic,Typeable)++instance Eq SAM_V1_6_Program_Record_Identifier where+ SAM_V1_6_Program_Record_Identifier sam_v1_6_program_record_identifier_tag1 sam_v1_6_program_record_identifier_value1 == SAM_V1_6_Program_Record_Identifier sam_v1_6_program_record_identifier_tag2 sam_v1_6_program_record_identifier_value2 = sam_v1_6_program_record_identifier_tag1 == sam_v1_6_program_record_identifier_tag2 && sam_v1_6_program_record_identifier_value1 == sam_v1_6_program_record_identifier_value2++instance Show SAM_V1_6_Program_Record_Identifier where+ show (SAM_V1_6_Program_Record_Identifier tag value) =+ "SAM_V1_6_Program_Record_Identifier { " +++ "tag = " +++ (show tag) +++ " , value = " +++ (show value) +++ " }"++-- | PN tag for @"SAM_V1_6_Program"@.+data SAM_V1_6_Program_Name = SAM_V1_6_Program_Name { sam_v1_6_program_name_tag :: Seq Word8+ , sam_v1_6_program_name_value :: ByteString+ }+ deriving (Generic,Typeable)++instance Eq SAM_V1_6_Program_Name where+ SAM_V1_6_Program_Name sam_v1_6_program_name_tag1 sam_v1_6_program_name_value1 == SAM_V1_6_Program_Name sam_v1_6_program_name_tag2 sam_v1_6_program_name_value2 = sam_v1_6_program_name_tag1 == sam_v1_6_program_name_tag2 && sam_v1_6_program_name_value1 == sam_v1_6_program_name_value2++instance Show SAM_V1_6_Program_Name where+ show (SAM_V1_6_Program_Name tag value) =+ "SAM_V1_6_Program_Name { " +++ "tag = " +++ (show tag) +++ " , value = " +++ (show value) +++ " }"++-- | CL tag for @"SAM_V1_6_Program"@.+data SAM_V1_6_Program_Command_Line = SAM_V1_6_Program_Command_Line { sam_v1_6_program_command_line_tag :: Seq Word8+ , sam_v1_6_program_command_line_value :: ByteString+ }+ deriving (Generic,Typeable)++instance Eq SAM_V1_6_Program_Command_Line where+ SAM_V1_6_Program_Command_Line sam_v1_6_program_command_line_tag1 sam_v1_6_program_command_line_value1 == SAM_V1_6_Program_Command_Line sam_v1_6_program_command_line_tag2 sam_v1_6_program_command_line_value2 = sam_v1_6_program_command_line_tag1 == sam_v1_6_program_command_line_tag2 && sam_v1_6_program_command_line_value1 == sam_v1_6_program_command_line_value2++instance Show SAM_V1_6_Program_Command_Line where+ show (SAM_V1_6_Program_Command_Line tag value) =+ "SAM_V1_6_Program_Command_Line { " +++ "tag = " +++ (show tag) +++ " , value = " +++ (show value) +++ " }"++-- | PP tag for @"SAM_V1_6_Program"@.+data SAM_V1_6_Program_Previous_PG_ID = SAM_V1_6_Program_Previous_PG_ID { sam_v1_6_program_previous_pg_id_tag :: Seq Word8+ , sam_v1_6_program_previous_pg_id_value :: ByteString+ }+ deriving (Generic,Typeable)++instance Eq SAM_V1_6_Program_Previous_PG_ID where+ SAM_V1_6_Program_Previous_PG_ID sam_v1_6_program_previous_pg_id_tag1 sam_v1_6_program_previous_pg_id_value1 == SAM_V1_6_Program_Previous_PG_ID sam_v1_6_program_previous_pg_id_tag2 sam_v1_6_program_previous_pg_id_value2 = sam_v1_6_program_previous_pg_id_tag1 == sam_v1_6_program_previous_pg_id_tag2 && sam_v1_6_program_previous_pg_id_value1 == sam_v1_6_program_previous_pg_id_value2++instance Show SAM_V1_6_Program_Previous_PG_ID where+ show (SAM_V1_6_Program_Previous_PG_ID tag value) =+ "SAM_V1_6_Program_Previous_PG_ID { " +++ "tag = " +++ (show tag) +++ " , value = " +++ (show value) +++ " }"++-- | DS tag for @"SAM_V1_6_Program"@.+data SAM_V1_6_Program_Description = SAM_V1_6_Program_Description { sam_v1_6_program_description_tag :: Seq Word8+ , sam_v1_6_program_description_value :: ByteString+ }+ deriving (Generic,Typeable)++instance Eq SAM_V1_6_Program_Description where+ SAM_V1_6_Program_Description sam_v1_6_program_description_tag1 sam_v1_6_program_description_value1 == SAM_V1_6_Program_Description sam_v1_6_program_description_tag2 sam_v1_6_program_description_value2 = sam_v1_6_program_description_tag1 == sam_v1_6_program_description_tag2 && sam_v1_6_program_description_value1 == sam_v1_6_program_description_value2++instance Show SAM_V1_6_Program_Description where+ show (SAM_V1_6_Program_Description tag value) =+ "SAM_V1_6_Program_Description { " +++ "tag = " +++ (show tag) +++ " , value = " +++ (show value) +++ " }"++-- | VN tag for @"SAM_V1_6_Program"@.+data SAM_V1_6_Program_Version = SAM_V1_6_Program_Version { sam_v1_6_program_version_tag :: Seq Word8+ , sam_v1_6_program_version_value :: ByteString+ }+ deriving (Generic,Typeable)++instance Eq SAM_V1_6_Program_Version where+ SAM_V1_6_Program_Version sam_v1_6_program_version_tag1 sam_v1_6_program_version_value1 == SAM_V1_6_Program_Version sam_v1_6_program_version_tag2 sam_v1_6_program_version_value2 = sam_v1_6_program_version_tag1 == sam_v1_6_program_version_tag2 && sam_v1_6_program_version_value1 == sam_v1_6_program_version_value2++instance Show SAM_V1_6_Program_Version where+ show (SAM_V1_6_Program_Version tag value) =+ "SAM_V1_6_Program_Version { " +++ "tag = " +++ (show tag) +++ " , value = " +++ (show value) +++ " }"
+ src/Data/SAM/Version1_6/Header/RG.hs view
@@ -0,0 +1,366 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# Language QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Header.RG+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Header.RG ( -- * SAM version 1.6 Read group data type+ SAM_V1_6_Read_Group(..),+ -- * SAM version 1.6 Read group data types+ SAM_V1_6_Read_Group_Identifier(..),+ SAM_V1_6_Read_Group_Barcode_Sequence(..),+ SAM_V1_6_Read_Group_Sequencing_Center(..),+ SAM_V1_6_Read_Group_Description(..),+ SAM_V1_6_Read_Group_Run_Date(..),+ SAM_V1_6_Read_Group_Flow_Order(..),+ SAM_V1_6_Read_Group_Key_Sequence(..),+ SAM_V1_6_Read_Group_Library(..),+ SAM_V1_6_Read_Group_Programs(..),+ SAM_V1_6_Read_Group_Predicted_Median_Insert_Size(..),+ SAM_V1_6_Read_Group_Platform(..),+ SAM_V1_6_Read_Group_Platform_Model(..),+ SAM_V1_6_Read_Group_Platform_Unit(..),+ SAM_V1_6_Read_Group_Sample(..)+ ) where++import Data.ByteString+import Data.Data+import Data.Sequence+import Data.Word+import Generics.Deriving.Base++-- | Custom SAM (version 1.6) @"SAM_V1_6_Read_Group"@ data type.+--+-- See section 1.3 of the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+data SAM_V1_6_Read_Group = SAM_V1_6_Read_Group { sam_v1_6_read_group_identifer :: SAM_V1_6_Read_Group_Identifier+ , sam_v1_6_read_group_barcode_sequence :: Maybe SAM_V1_6_Read_Group_Barcode_Sequence+ , sam_v1_6_read_group_sequencing_center :: Maybe SAM_V1_6_Read_Group_Sequencing_Center+ , sam_v1_6_read_group_description :: Maybe SAM_V1_6_Read_Group_Description+ , sam_v1_6_read_group_run_date :: Maybe SAM_V1_6_Read_Group_Run_Date+ , sam_v1_6_read_group_flow_order :: Maybe SAM_V1_6_Read_Group_Flow_Order+ , sam_v1_6_read_group_key_sequence :: Maybe SAM_V1_6_Read_Group_Key_Sequence+ , sam_v1_6_read_group_library :: Maybe SAM_V1_6_Read_Group_Library+ , sam_v1_6_read_group_programs :: Maybe SAM_V1_6_Read_Group_Programs+ , sam_v1_6_read_group_predicted_median_insert_size :: Maybe SAM_V1_6_Read_Group_Predicted_Median_Insert_Size+ , sam_v1_6_read_group_platform :: Maybe SAM_V1_6_Read_Group_Platform+ , sam_v1_6_read_group_platform_model :: Maybe SAM_V1_6_Read_Group_Platform_Model+ , sam_v1_6_read_group_platform_unit :: Maybe SAM_V1_6_Read_Group_Platform_Unit+ , sam_v1_6_read_group_sample :: Maybe SAM_V1_6_Read_Group_Sample+ }++instance Show SAM_V1_6_Read_Group where+ show (SAM_V1_6_Read_Group group_identifier+ barcode_sequence+ sequencing_center+ description+ run_date+ flow_order+ key_sequence+ library+ programs+ predicted_median_insert_size+ platform+ platform_model+ platform_unit+ sample+ ) =+ "SAM_V1_6_Read_Group { " +++ "read_group_identifier = " +++ (show group_identifier) +++ " , barcode_sequence = " +++ (show barcode_sequence) +++ " , sequencing_center = " +++ (show sequencing_center) +++ " , description = " +++ (show description) +++ " , run_date = " +++ (show run_date) +++ " , flow_order = " +++ (show flow_order) +++ " , key_sequence = " +++ (show key_sequence) +++ " , library = " +++ (show library) +++ " , programs = " +++ (show programs) +++ " , show_predicted_median_insert_size = " +++ (show predicted_median_insert_size) +++ " , platform = " +++ (show platform) +++ " , platform_model = " +++ (show platform_model) +++ " , platform_unit = " +++ (show platform_unit) +++ " , sample = " +++ (show sample) +++ " }"++-- | ID tag for @"SAM_V1_6_Read_Group"@.+data SAM_V1_6_Read_Group_Identifier = SAM_V1_6_Read_Group_Identifier { sam_v1_6_read_group_identifier_tag :: Seq Word8+ , sam_v1_6_read_group_identifier_value :: ByteString+ }+ deriving (Generic,Typeable)++instance Eq SAM_V1_6_Read_Group_Identifier where+ SAM_V1_6_Read_Group_Identifier sam_v1_6_read_group_identifier_tag1 sam_v1_6_read_group_identifier_value1 == SAM_V1_6_Read_Group_Identifier sam_v1_6_read_group_identifier_tag2 sam_v1_6_read_group_identifier_value2 = sam_v1_6_read_group_identifier_tag1 == sam_v1_6_read_group_identifier_tag2 && sam_v1_6_read_group_identifier_value1 == sam_v1_6_read_group_identifier_value2++instance Show SAM_V1_6_Read_Group_Identifier where+ show (SAM_V1_6_Read_Group_Identifier tag value) =+ "SAM_V1_6_Read_Group_Identifier { " +++ "tag = " +++ (show tag) +++ " , value = " +++ (show value) +++ " }"++-- | BC tag for @"SAM_V1_6_Read_Group"@.+data SAM_V1_6_Read_Group_Barcode_Sequence = SAM_V1_6_Read_Group_Barcode_Sequence { sam_v1_6_read_group_barcode_sequence_tag :: Seq Word8+ , sam_v1_6_read_group_barcode_sequence_value :: ByteString+ }+ deriving (Generic,Typeable)++instance Eq SAM_V1_6_Read_Group_Barcode_Sequence where+ SAM_V1_6_Read_Group_Barcode_Sequence sam_v1_6_read_group_barcode_sequence_tag1 sam_v1_6_read_group_barcode_sequence_value1 == SAM_V1_6_Read_Group_Barcode_Sequence sam_v1_6_read_group_barcode_sequence_tag2 sam_v1_6_read_group_barcode_sequence_value2 = sam_v1_6_read_group_barcode_sequence_tag1 == sam_v1_6_read_group_barcode_sequence_tag2 && sam_v1_6_read_group_barcode_sequence_value1 == sam_v1_6_read_group_barcode_sequence_value2++instance Show SAM_V1_6_Read_Group_Barcode_Sequence where+ show (SAM_V1_6_Read_Group_Barcode_Sequence tag value) =+ "SAM_V1_6_Read_Group_Barcode_Sequence { " +++ "tag = " +++ (show tag) +++ " , value = " +++ (show value) +++ " }"++-- | CN tag for @"SAM_V1_6_Read_Group"@.+data SAM_V1_6_Read_Group_Sequencing_Center = SAM_V1_6_Read_Group_Sequencing_Center { sam_v1_6_read_group_sequencing_center_tag :: Seq Word8+ , sam_v1_6_read_group_sequencing_center_value :: ByteString+ }+ deriving (Generic,Typeable)++instance Eq SAM_V1_6_Read_Group_Sequencing_Center where+ SAM_V1_6_Read_Group_Sequencing_Center sam_v1_6_read_group_sequencing_center_tag1 sam_v1_6_read_group_sequencing_center_value1 == SAM_V1_6_Read_Group_Sequencing_Center sam_v1_6_read_group_sequencing_center_tag2 sam_v1_6_read_group_sequencing_center_value2 = sam_v1_6_read_group_sequencing_center_tag1 == sam_v1_6_read_group_sequencing_center_tag2 && sam_v1_6_read_group_sequencing_center_value1 == sam_v1_6_read_group_sequencing_center_value2++instance Show SAM_V1_6_Read_Group_Sequencing_Center where+ show (SAM_V1_6_Read_Group_Sequencing_Center tag value) =+ "SAM_V1_6_Read_Group_Sequencing_Center { " +++ "tag = " +++ (show tag) +++ " , value = " +++ (show value) +++ " }"++-- | DS tag for @"SAM_V1_6_Read_Group"@.+data SAM_V1_6_Read_Group_Description = SAM_V1_6_Read_Group_Description { sam_v1_6_read_group_description_tag :: Seq Word8+ , sam_v1_6_read_group_description_value :: ByteString+ }+ deriving (Generic,Typeable)++instance Eq SAM_V1_6_Read_Group_Description where+ SAM_V1_6_Read_Group_Description sam_v1_6_read_group_description_tag1 sam_v1_6_read_group_description_value1 == SAM_V1_6_Read_Group_Description sam_v1_6_read_group_description_tag2 sam_v1_6_read_group_description_value2 = sam_v1_6_read_group_description_tag1 == sam_v1_6_read_group_description_tag2 && sam_v1_6_read_group_description_value1 == sam_v1_6_read_group_description_value2++instance Show SAM_V1_6_Read_Group_Description where+ show (SAM_V1_6_Read_Group_Description tag value) =+ "SAM_V1_6_Read_Group_Description { " +++ "tag = " +++ (show tag) +++ " , value = " +++ (show value) +++ " }"++-- | DT tag for @"SAM_V1_6_Read_Group"@.+data SAM_V1_6_Read_Group_Run_Date = SAM_V1_6_Read_Group_Run_Date { sam_v1_6_read_group_run_date_tag :: Seq Word8+ , sam_v1_6_read_group_run_date_value :: ByteString+ }+ deriving (Generic,Typeable)++instance Eq SAM_V1_6_Read_Group_Run_Date where+ SAM_V1_6_Read_Group_Run_Date sam_v1_6_read_group_run_date_tag1 sam_v1_6_read_group_run_date_value1 == SAM_V1_6_Read_Group_Run_Date sam_v1_6_read_group_run_date_tag2 sam_v1_6_read_group_run_date_value2 = sam_v1_6_read_group_run_date_tag1 == sam_v1_6_read_group_run_date_tag2 && sam_v1_6_read_group_run_date_value1 == sam_v1_6_read_group_run_date_value2++instance Show SAM_V1_6_Read_Group_Run_Date where+ show (SAM_V1_6_Read_Group_Run_Date tag value) =+ "SAM_V1_6_Read_Group_Run_Date { " +++ "tag = " +++ (show tag) +++ " , value = " +++ (show value) +++ " }"++-- | FO tag for @"SAM_V1_6_Read_Group"@.+data SAM_V1_6_Read_Group_Flow_Order = SAM_V1_6_Read_Group_Flow_Order { sam_v1_6_read_group_flow_order_tag :: Seq Word8+ , sam_v1_6_read_group_flow_order_value :: ByteString+ }+ deriving (Generic,Typeable)++instance Eq SAM_V1_6_Read_Group_Flow_Order where+ SAM_V1_6_Read_Group_Flow_Order sam_v1_6_read_group_flow_order_tag1 sam_v1_6_one_line_comment_value1 == SAM_V1_6_Read_Group_Flow_Order sam_v1_6_read_group_flow_order_tag2 sam_v1_6_read_group_flow_order_value2 = sam_v1_6_read_group_flow_order_tag1 == sam_v1_6_read_group_flow_order_tag2 && sam_v1_6_one_line_comment_value1 == sam_v1_6_read_group_flow_order_value2++instance Show SAM_V1_6_Read_Group_Flow_Order where+ show (SAM_V1_6_Read_Group_Flow_Order tag value) =+ "SAM_V1_6_Read_Group_Flow_Order { " +++ "tag = " +++ (show tag) +++ " , value = " +++ (show value) +++ " }"++-- | KS tag for @"SAM_V1_6_Read_Group"@.+data SAM_V1_6_Read_Group_Key_Sequence = SAM_V1_6_Read_Group_Key_Sequence { sam_v1_6_read_group_key_sequence_tag :: Seq Word8+ , sam_v1_6_read_group_key_sequence_value :: ByteString+ }+ deriving (Generic,Typeable)++instance Eq SAM_V1_6_Read_Group_Key_Sequence where+ SAM_V1_6_Read_Group_Key_Sequence sam_v1_6_read_group_key_sequence_tag1 sam_v1_6_read_group_key_sequence_value1 == SAM_V1_6_Read_Group_Key_Sequence sam_v1_6_read_group_key_sequence_tag2 sam_v1_6_read_group_key_sequence_value2 = sam_v1_6_read_group_key_sequence_tag1 == sam_v1_6_read_group_key_sequence_tag2 && sam_v1_6_read_group_key_sequence_value1 == sam_v1_6_read_group_key_sequence_value2++instance Show SAM_V1_6_Read_Group_Key_Sequence where+ show (SAM_V1_6_Read_Group_Key_Sequence tag value) =+ "SAM_V1_6_Read_Group_Key_Sequence { " +++ "tag = " +++ (show tag) +++ " , value = " +++ (show value) +++ " }"++-- | LB tag for @"SAM_V1_6_Read_Group"@.+data SAM_V1_6_Read_Group_Library = SAM_V1_6_Read_Group_Library { sam_v1_6_read_group_library_tag :: Seq Word8+ , sam_v1_6_read_group_library_value :: ByteString+ }+ deriving (Generic,Typeable)++instance Eq SAM_V1_6_Read_Group_Library where+ SAM_V1_6_Read_Group_Library sam_v1_6_read_group_library_tag1 sam_v1_6_read_group_library_value1 == SAM_V1_6_Read_Group_Library sam_v1_6_read_group_library_tag2 sam_v1_6_read_group_library_value2 = sam_v1_6_read_group_library_tag1 == sam_v1_6_read_group_library_tag2 && sam_v1_6_read_group_library_value1 == sam_v1_6_read_group_library_value2++instance Show SAM_V1_6_Read_Group_Library where+ show (SAM_V1_6_Read_Group_Library tag value) =+ "SAM_V1_6_Read_Group_Library { " +++ "tag = " +++ (show tag) +++ " , value = " +++ (show value) +++ " }"++-- | PG tag for @"SAM_V1_6_Read_Group"@.+data SAM_V1_6_Read_Group_Programs = SAM_V1_6_Read_Group_Programs { sam_v1_6_read_group_programs_tag :: Seq Word8+ , sam_v1_6_read_group_programs_value :: ByteString+ }+ deriving (Generic,Typeable)++instance Eq SAM_V1_6_Read_Group_Programs where+ SAM_V1_6_Read_Group_Programs sam_v1_6_read_group_programs_tag1 sam_v1_6_read_group_programs_value1 == SAM_V1_6_Read_Group_Programs sam_v1_6_read_group_programs_tag2 sam_v1_6_read_group_programs_value2 = sam_v1_6_read_group_programs_tag1 == sam_v1_6_read_group_programs_tag2 && sam_v1_6_read_group_programs_value1 == sam_v1_6_read_group_programs_value2++instance Show SAM_V1_6_Read_Group_Programs where+ show (SAM_V1_6_Read_Group_Programs tag value) =+ "SAM_V1_6_Read_Group_Programs { " +++ "tag = " +++ (show tag) +++ " , value = " +++ (show value) +++ " }"++-- | PI tag for @"SAM_V1_6_Read_Group"@.+data SAM_V1_6_Read_Group_Predicted_Median_Insert_Size = SAM_V1_6_Read_Group_Predicted_Median_Insert_Size { sam_v1_6_read_group_predicted_median_insert_size_tag :: Seq Word8+ , sam_v1_6_read_group_predicted_median_insert_size_value :: ByteString+ }+ deriving (Generic,Typeable)++instance Eq SAM_V1_6_Read_Group_Predicted_Median_Insert_Size where+ SAM_V1_6_Read_Group_Predicted_Median_Insert_Size sam_v1_6_read_group_predicted_median_insert_size_tag1 sam_v1_6_one_line_comment_value1 == SAM_V1_6_Read_Group_Predicted_Median_Insert_Size sam_v1_6_read_group_predicted_median_insert_size_tag2 sam_v1_6_read_group_predicted_median_insert_size_value2 = sam_v1_6_read_group_predicted_median_insert_size_tag1 == sam_v1_6_read_group_predicted_median_insert_size_tag2 && sam_v1_6_one_line_comment_value1 == sam_v1_6_read_group_predicted_median_insert_size_value2++instance Show SAM_V1_6_Read_Group_Predicted_Median_Insert_Size where+ show (SAM_V1_6_Read_Group_Predicted_Median_Insert_Size tag value) =+ "SAM_V1_6_Read_Group_Predicted_Median_Insert_Size { " +++ "tag = " +++ (show tag) +++ " , value = " +++ (show value) +++ " }"++-- | PL tag for @"SAM_V1_6_Read_Group"@.+data SAM_V1_6_Read_Group_Platform = SAM_V1_6_Read_Group_Platform { sam_v1_6_read_group_platform_tag :: Seq Word8+ , sam_v1_6_read_group_platform_value :: ByteString+ }+ deriving (Generic,Typeable)++instance Eq SAM_V1_6_Read_Group_Platform where+ SAM_V1_6_Read_Group_Platform sam_v1_6_read_group_platform_tag1 sam_v1_6_read_group_platform_value1 == SAM_V1_6_Read_Group_Platform sam_v1_6_read_group_platform_tag2 sam_v1_6_read_group_platform_value2 = sam_v1_6_read_group_platform_tag1 == sam_v1_6_read_group_platform_tag2 && sam_v1_6_read_group_platform_value1 == sam_v1_6_read_group_platform_value2++instance Show SAM_V1_6_Read_Group_Platform where+ show (SAM_V1_6_Read_Group_Platform tag value) =+ "SAM_V1_6_Read_Group_Platform { " +++ "tag = " +++ (show tag) +++ " , value = " +++ (show value) +++ " }"++-- | PM tag for @"SAM_V1_6_Read_Group"@.+data SAM_V1_6_Read_Group_Platform_Model = SAM_V1_6_Read_Group_Platform_Model { sam_v1_6_read_group_platform_model_tag :: Seq Word8+ , sam_v1_6_read_group_platform_model_value :: ByteString+ }+ deriving (Generic,Typeable)++instance Eq SAM_V1_6_Read_Group_Platform_Model where+ SAM_V1_6_Read_Group_Platform_Model sam_v1_6_read_group_platform_model_tag1 sam_v1_6_read_group_platform_model_value1 == SAM_V1_6_Read_Group_Platform_Model sam_v1_6_read_group_platform_model_tag2 sam_v1_6_read_group_platform_model_value2 = sam_v1_6_read_group_platform_model_tag1 == sam_v1_6_read_group_platform_model_tag2 && sam_v1_6_read_group_platform_model_value1 == sam_v1_6_read_group_platform_model_value2++instance Show SAM_V1_6_Read_Group_Platform_Model where+ show (SAM_V1_6_Read_Group_Platform_Model tag value) =+ "SAM_V1_6_Read_Group_Platform_Model { " +++ "tag = " +++ (show tag) +++ " , value = " +++ (show value) +++ " }"++-- | PU tag for @"SAM_V1_6_Read_Group"@.+data SAM_V1_6_Read_Group_Platform_Unit = SAM_V1_6_Read_Group_Platform_Unit { sam_v1_6_read_group_platform_unit_tag :: Seq Word8+ , sam_v1_6_read_group_platform_unit_value :: ByteString+ }+ deriving (Generic,Typeable)++instance Eq SAM_V1_6_Read_Group_Platform_Unit where+ SAM_V1_6_Read_Group_Platform_Unit sam_v1_6_read_group_platform_unit_tag1 sam_v1_6_read_group_platform_unit_value1 == SAM_V1_6_Read_Group_Platform_Unit sam_v1_6_read_group_platform_unit_tag2 sam_v1_6_read_group_platform_unit_value2 = sam_v1_6_read_group_platform_unit_tag1 == sam_v1_6_read_group_platform_unit_tag2 && sam_v1_6_read_group_platform_unit_value1 == sam_v1_6_read_group_platform_unit_value2++instance Show SAM_V1_6_Read_Group_Platform_Unit where+ show (SAM_V1_6_Read_Group_Platform_Unit tag value) =+ "SAM_V1_6_Read_Group_Platform_Unit { " +++ "tag = " +++ (show tag) +++ " , value = " +++ (show value) +++ " }"++-- | SM tag for @"SAM_V1_6_Read_Group"@.+data SAM_V1_6_Read_Group_Sample = SAM_V1_6_Read_Group_Sample { sam_v1_6_read_group_sample_tag :: Seq Word8+ , sam_v1_6_read_group_sample_value :: ByteString+ }+ deriving (Generic,Typeable)++instance Eq SAM_V1_6_Read_Group_Sample where+ SAM_V1_6_Read_Group_Sample sam_v1_6_read_group_sample_tag1 sam_v1_6_read_group_sample_value1 == SAM_V1_6_Read_Group_Sample sam_v1_6_read_group_sample_tag2 sam_v1_6_read_group_sample_value2 = sam_v1_6_read_group_sample_tag1 == sam_v1_6_read_group_sample_tag2 && sam_v1_6_read_group_sample_value1 == sam_v1_6_read_group_sample_value2++instance Show SAM_V1_6_Read_Group_Sample where+ show (SAM_V1_6_Read_Group_Sample tag value) =+ "SAM_V1_6_Read_Group_Sample { " +++ "tag = " +++ (show tag) +++ " , value = " +++ (show value) +++ " }"
+ src/Data/SAM/Version1_6/Header/SQ.hs view
@@ -0,0 +1,271 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# Language QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Header.SQ+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Header.SQ ( -- * SAM version 1.6 Reference sequence dictionary data type+ SAM_V1_6_Reference_Sequence_Dictionary(..),+ -- * SAM version 1.6 Reference sequence dictionary data types+ SAM_V1_6_Reference_Sequence_Dictionary_Reference_Sequence_Name(..),+ SAM_V1_6_Reference_Sequence_Dictionary_Reference_Sequence_Length(..),+ SAM_V1_6_Reference_Sequence_Dictionary_Alternative_Locus(..),+ SAM_V1_6_Reference_Sequence_Dictionary_Alternative_Reference_Sequence_Names(..),+ SAM_V1_6_Reference_Sequence_Dictionary_Genome_Assembly_Identifier(..),+ SAM_V1_6_Reference_Sequence_Dictionary_Description(..),+ SAM_V1_6_Reference_Sequence_Dictionary_MD5_Checksum(..),+ SAM_V1_6_Reference_Sequence_Dictionary_Species(..),+ SAM_V1_6_Reference_Sequence_Dictionary_Molecule_Topology(..),+ SAM_V1_6_Reference_Sequence_Dictionary_URI(..)+ ) where++import Data.ByteString+import Data.Data+import Data.Sequence+import Data.Word+import Generics.Deriving.Base++-- | Custom SAM (version 1.6) @"SAM_V1_6_Reference_Sequence_Dictionary"@ data type.+--+-- See section 1.3 of the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+data SAM_V1_6_Reference_Sequence_Dictionary = SAM_V1_6_Reference_Sequence_Dictionary { sam_v1_6_reference_sequence_dictionary_reference_sequence_name :: SAM_V1_6_Reference_Sequence_Dictionary_Reference_Sequence_Name+ , sam_v1_6_reference_sequence_dictionary_reference_sequence_length :: SAM_V1_6_Reference_Sequence_Dictionary_Reference_Sequence_Length+ , sam_v1_6_reference_sequence_dictionary_reference_alternative_locus :: Maybe SAM_V1_6_Reference_Sequence_Dictionary_Alternative_Locus+ , sam_v1_6_reference_sequence_dictionary_reference_alternative_reference_sequence_names :: Maybe SAM_V1_6_Reference_Sequence_Dictionary_Alternative_Reference_Sequence_Names+ , sam_v1_6_reference_sequence_dictionary_genome_assembly_identifier :: Maybe SAM_V1_6_Reference_Sequence_Dictionary_Genome_Assembly_Identifier+ , sam_v1_6_reference_sequence_dictionary_description :: Maybe SAM_V1_6_Reference_Sequence_Dictionary_Description+ , sam_v1_6_reference_sequence_dictionary_md5_checksum :: Maybe SAM_V1_6_Reference_Sequence_Dictionary_MD5_Checksum+ , sam_v1_6_reference_sequence_dictionary_species :: Maybe SAM_V1_6_Reference_Sequence_Dictionary_Species+ , sam_v1_6_reference_sequence_dictionary_molecule_topology :: Maybe SAM_V1_6_Reference_Sequence_Dictionary_Molecule_Topology + , sam_v1_6_reference_sequence_dictionary_uri :: Maybe SAM_V1_6_Reference_Sequence_Dictionary_URI + }+ deriving (Generic,Typeable)++instance Show SAM_V1_6_Reference_Sequence_Dictionary where+ show (SAM_V1_6_Reference_Sequence_Dictionary reference_sequence_name+ reference_sequence_length+ reference_alternative_locus+ reference_alternative_sequence_names+ genome_assembly_identifier+ description+ md5_checksum+ species+ molecule_topology+ uri+ ) =+ "SAM_V1_6_Reference_Sequence_Dictionary { " +++ "reference_sequence_name = " +++ (show reference_sequence_name) +++ " , reference_sequence_length = " +++ (show reference_sequence_length) +++ " , reference_alternative_locus = " +++ (show reference_alternative_locus) +++ " , reference_alternative_sequence_names = " +++ (show reference_alternative_sequence_names) +++ " , genome_assembly_identifier = " +++ (show genome_assembly_identifier) +++ " , description = " +++ (show description) +++ " , md5_checksum = " +++ (show md5_checksum) +++ " , species = " +++ (show species) +++ " , molecule_topology = " +++ (show molecule_topology) +++ " , uri = " +++ (show uri) +++ " }"++-- | SN tag for @"SAM_V1_6_Reference_Sequence_Dictionary"@.+data SAM_V1_6_Reference_Sequence_Dictionary_Reference_Sequence_Name = SAM_V1_6_Reference_Sequence_Dictionary_Reference_Sequence_Name { sam_v1_6_reference_sequence_dictionary_reference_sequence_name_tag :: Seq Word8+ , sam_v1_6_reference_sequence_dictionary_reference_sequence_name_value :: ByteString + }+ deriving (Generic,Typeable)++instance Eq SAM_V1_6_Reference_Sequence_Dictionary_Reference_Sequence_Name where+ SAM_V1_6_Reference_Sequence_Dictionary_Reference_Sequence_Name sam_v1_6_reference_sequence_dictionary_reference_sequence_name_tag1 sam_v1_6_reference_sequence_dictionary_reference_sequence_name_value1 == SAM_V1_6_Reference_Sequence_Dictionary_Reference_Sequence_Name sam_v1_6_reference_sequence_dictionary_reference_sequence_name_tag2 sam_v1_6_reference_sequence_dictionary_reference_sequence_name_value2 = sam_v1_6_reference_sequence_dictionary_reference_sequence_name_tag1 == sam_v1_6_reference_sequence_dictionary_reference_sequence_name_tag2 && sam_v1_6_reference_sequence_dictionary_reference_sequence_name_value1 == sam_v1_6_reference_sequence_dictionary_reference_sequence_name_value2 ++instance Show SAM_V1_6_Reference_Sequence_Dictionary_Reference_Sequence_Name where+ show (SAM_V1_6_Reference_Sequence_Dictionary_Reference_Sequence_Name tag value) =+ "SAM_V1_6_Reference_Sequence_Dictionary_Reference_Sequence_Name { " +++ "tag = " +++ (show tag) +++ " , value = " +++ (show value) +++ " }"++-- | LN tag for @"SAM_V1_6_Reference_Sequence_Dictionary"@.+data SAM_V1_6_Reference_Sequence_Dictionary_Reference_Sequence_Length = SAM_V1_6_Reference_Sequence_Dictionary_Reference_Sequence_Length { sam_v1_6_reference_sequence_dictionary_reference_sequence_length_tag :: Seq Word8+ , sam_v1_6_reference_sequence_dictionary_reference_sequence_length_value :: ByteString+ }+ deriving (Generic,Typeable)++instance Eq SAM_V1_6_Reference_Sequence_Dictionary_Reference_Sequence_Length where+ SAM_V1_6_Reference_Sequence_Dictionary_Reference_Sequence_Length sam_v1_6_reference_sequence_dictionary_reference_sequence_length_tag1 sam_v1_6_reference_sequence_dictionary_reference_sequence_length_value1 == SAM_V1_6_Reference_Sequence_Dictionary_Reference_Sequence_Length sam_v1_6_reference_sequence_dictionary_reference_sequence_length_tag2 sam_v1_6_reference_sequence_dictionary_reference_sequence_length_value2 = sam_v1_6_reference_sequence_dictionary_reference_sequence_length_tag1 == sam_v1_6_reference_sequence_dictionary_reference_sequence_length_tag2 && sam_v1_6_reference_sequence_dictionary_reference_sequence_length_value1 == sam_v1_6_reference_sequence_dictionary_reference_sequence_length_value2++instance Show SAM_V1_6_Reference_Sequence_Dictionary_Reference_Sequence_Length where+ show (SAM_V1_6_Reference_Sequence_Dictionary_Reference_Sequence_Length tag value) =+ "SAM_V1_6_Reference_Sequence_Dictionary_Reference_Sequence_Length { " +++ "tag = " +++ (show tag) +++ " , value = " +++ (show value) +++ " }"++-- | AH tag for @"SAM_V1_6_Reference_Sequence_Dictionary"@.+data SAM_V1_6_Reference_Sequence_Dictionary_Alternative_Locus = SAM_V1_6_Reference_Sequence_Dictionary_Alternative_Locus { sam_v1_6_reference_sequence_dictionary_alternative_locus_tag :: Seq Word8+ , sam_v1_6_reference_sequence_dictionary_alternative_locus_value :: ByteString+ }+ deriving (Generic,Typeable)++instance Eq SAM_V1_6_Reference_Sequence_Dictionary_Alternative_Locus where+ SAM_V1_6_Reference_Sequence_Dictionary_Alternative_Locus sam_v1_6_reference_sequence_dictionary_alternative_locus_tag1 sam_v1_6_reference_sequence_dictionary_alternative_locus_value1 == SAM_V1_6_Reference_Sequence_Dictionary_Alternative_Locus sam_v1_6_reference_sequence_dictionary_alternative_locus_tag2 sam_v1_6_reference_sequence_dictionary_alternative_locus_value2 = sam_v1_6_reference_sequence_dictionary_alternative_locus_tag1 == sam_v1_6_reference_sequence_dictionary_alternative_locus_tag2 && sam_v1_6_reference_sequence_dictionary_alternative_locus_value1 == sam_v1_6_reference_sequence_dictionary_alternative_locus_value2++instance Show SAM_V1_6_Reference_Sequence_Dictionary_Alternative_Locus where+ show (SAM_V1_6_Reference_Sequence_Dictionary_Alternative_Locus tag value) =+ "SAM_V1_6_Reference_Sequence_Dictionary_Alternative_Locus { " +++ "tag = " +++ (show tag) +++ " , value = " +++ (show value) +++ " }"++-- | AN tag for @"SAM_V1_6_Reference_Sequence_Dictionary"@.+data SAM_V1_6_Reference_Sequence_Dictionary_Alternative_Reference_Sequence_Names = SAM_V1_6_Reference_Sequence_Dictionary_Alternative_Reference_Sequence_Names { sam_v1_6_reference_sequence_dictionary_alternative_reference_sequence_names_tag :: Seq Word8+ , sam_v1_6_reference_sequence_dictionary_alternative_reference_sequence_names_value :: ByteString+ }+ deriving (Generic,Typeable)++instance Eq SAM_V1_6_Reference_Sequence_Dictionary_Alternative_Reference_Sequence_Names where+ SAM_V1_6_Reference_Sequence_Dictionary_Alternative_Reference_Sequence_Names sam_v1_6_reference_sequence_dictionary_alternative_reference_sequence_names_tag1 sam_v1_6_reference_sequence_dictionary_alternative_reference_sequence_names_value1 == SAM_V1_6_Reference_Sequence_Dictionary_Alternative_Reference_Sequence_Names sam_v1_6_reference_sequence_dictionary_alternative_reference_sequence_names_tag2 sam_v1_6_reference_sequence_dictionary_alternative_reference_sequence_names_value2 = sam_v1_6_reference_sequence_dictionary_alternative_reference_sequence_names_tag1 == sam_v1_6_reference_sequence_dictionary_alternative_reference_sequence_names_tag2 && sam_v1_6_reference_sequence_dictionary_alternative_reference_sequence_names_value1 == sam_v1_6_reference_sequence_dictionary_alternative_reference_sequence_names_value2++instance Show SAM_V1_6_Reference_Sequence_Dictionary_Alternative_Reference_Sequence_Names where+ show (SAM_V1_6_Reference_Sequence_Dictionary_Alternative_Reference_Sequence_Names tag value) = "SAM_V1_6_Reference_Sequence_Dictionary_Alternative_Reference_Sequence_Names { " +++ "tag = " +++ (show tag) +++ " , value = " +++ (show value) +++ " }"++-- | AS tag for @"SAM_V1_6_Reference_Sequence_Dictionary"@.+data SAM_V1_6_Reference_Sequence_Dictionary_Genome_Assembly_Identifier = SAM_V1_6_Reference_Sequence_Dictionary_Genome_Assembly_Identifier { sam_v1_6_reference_sequence_dictionary_genome_assembly_identifier_tag :: Seq Word8+ , sam_v1_6_reference_sequence_dictionary_genome_assembly_identifier_value :: ByteString+ }+ deriving (Generic,Typeable)++instance Eq SAM_V1_6_Reference_Sequence_Dictionary_Genome_Assembly_Identifier where+ SAM_V1_6_Reference_Sequence_Dictionary_Genome_Assembly_Identifier sam_v1_6_reference_sequence_dictionary_genome_assembly_identifier_tag1 sam_v1_6_reference_sequence_dictionary_genome_assembly_identifier_value1 == SAM_V1_6_Reference_Sequence_Dictionary_Genome_Assembly_Identifier sam_v1_6_reference_sequence_dictionary_genome_assembly_identifier_tag2 sam_v1_6_reference_sequence_dictionary_genome_assembly_identifier_value2 = sam_v1_6_reference_sequence_dictionary_genome_assembly_identifier_tag1 == sam_v1_6_reference_sequence_dictionary_genome_assembly_identifier_tag2 && sam_v1_6_reference_sequence_dictionary_genome_assembly_identifier_value1 == sam_v1_6_reference_sequence_dictionary_genome_assembly_identifier_value2++instance Show SAM_V1_6_Reference_Sequence_Dictionary_Genome_Assembly_Identifier where+ show (SAM_V1_6_Reference_Sequence_Dictionary_Genome_Assembly_Identifier tag value) = "SAM_V1_6_Reference_Sequence_Dictionary_Genome_Assembly_Identifier { " +++ "tag = " +++ (show tag) +++ " , value = " +++ (show value) +++ " }"++-- | DS tag for @"SAM_V1_6_Reference_Sequence_Dictionary"@.+data SAM_V1_6_Reference_Sequence_Dictionary_Description = SAM_V1_6_Reference_Sequence_Dictionary_Description { sam_v1_6_reference_sequence_dictionary_description_tag :: Seq Word8+ , sam_v1_6_reference_sequence_dictionary_description_value :: ByteString+ }+ deriving (Generic,Typeable)++instance Eq SAM_V1_6_Reference_Sequence_Dictionary_Description where+ SAM_V1_6_Reference_Sequence_Dictionary_Description sam_v1_6_reference_sequence_dictionary_description_tag1 sam_v1_6_reference_sequence_dictionary_description_value1 == SAM_V1_6_Reference_Sequence_Dictionary_Description sam_v1_6_reference_sequence_dictionary_description_tag2 sam_v1_6_reference_sequence_dictionary_description_value2 = sam_v1_6_reference_sequence_dictionary_description_tag1 == sam_v1_6_reference_sequence_dictionary_description_tag2 && sam_v1_6_reference_sequence_dictionary_description_value1 == sam_v1_6_reference_sequence_dictionary_description_value2++instance Show SAM_V1_6_Reference_Sequence_Dictionary_Description where+ show (SAM_V1_6_Reference_Sequence_Dictionary_Description tag value) = "SAM_V1_6_Reference_Sequence_Dictionary_Description { " +++ "tag = " +++ (show tag) +++ " , value = " +++ (show value) +++ " }"++-- | M5 tag for @"SAM_V1_6_Reference_Sequence_Dictionary"@.+data SAM_V1_6_Reference_Sequence_Dictionary_MD5_Checksum = SAM_V1_6_Reference_Sequence_Dictionary_MD5_Checksum { sam_v1_6_reference_sequence_dictionary_md5_checksum_tag :: Seq Word8+ , sam_v1_6_reference_sequence_dictionary_md5_checksum_value :: ByteString+ }+ deriving (Generic,Typeable)++instance Eq SAM_V1_6_Reference_Sequence_Dictionary_MD5_Checksum where+ SAM_V1_6_Reference_Sequence_Dictionary_MD5_Checksum sam_v1_6_reference_sequence_dictionary_md5_checksum_tag1 sam_v1_6_reference_sequence_dictionary_md5_checksum_value1 == SAM_V1_6_Reference_Sequence_Dictionary_MD5_Checksum sam_v1_6_reference_sequence_dictionary_md5_checksum_tag2 sam_v1_6_reference_sequence_dictionary_md5_checksum_value2 = sam_v1_6_reference_sequence_dictionary_md5_checksum_tag1 == sam_v1_6_reference_sequence_dictionary_md5_checksum_tag2 && sam_v1_6_reference_sequence_dictionary_md5_checksum_value1 == sam_v1_6_reference_sequence_dictionary_md5_checksum_value2++instance Show SAM_V1_6_Reference_Sequence_Dictionary_MD5_Checksum where+ show (SAM_V1_6_Reference_Sequence_Dictionary_MD5_Checksum tag value) = "SAM_V1_6_Reference_Sequence_Dictionary_MD5_Checksum { " +++ "tag = " +++ (show tag) +++ " , value = " +++ (show value) +++ " }"++-- | SP tag for @"SAM_V1_6_Reference_Sequence_Dictionary"@.+data SAM_V1_6_Reference_Sequence_Dictionary_Species = SAM_V1_6_Reference_Sequence_Dictionary_Species { sam_v1_6_reference_sequence_dictionary_species_tag :: Seq Word8+ , sam_v1_6_reference_sequence_dictionary_species_value :: ByteString+ }+ deriving (Generic,Typeable)++instance Eq SAM_V1_6_Reference_Sequence_Dictionary_Species where+ SAM_V1_6_Reference_Sequence_Dictionary_Species sam_v1_6_reference_sequence_dictionary_species_tag1 sam_v1_6_reference_sequence_dictionary_species_value1 == SAM_V1_6_Reference_Sequence_Dictionary_Species sam_v1_6_reference_sequence_dictionary_species_tag2 sam_v1_6_reference_sequence_dictionary_species_value2 = sam_v1_6_reference_sequence_dictionary_species_tag1 == sam_v1_6_reference_sequence_dictionary_species_tag2 && sam_v1_6_reference_sequence_dictionary_species_value1 == sam_v1_6_reference_sequence_dictionary_species_value2++instance Show SAM_V1_6_Reference_Sequence_Dictionary_Species where+ show (SAM_V1_6_Reference_Sequence_Dictionary_Species tag value) =+ "SAM_V1_6_Reference_Sequence_Dictionary_Species { " +++ "tag = " +++ (show tag) +++ " , value = " +++ (show value) +++ " }"++-- | TP tag for @"SAM_V1_6_Reference_Sequence_Dictionary"@.+data SAM_V1_6_Reference_Sequence_Dictionary_Molecule_Topology = SAM_V1_6_Reference_Sequence_Dictionary_Molecule_Topology { sam_v1_6_reference_sequence_dictionary_molecule_topology_tag :: Seq Word8+ , sam_v1_6_reference_sequence_dictionary_molecule_topology_value :: ByteString+ }+ deriving (Generic,Typeable)++instance Eq SAM_V1_6_Reference_Sequence_Dictionary_Molecule_Topology where+ SAM_V1_6_Reference_Sequence_Dictionary_Molecule_Topology sam_v1_6_reference_sequence_dictionary_molecule_topology_tag1 sam_v1_6_reference_sequence_dictionary_molecule_topology_value1 == SAM_V1_6_Reference_Sequence_Dictionary_Molecule_Topology sam_v1_6_reference_sequence_dictionary_molecule_topology_tag2 sam_v1_6_reference_sequence_dictionary_molecule_topology_value2 = sam_v1_6_reference_sequence_dictionary_molecule_topology_tag1 == sam_v1_6_reference_sequence_dictionary_molecule_topology_tag2 && sam_v1_6_reference_sequence_dictionary_molecule_topology_value1 == sam_v1_6_reference_sequence_dictionary_molecule_topology_value2++instance Show SAM_V1_6_Reference_Sequence_Dictionary_Molecule_Topology where+ show (SAM_V1_6_Reference_Sequence_Dictionary_Molecule_Topology tag value) =+ "SAM_V1_6_Reference_Sequence_Dictionary_Molecule_Topology { " +++ "tag = " +++ (show tag) +++ " , value = " +++ (show value) +++ " }"++-- | UR tag for @"SAM_V1_6_Reference_Sequence_Dictionary"@.+data SAM_V1_6_Reference_Sequence_Dictionary_URI = SAM_V1_6_Reference_Sequence_Dictionary_URI { sam_v1_6_reference_sequence_dictionary_uri_tag :: Seq Word8+ , sam_v1_6_reference_sequence_dictionary_uri_value :: ByteString+ }+ deriving (Generic,Typeable)++instance Eq SAM_V1_6_Reference_Sequence_Dictionary_URI where+ SAM_V1_6_Reference_Sequence_Dictionary_URI sam_v1_6_reference_sequence_dictionary_uri_tag1 sam_v1_6_reference_sequence_dictionary_uri_value1 == SAM_V1_6_Reference_Sequence_Dictionary_URI sam_v1_6_reference_sequence_dictionary_uri_tag2 sam_v1_6_reference_sequence_dictionary_uri_value2 = sam_v1_6_reference_sequence_dictionary_uri_tag1 == sam_v1_6_reference_sequence_dictionary_uri_tag2 && sam_v1_6_reference_sequence_dictionary_uri_value1 == sam_v1_6_reference_sequence_dictionary_uri_value2++instance Show SAM_V1_6_Reference_Sequence_Dictionary_URI where+ show (SAM_V1_6_Reference_Sequence_Dictionary_URI tag value) =+ "SAM_V1_6_Reference_Sequence_Dictionary_URI { " +++ "tag = " +++ (show tag) +++ " , value = " +++ (show value) +++ " }"
+ src/Data/SAM/Version1_6/Read/Base.hs view
@@ -0,0 +1,97 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# Language QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Base+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Base ( -- * Reading+ readSAM_V1_6+ ) where++import Data.SAM.Version1_6.Base+import Data.SAM.Version1_6.Read.Parser.Header.HD.Base+import Data.SAM.Version1_6.Read.Parser.Header.SQ.Base+import Data.SAM.Version1_6.Read.Parser.Header.RG.Base+import Data.SAM.Version1_6.Read.Parser.Header.PG.Base+import Data.SAM.Version1_6.Read.Parser.Header.CO.Base+import Data.SAM.Version1_6.Read.Parser.Alignment.Base++import Data.Attoparsec.ByteString.Char8 as DABC8+import Data.Attoparsec.ByteString.Lazy as DABL+import Data.ByteString.Lazy as DBL+import Data.Sequence as DSeq+import qualified Streamly.Data.Stream as S+import Streamly.External.ByteString.Lazy as StreamlyLByteString (fromChunksIO)+import Streamly.Internal.FileSystem.File as StreamlyInternalFile (chunkReader)++-- | Make a parser optional, return Nothing if there is no match.+maybeOption :: Parser a+ -> Parser (Maybe a)+maybeOption p = option Nothing (Just <$> p)++-- | Define the @"SAM_V1_6"@ parser.+parse_SAM_V1_6 :: Parser SAM_V1_6+parse_SAM_V1_6 = do+ filelevelmetadata <- maybeOption $ parse_SAM_V1_6_File_Level_Metadata <* endOfLine+ _ <- word8 10+ referencesequencedictionary <- maybeOption $ DABL.many' $ parse_SAM_V1_6_Reference_Sequence_Dictionary <* endOfLine+ _ <- word8 10+ readgroup <- maybeOption $ DABL.many' $ parse_SAM_V1_6_Read_Group <* endOfLine+ _ <- word8 10+ program <- maybeOption $ parse_SAM_V1_6_Program <* endOfLine+ _ <- word8 10+ onelinecomment <- maybeOption $ DABL.many' $ parse_SAM_V1_6_One_Line_Comment <* endOfLine + _ <- word8 10+ alignment <- DABL.many' $ parse_SAM_V1_6_Alignment <* endOfLine+ return SAM_V1_6 { sam_v1_6_file_level_metadata = filelevelmetadata+ , sam_v1_6_reference_sequence_dictionary = case referencesequencedictionary of+ Nothing -> Nothing+ Just referencesequencedictionaryf -> Just $ DSeq.fromList referencesequencedictionaryf+ , sam_v1_6_read_group = case readgroup of+ Nothing -> Nothing+ Just readgroupf -> Just $ DSeq.fromList readgroupf+ , sam_v1_6_program = program+ , sam_v1_6_one_line_comment = case onelinecomment of+ Nothing -> Nothing+ Just onelinecommentf -> Just $ DSeq.fromList onelinecommentf+ , sam_v1_6_alignment = DSeq.fromList alignment+ } ++-- | Run the @"SAM_V1_6"@ parser.+readSAM_V1_6_LBS :: DBL.ByteString+ -> IO SAM_V1_6+readSAM_V1_6_LBS lbs =+ case (DABL.parseOnly parse_SAM_V1_6 lbs) of+ Left samparseerror -> error samparseerror+ Right sam -> return sam++-- | Read a @"SAM_V1_6"@ from a file.+--+-- The file is checked for errors as it parses the SAM file.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+readSAM_V1_6 :: FilePath -- ^ Path to SAM file.+ -> IO SAM_V1_6+readSAM_V1_6 fp = do+ let lazysamfile = S.unfold StreamlyInternalFile.chunkReader fp+ lazysamfilef <- StreamlyLByteString.fromChunksIO lazysamfile+ readSAM_V1_6_LBS lazysamfilef
+ src/Data/SAM/Version1_6/Read/Error.hs view
@@ -0,0 +1,241 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# Language QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Error+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Error ( -- * SAM version 1.6 data type+ SAM_V1_6_Error(..)+ ) where++import Data.Data+import Generics.Deriving.Base++-- | Custom @"SAM_V1_6"@ (SAM version 1.6) error data type.+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+data SAM_V1_6_Error = -- | @HD tag not in accepted format (only important+ -- if @HD tag is present).+ SAM_V1_6_Error_File_Level_Metadata_Tag_Incorrect_Format+ -- | VN tag missing (only important+ -- if @HD tag is present).+ | SAM_V1_6_Error_File_Level_Metadata_Format_Version_Tag_Missing+ -- | VN tag not in accepted format (only important+ -- if @HD tag is present).+ | SAM_V1_6_Error_File_Level_Metadata_Format_Version_Tag_Incorrect_Format+ -- | VN value not in accepted format (only important+ -- if @HD tag is present).+ | SAM_V1_6_Error_File_Level_Metadata_Format_Version_Value_Incorrect_Format+ -- | Sorting order tag not in accepted format (only important+ -- if @HD tag is present).+ | SAM_V1_6_Error_File_Level_Metadata_Sorting_Order_Tag_Incorrect_Format+ -- | Sorting order invalid value (only important+ -- if @HD tag is present).+ | SAM_V1_6_Error_File_Level_Metadata_Sorting_Order_Invalid_Value+ -- | Grouping of alignments no in accepted format (only important+ -- if @HD tag is present).+ | SAM_V1_6_Error_File_Level_Metadata_Grouping_Of_Alignments_Tag_Incorrect_Format+ -- | Grouping of Alignments invalid value (only important+ -- if @HD tag is present).+ | SAM_V1_6_Error_File_Level_Metadata_Grouping_Of_Alignments_Invalid_Value+ -- | Subsorting order tag not in accepted format (only important+ -- if @HD tag is present).+ | SAM_V1_6_Error_File_Level_Metadata_Subsorting_Order_Tag_Incorrect_Format+ -- | Subsorting order of alignments not in accepted format (only+ -- if @HD tag is present.+ | SAM_V1_6_Error_File_Level_Metadata_Subsorting_Order_Incorrect_Format+ -- | SN tag missing (only important+ -- if @SQ tag is present).+ | SAM_V1_6_Error_Reference_Sequence_Dictionary_Reference_Sequence_Name_Tag_Missing+ -- | Reference Sequence Name not in accepted format (only important+ -- if @SQ tag is present.+ | SAM_V1_6_Error_Reference_Sequence_Dictionary_Reference_Sequence_Name_Incorrect_Format+ -- | Reference Sequence Name invalid value (only important+ -- if @SQ tag is present).+ | SAM_V1_6_Error_Reference_Sequence_Dictionary_Reference_Sequence_Name_Invalid_Value+ -- | LN tag missing (only important+ -- if @SQ tag is present).+ | SAM_V1_6_Error_Reference_Sequence_Dictionary_Reference_Sequence_Length_Missing+ -- | Reference Sequence Length not in accepted format (only important+ -- if @SQ tag is present.+ | SAM_V1_6_Error_Reference_Sequence_Dictionary_Reference_Sequence_Length_Incorrect_Format+ -- | Reference Sequence Length invalid value (only important+ -- if @SQ tag is present).+ | SAM_V1_6_Error_Reference_Sequence_Dictionary_Reference_Sequence_Length_Invalid_Value+ -- | Alternative locus not in accepted format (only important+ -- if @SQ tag is present).+ | SAM_V1_6_Error_Reference_Sequence_Dictionary_Alternative_Locus_Incorrect_Format+ -- | Alternative Reference Sequence Names not in accepted format (only important+ -- if @SQ tag is present).+ | SAM_V1_6_Error_Reference_Sequence_Dictionary_Alternative_Reference_Sequence_Names_Incorrect_Format+ -- | Alternative Reference Sequence Names invalid value (only important+ -- if @SQ tag is present).+ | SAM_V1_6_Error_Reference_Sequence_Dictionary_Alternative_Reference_Sequence_Names_Invalid_Value+ -- | Genome Assembly Identifier not in accepted format (only important+ -- if @SQ tag is present).+ | SAM_V1_6_Error_Reference_Sequence_Dictionary_Genome_Assembly_Identifier_Incorrect_Format+ -- | Description not in accepted format (only important+ -- if @SQ tag is present).+ | SAM_V1_6_Error_Reference_Sequence_Dictionary_Description_Incorrect_Format+ -- | MD5 checksum not in accepted format (only important+ -- if @SQ tag is present).+ | SAM_V1_6_Error_Reference_Sequence_Dictionary_MD5_Checksum_Incorrect_Format+ -- | Species not in accepted format (only important+ -- if @SQ tag is present).+ | SAM_V1_6_Error_Reference_Sequence_Dictionary_Species_Incorrect_Format+ -- | Molecule topology not in accepted format (only important+ -- if @SQ tag is present).+ | SAM_V1_6_Error_Reference_Sequence_Dictionary_Molecule_Topology_Incorrect_Format+ -- | Molecule topology invalid value (only important+ -- if @SQ tag is present).+ | SAM_V1_6_Error_Reference_Sequence_Dictionary_Molecule_Topology_Invalid_Value+ -- | URI not in accepted format (only important+ -- if @SQ tag is present).+ | SAM_V1_6_Error_Reference_Sequence_Dictionary_URI_Incorrect_Format+ -- | ID tag not accepted format (only important+ -- if @RG tag is present).+ | SAM_V1_6_Error_Read_Group_Read_Group_Identifier_Incorrect_Format+ -- | ID tag is missing (only important+ -- if @RG tag is present).+ | SAM_V1_6_Error_Read_Group_Read_Group_Identifier_Tag_Missing+ -- | BC tag not in accepted format (only important+ -- if @RG tag is present).+ | SAM_V1_6_Error_Read_Group_Barcode_Sequence_Incorrect_Format+ -- | CN tag not in accepted format (only important+ -- if @RG tag is present).+ | SAM_V1_6_Error_Read_Group_Sequencing_Center_Incorrect_Format+ -- | DS tag not in accepted format (only important+ -- if @RG tag is present).+ | SAM_V1_6_Error_Read_Group_Description_Incorrect_Format+ -- | DT tag not in accepted format (only important+ -- if @RG tag is present).+ | SAM_V1_6_Error_Read_Group_Date_Run_Produced_Incorrect_Format+ -- | FO tag not in accepted format (only important+ -- if @RG tag is present).+ | SAM_V1_6_Error_Read_Group_Flow_Order_Incorrect_Format+ -- | KS tag not in accepted format (only important+ -- if @RG tag is present).+ | SAM_V1_6_Error_Read_Group_Key_Sequence_Incorrect_Format+ -- | LB tag not in accepted format (only important+ -- if @RG tag is present).+ | SAM_V1_6_Error_Read_Group_Library_Incorrect_Format+ -- | PG tag not in accepted format (only important+ -- if @RG tag is present).+ | SAM_V1_6_Error_Read_Group_Programs_Incorrect_Format+ -- | PI tag not in accepted format (only important+ -- if @RG tag is present).+ | SAM_V1_6_Error_Read_Group_Predicted_Median_Insert_Size_Incorrect_Format+ -- | PL tag not in accepted format (only important+ -- if @RG tag is present).+ | SAM_V1_6_Error_Read_Group_Platform_Incorrect_Format+ -- | PM tag not in accepted format (only important+ -- if @RG tag is present).+ | SAM_V1_6_Error_Read_Group_Platform_Model_Incorrect_Format+ -- | PU tag not in accepted format (only important+ -- if @RG tag is present).+ | SAM_V1_6_Error_Read_Group_Platform_Unit_Incorrect_Format+ -- | SM tag not in accepted format (only important+ -- if @RG tag is present).+ | SAM_V1_6_Error_Read_Group_Sample_Incorrect_Format+ -- | RG tag not in accepted format.+ | SAM_V1_6_Error_Read_Group_Tag_Incorrect_Format+ -- | ID tag not in accepted format (only important+ -- if @PG tag is present).+ | SAM_V1_6_Error_Program_Identifier_Incorrect_Format+ -- | PN tag not in accepted format (only important+ -- if @PG tag is present).+ | SAM_V1_6_Error_Program_Name_Incorrect_Format+ -- | CL tag not in accepted format (only important+ -- if @PG tag is present).+ | SAM_V1_6_Error_Program_Command_Line_Incorrect_Format+ -- | PP tag not in accepted format (only important+ -- if @PG tag is present).+ | SAM_V1_6_Error_Program_Previous_PG_ID_Incorrect_Format+ -- | DS tag not in accepted format (only important+ -- if @PG tag is present).+ | SAM_V1_6_Error_Program_Description_Incorrect_Format+ -- | VN tag not in accepted format (only important+ -- if @PG tag is present).+ | SAM_V1_6_Error_Program_Version_Incorrect_Format+ -- | PG tag not in accepted format.+ | SAM_V1_6_Error_Program_Tag_Incorrect_Format+ -- | CO tag not in accepted format.+ | SAM_V1_6_Error_One_Line_Comment_Tag_Incorrect_Format+ -- | QNAME of alignment section not in accepted format.+ | SAM_V1_6_Error_Alignment_QNAME_Incorrect_Format+ -- | FLAG of alignment section not in accepted format.+ | SAM_V1_6_Error_Alignment_FLAG_Incorrect_Format+ -- | RNAME of alignment section not in accepted format.+ | SAM_V1_6_Error_Alignment_RNAME_Incorrect_Format+ -- | POS of alignment section not in accepted format.+ | SAM_V1_6_Error_Alignment_POS_Incorrect_Format+ -- | MAPQ of alignment section not in accepted format.+ | SAM_V1_6_Error_Alignment_MAPQ_Incorrect_Format+ -- | CIGAR of alignment section not in accepted format.+ | SAM_V1_6_Error_Alignment_CIGAR_Incorrect_Format+ -- | RNEXT of alignment section not in accepted format.+ | SAM_V1_6_Error_Alignment_RNEXT_Incorrect_Format+ -- | PNEXT of alignment section not in accepted format.+ | SAM_V1_6_Error_Alignment_PNEXT_Incorrect_Format+ -- | TLEN of alignment section not in accpepted format.+ | SAM_V1_6_Error_Alignment_TLEN_Incorrect_Format+ -- | SEQ of alignment section not in accepted format.+ | SAM_V1_6_Error_Alignment_SEQ_Incorrect_Format+ -- | QUAL of alignment section not in accepted format.+ | SAM_V1_6_Error_Alignment_QUAL_Incorrect_Format+ -- | AOPT tag of the alignment section not in accepted format.+ | SAM_V1_6_Error_Alignment_AOPT_Tag_Incorrect_Format+ -- | AOPT type of the alignment section not in accepted format.+ | SAM_V1_6_Error_Alignment_AOPT_Type_Incorrect_Format+ -- | AOPT value of the alignment section not in accepted format.+ | SAM_V1_6_Error_Alignment_AOPT_Value_Incorrect_Format+ -- | IOPT tag of the alignment section not in accepted format.+ | SAM_V1_6_Error_Alignment_IOPT_Tag_Incorrect_Format+ -- | IOPT type of the alignment section not in accepted format.+ | SAM_V1_6_Error_Alignment_IOPT_Type_Incorrect_Format+ -- | IOPT value of the alignment section not in accepted format.+ | SAM_V1_6_Error_Alignment_IOPT_Value_Incorrect_Format+ -- | FOPT tag of the alignment section not in accepted format.+ | SAM_V1_6_Error_Alignment_FOPT_Tag_Incorrect_Format+ -- | FOPT type of the alignment section not in accepted format.+ | SAM_V1_6_Error_Alignment_FOPT_Type_Incorrect_Format+ -- | FOPT value of the alignment section not in accepted format.+ | SAM_V1_6_Error_Alignment_FOPT_Value_Incorrect_Format+ -- | ZOPT tag of the alignment section not in accepted format.+ | SAM_V1_6_Error_Alignment_ZOPT_Tag_Incorrect_Format+ -- | ZOPT type of the alignment section not in accepted format.+ | SAM_V1_6_Error_Alignment_ZOPT_Type_Incorrect_Format+ -- | ZOPT value of the alignment section not in accepted format.+ | SAM_V1_6_Error_Alignment_ZOPT_Value_Incorrect_Format+ -- | HOPT tag of the alignment section not in accepted format.+ | SAM_V1_6_Error_Alignment_HOPT_Tag_Incorrect_Format+ -- | HOPT type of the alignment section not in accepted format.+ | SAM_V1_6_Error_Alignment_HOPT_Type_Incorrect_Format+ -- | HOPT value of the alignment section not in accepted format.+ | SAM_V1_6_Error_Alignment_HOPT_Value_Incorrect_Format+ -- | BOPT tag of the alignment section not in accepted format.+ | SAM_V1_6_Error_Alignment_BOPT_Tag_Incorrect_Format+ -- | BOPT type of the alignment section not in accepted format.+ | SAM_V1_6_Error_Alignment_BOPT_Type_Incorrect_Format+ -- | BOPT value type of the alignment section not in accepted format.+ | SAM_V1_6_Error_Alignment_BOPT_Value_Type_Incorrect_Format+ -- | BOPT value data of the alignment section not in accepted format.+ | SAM_V1_6_Error_Alignment_BOPT_Value_Data_Incorrect_Format+ deriving (Eq,Generic,Show,Typeable)
+ src/Data/SAM/Version1_6/Read/Parser/Alignment/AOPT.hs view
@@ -0,0 +1,78 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# Language QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Alignment.AOPT+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Alignment.AOPT ( -- * SAM_V1_6 parser - alignment section - aopt field + parse_SAM_V1_6_Alignment_AOPT+ ) where++import Data.SAM.Version1_6.Read.Error++import Data.Attoparsec.ByteString.Lazy as DABL+import qualified Data.ByteString as DB+import Text.Regex.PCRE.Heavy++-- | Defines a parser for the optional aopt field of alignment section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_Alignment_AOPT :: Parser DB.ByteString+parse_SAM_V1_6_Alignment_AOPT = do+ _ <- do alignmentaoptfieldtagp <- DABL.takeTill (== 58)+ -- Parse AOPT tag of the alignment section.+ case (alignmentaoptfieldtagp =~ [re|/[A-Za-z][A-Za-z0-9]/|]) of+ False -> fail $ show SAM_V1_6_Error_Alignment_AOPT_Tag_Incorrect_Format+ True -> -- AOPT tag is in the accepted format. + return alignmentaoptfieldtagp+ _ <- word8 58+ _ <- do alignmentaoptfieldtypep <- DABL.takeTill (== 58)+ -- Parse AOPT type of the alignment section.+ case (alignmentaoptfieldtypep =~ [re|[A]|]) of+ False -> fail $ show SAM_V1_6_Error_Alignment_AOPT_Type_Incorrect_Format+ True -> -- AOPT type is in the accepted format.+ return alignmentaoptfieldtypep+ _ <- word8 58+ alignmentaoptfieldvalue <- do alignmentaoptfieldvaluep <- DABL.takeTill (== 09)+ -- Parse AOPT value of the alignment section.+ case (alignmentaoptfieldvaluep =~ [re|[!-~]|]) of+ False -> fail $ show SAM_V1_6_Error_Alignment_AOPT_Value_Incorrect_Format+ True -> -- AOPT value is in the accepted format.+ return alignmentaoptfieldvaluep+ return alignmentaoptfieldvalue
+ src/Data/SAM/Version1_6/Read/Parser/Alignment/BOPT.hs view
@@ -0,0 +1,172 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# Language QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Alignment.BOPT+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Alignment.BOPT ( -- * SAM_V1_6 parser - alignment section - bopt field + parse_SAM_V1_6_Alignment_BOPT+ ) where++import Data.SAM.Version1_6.Alignment.BOPT+import Data.SAM.Version1_6.Read.Error++import Data.Attoparsec.ByteString.Lazy as DABL+import qualified Data.ByteString as DB (head,unpack)+import qualified Data.ByteString.Char8 as DBC8+import Data.Sequence as DSeq+import Text.Regex.PCRE.Heavy++-- | Defines a parser for the optional bopt field of alignment section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_Alignment_BOPT :: Parser SAM_V1_6_Alignment_BOPT+parse_SAM_V1_6_Alignment_BOPT = do+ alignmentboptfieldtag <- do alignmentboptfieldtagp <- DABL.takeTill (== 58)+ -- Parse BOPT tag of the alignment section.+ case (alignmentboptfieldtagp =~ [re|/[A-Za-z][A-Za-z0-9]/|]) of+ False -> fail $ show SAM_V1_6_Error_Alignment_BOPT_Tag_Incorrect_Format+ True -> -- BOPT tag is in the accepted format. + return alignmentboptfieldtagp+ _ <- word8 58+ _ <- do alignmentboptfieldtypep <- DABL.takeTill (== 58)+ -- Parse BOPT type of the alignment section.+ case (alignmentboptfieldtypep =~ [re|[B]|]) of+ False -> fail $ show SAM_V1_6_Error_Alignment_BOPT_Type_Incorrect_Format+ True -> -- BOPT type is in the accepted format.+ return alignmentboptfieldtypep+ _ <- word8 58+ alignmentboptfieldvaluetype <- do alignmentboptfieldvaluetypep <- DABL.take 1+ -- Parse BOPT value type of the alignment section.+ case (alignmentboptfieldvaluetypep =~ [re|[cCsSiIf]|]) of+ False -> fail $ show SAM_V1_6_Error_Alignment_BOPT_Value_Type_Incorrect_Format+ True -> -- BOPT value type is in the accepted format.+ return alignmentboptfieldvaluetypep+ alignmentboptfieldvaluedata <- do alignmentboptfieldvaluedatap <- DABL.takeTill (\x -> x == 09 || x == 0x0D || x == 0x0A)+ -- Parse BOPT value data of the alignment section.+ case (alignmentboptfieldvaluedatap =~ [re|(,[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)*|]) of+ False -> fail $ show SAM_V1_6_Error_Alignment_BOPT_Value_Data_Incorrect_Format+ True -> -- BOPT value data is in the accepted format.+ return alignmentboptfieldvaluedatap+ case (DBC8.unpack alignmentboptfieldvaluetype) of+ "c" -> return SAM_V1_6_Alignment_BOPT { sam_v1_6_alignment_bopt_int8 = Just SAM_V1_6_Alignment_BOPT_Int8 { sam_v1_6_alignment_bopt_int8_tag = DSeq.fromList $ DB.unpack alignmentboptfieldtag+ , sam_v1_6_alignment_bopt_int8_type = DB.head alignmentboptfieldvaluetype+ , sam_v1_6_alignment_bopt_int8_value = fmap fromIntegral (DSeq.fromList $ DB.unpack alignmentboptfieldvaluedata)+ }+ , sam_v1_6_alignment_bopt_word8 = Nothing+ , sam_v1_6_alignment_bopt_int16 = Nothing+ , sam_v1_6_alignment_bopt_word16 = Nothing+ , sam_v1_6_alignment_bopt_int32 = Nothing+ , sam_v1_6_alignment_bopt_word32 = Nothing+ , sam_v1_6_alignment_bopt_float = Nothing+ }+ "C" -> return SAM_V1_6_Alignment_BOPT { sam_v1_6_alignment_bopt_int8 = Nothing+ , sam_v1_6_alignment_bopt_word8 = Just SAM_V1_6_Alignment_BOPT_Word8 { sam_v1_6_alignment_bopt_word8_tag = DSeq.fromList $ DB.unpack alignmentboptfieldtag+ , sam_v1_6_alignment_bopt_word8_type = DB.head alignmentboptfieldvaluetype+ , sam_v1_6_alignment_bopt_word8_value = DSeq.fromList $ DB.unpack alignmentboptfieldvaluedata+ } + , sam_v1_6_alignment_bopt_int16 = Nothing+ , sam_v1_6_alignment_bopt_word16 = Nothing+ , sam_v1_6_alignment_bopt_int32 = Nothing+ , sam_v1_6_alignment_bopt_word32 = Nothing+ , sam_v1_6_alignment_bopt_float = Nothing+ }+ "s" -> return SAM_V1_6_Alignment_BOPT { sam_v1_6_alignment_bopt_int8 = Nothing+ , sam_v1_6_alignment_bopt_word8 = Nothing+ , sam_v1_6_alignment_bopt_int16 = Just SAM_V1_6_Alignment_BOPT_Int16 { sam_v1_6_alignment_bopt_int16_tag = DSeq.fromList $ DB.unpack alignmentboptfieldtag+ , sam_v1_6_alignment_bopt_int16_type = DB.head alignmentboptfieldvaluetype+ , sam_v1_6_alignment_bopt_int16_value = fmap fromIntegral (DSeq.fromList $ DB.unpack alignmentboptfieldvaluedata)+ }+ , sam_v1_6_alignment_bopt_word16 = Nothing+ , sam_v1_6_alignment_bopt_int32 = Nothing+ , sam_v1_6_alignment_bopt_word32 = Nothing+ , sam_v1_6_alignment_bopt_float = Nothing+ }+ "S" -> return SAM_V1_6_Alignment_BOPT { sam_v1_6_alignment_bopt_int8 = Nothing+ , sam_v1_6_alignment_bopt_word8 = Nothing+ , sam_v1_6_alignment_bopt_int16 = Nothing+ , sam_v1_6_alignment_bopt_word16 = Just SAM_V1_6_Alignment_BOPT_Word16 { sam_v1_6_alignment_bopt_word16_tag = DSeq.fromList $ DB.unpack alignmentboptfieldtag+ , sam_v1_6_alignment_bopt_word16_type = DB.head alignmentboptfieldvaluetype+ , sam_v1_6_alignment_bopt_word16_value = fmap fromIntegral (DSeq.fromList $ DB.unpack alignmentboptfieldvaluedata)+ }+ , sam_v1_6_alignment_bopt_int32 = Nothing+ , sam_v1_6_alignment_bopt_word32 = Nothing+ , sam_v1_6_alignment_bopt_float = Nothing+ }+ "i" -> return SAM_V1_6_Alignment_BOPT { sam_v1_6_alignment_bopt_int8 = Nothing+ , sam_v1_6_alignment_bopt_word8 = Nothing+ , sam_v1_6_alignment_bopt_int16 = Nothing+ , sam_v1_6_alignment_bopt_word16 = Nothing+ , sam_v1_6_alignment_bopt_int32 = Just SAM_V1_6_Alignment_BOPT_Int32 { sam_v1_6_alignment_bopt_int32_tag = DSeq.fromList $ DB.unpack alignmentboptfieldtag+ , sam_v1_6_alignment_bopt_int32_type = DB.head alignmentboptfieldvaluetype+ , sam_v1_6_alignment_bopt_int32_value = fmap fromIntegral (DSeq.fromList $ DB.unpack alignmentboptfieldvaluedata)+ }+ , sam_v1_6_alignment_bopt_word32 = Nothing+ , sam_v1_6_alignment_bopt_float = Nothing+ }+ "I" -> return SAM_V1_6_Alignment_BOPT { sam_v1_6_alignment_bopt_int8 = Nothing+ , sam_v1_6_alignment_bopt_word8 = Nothing+ , sam_v1_6_alignment_bopt_int16 = Nothing+ , sam_v1_6_alignment_bopt_word16 = Nothing+ , sam_v1_6_alignment_bopt_int32 = Nothing+ , sam_v1_6_alignment_bopt_word32 = Just SAM_V1_6_Alignment_BOPT_Word32 { sam_v1_6_alignment_bopt_word32_tag = DSeq.fromList $ DB.unpack alignmentboptfieldtag+ , sam_v1_6_alignment_bopt_word32_type = DB.head alignmentboptfieldvaluetype+ , sam_v1_6_alignment_bopt_word32_value = fmap fromIntegral (DSeq.fromList $ DB.unpack alignmentboptfieldvaluedata)+ }+ , sam_v1_6_alignment_bopt_float = Nothing+ }+ "f" -> return SAM_V1_6_Alignment_BOPT { sam_v1_6_alignment_bopt_int8 = Nothing+ , sam_v1_6_alignment_bopt_word8 = Nothing+ , sam_v1_6_alignment_bopt_int16 = Nothing+ , sam_v1_6_alignment_bopt_word16 = Nothing+ , sam_v1_6_alignment_bopt_int32 = Nothing+ , sam_v1_6_alignment_bopt_word32 = Nothing+ , sam_v1_6_alignment_bopt_float = Just SAM_V1_6_Alignment_BOPT_Float { sam_v1_6_alignment_bopt_float_tag = DSeq.fromList $ DB.unpack alignmentboptfieldtag+ , sam_v1_6_alignment_bopt_float_type = DB.head alignmentboptfieldvaluetype+ , sam_v1_6_alignment_bopt_float_value = fmap fromIntegral (DSeq.fromList $ DB.unpack alignmentboptfieldvaluedata)+ }+ }+ _ -> return SAM_V1_6_Alignment_BOPT { sam_v1_6_alignment_bopt_int8 = Nothing+ , sam_v1_6_alignment_bopt_word8 = Nothing+ , sam_v1_6_alignment_bopt_int16 = Nothing+ , sam_v1_6_alignment_bopt_word16 = Nothing+ , sam_v1_6_alignment_bopt_int32 = Nothing+ , sam_v1_6_alignment_bopt_word32 = Nothing+ , sam_v1_6_alignment_bopt_float = Nothing+ }
+ src/Data/SAM/Version1_6/Read/Parser/Alignment/Base.hs view
@@ -0,0 +1,191 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# Language QuasiQuotes #-}+{-# OPTIONS_GHC -fno-warn-name-shadowing #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Alignment.Base+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Alignment.Base ( -- * SAM_V1_6 parser - alignment section+ parse_SAM_V1_6_Alignment+ ) where++import Data.SAM.Version1_6.Alignment+import Data.SAM.Version1_6.Read.Error+import Data.SAM.Version1_6.Read.Parser.Alignment.AOPT+import Data.SAM.Version1_6.Read.Parser.Alignment.IOPT+import Data.SAM.Version1_6.Read.Parser.Alignment.FOPT+import Data.SAM.Version1_6.Read.Parser.Alignment.ZOPT+import Data.SAM.Version1_6.Read.Parser.Alignment.HOPT+import Data.SAM.Version1_6.Read.Parser.Alignment.BOPT++import Data.Attoparsec.ByteString.Lazy as DABL+import qualified Data.ByteString.Char8 as DBC8+import Text.Regex.PCRE.Heavy++-- | Make a parser optional, return Nothing if there is no match.+maybeOption :: Parser a+ -> Parser (Maybe a)+maybeOption p = option Nothing (Just <$> p)++-- | @"SAM_V1_6_Alignment"@ parser.+--+-- Defines a parser for the alignment section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_Alignment :: Parser SAM_V1_6_Alignment+parse_SAM_V1_6_Alignment = do+ qname <- do qnamep <- DABL.takeTill (== 09)+ -- Parse QNAME field of alignment section.+ case (qnamep =~ [re|[!-?A-~]{1,254}|\*|]) of+ False -> fail $ show SAM_V1_6_Error_Alignment_QNAME_Incorrect_Format+ True -> -- QNAME is in the accepted format.+ return qnamep+ _ <- word8 09+ flag <- do flagp <- DABL.takeTill (== 09)+ -- Parse FLAG field of alignment section.+ case (flagp =~ [re|[0-9]*|]) of+ False -> fail $ show SAM_V1_6_Error_Alignment_FLAG_Incorrect_Format+ True -> -- FLAG is in the accepted format.+ return flagp+ _ <- word8 09+ rname <- do rnamep <- DABL.takeTill (== 09)+ -- Parse RNAME field of alignment section.+ case (rnamep =~ [re|\*|[0-9A-Za-z!#$%&+./:;?@^_|~-][0-9A-Za-z!#$%&*+./:;=?@^_|~-]*|]) of+ False -> fail $ show SAM_V1_6_Error_Alignment_RNAME_Incorrect_Format + True -> -- RNAME is in the accepted format.+ return rnamep+ _ <- word8 09+ pos <- do posp <- DABL.takeTill (== 09)+ -- Parse POS field of the alignment section.+ case (posp =~ [re|[0-9]*|]) of+ False -> fail $ show SAM_V1_6_Error_Alignment_POS_Incorrect_Format+ True -> -- POS is in the accepted format.+ return posp+ _ <- word8 09+ mapq <- do mapqp <- DABL.takeTill (== 09)+ -- Parse MAPQ field of the alignment section.+ case (mapqp =~ [re|[0-9]*|]) of+ False -> fail $ show SAM_V1_6_Error_Alignment_MAPQ_Incorrect_Format+ True -> -- MAPQ is in the accepted format.+ return mapqp+ _ <- word8 09+ cigar <- do cigarp <- DABL.takeTill (== 09)+ -- Parse CIGAR field of alignment section.+ case (cigarp =~ [re|\*|([0-9]+[MIDNSHPX=])+|]) of+ False -> fail $ show SAM_V1_6_Error_Alignment_CIGAR_Incorrect_Format+ True -> -- CIGAR is in the accepted format.+ return cigarp+ _ <- word8 09+ rnext <- do rnextp <- DABL.takeTill (== 09)+ -- Parse RNEXT field of the alignment section.+ case (rnextp =~ [re|\*|=|[0-9A-Za-z!#$%&+./:;?@^_|~-][0-9A-Za-z!#$%&*+./:;=?@^_|~-]*|]) of+ False -> fail $ show SAM_V1_6_Error_Alignment_RNEXT_Incorrect_Format+ True -> -- RNEXT is in the accepted format.+ return rnextp+ _ <- word8 09+ pnext <- do pnextp <- DABL.takeTill (== 09)+ -- Parse PNEXT field of the alignment section.+ case (pnextp =~ [re|[0-9]*|]) of+ False -> fail $ show SAM_V1_6_Error_Alignment_PNEXT_Incorrect_Format+ True -> -- PNEXT is in the accepted format.+ return pnextp+ _ <- word8 09+ tlen <- do tlenp <- DABL.takeTill (== 09)+ -- Parse TLEN field of the alignment section.+ case (tlenp =~ [re|[-]?[0-9]*|]) of+ False -> fail $ show SAM_V1_6_Error_Alignment_TLEN_Incorrect_Format + True -> -- TLEN is in the accepted format.+ return tlenp+ _ <- word8 09+ seq <- do seqp <- DABL.takeTill (== 09)+ -- Parse SEQ field of the alignment section.+ case (seqp =~ [re|\*|[A-Za-z=.]+|]) of+ False -> fail $ show SAM_V1_6_Error_Alignment_SEQ_Incorrect_Format + True -> -- SEQ is in the accepted format.+ return seqp+ _ <- word8 09+ qual <- do qualp <- DABL.takeTill (== 09)+ -- Parse QUAL field of the alignment section.+ case (qualp =~ [re|[!-~]+|]) of+ False -> fail $ show SAM_V1_6_Error_Alignment_QUAL_Incorrect_Format+ True -> -- QUAL is in the accepted format.+ return qualp+ _ <- word8 09+ -- This parser assumes that the AOPT tag always appears first,+ -- followed by IOPT, FOPT, ZOPT, HOPT, and BOPT, if they exist,+ -- in that order.+ aopt <- maybeOption parse_SAM_V1_6_Alignment_AOPT+ _ <- word8 09+ iopt <- maybeOption parse_SAM_V1_6_Alignment_IOPT+ _ <- word8 09+ fopt <- maybeOption parse_SAM_V1_6_Alignment_FOPT+ _ <- word8 09+ zopt <- maybeOption parse_SAM_V1_6_Alignment_ZOPT+ _ <- word8 09+ hopt <- maybeOption parse_SAM_V1_6_Alignment_HOPT+ _ <- word8 09+ bopt <- maybeOption parse_SAM_V1_6_Alignment_BOPT+ -- Return the parsed SAM_V1_6.+ return SAM_V1_6_Alignment { sam_v1_6_alignment_qname = qname+ , sam_v1_6_alignment_flag = case (DBC8.readInt flag) of+ Nothing -> (-1)+ Just (flagint,_) -> flagint+ , sam_v1_6_alignment_rname = rname+ , sam_v1_6_alignment_pos = case (DBC8.readInteger pos) of+ Nothing -> 0+ Just (posinteger,_) -> posinteger+ , sam_v1_6_alignment_mapq = case (DBC8.readInt mapq) of+ Nothing -> 255+ Just (mapqint,_) -> mapqint+ , sam_v1_6_alignment_cigar = cigar+ , sam_v1_6_alignment_rnext = rnext+ , sam_v1_6_alignment_pnext = case (DBC8.readInteger pnext) of+ Nothing -> 0+ Just (pnextinteger,_) -> pnextinteger+ , sam_v1_6_alignment_tlen = case (DBC8.readInteger tlen) of+ Nothing -> 0+ Just (tleninteger,_) -> tleninteger+ , sam_v1_6_alignment_seq = seq+ , sam_v1_6_alignment_qual = qual+ , sam_v1_6_alignment_aopt = aopt+ , sam_v1_6_alignment_iopt = iopt+ , sam_v1_6_alignment_fopt = fopt+ , sam_v1_6_alignment_zopt = zopt+ , sam_v1_6_alignment_hopt = hopt+ , sam_v1_6_alignment_bopt = bopt+ }
+ src/Data/SAM/Version1_6/Read/Parser/Alignment/FOPT.hs view
@@ -0,0 +1,80 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# Language QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Alignment.FOPT+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Alignment.FOPT ( -- * SAM_V1_6 parser - alignment section - fopt field + parse_SAM_V1_6_Alignment_FOPT+ ) where++import Data.SAM.Version1_6.Read.Error++import Data.Attoparsec.ByteString.Lazy as DABL+import qualified Data.ByteString.Char8 as DBC8+import Text.Regex.PCRE.Heavy++-- | Defines a parser for the optional fopt field of alignment section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_Alignment_FOPT :: Parser Float+parse_SAM_V1_6_Alignment_FOPT = do+ _ <- do alignmentfoptfieldtagp <- DABL.takeTill (== 58)+ -- Parse FOPT tag of the alignment section.+ case (alignmentfoptfieldtagp =~ [re|/[A-Za-z][A-Za-z0-9]/|]) of+ False -> fail $ show SAM_V1_6_Error_Alignment_FOPT_Tag_Incorrect_Format+ True -> -- FOPT tag is in the accepted format. + return alignmentfoptfieldtagp+ _ <- word8 58+ _ <- do alignmentfoptfieldtypep <- DABL.takeTill (== 58)+ -- Parse FOPT type of the alignment section.+ case (alignmentfoptfieldtypep =~ [re|[f]|]) of+ False -> fail $ show SAM_V1_6_Error_Alignment_FOPT_Type_Incorrect_Format+ True -> -- FOPT type is in the accepted format.+ return alignmentfoptfieldtypep+ _ <- word8 58+ alignmentfoptfieldvalue <- do alignmentfoptfieldvaluep <- DABL.takeTill (== 09)+ -- Parse FOPT value of the alignment section.+ case (alignmentfoptfieldvaluep =~ [re|[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?|]) of+ False -> fail $ show SAM_V1_6_Error_Alignment_FOPT_Value_Incorrect_Format+ True -> -- FOPT value is in the accepted format.+ case (DBC8.readInteger alignmentfoptfieldvaluep) of+ Nothing -> return (-1)+ Just (alignmentfoptfieldvalueinteger,_) -> return $ (fromInteger alignmentfoptfieldvalueinteger :: Float)+ return alignmentfoptfieldvalue
+ src/Data/SAM/Version1_6/Read/Parser/Alignment/HOPT.hs view
@@ -0,0 +1,80 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# Language QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Alignment.HOPT+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Alignment.HOPT ( -- * SAM_V1_6 parser - alignment section - hopt field + parse_SAM_V1_6_Alignment_HOPT+ ) where++import Data.SAM.Version1_6.Read.Error++import Data.Attoparsec.ByteString.Lazy as DABL+import qualified Data.ByteString as DB+import Data.Sequence as DSeq+import Data.Word+import Text.Regex.PCRE.Heavy++-- | Defines a parser for the optional hopt field of alignment section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_Alignment_HOPT :: Parser (Seq Word8)+parse_SAM_V1_6_Alignment_HOPT = do+ _ <- do alignmenthoptfieldtagp <- DABL.takeTill (== 58)+ -- Parse HOPT tag of the alignment section.+ case (alignmenthoptfieldtagp =~ [re|/[A-Za-z][A-Za-z0-9]/|]) of+ False -> fail $ show SAM_V1_6_Error_Alignment_HOPT_Tag_Incorrect_Format+ True -> -- HOPT tag is in the accepted format. + return alignmenthoptfieldtagp+ _ <- word8 58+ _ <- do alignmenthoptfieldtypep <- DABL.takeTill (== 58)+ -- Parse HOPT type of the alignment section.+ case (alignmenthoptfieldtypep =~ [re|[H]|]) of+ False -> fail $ show SAM_V1_6_Error_Alignment_HOPT_Type_Incorrect_Format+ True -> -- HOPT type is in the accepted format.+ return alignmenthoptfieldtypep+ _ <- word8 58+ alignmenthoptfieldvalue <- do alignmenthoptfieldvaluep <- DABL.takeTill (== 09)+ -- Parse HOPT value of the alignment section.+ case (alignmenthoptfieldvaluep =~ [re|([0-9A-F][0-9A-F])*|]) of+ False -> fail $ show SAM_V1_6_Error_Alignment_HOPT_Value_Incorrect_Format+ True -> -- HOPT value is in the accepted format.+ return $ DSeq.fromList $ DB.unpack alignmenthoptfieldvaluep+ return alignmenthoptfieldvalue
+ src/Data/SAM/Version1_6/Read/Parser/Alignment/IOPT.hs view
@@ -0,0 +1,80 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# Language QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Alignment.IOPT+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Alignment.IOPT ( -- * SAM_V1_6 parser - alignment section - iopt field + parse_SAM_V1_6_Alignment_IOPT+ ) where++import Data.SAM.Version1_6.Read.Error++import Data.Attoparsec.ByteString.Lazy as DABL+import qualified Data.ByteString.Char8 as DBC8+import Text.Regex.PCRE.Heavy++-- | Defines a parser for the optional iopt field of alignment section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_Alignment_IOPT :: Parser Integer+parse_SAM_V1_6_Alignment_IOPT = do+ _ <- do alignmentioptfieldtagp <- DABL.takeTill (== 58)+ -- Parse IOPT tag of the alignment section.+ case (alignmentioptfieldtagp =~ [re|/[A-Za-z][A-Za-z0-9]/|]) of+ False -> fail $ show SAM_V1_6_Error_Alignment_IOPT_Tag_Incorrect_Format+ True -> -- IOPT tag is in the accepted format. + return alignmentioptfieldtagp+ _ <- word8 58+ _ <- do alignmentioptfieldtypep <- DABL.takeTill (== 58)+ -- Parse IOPT type of the alignment section.+ case (alignmentioptfieldtypep =~ [re|[i]|]) of+ False -> fail $ show SAM_V1_6_Error_Alignment_IOPT_Type_Incorrect_Format+ True -> -- IOPT type is in the accepted format.+ return alignmentioptfieldtypep+ _ <- word8 58+ alignmentioptfieldvalue <- do alignmentioptfieldvaluep <- DABL.takeTill (== 09)+ -- Parse IOPT value of the alignment section.+ case (alignmentioptfieldvaluep =~ [re|[-+]?[0-9]+|]) of+ False -> fail $ show SAM_V1_6_Error_Alignment_IOPT_Value_Incorrect_Format+ True -> -- IOPT value is in the accepted format.+ case (DBC8.readInteger alignmentioptfieldvaluep) of+ Nothing -> return (-1)+ Just (alignmentioptfieldvalueinteger,_) -> return alignmentioptfieldvalueinteger+ return alignmentioptfieldvalue
+ src/Data/SAM/Version1_6/Read/Parser/Alignment/ZOPT.hs view
@@ -0,0 +1,78 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# Language QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Alignment.ZOPT+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Alignment.ZOPT ( -- * SAM_V1_6 parser - alignment section - zopt field + parse_SAM_V1_6_Alignment_ZOPT+ ) where++import Data.SAM.Version1_6.Read.Error++import Data.Attoparsec.ByteString.Lazy as DABL+import qualified Data.ByteString as DB+import Text.Regex.PCRE.Heavy++-- | Defines a parser for the optional zopt field of alignment section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_Alignment_ZOPT :: Parser DB.ByteString+parse_SAM_V1_6_Alignment_ZOPT = do+ _ <- do alignmentzoptfieldtagp <- DABL.takeTill (== 58)+ -- Parse ZOPT tag of the alignment section.+ case (alignmentzoptfieldtagp =~ [re|/[A-Za-z][A-Za-z0-9]/|]) of+ False -> fail $ show SAM_V1_6_Error_Alignment_ZOPT_Tag_Incorrect_Format+ True -> -- ZOPT tag is in the accepted format. + return alignmentzoptfieldtagp+ _ <- word8 58+ _ <- do alignmentzoptfieldtypep <- DABL.takeTill (== 58)+ -- Parse ZOPT type of the alignment section.+ case (alignmentzoptfieldtypep =~ [re|[Z]|]) of+ False -> fail $ show SAM_V1_6_Error_Alignment_ZOPT_Type_Incorrect_Format+ True -> -- ZOPT type is in the accepted format.+ return alignmentzoptfieldtypep+ _ <- word8 58+ alignmentzoptfieldvalue <- do alignmentzoptfieldvaluep <- DABL.takeTill (== 09)+ -- Parse ZOPT value of the alignment section.+ case (alignmentzoptfieldvaluep =~ [re|[ !-~]*|]) of+ False -> fail $ show SAM_V1_6_Error_Alignment_ZOPT_Value_Incorrect_Format+ True -> -- ZOPT value is in the accepted format.+ return alignmentzoptfieldvaluep+ return alignmentzoptfieldvalue
+ src/Data/SAM/Version1_6/Read/Parser/Header/CO/Base.hs view
@@ -0,0 +1,71 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE QuasiQuotes #-}+{-# OPTIONS_GHC -fno-warn-name-shadowing #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Header.CO.Base+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Header.CO.Base ( -- * SAM_V1_6 parser - header section (One-line text comment)+ parse_SAM_V1_6_One_Line_Comment+ ) where++import Data.SAM.Version1_6.Header+import Data.SAM.Version1_6.Read.Error++import Data.Attoparsec.ByteString.Char8 as DABC8+import Data.Attoparsec.ByteString.Lazy as DABL+import Text.Regex.PCRE.Heavy++-- | @"SAM_V1_6_One_Line_Comment"@ parser.+--+-- Defines a parser for @CO tag section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_One_Line_Comment :: Parser SAM_V1_6_One_Line_Comment+parse_SAM_V1_6_One_Line_Comment = do+ _ <- do coheaderp <- DABL.takeTill (== 09)+ -- Parse @PG tag of the header section.+ case (coheaderp =~ [re|[@][C][O]|]) of+ False -> fail $ show SAM_V1_6_Error_One_Line_Comment_Tag_Incorrect_Format+ True -> -- @CO tag is in the accepted format.+ return coheaderp+ _ <- word8 09+ value <- DABL.takeTill (\x -> x == 13 || x == 10)+ return SAM_V1_6_One_Line_Comment { sam_v1_6_one_line_comment_value = value+ }
+ src/Data/SAM/Version1_6/Read/Parser/Header/HD/Base.hs view
@@ -0,0 +1,89 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Header.HD.Base+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Header.HD.Base ( -- * SAM_V1_6 parser - header section (File-level metadata)+ parse_SAM_V1_6_File_Level_Metadata+ ) where++import Data.SAM.Version1_6.Header+import Data.SAM.Version1_6.Read.Error+import Data.SAM.Version1_6.Read.Parser.Header.HD.VN+import Data.SAM.Version1_6.Read.Parser.Header.HD.SO+import Data.SAM.Version1_6.Read.Parser.Header.HD.GO+import Data.SAM.Version1_6.Read.Parser.Header.HD.SS++import Data.Attoparsec.ByteString.Lazy as DABL+import Text.Regex.PCRE.Heavy++-- | Make a parser optional, return Nothing if there is no match.+maybeOption :: Parser a+ -> Parser (Maybe a)+maybeOption p = option Nothing (Just <$> p)++-- | @"SAM_V1_6_File_Level_Metadata"@ parser.+--+-- Defines a parser for @HD tag section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_File_Level_Metadata :: Parser SAM_V1_6_File_Level_Metadata+parse_SAM_V1_6_File_Level_Metadata = do+ _ <- do hdheaderp <- DABL.takeTill (== 09)+ -- Parse @HD tag of the header section.+ case (hdheaderp =~ [re|[@][H][D]|]) of+ False -> fail $ show SAM_V1_6_Error_File_Level_Metadata_Tag_Incorrect_Format+ True -> -- @HD tag is in the accepted format.+ return hdheaderp+ _ <- word8 09+ -- This parser assumes that the VN tag always appears first, followed by+ -- SO, GO and SS tags, if they exist, in that order.+ vn <- parse_SAM_V1_6_File_Level_Metadata_VN+ _ <- word8 09+ so <- maybeOption parse_SAM_V1_6_File_Level_Metadata_SO+ _ <- word8 09+ go <- maybeOption parse_SAM_V1_6_File_Level_Metadata_GO+ _ <- word8 09+ ss <- maybeOption parse_SAM_V1_6_File_Level_Metadata_SS+ return SAM_V1_6_File_Level_Metadata { sam_v1_6_file_level_metadata_format_version = vn+ , sam_v1_6_file_level_metadata_sorting_order = so+ , sam_v1_6_file_level_metadata_alignment_grouping = go+ , sam_v1_6_file_level_metadata_subsorting_order = ss+ }
+ src/Data/SAM/Version1_6/Read/Parser/Header/HD/GO.hs view
@@ -0,0 +1,75 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Header.HD.GO+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Header.HD.GO ( -- * SAM_V1_6 parser - header section (File-level metadata) - GO tag+ parse_SAM_V1_6_File_Level_Metadata_GO+ ) where++import Data.SAM.Version1_6.Header+import Data.SAM.Version1_6.Read.Error++import Data.Attoparsec.ByteString.Lazy as DABL+import qualified Data.ByteString as DB (unpack)+import Data.Sequence as DSeq+import Text.Regex.PCRE.Heavy++-- | Defines a parser for the GO tag of the @HD tag section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_File_Level_Metadata_GO :: Parser SAM_V1_6_File_Level_Metadata_Alignment_Grouping+parse_SAM_V1_6_File_Level_Metadata_GO = do+ hdheaderalignmentgroupingtag <- do hdheaderalignmentgroupingtagp <- DABL.takeTill (== 58)+ -- Parse GO tag of the header section.+ case (hdheaderalignmentgroupingtagp =~ [re|[G][O]|]) of+ False -> fail $ show SAM_V1_6_Error_File_Level_Metadata_Grouping_Of_Alignments_Tag_Incorrect_Format+ True -> -- GO tag is in the accepted format.+ return hdheaderalignmentgroupingtagp+ _ <- word8 58+ hdheaderalignmentgroupingvalue <- do hdheaderalignmentgroupingvaluep <- DABL.takeTill (== 09)+ -- Parse GO value of the header section.+ case (hdheaderalignmentgroupingvaluep =~ [re|[n][o][n][e]|[q][u][e][r][y]|[r][e][f][e][r][e][n][c][e]|]) of+ False -> fail $ show SAM_V1_6_Error_File_Level_Metadata_Grouping_Of_Alignments_Invalid_Value+ True -> -- GO value is in the accepted format.+ return hdheaderalignmentgroupingvaluep+ return SAM_V1_6_File_Level_Metadata_Alignment_Grouping { sam_v1_6_file_level_metadata_alignment_grouping_tag = DSeq.fromList $ DB.unpack hdheaderalignmentgroupingtag+ , sam_v1_6_file_level_metadata_alignment_grouping_value = hdheaderalignmentgroupingvalue+ }
+ src/Data/SAM/Version1_6/Read/Parser/Header/HD/SO.hs view
@@ -0,0 +1,75 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Header.HD.SO+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Header.HD.SO ( -- * SAM_V1_6 parser - header section (File-level metadata) - SO tag+ parse_SAM_V1_6_File_Level_Metadata_SO+ ) where++import Data.SAM.Version1_6.Header+import Data.SAM.Version1_6.Read.Error++import Data.Attoparsec.ByteString.Lazy as DABL+import qualified Data.ByteString as DB (unpack)+import Data.Sequence as DSeq+import Text.Regex.PCRE.Heavy++-- | Defines a parser for the SO tag of the @HD tag section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_File_Level_Metadata_SO :: Parser SAM_V1_6_File_Level_Metadata_Sorting_Order+parse_SAM_V1_6_File_Level_Metadata_SO = do+ hdheadersortingordertag <- do hdheadersortingordertagp <- DABL.takeTill (== 58)+ -- Parse SO tag of the header section.+ case (hdheadersortingordertagp =~ [re|[S][O]|]) of+ False -> fail $ show SAM_V1_6_Error_File_Level_Metadata_Sorting_Order_Tag_Incorrect_Format+ True -> -- SO tag is in the accepted format.+ return hdheadersortingordertagp+ _ <- word8 58+ hdheadersortingordervalue <- do hdheadersortingordervaluep <- DABL.takeTill (== 09)+ -- Parse SO value of the header section.+ case (hdheadersortingordervaluep =~ [re|[u][n][k][n][o][w][n]|[u][n][s][o][r][t][e][d]|[q][u][e][r][y][n][a][m][e]|[c][o][o][r][d][i][n][a][t][e]|]) of+ False -> fail $ show SAM_V1_6_Error_File_Level_Metadata_Sorting_Order_Invalid_Value+ True -> -- SO value is in the accepted format.+ return hdheadersortingordervaluep + return SAM_V1_6_File_Level_Metadata_Sorting_Order { sam_v1_6_file_level_metadata_sorting_order_tag = DSeq.fromList $ DB.unpack hdheadersortingordertag+ , sam_v1_6_file_level_metadata_sorting_order_value = hdheadersortingordervalue+ }
+ src/Data/SAM/Version1_6/Read/Parser/Header/HD/SS.hs view
@@ -0,0 +1,75 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Header.HD.SS+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Header.HD.SS ( -- * SAM_V1_6 parser - header section (File-level metadata) - SS tag+ parse_SAM_V1_6_File_Level_Metadata_SS+ ) where++import Data.SAM.Version1_6.Header+import Data.SAM.Version1_6.Read.Error++import Data.Attoparsec.ByteString.Lazy as DABL+import qualified Data.ByteString as DB (unpack)+import Data.Sequence as DSeq+import Text.Regex.PCRE.Heavy++-- | Defines a parser for the SS tag of the @HD tag section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_File_Level_Metadata_SS :: Parser SAM_V1_6_File_Level_Metadata_SubSorting_Order+parse_SAM_V1_6_File_Level_Metadata_SS = do+ hdheadersubsortingordertag <- do hdheadersubsortingordertagp <- DABL.takeTill (== 58)+ -- Parse SS tag of the header section.+ case (hdheadersubsortingordertagp =~ [re|[S][S]|]) of+ False -> fail $ show SAM_V1_6_Error_File_Level_Metadata_Subsorting_Order_Tag_Incorrect_Format+ True -> -- SS tag is in the accepted format.+ return hdheadersubsortingordertagp+ _ <- word8 58+ hdheadersubsortingordervalue <- do hdheadersubsortingordervaluep <- DABL.takeTill (== 09)+ -- Parse SS value of the header section.+ case (hdheadersubsortingordervaluep =~ [re|(coordinate|queryname|unsorted)(:[A-Za-z0-9_-]+)+|]) of+ False -> fail $ show SAM_V1_6_Error_File_Level_Metadata_Subsorting_Order_Incorrect_Format + True -> -- SS value is in the accepted format.+ return hdheadersubsortingordervaluep + return SAM_V1_6_File_Level_Metadata_SubSorting_Order { sam_v1_6_file_level_metadata_subsorting_order_tag = DSeq.fromList $ DB.unpack hdheadersubsortingordertag+ , sam_v1_6_file_level_metadata_subsorting_order_value = hdheadersubsortingordervalue+ }
+ src/Data/SAM/Version1_6/Read/Parser/Header/HD/VN.hs view
@@ -0,0 +1,75 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Header.HD.VN+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Header.HD.VN ( -- * SAM_V1_6 parser - header section (File-level metadata) - VN tag+ parse_SAM_V1_6_File_Level_Metadata_VN+ ) where++import Data.SAM.Version1_6.Header+import Data.SAM.Version1_6.Read.Error++import Data.Attoparsec.ByteString.Lazy as DABL+import qualified Data.ByteString as DB (unpack)+import Data.Sequence as DSeq+import Text.Regex.PCRE.Heavy++-- | Defines a parser for the VN tag of the @HD tag section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_File_Level_Metadata_VN :: Parser SAM_V1_6_File_Level_Metadata_Format_Version+parse_SAM_V1_6_File_Level_Metadata_VN = do+ hdheaderversiontag <- do hdheaderversiontagp <- DABL.takeTill (== 58)+ -- Parse VN tag of the header section.+ case (hdheaderversiontagp =~ [re|[V][N]|]) of+ False -> fail $ show SAM_V1_6_Error_File_Level_Metadata_Format_Version_Tag_Incorrect_Format+ True -> -- VN tag is in the accepted format. + return hdheaderversiontagp+ _ <- word8 58+ hdheaderversionvalue <- do hdheaderversionvaluep <- DABL.takeTill (== 09)+ -- Parse VN value of the header section.+ case (hdheaderversionvaluep =~ [re|/^[0-9]+\.[0-9]+$/.|]) of+ False -> fail $ show SAM_V1_6_Error_File_Level_Metadata_Format_Version_Value_Incorrect_Format+ True -> -- VN value is in the accepted format.+ return hdheaderversionvaluep + return SAM_V1_6_File_Level_Metadata_Format_Version { sam_v1_6_file_level_metadata_format_version_tag = DSeq.fromList $ DB.unpack hdheaderversiontag+ , sam_v1_6_file_level_metadata_format_version_value = hdheaderversionvalue+ }
+ src/Data/SAM/Version1_6/Read/Parser/Header/PG/Base.hs view
@@ -0,0 +1,99 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE QuasiQuotes #-}+{-# OPTIONS_GHC -fno-warn-name-shadowing #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Header.PG.Base+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Header.PG.Base ( -- * SAM_V1_6 parser - header section (Program)+ parse_SAM_V1_6_Program+ ) where++import Data.SAM.Version1_6.Header+import Data.SAM.Version1_6.Read.Error+import Data.SAM.Version1_6.Read.Parser.Header.PG.ID+import Data.SAM.Version1_6.Read.Parser.Header.PG.PN+import Data.SAM.Version1_6.Read.Parser.Header.PG.CL+import Data.SAM.Version1_6.Read.Parser.Header.PG.PP+import Data.SAM.Version1_6.Read.Parser.Header.PG.DS+import Data.SAM.Version1_6.Read.Parser.Header.PG.VN++import Data.Attoparsec.ByteString.Lazy as DABL+import Text.Regex.PCRE.Heavy++-- | Make a parser optional, return Nothing if there is no match.+maybeOption :: Parser a+ -> Parser (Maybe a)+maybeOption p = option Nothing (Just <$> p)++-- | @"SAM_V1_6_Program"@ parser.+--+-- Defines a parser for @PG tag section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_Program :: Parser SAM_V1_6_Program+parse_SAM_V1_6_Program = do+ _ <- do pgheaderp <- DABL.takeTill (== 09)+ -- Parse @PG tag of the header section.+ case (pgheaderp =~ [re|[@][P][G]|]) of+ False -> fail $ show SAM_V1_6_Error_Program_Tag_Incorrect_Format + True -> -- @PG tag is in the accepted format.+ return pgheaderp+ _ <- word8 09+ -- This parser assumes that the ID tag always appears first, followed by+ -- the PN, CL, PP,+ -- DS and VN tags if they exist, in that order.+ id <- parse_SAM_V1_6_SAM_V1_6_Program_ID+ _ <- word8 09+ pn <- maybeOption parse_SAM_V1_6_SAM_V1_6_Program_PN+ _ <- word8 09+ cl <- maybeOption parse_SAM_V1_6_SAM_V1_6_Program_CL+ _ <- word8 09+ pp <- maybeOption parse_SAM_V1_6_SAM_V1_6_Program_PP+ _ <- word8 09+ ds <- maybeOption parse_SAM_V1_6_SAM_V1_6_Program_DS+ _ <- word8 09+ vn <- maybeOption parse_SAM_V1_6_SAM_V1_6_Program_VN+ return SAM_V1_6_Program { sam_v1_6_program_record_identifier = id+ , sam_v1_6_program_name = pn+ , sam_v1_6_program_command_line = cl+ , sam_v1_6_program_previous_pg_id = pp+ , sam_v1_6_program_description = ds+ , sam_v1_6_program_version = vn+ }
+ src/Data/SAM/Version1_6/Read/Parser/Header/PG/CL.hs view
@@ -0,0 +1,70 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Header.PG.CL+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Header.PG.CL ( -- * SAM_V1_6 parser - header section (Program) - CL tag+ parse_SAM_V1_6_SAM_V1_6_Program_CL+ ) where++import Data.SAM.Version1_6.Header+import Data.SAM.Version1_6.Read.Error++import Data.Attoparsec.ByteString.Lazy as DABL+import qualified Data.ByteString as DB (unpack)+import Data.Sequence as DSeq+import Text.Regex.PCRE.Heavy++-- | Defines a parser for the CL tag of the @PG tag section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_SAM_V1_6_Program_CL :: Parser SAM_V1_6_Program_Command_Line+parse_SAM_V1_6_SAM_V1_6_Program_CL = do+ pgheadercommandlinetag <- do pgheadercommandlinetagp <- DABL.takeTill (== 58)+ -- Parse CL tag of the header section.+ case (pgheadercommandlinetagp =~ [re|[C][L]|]) of+ False -> fail $ show SAM_V1_6_Error_Program_Command_Line_Incorrect_Format + True -> -- CL tag is in the accepted format. + return pgheadercommandlinetagp+ _ <- word8 58+ pgheadercommandlinevalue <- DABL.takeTill (== 09)+ return SAM_V1_6_Program_Command_Line { sam_v1_6_program_command_line_tag = DSeq.fromList $ DB.unpack pgheadercommandlinetag+ , sam_v1_6_program_command_line_value = pgheadercommandlinevalue+ }
+ src/Data/SAM/Version1_6/Read/Parser/Header/PG/DS.hs view
@@ -0,0 +1,70 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Header.PG.DS+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Header.PG.DS ( -- * SAM_V1_6 parser - header section (Program) - DS tag+ parse_SAM_V1_6_SAM_V1_6_Program_DS+ ) where++import Data.SAM.Version1_6.Header+import Data.SAM.Version1_6.Read.Error++import Data.Attoparsec.ByteString.Lazy as DABL+import qualified Data.ByteString as DB (unpack)+import Data.Sequence as DSeq+import Text.Regex.PCRE.Heavy++-- | Defines a parser for the DS tag of the @PG tag section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_SAM_V1_6_Program_DS :: Parser SAM_V1_6_Program_Description+parse_SAM_V1_6_SAM_V1_6_Program_DS = do+ pgheaderdescriptiontag <- do pgheaderdescriptiontagp <- DABL.takeTill (== 58)+ -- Parse DS tag of the header section.+ case (pgheaderdescriptiontagp =~ [re|[D][S]|]) of+ False -> fail $ show SAM_V1_6_Error_Program_Description_Incorrect_Format + True -> -- DS tag is in the accepted format. + return pgheaderdescriptiontagp+ _ <- word8 58+ pgheaderdescriptionvalue <- DABL.takeTill (== 09)+ return SAM_V1_6_Program_Description { sam_v1_6_program_description_tag = DSeq.fromList $ DB.unpack pgheaderdescriptiontag+ , sam_v1_6_program_description_value = pgheaderdescriptionvalue+ }
+ src/Data/SAM/Version1_6/Read/Parser/Header/PG/ID.hs view
@@ -0,0 +1,70 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Header.PG.ID+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Header.PG.ID ( -- * SAM_V1_6 parser - header section (Program) - ID tag+ parse_SAM_V1_6_SAM_V1_6_Program_ID+ ) where++import Data.SAM.Version1_6.Header+import Data.SAM.Version1_6.Read.Error++import Data.Attoparsec.ByteString.Lazy as DABL+import qualified Data.ByteString as DB (unpack)+import Data.Sequence as DSeq+import Text.Regex.PCRE.Heavy++-- | Defines a parser for the ID tag of the @PG tag section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_SAM_V1_6_Program_ID :: Parser SAM_V1_6_Program_Record_Identifier+parse_SAM_V1_6_SAM_V1_6_Program_ID = do+ pgheaderidentifiertag <- do pgheaderidentifiertagp <- DABL.takeTill (== 58)+ -- Parse ID tag of the header section.+ case (pgheaderidentifiertagp =~ [re|[I][D]|]) of+ False -> fail $ show SAM_V1_6_Error_Program_Identifier_Incorrect_Format + True -> -- ID tag is in the accepted format. + return pgheaderidentifiertagp+ _ <- word8 58+ pgheaderidentifiervalue <- DABL.takeTill (== 09)+ return SAM_V1_6_Program_Record_Identifier { sam_v1_6_program_record_identifier_tag = DSeq.fromList $ DB.unpack pgheaderidentifiertag+ , sam_v1_6_program_record_identifier_value = pgheaderidentifiervalue+ }
+ src/Data/SAM/Version1_6/Read/Parser/Header/PG/PN.hs view
@@ -0,0 +1,70 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Header.PG.PN+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Header.PG.PN ( -- * SAM_V1_6 parser - header section (Program) - PN tag+ parse_SAM_V1_6_SAM_V1_6_Program_PN+ ) where++import Data.SAM.Version1_6.Header+import Data.SAM.Version1_6.Read.Error++import Data.Attoparsec.ByteString.Lazy as DABL+import qualified Data.ByteString as DB (unpack)+import Data.Sequence as DSeq+import Text.Regex.PCRE.Heavy++-- | Defines a parser for the PN tag of the @PG tag section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_SAM_V1_6_Program_PN :: Parser SAM_V1_6_Program_Name+parse_SAM_V1_6_SAM_V1_6_Program_PN = do+ pgheadernametag <- do pgheadernametagp <- DABL.takeTill (== 58)+ -- Parse PN tag of the header section.+ case (pgheadernametagp =~ [re|[P][N]|]) of+ False -> fail $ show SAM_V1_6_Error_Program_Name_Incorrect_Format + True -> -- PN tag is in the accepted format. + return pgheadernametagp+ _ <- word8 58+ pgheadernamevalue <- DABL.takeTill (== 09)+ return SAM_V1_6_Program_Name { sam_v1_6_program_name_tag = DSeq.fromList $ DB.unpack pgheadernametag+ , sam_v1_6_program_name_value = pgheadernamevalue+ }
+ src/Data/SAM/Version1_6/Read/Parser/Header/PG/PP.hs view
@@ -0,0 +1,70 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Header.PG.PP+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Header.PG.PP ( -- * SAM_V1_6 parser - header section (Program) - PP tag+ parse_SAM_V1_6_SAM_V1_6_Program_PP+ ) where++import Data.SAM.Version1_6.Header+import Data.SAM.Version1_6.Read.Error++import Data.Attoparsec.ByteString.Lazy as DABL+import qualified Data.ByteString as DB (unpack)+import Data.Sequence as DSeq+import Text.Regex.PCRE.Heavy++-- | Defines a parser for the PP tag of the @PG tag section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_SAM_V1_6_Program_PP :: Parser SAM_V1_6_Program_Previous_PG_ID+parse_SAM_V1_6_SAM_V1_6_Program_PP = do+ pgheaderpreviouspgidtag <- do pgheaderpreviouspgidtagp <- DABL.takeTill (== 58)+ -- Parse PP tag of the header section.+ case (pgheaderpreviouspgidtagp =~ [re|[P][P]|]) of+ False -> fail $ show SAM_V1_6_Error_Program_Previous_PG_ID_Incorrect_Format + True -> -- PP tag is in the accepted format. + return pgheaderpreviouspgidtagp+ _ <- word8 58+ pgheaderpreviouspgidvalue <- DABL.takeTill (== 09)+ return SAM_V1_6_Program_Previous_PG_ID { sam_v1_6_program_previous_pg_id_tag = DSeq.fromList $ DB.unpack pgheaderpreviouspgidtag+ , sam_v1_6_program_previous_pg_id_value = pgheaderpreviouspgidvalue+ }
+ src/Data/SAM/Version1_6/Read/Parser/Header/PG/VN.hs view
@@ -0,0 +1,70 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Header.PG.VN+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Header.PG.VN ( -- * SAM_V1_6 parser - header section (Program) - VN tag+ parse_SAM_V1_6_SAM_V1_6_Program_VN+ ) where++import Data.SAM.Version1_6.Header+import Data.SAM.Version1_6.Read.Error++import Data.Attoparsec.ByteString.Lazy as DABL+import qualified Data.ByteString as DB (unpack)+import Data.Sequence as DSeq+import Text.Regex.PCRE.Heavy++-- | Defines a parser for the VN tag of the @PG tag section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_SAM_V1_6_Program_VN :: Parser SAM_V1_6_Program_Version+parse_SAM_V1_6_SAM_V1_6_Program_VN = do+ pgheaderversiontag <- do pgheaderversiontagp <- DABL.takeTill (== 58)+ -- Parse VN tag of the header section.+ case (pgheaderversiontagp =~ [re|[V][N]|]) of+ False -> fail $ show SAM_V1_6_Error_Program_Version_Incorrect_Format + True -> -- VN tag is in the accepted format. + return pgheaderversiontagp+ _ <- word8 58+ pgheaderversionvalue <- DABL.takeTill (== 09)+ return SAM_V1_6_Program_Version { sam_v1_6_program_version_tag = DSeq.fromList $ DB.unpack pgheaderversiontag+ , sam_v1_6_program_version_value = pgheaderversionvalue+ }
+ src/Data/SAM/Version1_6/Read/Parser/Header/RG/BC.hs view
@@ -0,0 +1,70 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Header.RG.BC+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Header.RG.BC ( -- * SAM_V1_6 parser - header section (Read group) - BC tag+ parse_SAM_V1_6_SAM_V1_6_Read_Group_BC+ ) where++import Data.SAM.Version1_6.Header+import Data.SAM.Version1_6.Read.Error++import Data.Attoparsec.ByteString.Lazy as DABL+import qualified Data.ByteString as DB (unpack)+import Data.Sequence as DSeq+import Text.Regex.PCRE.Heavy++-- | Defines a parser for the BC tag of the @RG tag section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_SAM_V1_6_Read_Group_BC :: Parser SAM_V1_6_Read_Group_Barcode_Sequence +parse_SAM_V1_6_SAM_V1_6_Read_Group_BC = do+ rgheaderbarcodesequencetag <- do rgheaderbarcodesequencetagp <- DABL.takeTill (== 58)+ -- Parse BC tag of the header section.+ case (rgheaderbarcodesequencetagp =~ [re|[B][C]|]) of+ False -> fail $ show SAM_V1_6_Error_Read_Group_Barcode_Sequence_Incorrect_Format + True -> -- BC tag is in the accepted format. + return rgheaderbarcodesequencetagp+ _ <- word8 58+ rgheaderbarcodesequencevalue <- DABL.takeTill (== 09)+ return SAM_V1_6_Read_Group_Barcode_Sequence { sam_v1_6_read_group_barcode_sequence_tag = DSeq.fromList $ DB.unpack rgheaderbarcodesequencetag+ , sam_v1_6_read_group_barcode_sequence_value = rgheaderbarcodesequencevalue+ }
+ src/Data/SAM/Version1_6/Read/Parser/Header/RG/Base.hs view
@@ -0,0 +1,131 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE QuasiQuotes #-}+{-# OPTIONS_GHC -fno-warn-name-shadowing #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Header.RG.Base+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Header.RG.Base ( -- * SAM_V1_6 parser - header section (Read group)+ parse_SAM_V1_6_Read_Group+ ) where++import Data.SAM.Version1_6.Header+import Data.SAM.Version1_6.Read.Error+import Data.SAM.Version1_6.Read.Parser.Header.RG.ID+import Data.SAM.Version1_6.Read.Parser.Header.RG.BC+import Data.SAM.Version1_6.Read.Parser.Header.RG.CN+import Data.SAM.Version1_6.Read.Parser.Header.RG.DS+import Data.SAM.Version1_6.Read.Parser.Header.RG.DT+import Data.SAM.Version1_6.Read.Parser.Header.RG.FO+import Data.SAM.Version1_6.Read.Parser.Header.RG.KS+import Data.SAM.Version1_6.Read.Parser.Header.RG.LB+import Data.SAM.Version1_6.Read.Parser.Header.RG.PG+import Data.SAM.Version1_6.Read.Parser.Header.RG.PI+import Data.SAM.Version1_6.Read.Parser.Header.RG.PL+import Data.SAM.Version1_6.Read.Parser.Header.RG.PM+import Data.SAM.Version1_6.Read.Parser.Header.RG.PU+import Data.SAM.Version1_6.Read.Parser.Header.RG.SM++import Data.Attoparsec.ByteString.Lazy as DABL+import Text.Regex.PCRE.Heavy++-- | Make a parser optional, return Nothing if there is no match.+maybeOption :: Parser a+ -> Parser (Maybe a)+maybeOption p = option Nothing (Just <$> p)++-- | @"SAM_V1_6_Read_Group"@ parser.+--+-- Defines a parser for @RG tag section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_Read_Group :: Parser SAM_V1_6_Read_Group+parse_SAM_V1_6_Read_Group = do+ _ <- do rgheaderp <- DABL.takeTill (== 09)+ -- Parse @RG tag of the header section.+ case (rgheaderp =~ [re|[@][R][G]|]) of+ False -> fail $ show SAM_V1_6_Error_Read_Group_Tag_Incorrect_Format+ True -> -- @RG tag is in the accepted format.+ return rgheaderp+ _ <- word8 09+ -- This parser assumes that the ID tag always appears first, followed by+ -- the BC, CN, DS, DT, FO, KS, LB, PG, PI, PL,+ -- PM, PU and SM tags if they exist, in that order.+ id <- parse_SAM_V1_6_SAM_V1_6_Read_Group_ID+ _ <- word8 09+ bc <- maybeOption parse_SAM_V1_6_SAM_V1_6_Read_Group_BC+ _ <- word8 09+ cn <- maybeOption parse_SAM_V1_6_SAM_V1_6_Read_Group_CN+ _ <- word8 09+ ds <- maybeOption parse_SAM_V1_6_SAM_V1_6_Read_Group_DS+ _ <- word8 09+ dt <- maybeOption parse_SAM_V1_6_SAM_V1_6_Read_Group_DT+ _ <- word8 09+ fo <- maybeOption parse_SAM_V1_6_SAM_V1_6_Read_Group_FO+ _ <- word8 09+ ks <- maybeOption parse_SAM_V1_6_SAM_V1_6_Read_Group_KS+ _ <- word8 09+ lb <- maybeOption parse_SAM_V1_6_SAM_V1_6_Read_Group_LB+ _ <- word8 09+ pg <- maybeOption parse_SAM_V1_6_SAM_V1_6_Read_Group_PG+ _ <- word8 09+ pi <- maybeOption parse_SAM_V1_6_SAM_V1_6_Read_Group_PI+ _ <- word8 09+ pl <- maybeOption parse_SAM_V1_6_SAM_V1_6_Read_Group_PL+ _ <- word8 09+ pm <- maybeOption parse_SAM_V1_6_SAM_V1_6_Read_Group_PM+ _ <- word8 09+ pu <- maybeOption parse_SAM_V1_6_SAM_V1_6_Read_Group_PU+ _ <- word8 09+ sm <- maybeOption parse_SAM_V1_6_SAM_V1_6_Read_Group_SM+ return SAM_V1_6_Read_Group { sam_v1_6_read_group_identifer = id+ , sam_v1_6_read_group_barcode_sequence = bc+ , sam_v1_6_read_group_sequencing_center = cn+ , sam_v1_6_read_group_description = ds+ , sam_v1_6_read_group_run_date = dt+ , sam_v1_6_read_group_flow_order = fo+ , sam_v1_6_read_group_key_sequence = ks+ , sam_v1_6_read_group_library = lb+ , sam_v1_6_read_group_programs = pg+ , sam_v1_6_read_group_predicted_median_insert_size = pi+ , sam_v1_6_read_group_platform = pl+ , sam_v1_6_read_group_platform_model = pm+ , sam_v1_6_read_group_platform_unit = pu+ , sam_v1_6_read_group_sample = sm+ }
+ src/Data/SAM/Version1_6/Read/Parser/Header/RG/CN.hs view
@@ -0,0 +1,70 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Header.RG.CN+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Header.RG.CN ( -- * SAM_V1_6 parser - header section (Read group) - CN tag+ parse_SAM_V1_6_SAM_V1_6_Read_Group_CN+ ) where++import Data.SAM.Version1_6.Header+import Data.SAM.Version1_6.Read.Error++import Data.Attoparsec.ByteString.Lazy as DABL+import qualified Data.ByteString as DB (unpack)+import Data.Sequence as DSeq+import Text.Regex.PCRE.Heavy++-- | Defines a parser for the CN tag of the @RG tag section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_SAM_V1_6_Read_Group_CN :: Parser SAM_V1_6_Read_Group_Sequencing_Center +parse_SAM_V1_6_SAM_V1_6_Read_Group_CN = do+ rgheadersequencingcentertag <- do rgheadersequencingcentertagp <- DABL.takeTill (== 58)+ -- Parse CN tag of the header section.+ case (rgheadersequencingcentertagp =~ [re|[C][N]|]) of+ False -> fail $ show SAM_V1_6_Error_Read_Group_Sequencing_Center_Incorrect_Format + True -> -- CN tag is in the accepted format. + return rgheadersequencingcentertagp+ _ <- word8 58+ rgheadersequencingcentervalue <- DABL.takeTill (== 09)+ return SAM_V1_6_Read_Group_Sequencing_Center { sam_v1_6_read_group_sequencing_center_tag = DSeq.fromList $ DB.unpack rgheadersequencingcentertag+ , sam_v1_6_read_group_sequencing_center_value = rgheadersequencingcentervalue+ }
+ src/Data/SAM/Version1_6/Read/Parser/Header/RG/DS.hs view
@@ -0,0 +1,70 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Header.RG.DS+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Header.RG.DS ( -- * SAM_V1_6 parser - header section (Read group) - DS tag+ parse_SAM_V1_6_SAM_V1_6_Read_Group_DS+ ) where++import Data.SAM.Version1_6.Header+import Data.SAM.Version1_6.Read.Error++import Data.Attoparsec.ByteString.Lazy as DABL+import qualified Data.ByteString as DB (unpack)+import Data.Sequence as DSeq+import Text.Regex.PCRE.Heavy++-- | Defines a parser for the DS tag of the @RG tag section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_SAM_V1_6_Read_Group_DS :: Parser SAM_V1_6_Read_Group_Description +parse_SAM_V1_6_SAM_V1_6_Read_Group_DS = do+ rgheaderdescriptiontag <- do rgheaderdescriptiontagp <- DABL.takeTill (== 58)+ -- Parse DS tag of the header section.+ case (rgheaderdescriptiontagp =~ [re|[D][S]|]) of+ False -> fail $ show SAM_V1_6_Error_Read_Group_Description_Incorrect_Format + True -> -- DS tag is in the accepted format. + return rgheaderdescriptiontagp+ _ <- word8 58+ rgheaderdescriptionvalue <- DABL.takeTill (== 09)+ return SAM_V1_6_Read_Group_Description { sam_v1_6_read_group_description_tag = DSeq.fromList $ DB.unpack rgheaderdescriptiontag+ , sam_v1_6_read_group_description_value = rgheaderdescriptionvalue+ }
+ src/Data/SAM/Version1_6/Read/Parser/Header/RG/DT.hs view
@@ -0,0 +1,70 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Header.RG.DT+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Header.RG.DT ( -- * SAM_V1_6 parser - header section (Read group) - DT tag+ parse_SAM_V1_6_SAM_V1_6_Read_Group_DT+ ) where++import Data.SAM.Version1_6.Header+import Data.SAM.Version1_6.Read.Error++import Data.Attoparsec.ByteString.Lazy as DABL+import qualified Data.ByteString as DB (unpack)+import Data.Sequence as DTeq+import Text.Regex.PCRE.Heavy++-- | Defines a parser for the DT tag of the @RG tag section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_SAM_V1_6_Read_Group_DT :: Parser SAM_V1_6_Read_Group_Run_Date +parse_SAM_V1_6_SAM_V1_6_Read_Group_DT = do+ rgheaderrundatetag <- do rgheaderrundatetagp <- DABL.takeTill (== 58)+ -- Parse DT tag of the header section.+ case (rgheaderrundatetagp =~ [re|[D][T]|]) of+ False -> fail $ show SAM_V1_6_Error_Read_Group_Date_Run_Produced_Incorrect_Format+ True -> -- DT tag is in the accepted format. + return rgheaderrundatetagp+ _ <- word8 58+ rgheaderrundatevalue <- DABL.takeTill (== 09)+ return SAM_V1_6_Read_Group_Run_Date { sam_v1_6_read_group_run_date_tag = DTeq.fromList $ DB.unpack rgheaderrundatetag+ , sam_v1_6_read_group_run_date_value = rgheaderrundatevalue+ }
+ src/Data/SAM/Version1_6/Read/Parser/Header/RG/FO.hs view
@@ -0,0 +1,75 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Header.RG.FO+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Header.RG.FO ( -- * SAM_V1_6 parser - header section (Read group) - FO tag+ parse_SAM_V1_6_SAM_V1_6_Read_Group_FO+ ) where++import Data.SAM.Version1_6.Header+import Data.SAM.Version1_6.Read.Error++import Data.Attoparsec.ByteString.Lazy as DABL+import qualified Data.ByteString as DB (unpack)+import Data.Sequence as DSeq+import Text.Regex.PCRE.Heavy++-- | Defines a parser for the FO tag of the @RG tag section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_SAM_V1_6_Read_Group_FO :: Parser SAM_V1_6_Read_Group_Flow_Order +parse_SAM_V1_6_SAM_V1_6_Read_Group_FO = do+ rgheaderflowordertag <- do rgheaderflowordertagp <- DABL.takeTill (== 58)+ -- Parse FO tag of the header section.+ case (rgheaderflowordertagp =~ [re|[F][O]|]) of+ False -> fail $ show SAM_V1_6_Error_Read_Group_Flow_Order_Incorrect_Format+ True -> -- FO tag is in the accepted format. + return rgheaderflowordertagp+ _ <- word8 58+ rgheaderflowordervalue <- do rgheaderflowordervaluep <- DABL.takeTill (== 09)+ -- Parse FO value of the header section.+ case (rgheaderflowordervaluep =~ [re|/\*|[ACMGRSVTWYHKDBN]+/|]) of+ False -> fail $ show SAM_V1_6_Error_Read_Group_Flow_Order_Incorrect_Format+ True -> -- FO value is in the accepted format.+ return rgheaderflowordervaluep+ return SAM_V1_6_Read_Group_Flow_Order { sam_v1_6_read_group_flow_order_tag = DSeq.fromList $ DB.unpack rgheaderflowordertag+ , sam_v1_6_read_group_flow_order_value = rgheaderflowordervalue+ }
+ src/Data/SAM/Version1_6/Read/Parser/Header/RG/ID.hs view
@@ -0,0 +1,70 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Header.RG.ID+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Header.RG.ID ( -- * SAM_V1_6 parser - header section (Read group) - ID tag+ parse_SAM_V1_6_SAM_V1_6_Read_Group_ID+ ) where++import Data.SAM.Version1_6.Header+import Data.SAM.Version1_6.Read.Error++import Data.Attoparsec.ByteString.Lazy as DABL+import qualified Data.ByteString as DB (unpack)+import Data.Sequence as DSeq+import Text.Regex.PCRE.Heavy++-- | Defines a parser for the ID tag of the @RG tag section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_SAM_V1_6_Read_Group_ID :: Parser SAM_V1_6_Read_Group_Identifier +parse_SAM_V1_6_SAM_V1_6_Read_Group_ID = do+ rgheaderreadgroupidentifiertag <- do rgheaderreadgroupidentifiertagp <- DABL.takeTill (== 58)+ -- Parse ID tag of the header section.+ case (rgheaderreadgroupidentifiertagp =~ [re|[I][D]|]) of+ False -> fail $ show SAM_V1_6_Error_Read_Group_Read_Group_Identifier_Incorrect_Format+ True -> -- ID tag is in the accepted format. + return rgheaderreadgroupidentifiertagp+ _ <- word8 58+ rgheaderreadgroupidentifiervalue <- DABL.takeTill (== 09)+ return SAM_V1_6_Read_Group_Identifier { sam_v1_6_read_group_identifier_tag = DSeq.fromList $ DB.unpack rgheaderreadgroupidentifiertag+ , sam_v1_6_read_group_identifier_value = rgheaderreadgroupidentifiervalue+ }
+ src/Data/SAM/Version1_6/Read/Parser/Header/RG/KS.hs view
@@ -0,0 +1,70 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Header.RG.KS+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Header.RG.KS ( -- * SAM_V1_6 parser - header section (Read group) - KS tag+ parse_SAM_V1_6_SAM_V1_6_Read_Group_KS+ ) where++import Data.SAM.Version1_6.Header+import Data.SAM.Version1_6.Read.Error++import Data.Attoparsec.ByteString.Lazy as DABL+import qualified Data.ByteString as DB (unpack)+import Data.Sequence as DSeq+import Text.Regex.PCRE.Heavy++-- | Defines a parser for the KS tag of the @RG tag section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_SAM_V1_6_Read_Group_KS :: Parser SAM_V1_6_Read_Group_Key_Sequence +parse_SAM_V1_6_SAM_V1_6_Read_Group_KS = do+ rgheaderkeysequencetag <- do rgheaderkeysequencetagp <- DABL.takeTill (== 58)+ -- Parse KS tag of the header section.+ case (rgheaderkeysequencetagp =~ [re|[K][S]|]) of+ False -> fail $ show SAM_V1_6_Error_Read_Group_Key_Sequence_Incorrect_Format+ True -> -- KS tag is in the accepted format. + return rgheaderkeysequencetagp+ _ <- word8 58+ rgheaderkeysequencevalue <- DABL.takeTill (== 09)+ return SAM_V1_6_Read_Group_Key_Sequence { sam_v1_6_read_group_key_sequence_tag = DSeq.fromList $ DB.unpack rgheaderkeysequencetag+ , sam_v1_6_read_group_key_sequence_value = rgheaderkeysequencevalue+ }
+ src/Data/SAM/Version1_6/Read/Parser/Header/RG/LB.hs view
@@ -0,0 +1,70 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Header.RG.LB+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Header.RG.LB ( -- * SAM_V1_6 parser - header section (Read group) - LB tag+ parse_SAM_V1_6_SAM_V1_6_Read_Group_LB+ ) where++import Data.SAM.Version1_6.Header+import Data.SAM.Version1_6.Read.Error++import Data.Attoparsec.ByteString.Lazy as DABL+import qualified Data.ByteString as DB (unpack)+import Data.Sequence as DSeq+import Text.Regex.PCRE.Heavy++-- | Defines a parser for the LB tag of the @RG tag section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_SAM_V1_6_Read_Group_LB :: Parser SAM_V1_6_Read_Group_Library +parse_SAM_V1_6_SAM_V1_6_Read_Group_LB = do+ rgheaderlibrarytag <- do rgheaderlibrarytagp <- DABL.takeTill (== 58)+ -- Parse LB tag of the header section.+ case (rgheaderlibrarytagp =~ [re|[L][B]|]) of+ False -> fail $ show SAM_V1_6_Error_Read_Group_Library_Incorrect_Format+ True -> -- LB tag is in the accepted format. + return rgheaderlibrarytagp+ _ <- word8 58+ rgheaderlibraryvalue <- DABL.takeTill (== 09)+ return SAM_V1_6_Read_Group_Library { sam_v1_6_read_group_library_tag = DSeq.fromList $ DB.unpack rgheaderlibrarytag+ , sam_v1_6_read_group_library_value = rgheaderlibraryvalue+ }
+ src/Data/SAM/Version1_6/Read/Parser/Header/RG/PG.hs view
@@ -0,0 +1,70 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Header.RG.PG+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Header.RG.PG ( -- * SAM_V1_6 parser - header section (Read group) - PG tag+ parse_SAM_V1_6_SAM_V1_6_Read_Group_PG+ ) where++import Data.SAM.Version1_6.Header+import Data.SAM.Version1_6.Read.Error++import Data.Attoparsec.ByteString.Lazy as DABL+import qualified Data.ByteString as DB (unpack)+import Data.Sequence as DSeq+import Text.Regex.PCRE.Heavy++-- | Defines a parser for the PG tag of the @RG tag section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_SAM_V1_6_Read_Group_PG :: Parser SAM_V1_6_Read_Group_Programs +parse_SAM_V1_6_SAM_V1_6_Read_Group_PG = do+ rgheaderprogramstag <- do rgheaderprogramstagp <- DABL.takeTill (== 58)+ -- Parse PG tag of the header section.+ case (rgheaderprogramstagp =~ [re|[P][G]|]) of+ False -> fail $ show SAM_V1_6_Error_Read_Group_Programs_Incorrect_Format+ True -> -- PG tag is in the accepted format. + return rgheaderprogramstagp+ _ <- word8 58+ rgheaderprogramsvalue <- DABL.takeTill (== 09)+ return SAM_V1_6_Read_Group_Programs { sam_v1_6_read_group_programs_tag = DSeq.fromList $ DB.unpack rgheaderprogramstag+ , sam_v1_6_read_group_programs_value = rgheaderprogramsvalue+ }
+ src/Data/SAM/Version1_6/Read/Parser/Header/RG/PI.hs view
@@ -0,0 +1,70 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Header.RG.PI+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Header.RG.PI ( -- * SAM_V1_6 parser - header section (Read group) - PI tag+ parse_SAM_V1_6_SAM_V1_6_Read_Group_PI+ ) where++import Data.SAM.Version1_6.Header+import Data.SAM.Version1_6.Read.Error++import Data.Attoparsec.ByteString.Lazy as DABL+import qualified Data.ByteString as DB (unpack)+import Data.Sequence as DSeq+import Text.Regex.PCRE.Heavy++-- | Defines a parser for the PI tag of the @RG tag section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_SAM_V1_6_Read_Group_PI :: Parser SAM_V1_6_Read_Group_Predicted_Median_Insert_Size +parse_SAM_V1_6_SAM_V1_6_Read_Group_PI = do+ rgheaderpredictedmedianinsertsizetag <- do rgheaderpredictedmedianinsertsizetagp <- DABL.takeTill (== 58)+ -- Parse PI tag of the header section.+ case (rgheaderpredictedmedianinsertsizetagp =~ [re|[P][I]|]) of+ False -> fail $ show SAM_V1_6_Error_Read_Group_Predicted_Median_Insert_Size_Incorrect_Format+ True -> -- PI tag is in the accepted format. + return rgheaderpredictedmedianinsertsizetagp+ _ <- word8 58+ rgheaderpredictedmedianinsertsizevalue <- DABL.takeTill (== 09)+ return SAM_V1_6_Read_Group_Predicted_Median_Insert_Size { sam_v1_6_read_group_predicted_median_insert_size_tag = DSeq.fromList $ DB.unpack rgheaderpredictedmedianinsertsizetag+ , sam_v1_6_read_group_predicted_median_insert_size_value = rgheaderpredictedmedianinsertsizevalue+ }
+ src/Data/SAM/Version1_6/Read/Parser/Header/RG/PL.hs view
@@ -0,0 +1,75 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Header.RG.PL+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Header.RG.PL ( -- * SAM_V1_6 parser - header section (Read group) - PL tag+ parse_SAM_V1_6_SAM_V1_6_Read_Group_PL+ ) where++import Data.SAM.Version1_6.Header+import Data.SAM.Version1_6.Read.Error++import Data.Attoparsec.ByteString.Lazy as DABL+import qualified Data.ByteString as DB (unpack)+import Data.Sequence as DSeq+import Text.Regex.PCRE.Heavy++-- | Defines a parser for the PL tag of the @RG tag section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_SAM_V1_6_Read_Group_PL :: Parser SAM_V1_6_Read_Group_Platform +parse_SAM_V1_6_SAM_V1_6_Read_Group_PL = do+ rgheaderplatformtag <- do rgheaderplatformtagp <- DABL.takeTill (== 58)+ -- Parse PL tag of the header section.+ case (rgheaderplatformtagp =~ [re|[P][L]|]) of+ False -> fail $ show SAM_V1_6_Error_Read_Group_Platform_Incorrect_Format+ True -> -- PL tag is in the accepted format. + return rgheaderplatformtagp+ _ <- word8 58+ rgheaderplatformvalue <- do rgheaderplatformvaluep <- DABL.takeTill (== 09)+ -- Parse PL value of the header section.+ case (rgheaderplatformvaluep =~ [re|[C][A][P][I][L][L][A][R][Y]|[D][N][B][S][E][Q]|[E][L][E][M][E][N][T]|[H][E][L][I][C][O][S]|[I][L][L][U][M][I][N][A]|[I][O][N][T][O][R][R][E][N][T]|[L][S][4][5][4]|[O][N][T]|[P][A][C][B][I][O]|[S][O][L][I][D]|[U][L][T][I][M][A]|]) of+ False -> fail $ show SAM_V1_6_Error_Read_Group_Platform_Incorrect_Format+ True -> -- PL value is in the accepted format.+ return rgheaderplatformvaluep+ return SAM_V1_6_Read_Group_Platform { sam_v1_6_read_group_platform_tag = DSeq.fromList $ DB.unpack rgheaderplatformtag+ , sam_v1_6_read_group_platform_value = rgheaderplatformvalue+ }
+ src/Data/SAM/Version1_6/Read/Parser/Header/RG/PM.hs view
@@ -0,0 +1,70 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Header.RG.PM+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Header.RG.PM ( -- * SAM_V1_6 parser - header section (Read group) - PM tag+ parse_SAM_V1_6_SAM_V1_6_Read_Group_PM+ ) where++import Data.SAM.Version1_6.Header+import Data.SAM.Version1_6.Read.Error++import Data.Attoparsec.ByteString.Lazy as DABL+import qualified Data.ByteString as DB (unpack)+import Data.Sequence as DSeq+import Text.Regex.PCRE.Heavy++-- | Defines a parser for the PM tag of the @RG tag section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_SAM_V1_6_Read_Group_PM :: Parser SAM_V1_6_Read_Group_Platform_Model +parse_SAM_V1_6_SAM_V1_6_Read_Group_PM = do+ rgheaderplatformmodeltag <- do rgheaderplatformmodeltagp <- DABL.takeTill (== 58)+ -- Parse PM tag of the header section.+ case (rgheaderplatformmodeltagp =~ [re|[P][M]|]) of+ False -> fail $ show SAM_V1_6_Error_Read_Group_Platform_Model_Incorrect_Format+ True -> -- PM tag is in the accepted format. + return rgheaderplatformmodeltagp+ _ <- word8 58+ rgheaderplatformmodelvalue <- DABL.takeTill (== 09)+ return SAM_V1_6_Read_Group_Platform_Model { sam_v1_6_read_group_platform_model_tag = DSeq.fromList $ DB.unpack rgheaderplatformmodeltag+ , sam_v1_6_read_group_platform_model_value = rgheaderplatformmodelvalue+ }
+ src/Data/SAM/Version1_6/Read/Parser/Header/RG/PU.hs view
@@ -0,0 +1,70 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Header.RG.PU+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Header.RG.PU ( -- * SAM_V1_6 parser - header section (Read group) - PU tag+ parse_SAM_V1_6_SAM_V1_6_Read_Group_PU+ ) where++import Data.SAM.Version1_6.Header+import Data.SAM.Version1_6.Read.Error++import Data.Attoparsec.ByteString.Lazy as DABL+import qualified Data.ByteString as DB (unpack)+import Data.Sequence as DSeq+import Text.Regex.PCRE.Heavy++-- | Defines a parser for the PU tag of the @RG tag section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_SAM_V1_6_Read_Group_PU :: Parser SAM_V1_6_Read_Group_Platform_Unit +parse_SAM_V1_6_SAM_V1_6_Read_Group_PU = do+ rgheaderplatformunittag <- do rgheaderplatformunittagp <- DABL.takeTill (== 58)+ -- Parse PU tag of the header section.+ case (rgheaderplatformunittagp =~ [re|[P][U]|]) of+ False -> fail $ show SAM_V1_6_Error_Read_Group_Platform_Unit_Incorrect_Format + True -> -- PU tag is in the accepted format. + return rgheaderplatformunittagp+ _ <- word8 58+ rgheaderplatformunitvalue <- DABL.takeTill (== 09)+ return SAM_V1_6_Read_Group_Platform_Unit { sam_v1_6_read_group_platform_unit_tag = DSeq.fromList $ DB.unpack rgheaderplatformunittag+ , sam_v1_6_read_group_platform_unit_value = rgheaderplatformunitvalue+ }
+ src/Data/SAM/Version1_6/Read/Parser/Header/RG/SM.hs view
@@ -0,0 +1,70 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Header.RG.SM+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Header.RG.SM ( -- * SAM_V1_6 parser - header section (Read group) - SM tag+ parse_SAM_V1_6_SAM_V1_6_Read_Group_SM+ ) where++import Data.SAM.Version1_6.Header+import Data.SAM.Version1_6.Read.Error++import Data.Attoparsec.ByteString.Lazy as DABL+import qualified Data.ByteString as DB (unpack)+import Data.Sequence as DSeq+import Text.Regex.PCRE.Heavy++-- | Defines a parser for the SM tag of the @RG tag section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_SAM_V1_6_Read_Group_SM :: Parser SAM_V1_6_Read_Group_Sample +parse_SAM_V1_6_SAM_V1_6_Read_Group_SM = do+ rgheadersampletag <- do rgheadersampletagp <- DABL.takeTill (== 58)+ -- Parse SM tag of the header section.+ case (rgheadersampletagp =~ [re|[S][M]|]) of+ False -> fail $ show SAM_V1_6_Error_Read_Group_Sample_Incorrect_Format+ True -> -- SM tag is in the accepted format. + return rgheadersampletagp+ _ <- word8 58+ rgheadersamplevalue <- DABL.takeTill (== 09)+ return SAM_V1_6_Read_Group_Sample { sam_v1_6_read_group_sample_tag = DSeq.fromList $ DB.unpack rgheadersampletag+ , sam_v1_6_read_group_sample_value = rgheadersamplevalue+ }
+ src/Data/SAM/Version1_6/Read/Parser/Header/SQ/AH.hs view
@@ -0,0 +1,70 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Header.SQ.AH+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Header.SQ.AH ( -- * SAM_V1_6 parser - header section (Reference sequence dictionary) - AH tag+ parse_SAM_V1_6_SAM_V1_6_Reference_Sequence_Dictionary_AH+ ) where++import Data.SAM.Version1_6.Header+import Data.SAM.Version1_6.Read.Error++import Data.Attoparsec.ByteString.Lazy as DABL+import qualified Data.ByteString as DB (unpack)+import Data.Sequence as DSeq+import Text.Regex.PCRE.Heavy++-- | Defines a parser for the AH tag of the @SQ tag section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_SAM_V1_6_Reference_Sequence_Dictionary_AH :: Parser SAM_V1_6_Reference_Sequence_Dictionary_Alternative_Locus+parse_SAM_V1_6_SAM_V1_6_Reference_Sequence_Dictionary_AH = do+ sqheaderalternativelocustag <- do sqheaderalternativelocustagp <- DABL.takeTill (== 58)+ -- Parse AH tag of the header section.+ case (sqheaderalternativelocustagp =~ [re|[A][H]|]) of+ False -> fail $ show SAM_V1_6_Error_Reference_Sequence_Dictionary_Alternative_Locus_Incorrect_Format+ True -> -- AH tag is in the accepted format.+ return sqheaderalternativelocustagp+ _ <- word8 58+ sqheaderalternativelocusvalue <- DABL.takeTill (== 09) + return SAM_V1_6_Reference_Sequence_Dictionary_Alternative_Locus { sam_v1_6_reference_sequence_dictionary_alternative_locus_tag = DSeq.fromList $ DB.unpack sqheaderalternativelocustag+ , sam_v1_6_reference_sequence_dictionary_alternative_locus_value = sqheaderalternativelocusvalue+ }
+ src/Data/SAM/Version1_6/Read/Parser/Header/SQ/AN.hs view
@@ -0,0 +1,75 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Header.SQ.AN+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Header.SQ.AN ( -- * SAM_V1_6 parser - header section (Reference sequence dictionary) - AN tag+ parse_SAM_V1_6_SAM_V1_6_Reference_Sequence_Dictionary_AN+ ) where++import Data.SAM.Version1_6.Header+import Data.SAM.Version1_6.Read.Error++import Data.Attoparsec.ByteString.Lazy as DABL+import qualified Data.ByteString as DB (unpack)+import Data.Sequence as DSeq+import Text.Regex.PCRE.Heavy++-- | Defines a parser for the AN tag of the @SQ tag section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_SAM_V1_6_Reference_Sequence_Dictionary_AN :: Parser SAM_V1_6_Reference_Sequence_Dictionary_Alternative_Reference_Sequence_Names+parse_SAM_V1_6_SAM_V1_6_Reference_Sequence_Dictionary_AN = do+ sqheaderalternativereferencesequencenamestag <- do sqheaderalternativereferencesequencenamestagp <- DABL.takeTill (== 58)+ -- Parse AN tag of the header section.+ case (sqheaderalternativereferencesequencenamestagp =~ [re|[A][N]|]) of+ False -> fail $ show SAM_V1_6_Error_Reference_Sequence_Dictionary_Alternative_Reference_Sequence_Names_Incorrect_Format+ True -> -- AN tag is in the accepted format.+ return sqheaderalternativereferencesequencenamestagp+ _ <- word8 58+ sqheaderalternativereferencesequencenamesvalue <- do sqheaderalternativereferencesequencenamesvaluep <- DABL.takeTill (== 09)+ -- Parse AN value of the header section.+ case (sqheaderalternativereferencesequencenamesvaluep =~ [re|[0-9A-Za-z!#$%&+./:;?@^_|~-][0-9A-Za-z!#$%&*+./:;=?@^_|~-]*(,[0-9A-Za-z!#$%&+./:;?@^_|~-][0-9A-Za-z!#$%&*+./:;=?@^_|~-]*)*|]) of+ False -> fail $ show SAM_V1_6_Error_Reference_Sequence_Dictionary_Alternative_Reference_Sequence_Names_Invalid_Value+ True -> -- AN value is in the accepted format.+ return sqheaderalternativereferencesequencenamesvaluep+ return SAM_V1_6_Reference_Sequence_Dictionary_Alternative_Reference_Sequence_Names { sam_v1_6_reference_sequence_dictionary_alternative_reference_sequence_names_tag = DSeq.fromList $ DB.unpack sqheaderalternativereferencesequencenamestag+ , sam_v1_6_reference_sequence_dictionary_alternative_reference_sequence_names_value = sqheaderalternativereferencesequencenamesvalue+ }
+ src/Data/SAM/Version1_6/Read/Parser/Header/SQ/AS.hs view
@@ -0,0 +1,70 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Header.SQ.AS+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Header.SQ.AS ( -- * SAM_V1_6 parser - header section (Reference sequence dictionary) - AS tag+ parse_SAM_V1_6_SAM_V1_6_Reference_Sequence_Dictionary_AS+ ) where++import Data.SAM.Version1_6.Header+import Data.SAM.Version1_6.Read.Error++import Data.Attoparsec.ByteString.Lazy as DABL+import qualified Data.ByteString as DB (unpack)+import Data.Sequence as DSeq+import Text.Regex.PCRE.Heavy++-- | Defines a parser for the AS tag of the @SQ tag section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_SAM_V1_6_Reference_Sequence_Dictionary_AS :: Parser SAM_V1_6_Reference_Sequence_Dictionary_Genome_Assembly_Identifier+parse_SAM_V1_6_SAM_V1_6_Reference_Sequence_Dictionary_AS = do+ sqheadergenomeassemblyidentifiertag <- do sqheadergenomeassemblyidentifiertagp <- DABL.takeTill (== 58)+ -- Parse AS tag of the header section.+ case (sqheadergenomeassemblyidentifiertagp =~ [re|[A][S]|]) of+ False -> fail $ show SAM_V1_6_Error_Reference_Sequence_Dictionary_Genome_Assembly_Identifier_Incorrect_Format+ True -> -- AS tag is in the accepted format.+ return sqheadergenomeassemblyidentifiertagp+ _ <- word8 58+ sqheadergenomeassemblyidentifiervalue <- DABL.takeTill (== 09)+ return SAM_V1_6_Reference_Sequence_Dictionary_Genome_Assembly_Identifier { sam_v1_6_reference_sequence_dictionary_genome_assembly_identifier_tag = DSeq.fromList $ DB.unpack sqheadergenomeassemblyidentifiertag+ , sam_v1_6_reference_sequence_dictionary_genome_assembly_identifier_value = sqheadergenomeassemblyidentifiervalue+ }
+ src/Data/SAM/Version1_6/Read/Parser/Header/SQ/Base.hs view
@@ -0,0 +1,114 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Header.SQ.Base+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Header.SQ.Base ( -- * SAM_V1_6 parser - header section (Reference sequence dictionary)+ parse_SAM_V1_6_Reference_Sequence_Dictionary+ ) where++import Data.SAM.Version1_6.Header+import Data.SAM.Version1_6.Read.Error+import Data.SAM.Version1_6.Read.Parser.Header.SQ.SN+import Data.SAM.Version1_6.Read.Parser.Header.SQ.LN+import Data.SAM.Version1_6.Read.Parser.Header.SQ.AH+import Data.SAM.Version1_6.Read.Parser.Header.SQ.AN+import Data.SAM.Version1_6.Read.Parser.Header.SQ.AS+import Data.SAM.Version1_6.Read.Parser.Header.SQ.DS+import Data.SAM.Version1_6.Read.Parser.Header.SQ.M5+import Data.SAM.Version1_6.Read.Parser.Header.SQ.SP+import Data.SAM.Version1_6.Read.Parser.Header.SQ.TP+import Data.SAM.Version1_6.Read.Parser.Header.SQ.UR++import Data.Attoparsec.ByteString.Lazy as DABL+import Text.Regex.PCRE.Heavy++-- | Make a parser optional, return Nothing if there is no match.+maybeOption :: Parser a+ -> Parser (Maybe a)+maybeOption p = option Nothing (Just <$> p)++-- | @"SAM_V1_6_Reference_Sequence_Dictionary"@ parser.+--+-- Defines a parser for @SQ tag section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_Reference_Sequence_Dictionary :: Parser SAM_V1_6_Reference_Sequence_Dictionary+parse_SAM_V1_6_Reference_Sequence_Dictionary = do+ _ <- do sqheaderp <- DABL.takeTill (== 09)+ -- Parse @SQ tag of the header section.+ case (sqheaderp =~ [re|[@][S][Q]|]) of+ False -> fail $ show SAM_V1_6_Error_File_Level_Metadata_Tag_Incorrect_Format+ True -> -- @SQ tag is in the accepted format.+ return sqheaderp+ _ <- word8 09+ -- This parser assumes that the SN tag always appears first, followed by+ -- the LN tag, followed by the AH, AN, AS, DS, M5,+ -- SP, TP and UR tags if they exist, in that order.+ sn <- parse_SAM_V1_6_SAM_V1_6_Reference_Sequence_Dictionary_SN+ _ <- word8 09+ ln <- parse_SAM_V1_6_SAM_V1_6_Reference_Sequence_Dictionary_LN+ _ <- word8 09+ ah <- maybeOption parse_SAM_V1_6_SAM_V1_6_Reference_Sequence_Dictionary_AH+ _ <- word8 09+ an <- maybeOption parse_SAM_V1_6_SAM_V1_6_Reference_Sequence_Dictionary_AN+ _ <- word8 09+ as <- maybeOption parse_SAM_V1_6_SAM_V1_6_Reference_Sequence_Dictionary_AS+ _ <- word8 09+ ds <- maybeOption parse_SAM_V1_6_SAM_V1_6_Reference_Sequence_Dictionary_DS+ _ <- word8 09+ m5 <- maybeOption parse_SAM_V1_6_SAM_V1_6_Reference_Sequence_Dictionary_M5+ _ <- word8 09+ sp <- maybeOption parse_SAM_V1_6_SAM_V1_6_Reference_Sequence_Dictionary_SP+ _ <- word8 09+ tp <- maybeOption parse_SAM_V1_6_SAM_V1_6_Reference_Sequence_Dictionary_TP+ _ <- word8 09+ ur <- maybeOption parse_SAM_V1_6_SAM_V1_6_Reference_Sequence_Dictionary_UR + return SAM_V1_6_Reference_Sequence_Dictionary { sam_v1_6_reference_sequence_dictionary_reference_sequence_name = sn + , sam_v1_6_reference_sequence_dictionary_reference_sequence_length = ln+ , sam_v1_6_reference_sequence_dictionary_reference_alternative_locus = ah+ , sam_v1_6_reference_sequence_dictionary_reference_alternative_reference_sequence_names = an+ , sam_v1_6_reference_sequence_dictionary_genome_assembly_identifier = as+ , sam_v1_6_reference_sequence_dictionary_description = ds+ , sam_v1_6_reference_sequence_dictionary_md5_checksum = m5+ , sam_v1_6_reference_sequence_dictionary_species = sp+ , sam_v1_6_reference_sequence_dictionary_molecule_topology = tp+ , sam_v1_6_reference_sequence_dictionary_uri = ur+ }
+ src/Data/SAM/Version1_6/Read/Parser/Header/SQ/DS.hs view
@@ -0,0 +1,70 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Header.SQ.DS+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Header.SQ.DS ( -- * SAM_V1_6 parser - header section (Reference sequence dictionary) - DS tag+ parse_SAM_V1_6_SAM_V1_6_Reference_Sequence_Dictionary_DS+ ) where++import Data.SAM.Version1_6.Header+import Data.SAM.Version1_6.Read.Error++import Data.Attoparsec.ByteString.Lazy as DABL+import qualified Data.ByteString as DB (unpack)+import Data.Sequence as DSeq+import Text.Regex.PCRE.Heavy++-- | Defines a parser for the DS tag of the @SQ tag section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_SAM_V1_6_Reference_Sequence_Dictionary_DS :: Parser SAM_V1_6_Reference_Sequence_Dictionary_Description+parse_SAM_V1_6_SAM_V1_6_Reference_Sequence_Dictionary_DS = do+ sqheaderdescriptiontag <- do sqheaderdescriptiontagp <- DABL.takeTill (== 58)+ -- Parse DS tag of the header section.+ case (sqheaderdescriptiontagp =~ [re|[D][S]|]) of+ False -> fail $ show SAM_V1_6_Error_Reference_Sequence_Dictionary_Description_Incorrect_Format + True -> -- DS tag is in the accepted format.+ return sqheaderdescriptiontagp+ _ <- word8 58+ sqheaderdescriptionvalue <- DABL.takeTill (== 09)+ return SAM_V1_6_Reference_Sequence_Dictionary_Description { sam_v1_6_reference_sequence_dictionary_description_tag = DSeq.fromList $ DB.unpack sqheaderdescriptiontag+ , sam_v1_6_reference_sequence_dictionary_description_value = sqheaderdescriptionvalue+ }
+ src/Data/SAM/Version1_6/Read/Parser/Header/SQ/LN.hs view
@@ -0,0 +1,75 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Header.SQ.LN+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Header.SQ.LN ( -- * SAM_V1_6 parser - header section (Reference sequence dictionary) - LN tag+ parse_SAM_V1_6_SAM_V1_6_Reference_Sequence_Dictionary_LN+ ) where++import Data.SAM.Version1_6.Header+import Data.SAM.Version1_6.Read.Error++import Data.Attoparsec.ByteString.Lazy as DABL+import qualified Data.ByteString as DB (unpack)+import Data.Sequence as DSeq+import Text.Regex.PCRE.Heavy++-- | Defines a parser for the LN tag of the @SQ tag section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_SAM_V1_6_Reference_Sequence_Dictionary_LN :: Parser SAM_V1_6_Reference_Sequence_Dictionary_Reference_Sequence_Length+parse_SAM_V1_6_SAM_V1_6_Reference_Sequence_Dictionary_LN = do+ sqheadersequencelengthtag <- do sqheadersequencelengthtagp <- DABL.takeTill (== 58)+ -- Parse LN tag of the header section.+ case (sqheadersequencelengthtagp =~ [re|[L][N]|]) of+ False -> fail $ show SAM_V1_6_Error_Reference_Sequence_Dictionary_Reference_Sequence_Length_Incorrect_Format+ True -> -- LN tag is in the accepted format.+ return sqheadersequencelengthtagp+ _ <- word8 58+ sqheadersequencelengthvalue <- do sqheadersequencelengthvaluep <- DABL.takeTill (== 09)+ -- Parse LN value of the header section.+ case (sqheadersequencelengthvaluep =~ [re|[0-9]*|]) of -- Make this regex actually check the range of [1,2^31 - 1]?+ False -> fail $ show SAM_V1_6_Error_Reference_Sequence_Dictionary_Reference_Sequence_Length_Invalid_Value+ True -> -- LN value is in the accepted format.+ return sqheadersequencelengthvaluep+ return SAM_V1_6_Reference_Sequence_Dictionary_Reference_Sequence_Length { sam_v1_6_reference_sequence_dictionary_reference_sequence_length_tag = DSeq.fromList $ DB.unpack sqheadersequencelengthtag+ , sam_v1_6_reference_sequence_dictionary_reference_sequence_length_value = sqheadersequencelengthvalue+ }
+ src/Data/SAM/Version1_6/Read/Parser/Header/SQ/M5.hs view
@@ -0,0 +1,70 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Header.SQ.M5+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Header.SQ.M5 ( -- * SAM_V1_6 parser - header section (Reference sequence dictionary) - M5 tag+ parse_SAM_V1_6_SAM_V1_6_Reference_Sequence_Dictionary_M5+ ) where++import Data.SAM.Version1_6.Header+import Data.SAM.Version1_6.Read.Error++import Data.Attoparsec.ByteString.Lazy as DABL+import qualified Data.ByteString as DB (unpack)+import Data.Sequence as DSeq+import Text.Regex.PCRE.Heavy++-- | Defines a parser for the M5 tag of the @SQ tag section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_SAM_V1_6_Reference_Sequence_Dictionary_M5 :: Parser SAM_V1_6_Reference_Sequence_Dictionary_MD5_Checksum+parse_SAM_V1_6_SAM_V1_6_Reference_Sequence_Dictionary_M5 = do+ sqheadermd5checksumtag <- do sqheadermd5checksumtagp <- DABL.takeTill (== 58)+ -- Parse M5 tag of the header section.+ case (sqheadermd5checksumtagp =~ [re|[M][5]|]) of+ False -> fail $ show SAM_V1_6_Error_Reference_Sequence_Dictionary_MD5_Checksum_Incorrect_Format + True -> -- M5 tag is in the accepted format.+ return sqheadermd5checksumtagp+ _ <- word8 58+ sqheadermd5checksumvalue <- DABL.takeTill (== 09)+ return SAM_V1_6_Reference_Sequence_Dictionary_MD5_Checksum { sam_v1_6_reference_sequence_dictionary_md5_checksum_tag = DSeq.fromList $ DB.unpack sqheadermd5checksumtag+ , sam_v1_6_reference_sequence_dictionary_md5_checksum_value = sqheadermd5checksumvalue+ }
+ src/Data/SAM/Version1_6/Read/Parser/Header/SQ/SN.hs view
@@ -0,0 +1,75 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Header.SQ.SN+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Header.SQ.SN ( -- * SAM_V1_6 parser - header section (Reference sequence dictionary) - SN tag+ parse_SAM_V1_6_SAM_V1_6_Reference_Sequence_Dictionary_SN+ ) where++import Data.SAM.Version1_6.Header+import Data.SAM.Version1_6.Read.Error++import Data.Attoparsec.ByteString.Lazy as DABL+import qualified Data.ByteString as DB (unpack)+import Data.Sequence as DSeq+import Text.Regex.PCRE.Heavy++-- | Defines a parser for the SN tag of the @SQ tag section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_SAM_V1_6_Reference_Sequence_Dictionary_SN :: Parser SAM_V1_6_Reference_Sequence_Dictionary_Reference_Sequence_Name+parse_SAM_V1_6_SAM_V1_6_Reference_Sequence_Dictionary_SN = do+ sqheadersequencenametag <- do sqheadersequencenametagp <- DABL.takeTill (== 58)+ -- Parse SN tag of the header section.+ case (sqheadersequencenametagp =~ [re|[S][N]|]) of+ False -> fail $ show SAM_V1_6_Error_Reference_Sequence_Dictionary_Reference_Sequence_Name_Incorrect_Format+ True -> -- SN tag is in the accepted format. + return sqheadersequencenametagp+ _ <- word8 58+ sqheadersequencenamevalue <- do sqheadersequencenamevaluep <- DABL.takeTill (== 09)+ -- Parse SN value of the header section.+ case (sqheadersequencenamevaluep =~ [re|[0-9A-Za-z!#$%&+./:;?@^_|~-][0-9A-Za-z!#$%&*+./:;=?@^_|~-]*|]) of+ False -> fail $ show SAM_V1_6_Error_Reference_Sequence_Dictionary_Reference_Sequence_Name_Invalid_Value+ True -> -- SN value is in the accepted format.+ return sqheadersequencenamevaluep + return SAM_V1_6_Reference_Sequence_Dictionary_Reference_Sequence_Name { sam_v1_6_reference_sequence_dictionary_reference_sequence_name_tag = DSeq.fromList $ DB.unpack sqheadersequencenametag+ , sam_v1_6_reference_sequence_dictionary_reference_sequence_name_value = sqheadersequencenamevalue+ }
+ src/Data/SAM/Version1_6/Read/Parser/Header/SQ/SP.hs view
@@ -0,0 +1,70 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Header.SQ.SP+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Header.SQ.SP ( -- * SAM_V1_6 parser - header section (Reference sequence dictionary) - SP tag+ parse_SAM_V1_6_SAM_V1_6_Reference_Sequence_Dictionary_SP+ ) where++import Data.SAM.Version1_6.Header+import Data.SAM.Version1_6.Read.Error++import Data.Attoparsec.ByteString.Lazy as DABL+import qualified Data.ByteString as DB (unpack)+import Data.Sequence as DSeq+import Text.Regex.PCRE.Heavy++-- | Defines a parser for the SP tag of the @SQ tag section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_SAM_V1_6_Reference_Sequence_Dictionary_SP :: Parser SAM_V1_6_Reference_Sequence_Dictionary_Species+parse_SAM_V1_6_SAM_V1_6_Reference_Sequence_Dictionary_SP = do+ sqheaderspeciestag <- do sqheaderspeciestagp <- DABL.takeTill (== 58)+ -- Parse SP tag of the header section.+ case (sqheaderspeciestagp =~ [re|[S][P]|]) of+ False -> fail $ show SAM_V1_6_Error_Reference_Sequence_Dictionary_Species_Incorrect_Format+ True -> -- SP tag is in the accepted format.+ return sqheaderspeciestagp+ _ <- word8 58+ sqheaderspeciesvalue <- DABL.takeTill (== 09)+ return SAM_V1_6_Reference_Sequence_Dictionary_Species { sam_v1_6_reference_sequence_dictionary_species_tag = DSeq.fromList $ DB.unpack sqheaderspeciestag+ , sam_v1_6_reference_sequence_dictionary_species_value = sqheaderspeciesvalue+ }
+ src/Data/SAM/Version1_6/Read/Parser/Header/SQ/TP.hs view
@@ -0,0 +1,75 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Header.SQ.TP+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Header.SQ.TP ( -- * SAM_V1_6 parser - header section (Reference sequence dictionary) - TP tag+ parse_SAM_V1_6_SAM_V1_6_Reference_Sequence_Dictionary_TP+ ) where++import Data.SAM.Version1_6.Header+import Data.SAM.Version1_6.Read.Error++import Data.Attoparsec.ByteString.Lazy as DABL+import qualified Data.ByteString as DB (unpack)+import Data.Sequence as DSeq+import Text.Regex.PCRE.Heavy++-- | Defines a parser for the TP tag of the @SQ tag section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_SAM_V1_6_Reference_Sequence_Dictionary_TP :: Parser SAM_V1_6_Reference_Sequence_Dictionary_Molecule_Topology+parse_SAM_V1_6_SAM_V1_6_Reference_Sequence_Dictionary_TP = do+ sqheadermoleculetopologytag <- do sqheadermoleculetopologytagp <- DABL.takeTill (== 58)+ -- Parse TP tag of the header section.+ case (sqheadermoleculetopologytagp =~ [re|[T][P]|]) of+ False -> fail $ show SAM_V1_6_Error_Reference_Sequence_Dictionary_Molecule_Topology_Incorrect_Format+ True -> -- TP tag is in the accepted format. + return sqheadermoleculetopologytagp+ _ <- word8 58+ sqheadermoleculetopologyvalue <- do sqheadermoleculetopologyvaluep <- DABL.takeTill (== 09)+ -- Parse TP value of the header section.+ case (sqheadermoleculetopologyvaluep =~ [re|[l][i][n][e][a][r]|[c][i][r][c][u][l][a][r]|]) of+ False -> fail $ show SAM_V1_6_Error_Reference_Sequence_Dictionary_Molecule_Topology_Invalid_Value+ True -> -- TP value is in the accepted format.+ return sqheadermoleculetopologyvaluep + return SAM_V1_6_Reference_Sequence_Dictionary_Molecule_Topology { sam_v1_6_reference_sequence_dictionary_molecule_topology_tag = DSeq.fromList $ DB.unpack sqheadermoleculetopologytag+ , sam_v1_6_reference_sequence_dictionary_molecule_topology_value = sqheadermoleculetopologyvalue+ }
+ src/Data/SAM/Version1_6/Read/Parser/Header/SQ/UR.hs view
@@ -0,0 +1,70 @@+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedLists #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE QuasiQuotes #-}++-- |+-- Module : Data.SAM.Version1_6.Read.Parser.Header.SQ.UR+-- Copyright : (c) Matthew Mosior 2023+-- License : BSD-style+-- Maintainer : mattm.github@gmail.com+-- Portability : portable+--+-- = WARNING+--+-- This module is considered __internal__.+--+-- The Package Versioning Policy __does not apply__.+--+-- The contents of this module may change __in any way whatsoever__+-- and __without any warning__ between minor versions of this package.+--+-- Authors importing this library are expected to track development+-- closely.+--+-- All credit goes to the author(s)/maintainer(s) of the+-- [containers](https://hackage.haskell.org/package/containers) library+-- for the above warning text.+--+-- = Description+--+-- This library enables the decoding/encoding of SAM, BAM and CRAM file formats.++module Data.SAM.Version1_6.Read.Parser.Header.SQ.UR ( -- * SAM_V1_6 parser - header section (Reference sequence dictionary) - UR tag+ parse_SAM_V1_6_SAM_V1_6_Reference_Sequence_Dictionary_UR+ ) where++import Data.SAM.Version1_6.Header+import Data.SAM.Version1_6.Read.Error++import Data.Attoparsec.ByteString.Lazy as DABL+import qualified Data.ByteString as DB (unpack)+import Data.Sequence as DSeq+import Text.Regex.PCRE.Heavy++-- | Defines a parser for the UR tag of the @SQ tag section of the SAM v1.6 file format.+--+-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.+parse_SAM_V1_6_SAM_V1_6_Reference_Sequence_Dictionary_UR :: Parser SAM_V1_6_Reference_Sequence_Dictionary_URI+parse_SAM_V1_6_SAM_V1_6_Reference_Sequence_Dictionary_UR = do+ sqheaderuritag <- do sqheaderuritagp <- DABL.takeTill (== 58)+ -- Parse UR tag of the header section.+ case (sqheaderuritagp =~ [re|[U][R]|]) of+ False -> fail $ show SAM_V1_6_Error_Reference_Sequence_Dictionary_URI_Incorrect_Format+ True -> -- UR tag is in the accepted format.+ return sqheaderuritagp+ _ <- word8 58+ sqheaderurivalue <- DABL.takeTill (== 09)+ return SAM_V1_6_Reference_Sequence_Dictionary_URI { sam_v1_6_reference_sequence_dictionary_uri_tag = DSeq.fromList $ DB.unpack sqheaderuritag+ , sam_v1_6_reference_sequence_dictionary_uri_value = sqheaderurivalue+ }
+ test/Main.hs view
@@ -0,0 +1,4 @@+module Main (main) where++main :: IO ()+main = putStrLn "Test suite not yet implemented."