{-# 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
--
-- = 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.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 -> ByteString
sam_v1_6_alignment_qname :: ByteString
                                             , SAM_V1_6_Alignment -> Int
sam_v1_6_alignment_flag  :: Int
                                             , SAM_V1_6_Alignment -> ByteString
sam_v1_6_alignment_rname :: ByteString
                                             , SAM_V1_6_Alignment -> Integer
sam_v1_6_alignment_pos   :: Integer
                                             , SAM_V1_6_Alignment -> Int
sam_v1_6_alignment_mapq  :: Int
                                             , SAM_V1_6_Alignment -> ByteString
sam_v1_6_alignment_cigar :: ByteString
                                             , SAM_V1_6_Alignment -> ByteString
sam_v1_6_alignment_rnext :: ByteString
                                             , SAM_V1_6_Alignment -> Integer
sam_v1_6_alignment_pnext :: Integer
                                             , SAM_V1_6_Alignment -> Integer
sam_v1_6_alignment_tlen  :: Integer
                                             , SAM_V1_6_Alignment -> ByteString
sam_v1_6_alignment_seq   :: ByteString
                                             , SAM_V1_6_Alignment -> ByteString
sam_v1_6_alignment_qual  :: ByteString
                                             , SAM_V1_6_Alignment -> Maybe ByteString
sam_v1_6_alignment_aopt  :: Maybe ByteString
                                             , SAM_V1_6_Alignment -> Maybe Integer
sam_v1_6_alignment_iopt  :: Maybe Integer
                                             , SAM_V1_6_Alignment -> Maybe Float
sam_v1_6_alignment_fopt  :: Maybe Float
                                             , SAM_V1_6_Alignment -> Maybe ByteString
sam_v1_6_alignment_zopt  :: Maybe ByteString
                                             , SAM_V1_6_Alignment -> Maybe (Seq Word8)
sam_v1_6_alignment_hopt  :: Maybe (Seq Word8)
                                             , SAM_V1_6_Alignment -> Maybe SAM_V1_6_Alignment_BOPT
sam_v1_6_alignment_bopt  :: Maybe SAM_V1_6_Alignment_BOPT
                                             }
  deriving ((forall x. SAM_V1_6_Alignment -> Rep SAM_V1_6_Alignment x)
-> (forall x. Rep SAM_V1_6_Alignment x -> SAM_V1_6_Alignment)
-> Generic SAM_V1_6_Alignment
forall x. Rep SAM_V1_6_Alignment x -> SAM_V1_6_Alignment
forall x. SAM_V1_6_Alignment -> Rep SAM_V1_6_Alignment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. SAM_V1_6_Alignment -> Rep SAM_V1_6_Alignment x
from :: forall x. SAM_V1_6_Alignment -> Rep SAM_V1_6_Alignment x
$cto :: forall x. Rep SAM_V1_6_Alignment x -> SAM_V1_6_Alignment
to :: forall x. Rep SAM_V1_6_Alignment x -> SAM_V1_6_Alignment
Generic,Typeable)

instance Show SAM_V1_6_Alignment where
  show :: SAM_V1_6_Alignment -> String
show (SAM_V1_6_Alignment ByteString
qname Int
flag ByteString
rname Integer
pos Int
mapq ByteString
cigar ByteString
rnext Integer
pnext Integer
tlen ByteString
seq ByteString
qual Maybe ByteString
aopt Maybe Integer
iopt Maybe Float
fopt Maybe ByteString
zopt Maybe (Seq Word8)
hopt Maybe SAM_V1_6_Alignment_BOPT
bopt) =
    String
"SAM_V1_6_Alignment { " String -> ShowS
forall a. [a] -> [a] -> [a]
++
    String
"qname = "              String -> ShowS
forall a. [a] -> [a] -> [a]
++
    (ByteString -> String
forall a. Show a => a -> String
show ByteString
qname)            String -> ShowS
forall a. [a] -> [a] -> [a]
++
    String
" , flag = "            String -> ShowS
forall a. [a] -> [a] -> [a]
++
    (Int -> String
forall a. Show a => a -> String
show Int
flag)             String -> ShowS
forall a. [a] -> [a] -> [a]
++
    String
" , rname = "           String -> ShowS
forall a. [a] -> [a] -> [a]
++
    (ByteString -> String
forall a. Show a => a -> String
show ByteString
rname)            String -> ShowS
forall a. [a] -> [a] -> [a]
++
    String
" , pos = "             String -> ShowS
forall a. [a] -> [a] -> [a]
++
    (Integer -> String
forall a. Show a => a -> String
show Integer
pos)              String -> ShowS
forall a. [a] -> [a] -> [a]
++
    String
" , mapq = "            String -> ShowS
forall a. [a] -> [a] -> [a]
++
    (Int -> String
forall a. Show a => a -> String
show Int
mapq)             String -> ShowS
forall a. [a] -> [a] -> [a]
++
    String
" , cigar = "           String -> ShowS
forall a. [a] -> [a] -> [a]
++
    (ByteString -> String
forall a. Show a => a -> String
show ByteString
cigar)            String -> ShowS
forall a. [a] -> [a] -> [a]
++
    String
" , rnext = "           String -> ShowS
forall a. [a] -> [a] -> [a]
++
    (ByteString -> String
forall a. Show a => a -> String
show ByteString
rnext)            String -> ShowS
forall a. [a] -> [a] -> [a]
++
    String
" , pnext = "           String -> ShowS
forall a. [a] -> [a] -> [a]
++
    (Integer -> String
forall a. Show a => a -> String
show Integer
pnext)            String -> ShowS
forall a. [a] -> [a] -> [a]
++
    String
" , tlen = "            String -> ShowS
forall a. [a] -> [a] -> [a]
++
    (Integer -> String
forall a. Show a => a -> String
show Integer
tlen)             String -> ShowS
forall a. [a] -> [a] -> [a]
++
    String
" , seq = "             String -> ShowS
forall a. [a] -> [a] -> [a]
++
    (ByteString -> String
forall a. Show a => a -> String
show ByteString
seq)              String -> ShowS
forall a. [a] -> [a] -> [a]
++
    String
" , qual = "            String -> ShowS
forall a. [a] -> [a] -> [a]
++
    (ByteString -> String
forall a. Show a => a -> String
show ByteString
qual)             String -> ShowS
forall a. [a] -> [a] -> [a]
++
    String
" , aopt = "            String -> ShowS
forall a. [a] -> [a] -> [a]
++
    ( Maybe ByteString -> String
forall a. Show a => a -> String
show Maybe ByteString
aopt)            String -> ShowS
forall a. [a] -> [a] -> [a]
++
    String
" , iopt = "            String -> ShowS
forall a. [a] -> [a] -> [a]
++
    (Maybe Integer -> String
forall a. Show a => a -> String
show Maybe Integer
iopt)             String -> ShowS
forall a. [a] -> [a] -> [a]
++
    String
" , fopt = "            String -> ShowS
forall a. [a] -> [a] -> [a]
++
    (Maybe Float -> String
forall a. Show a => a -> String
show Maybe Float
fopt)             String -> ShowS
forall a. [a] -> [a] -> [a]
++
    String
" , zopt = "            String -> ShowS
forall a. [a] -> [a] -> [a]
++
    (Maybe ByteString -> String
forall a. Show a => a -> String
show Maybe ByteString
zopt)             String -> ShowS
forall a. [a] -> [a] -> [a]
++
    String
" , hopt = "            String -> ShowS
forall a. [a] -> [a] -> [a]
++
    (Maybe (Seq Word8) -> String
forall a. Show a => a -> String
show Maybe (Seq Word8)
hopt)             String -> ShowS
forall a. [a] -> [a] -> [a]
++
    String
" , bopt = "            String -> ShowS
forall a. [a] -> [a] -> [a]
++
    (Maybe SAM_V1_6_Alignment_BOPT -> String
forall a. Show a => a -> String
show Maybe SAM_V1_6_Alignment_BOPT
bopt)             String -> ShowS
forall a. [a] -> [a] -> [a]
++
    String
" }"