{-# LANGUAGE FlexibleContexts      #-}
{-# LANGUAGE FlexibleInstances     #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeFamilies          #-}

-- |
-- Module      :  Data.SAM.Version1_6.Write.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.Write.Base ( -- * Writing
                                       writeSAM_V1_6
                                      ) where

import Data.SAM.Version1_6.Base
import Data.SAM.Version1_6.Header.HD
import Data.SAM.Version1_6.Header.SQ
import Data.SAM.Version1_6.Header.RG
import Data.SAM.Version1_6.Header.PG
import Data.SAM.Version1_6.Header.CO
import Data.SAM.Version1_6.Alignment.Base
import Data.SAM.Version1_6.Alignment.AOPT
import Data.SAM.Version1_6.Alignment.IOPT
import Data.SAM.Version1_6.Alignment.FOPT
import Data.SAM.Version1_6.Alignment.ZOPT
import Data.SAM.Version1_6.Alignment.HOPT
import Data.SAM.Version1_6.Alignment.BOPT

import Data.ByteString            as DB    (pack,singleton)
import Data.ByteString.Lazy       as DBL   (filter)
import Data.ByteString.Lazy.Char8 as DBLC8 (fromStrict,unpack)
import Data.Foldable                       (toList)
import Data.List                           (intercalate)
import Data.Word
import Data.ByteString.Builder             (toLazyByteString,word16LE,word32LE)
import System.IO                           (hFlush,hClose,hPutStr,IOMode(..),openFile, Handle)


-- | Deconstruct a @"SAM_V1_6"@ to a `String`.
deconstructSAM_V1_6 :: SAM_V1_6
                    -> String
deconstructSAM_V1_6 :: SAM_V1_6 -> String
deconstructSAM_V1_6 SAM_V1_6
samv16 =
  ( String -> [String] -> String
forall a. [a] -> [[a]] -> [a]
intercalate String
"\n" ([String] -> String) -> [String] -> String
forall a b. (a -> b) -> a -> b
$
      (String -> Bool) -> [String] -> [String]
forall a. (a -> Bool) -> [a] -> [a]
Prelude.filter (Bool -> Bool
not (Bool -> Bool) -> (String -> Bool) -> String -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Bool
forall a. [a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
Prelude.null)
                          [ String
sam_v1_6_file_level_metadata_tos
                          , String
sam_v1_6_reference_sequence_dictionary_tos
                          , String
sam_v1_6_read_group_tos
                          , String
sam_v1_6_program_tos
                          , String
sam_v1_6_one_line_comment_tos
                          , String
sam_v1_6_alignment_tos
                          ]
  )
  String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"\n"
  where
    sam_v1_6_file_level_metadata_format_version_tos :: SAM_V1_6_File_Level_Metadata -> String
sam_v1_6_file_level_metadata_format_version_tos SAM_V1_6_File_Level_Metadata
x = String
"VN:" String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                        ( ByteString -> String
unpack     (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$
                                                          ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$
                                                          SAM_V1_6_File_Level_Metadata_Format_Version -> ByteString
sam_v1_6_file_level_metadata_format_version_value (SAM_V1_6_File_Level_Metadata_Format_Version -> ByteString)
-> SAM_V1_6_File_Level_Metadata_Format_Version -> ByteString
forall a b. (a -> b) -> a -> b
$
                                                          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
x
                                                        )
    sam_v1_6_file_level_metadata_sorting_order_tos :: SAM_V1_6_File_Level_Metadata -> String
sam_v1_6_file_level_metadata_sorting_order_tos SAM_V1_6_File_Level_Metadata
x = case (SAM_V1_6_File_Level_Metadata
-> Maybe SAM_V1_6_File_Level_Metadata_Sorting_Order
sam_v1_6_file_level_metadata_sorting_order SAM_V1_6_File_Level_Metadata
x) of
                                                         Maybe SAM_V1_6_File_Level_Metadata_Sorting_Order
Nothing  -> String
""
                                                         Just SAM_V1_6_File_Level_Metadata_Sorting_Order
rgf -> String
"SO:" String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                                     ( ByteString -> String
unpack     (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$
                                                                       ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$
                                                                       SAM_V1_6_File_Level_Metadata_Sorting_Order -> ByteString
sam_v1_6_file_level_metadata_sorting_order_value SAM_V1_6_File_Level_Metadata_Sorting_Order
rgf
                                                                     )
    sam_v1_6_file_level_metadata_alignment_grouping_tos :: SAM_V1_6_File_Level_Metadata -> String
sam_v1_6_file_level_metadata_alignment_grouping_tos SAM_V1_6_File_Level_Metadata
x = case (SAM_V1_6_File_Level_Metadata
-> Maybe SAM_V1_6_File_Level_Metadata_Alignment_Grouping
sam_v1_6_file_level_metadata_alignment_grouping SAM_V1_6_File_Level_Metadata
x) of
                                                              Maybe SAM_V1_6_File_Level_Metadata_Alignment_Grouping
Nothing  -> String
""
                                                              Just SAM_V1_6_File_Level_Metadata_Alignment_Grouping
rgf -> String
"GO:" String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                                          ( ByteString -> String
unpack     (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$
                                                                            ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$
                                                                            SAM_V1_6_File_Level_Metadata_Alignment_Grouping -> ByteString
sam_v1_6_file_level_metadata_alignment_grouping_value SAM_V1_6_File_Level_Metadata_Alignment_Grouping
rgf
                                                                          )
    sam_v1_6_file_level_metadata_subsorting_order_tos :: SAM_V1_6_File_Level_Metadata -> String
sam_v1_6_file_level_metadata_subsorting_order_tos SAM_V1_6_File_Level_Metadata
x = case (SAM_V1_6_File_Level_Metadata
-> Maybe SAM_V1_6_File_Level_Metadata_SubSorting_Order
sam_v1_6_file_level_metadata_subsorting_order SAM_V1_6_File_Level_Metadata
x) of
                                                            Maybe SAM_V1_6_File_Level_Metadata_SubSorting_Order
Nothing  -> String
""
                                                            Just SAM_V1_6_File_Level_Metadata_SubSorting_Order
rgf -> String
"SS:" String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                                        ( ByteString -> String
unpack     (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$
                                                                          ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$
                                                                          SAM_V1_6_File_Level_Metadata_SubSorting_Order -> ByteString
sam_v1_6_file_level_metadata_subsorting_order_value SAM_V1_6_File_Level_Metadata_SubSorting_Order
rgf
                                                                        )
    sam_v1_6_file_level_metadata_tos :: String
sam_v1_6_file_level_metadata_tos = case (SAM_V1_6 -> Maybe SAM_V1_6_File_Level_Metadata
sam_v1_6_file_level_metadata SAM_V1_6
samv16) of
                                         Maybe SAM_V1_6_File_Level_Metadata
Nothing  -> String
""
                                         Just SAM_V1_6_File_Level_Metadata
hdf -> String -> [String] -> String
forall a. [a] -> [[a]] -> [a]
intercalate String
"\t" ([String] -> String) -> [String] -> String
forall a b. (a -> b) -> a -> b
$
                                                       (String -> Bool) -> [String] -> [String]
forall a. (a -> Bool) -> [a] -> [a]
Prelude.filter (Bool -> Bool
not (Bool -> Bool) -> (String -> Bool) -> String -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Bool
forall a. [a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
Prelude.null) ([String] -> [String]) -> [String] -> [String]
forall a b. (a -> b) -> a -> b
$
                                                                           [ String
"@HD"
                                                                           , SAM_V1_6_File_Level_Metadata -> String
sam_v1_6_file_level_metadata_format_version_tos SAM_V1_6_File_Level_Metadata
hdf
                                                                           , SAM_V1_6_File_Level_Metadata -> String
sam_v1_6_file_level_metadata_sorting_order_tos SAM_V1_6_File_Level_Metadata
hdf
                                                                           , SAM_V1_6_File_Level_Metadata -> String
sam_v1_6_file_level_metadata_alignment_grouping_tos SAM_V1_6_File_Level_Metadata
hdf
                                                                           , SAM_V1_6_File_Level_Metadata -> String
sam_v1_6_file_level_metadata_subsorting_order_tos SAM_V1_6_File_Level_Metadata
hdf 
                                                                           ]
    sam_v1_6_reference_sequence_dictionary_reference_sequence_name_tos :: SAM_V1_6_Reference_Sequence_Dictionary -> String
sam_v1_6_reference_sequence_dictionary_reference_sequence_name_tos SAM_V1_6_Reference_Sequence_Dictionary
x = String
"SN:" String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                                           ( ByteString -> String
unpack                                                               (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$
                                                                             ByteString -> ByteString
fromStrict                                                           (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$
                                                                             SAM_V1_6_Reference_Sequence_Dictionary_Reference_Sequence_Name
-> ByteString
sam_v1_6_reference_sequence_dictionary_reference_sequence_name_value (SAM_V1_6_Reference_Sequence_Dictionary_Reference_Sequence_Name
 -> ByteString)
-> SAM_V1_6_Reference_Sequence_Dictionary_Reference_Sequence_Name
-> ByteString
forall a b. (a -> b) -> a -> b
$
                                                                             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
x
                                                                           )
    sam_v1_6_reference_sequence_dictionary_reference_sequence_length_tos :: SAM_V1_6_Reference_Sequence_Dictionary -> String
sam_v1_6_reference_sequence_dictionary_reference_sequence_length_tos SAM_V1_6_Reference_Sequence_Dictionary
x = String
"LN:" String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                                             ( ByteString -> String
unpack                                                                 (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$
                                                                               ByteString -> ByteString
fromStrict                                                             (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$
                                                                               SAM_V1_6_Reference_Sequence_Dictionary_Reference_Sequence_Length
-> ByteString
sam_v1_6_reference_sequence_dictionary_reference_sequence_length_value (SAM_V1_6_Reference_Sequence_Dictionary_Reference_Sequence_Length
 -> ByteString)
-> SAM_V1_6_Reference_Sequence_Dictionary_Reference_Sequence_Length
-> ByteString
forall a b. (a -> b) -> a -> b
$
                                                                               SAM_V1_6_Reference_Sequence_Dictionary
-> SAM_V1_6_Reference_Sequence_Dictionary_Reference_Sequence_Length
sam_v1_6_reference_sequence_dictionary_reference_sequence_length SAM_V1_6_Reference_Sequence_Dictionary
x
                                                                             )
    sam_v1_6_reference_sequence_dictionary_alternative_locus_tos :: SAM_V1_6_Reference_Sequence_Dictionary -> String
sam_v1_6_reference_sequence_dictionary_alternative_locus_tos SAM_V1_6_Reference_Sequence_Dictionary
x = case (SAM_V1_6_Reference_Sequence_Dictionary
-> Maybe SAM_V1_6_Reference_Sequence_Dictionary_Alternative_Locus
sam_v1_6_reference_sequence_dictionary_alternative_locus SAM_V1_6_Reference_Sequence_Dictionary
x) of
                                                                       Maybe SAM_V1_6_Reference_Sequence_Dictionary_Alternative_Locus
Nothing  -> String
""
                                                                       Just SAM_V1_6_Reference_Sequence_Dictionary_Alternative_Locus
sqf -> String
"AH:" String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                                                   ( ByteString -> String
unpack     (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$
                                                                                     ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$
                                                                                     SAM_V1_6_Reference_Sequence_Dictionary_Alternative_Locus
-> ByteString
sam_v1_6_reference_sequence_dictionary_alternative_locus_value SAM_V1_6_Reference_Sequence_Dictionary_Alternative_Locus
sqf
                                                                                   )
    sam_v1_6_reference_sequence_dictionary_alternative_reference_sequence_names_tos :: SAM_V1_6_Reference_Sequence_Dictionary -> String
sam_v1_6_reference_sequence_dictionary_alternative_reference_sequence_names_tos SAM_V1_6_Reference_Sequence_Dictionary
x = case (SAM_V1_6_Reference_Sequence_Dictionary
-> Maybe
     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
x) of
                                                                                          Maybe
  SAM_V1_6_Reference_Sequence_Dictionary_Alternative_Reference_Sequence_Names
Nothing  -> String
"" 
                                                                                          Just SAM_V1_6_Reference_Sequence_Dictionary_Alternative_Reference_Sequence_Names
sqf -> String
"AN:" String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                                                                      ( ByteString -> String
unpack     (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$
                                                                                                        ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$
                                                                                                        SAM_V1_6_Reference_Sequence_Dictionary_Alternative_Reference_Sequence_Names
-> ByteString
sam_v1_6_reference_sequence_dictionary_alternative_reference_sequence_names_value SAM_V1_6_Reference_Sequence_Dictionary_Alternative_Reference_Sequence_Names
sqf
                                                                                                      )
    sam_v1_6_reference_sequence_dictionary_genome_assembly_identifier_tos :: SAM_V1_6_Reference_Sequence_Dictionary -> String
sam_v1_6_reference_sequence_dictionary_genome_assembly_identifier_tos SAM_V1_6_Reference_Sequence_Dictionary
x = case (SAM_V1_6_Reference_Sequence_Dictionary
-> Maybe
     SAM_V1_6_Reference_Sequence_Dictionary_Genome_Assembly_Identifier
sam_v1_6_reference_sequence_dictionary_genome_assembly_identifier SAM_V1_6_Reference_Sequence_Dictionary
x) of
                                                                                Maybe
  SAM_V1_6_Reference_Sequence_Dictionary_Genome_Assembly_Identifier
Nothing  -> String
""
                                                                                Just SAM_V1_6_Reference_Sequence_Dictionary_Genome_Assembly_Identifier
sqf -> String
"AS:" String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                                                            ( ByteString -> String
unpack     (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$
                                                                                              ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$
                                                                                              SAM_V1_6_Reference_Sequence_Dictionary_Genome_Assembly_Identifier
-> ByteString
sam_v1_6_reference_sequence_dictionary_genome_assembly_identifier_value SAM_V1_6_Reference_Sequence_Dictionary_Genome_Assembly_Identifier
sqf
                                                                                            )
    sam_v1_6_reference_sequence_dictionary_description_tos :: SAM_V1_6_Reference_Sequence_Dictionary -> String
sam_v1_6_reference_sequence_dictionary_description_tos SAM_V1_6_Reference_Sequence_Dictionary
x = case (SAM_V1_6_Reference_Sequence_Dictionary
-> Maybe SAM_V1_6_Reference_Sequence_Dictionary_Description
sam_v1_6_reference_sequence_dictionary_description SAM_V1_6_Reference_Sequence_Dictionary
x) of
                                                                 Maybe SAM_V1_6_Reference_Sequence_Dictionary_Description
Nothing  -> String
""
                                                                 Just SAM_V1_6_Reference_Sequence_Dictionary_Description
sqf -> String
"DS:" String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                                             ( ByteString -> String
unpack     (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$
                                                                               ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$
                                                                               SAM_V1_6_Reference_Sequence_Dictionary_Description -> ByteString
sam_v1_6_reference_sequence_dictionary_description_value SAM_V1_6_Reference_Sequence_Dictionary_Description
sqf
                                                                             )
    sam_v1_6_reference_sequence_dictionary_md5_checksum_tos :: SAM_V1_6_Reference_Sequence_Dictionary -> String
sam_v1_6_reference_sequence_dictionary_md5_checksum_tos SAM_V1_6_Reference_Sequence_Dictionary
x = case (SAM_V1_6_Reference_Sequence_Dictionary
-> Maybe SAM_V1_6_Reference_Sequence_Dictionary_MD5_Checksum
sam_v1_6_reference_sequence_dictionary_md5_checksum SAM_V1_6_Reference_Sequence_Dictionary
x) of
                                                                  Maybe SAM_V1_6_Reference_Sequence_Dictionary_MD5_Checksum
Nothing  -> String
""
                                                                  Just SAM_V1_6_Reference_Sequence_Dictionary_MD5_Checksum
sqf -> String
"M5:" String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                                              ( ByteString -> String
unpack     (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$
                                                                                ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$
                                                                                SAM_V1_6_Reference_Sequence_Dictionary_MD5_Checksum -> ByteString
sam_v1_6_reference_sequence_dictionary_md5_checksum_value SAM_V1_6_Reference_Sequence_Dictionary_MD5_Checksum
sqf
                                                                              )
    sam_v1_6_reference_sequence_dictionary_species_tos :: SAM_V1_6_Reference_Sequence_Dictionary -> String
sam_v1_6_reference_sequence_dictionary_species_tos SAM_V1_6_Reference_Sequence_Dictionary
x = case (SAM_V1_6_Reference_Sequence_Dictionary
-> Maybe SAM_V1_6_Reference_Sequence_Dictionary_Species
sam_v1_6_reference_sequence_dictionary_species SAM_V1_6_Reference_Sequence_Dictionary
x) of
                                                             Maybe SAM_V1_6_Reference_Sequence_Dictionary_Species
Nothing  -> String
""
                                                             Just SAM_V1_6_Reference_Sequence_Dictionary_Species
sqf -> String
"SP:" String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                                         ( ByteString -> String
unpack     (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$
                                                                           ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$
                                                                           SAM_V1_6_Reference_Sequence_Dictionary_Species -> ByteString
sam_v1_6_reference_sequence_dictionary_species_value SAM_V1_6_Reference_Sequence_Dictionary_Species
sqf
                                                                         )
    sam_v1_6_reference_sequence_dictionary_molecule_topology_tos :: SAM_V1_6_Reference_Sequence_Dictionary -> String
sam_v1_6_reference_sequence_dictionary_molecule_topology_tos SAM_V1_6_Reference_Sequence_Dictionary
x = case (SAM_V1_6_Reference_Sequence_Dictionary
-> Maybe SAM_V1_6_Reference_Sequence_Dictionary_Molecule_Topology
sam_v1_6_reference_sequence_dictionary_molecule_topology SAM_V1_6_Reference_Sequence_Dictionary
x) of
                                                                       Maybe SAM_V1_6_Reference_Sequence_Dictionary_Molecule_Topology
Nothing  -> String
""
                                                                       Just SAM_V1_6_Reference_Sequence_Dictionary_Molecule_Topology
sqf -> String
"TP:" String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                                                   ( ByteString -> String
unpack     (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$
                                                                                     ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$
                                                                                     SAM_V1_6_Reference_Sequence_Dictionary_Molecule_Topology
-> ByteString
sam_v1_6_reference_sequence_dictionary_molecule_topology_value SAM_V1_6_Reference_Sequence_Dictionary_Molecule_Topology
sqf
                                                                                   )
    sam_v1_6_reference_sequence_dictionary_uri_tos :: SAM_V1_6_Reference_Sequence_Dictionary -> String
sam_v1_6_reference_sequence_dictionary_uri_tos SAM_V1_6_Reference_Sequence_Dictionary
x = case (SAM_V1_6_Reference_Sequence_Dictionary
-> Maybe SAM_V1_6_Reference_Sequence_Dictionary_URI
sam_v1_6_reference_sequence_dictionary_uri SAM_V1_6_Reference_Sequence_Dictionary
x) of
                                                         Maybe SAM_V1_6_Reference_Sequence_Dictionary_URI
Nothing  -> String
""
                                                         Just SAM_V1_6_Reference_Sequence_Dictionary_URI
sqf -> String
"UR:" String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                                     ( ByteString -> String
unpack     (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$
                                                                       ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$
                                                                       SAM_V1_6_Reference_Sequence_Dictionary_URI -> ByteString
sam_v1_6_reference_sequence_dictionary_uri_value SAM_V1_6_Reference_Sequence_Dictionary_URI
sqf
                                                                     )
    sam_v1_6_reference_sequence_dictionary_tos :: String
sam_v1_6_reference_sequence_dictionary_tos = case (SAM_V1_6 -> Maybe (Seq SAM_V1_6_Reference_Sequence_Dictionary)
sam_v1_6_reference_sequence_dictionary SAM_V1_6
samv16) of
                                                   Maybe (Seq SAM_V1_6_Reference_Sequence_Dictionary)
Nothing  -> String
""
                                                   Just Seq SAM_V1_6_Reference_Sequence_Dictionary
sqf -> String -> [String] -> String
forall a. [a] -> [[a]] -> [a]
intercalate String
"\n" ([String] -> String) -> [String] -> String
forall a b. (a -> b) -> a -> b
$
                                                                   (SAM_V1_6_Reference_Sequence_Dictionary -> String)
-> [SAM_V1_6_Reference_Sequence_Dictionary] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map (\SAM_V1_6_Reference_Sequence_Dictionary
x -> String -> [String] -> String
forall a. [a] -> [[a]] -> [a]
intercalate String
"\t" ([String] -> String) -> [String] -> String
forall a b. (a -> b) -> a -> b
$
                                                                                (String -> Bool) -> [String] -> [String]
forall a. (a -> Bool) -> [a] -> [a]
Prelude.filter (Bool -> Bool
not (Bool -> Bool) -> (String -> Bool) -> String -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Bool
forall a. [a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
Prelude.null) ([String] -> [String]) -> [String] -> [String]
forall a b. (a -> b) -> a -> b
$
                                                                                                    [ String
"@SQ"
                                                                                                    , SAM_V1_6_Reference_Sequence_Dictionary -> String
sam_v1_6_reference_sequence_dictionary_reference_sequence_name_tos SAM_V1_6_Reference_Sequence_Dictionary
x
                                                                                                    , SAM_V1_6_Reference_Sequence_Dictionary -> String
sam_v1_6_reference_sequence_dictionary_reference_sequence_length_tos SAM_V1_6_Reference_Sequence_Dictionary
x
                                                                                                    , SAM_V1_6_Reference_Sequence_Dictionary -> String
sam_v1_6_reference_sequence_dictionary_alternative_locus_tos SAM_V1_6_Reference_Sequence_Dictionary
x
                                                                                                    , SAM_V1_6_Reference_Sequence_Dictionary -> String
sam_v1_6_reference_sequence_dictionary_alternative_reference_sequence_names_tos SAM_V1_6_Reference_Sequence_Dictionary
x
                                                                                                    , SAM_V1_6_Reference_Sequence_Dictionary -> String
sam_v1_6_reference_sequence_dictionary_genome_assembly_identifier_tos SAM_V1_6_Reference_Sequence_Dictionary
x
                                                                                                    , SAM_V1_6_Reference_Sequence_Dictionary -> String
sam_v1_6_reference_sequence_dictionary_description_tos SAM_V1_6_Reference_Sequence_Dictionary
x
                                                                                                    , SAM_V1_6_Reference_Sequence_Dictionary -> String
sam_v1_6_reference_sequence_dictionary_md5_checksum_tos SAM_V1_6_Reference_Sequence_Dictionary
x
                                                                                                    , SAM_V1_6_Reference_Sequence_Dictionary -> String
sam_v1_6_reference_sequence_dictionary_species_tos SAM_V1_6_Reference_Sequence_Dictionary
x
                                                                                                    , SAM_V1_6_Reference_Sequence_Dictionary -> String
sam_v1_6_reference_sequence_dictionary_molecule_topology_tos SAM_V1_6_Reference_Sequence_Dictionary
x
                                                                                                    , SAM_V1_6_Reference_Sequence_Dictionary -> String
sam_v1_6_reference_sequence_dictionary_uri_tos SAM_V1_6_Reference_Sequence_Dictionary
x
                                                                                                    ]
                                                                       ) (Seq SAM_V1_6_Reference_Sequence_Dictionary
-> [SAM_V1_6_Reference_Sequence_Dictionary]
forall a. Seq a -> [a]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList Seq SAM_V1_6_Reference_Sequence_Dictionary
sqf)
    sam_v1_6_read_group_identifer_tos :: SAM_V1_6_Read_Group -> String
sam_v1_6_read_group_identifer_tos SAM_V1_6_Read_Group
x = String
"ID:" String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                          ( ByteString -> String
unpack                               (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$
                                            ByteString -> ByteString
fromStrict                           (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$
                                            SAM_V1_6_Read_Group_Identifier -> ByteString
sam_v1_6_read_group_identifier_value (SAM_V1_6_Read_Group_Identifier -> ByteString)
-> SAM_V1_6_Read_Group_Identifier -> ByteString
forall a b. (a -> b) -> a -> b
$
                                            SAM_V1_6_Read_Group -> SAM_V1_6_Read_Group_Identifier
sam_v1_6_read_group_identifier SAM_V1_6_Read_Group
x
                                          )
    sam_v1_6_read_group_barcode_sequence_tos :: SAM_V1_6_Read_Group -> String
sam_v1_6_read_group_barcode_sequence_tos SAM_V1_6_Read_Group
x = case (SAM_V1_6_Read_Group -> Maybe SAM_V1_6_Read_Group_Barcode_Sequence
sam_v1_6_read_group_barcode_sequence SAM_V1_6_Read_Group
x) of
                                                   Maybe SAM_V1_6_Read_Group_Barcode_Sequence
Nothing  -> String
""
                                                   Just SAM_V1_6_Read_Group_Barcode_Sequence
rgf -> String
"BC:" String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                               ( ByteString -> String
unpack     (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$
                                                                 ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$
                                                                 SAM_V1_6_Read_Group_Barcode_Sequence -> ByteString
sam_v1_6_read_group_barcode_sequence_value SAM_V1_6_Read_Group_Barcode_Sequence
rgf
                                                               )
    sam_v1_6_read_group_sequencing_center_tos :: SAM_V1_6_Read_Group -> String
sam_v1_6_read_group_sequencing_center_tos SAM_V1_6_Read_Group
x = case (SAM_V1_6_Read_Group -> Maybe SAM_V1_6_Read_Group_Sequencing_Center
sam_v1_6_read_group_sequencing_center SAM_V1_6_Read_Group
x) of
                                                    Maybe SAM_V1_6_Read_Group_Sequencing_Center
Nothing  -> String
""
                                                    Just SAM_V1_6_Read_Group_Sequencing_Center
rgf -> String
"CN:" String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                                ( ByteString -> String
unpack     (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$
                                                                  ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$
                                                                  SAM_V1_6_Read_Group_Sequencing_Center -> ByteString
sam_v1_6_read_group_sequencing_center_value SAM_V1_6_Read_Group_Sequencing_Center
rgf
                                                                )
    sam_v1_6_read_group_description_tos :: SAM_V1_6_Read_Group -> String
sam_v1_6_read_group_description_tos SAM_V1_6_Read_Group
x = case (SAM_V1_6_Read_Group -> Maybe SAM_V1_6_Read_Group_Description
sam_v1_6_read_group_description SAM_V1_6_Read_Group
x) of
                                              Maybe SAM_V1_6_Read_Group_Description
Nothing  -> String
""
                                              Just SAM_V1_6_Read_Group_Description
rgf -> String
"DS:" String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                          ( ByteString -> String
unpack     (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$
                                                            ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$
                                                            SAM_V1_6_Read_Group_Description -> ByteString
sam_v1_6_read_group_description_value SAM_V1_6_Read_Group_Description
rgf
                                                          )
    sam_v1_6_read_group_run_date_tos :: SAM_V1_6_Read_Group -> String
sam_v1_6_read_group_run_date_tos SAM_V1_6_Read_Group
x = case (SAM_V1_6_Read_Group -> Maybe SAM_V1_6_Read_Group_Run_Date
sam_v1_6_read_group_run_date SAM_V1_6_Read_Group
x) of
                                           Maybe SAM_V1_6_Read_Group_Run_Date
Nothing  -> String
""
                                           Just SAM_V1_6_Read_Group_Run_Date
rgf -> String
"DT:" String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                       ( ByteString -> String
unpack     (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$
                                                         ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$
                                                         SAM_V1_6_Read_Group_Run_Date -> ByteString
sam_v1_6_read_group_run_date_value SAM_V1_6_Read_Group_Run_Date
rgf
                                                       )
    sam_v1_6_read_group_flow_order_tos :: SAM_V1_6_Read_Group -> String
sam_v1_6_read_group_flow_order_tos SAM_V1_6_Read_Group
x = case (SAM_V1_6_Read_Group -> Maybe SAM_V1_6_Read_Group_Flow_Order
sam_v1_6_read_group_flow_order SAM_V1_6_Read_Group
x) of
                                             Maybe SAM_V1_6_Read_Group_Flow_Order
Nothing  -> String
""
                                             Just SAM_V1_6_Read_Group_Flow_Order
rgf -> String
"FO:" String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                         ( ByteString -> String
unpack     (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$
                                                           ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$
                                                           SAM_V1_6_Read_Group_Flow_Order -> ByteString
sam_v1_6_read_group_flow_order_value SAM_V1_6_Read_Group_Flow_Order
rgf
                                                         )
    sam_v1_6_read_group_key_sequence_tos :: SAM_V1_6_Read_Group -> String
sam_v1_6_read_group_key_sequence_tos SAM_V1_6_Read_Group
x = case (SAM_V1_6_Read_Group -> Maybe SAM_V1_6_Read_Group_Key_Sequence
sam_v1_6_read_group_key_sequence SAM_V1_6_Read_Group
x) of
                                               Maybe SAM_V1_6_Read_Group_Key_Sequence
Nothing  -> String
""
                                               Just SAM_V1_6_Read_Group_Key_Sequence
rgf -> String
"KS:" String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                           ( ByteString -> String
unpack     (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$
                                                             ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$
                                                             SAM_V1_6_Read_Group_Key_Sequence -> ByteString
sam_v1_6_read_group_key_sequence_value SAM_V1_6_Read_Group_Key_Sequence
rgf
                                                           )
    sam_v1_6_read_group_library_tos :: SAM_V1_6_Read_Group -> String
sam_v1_6_read_group_library_tos SAM_V1_6_Read_Group
x = case (SAM_V1_6_Read_Group -> Maybe SAM_V1_6_Read_Group_Library
sam_v1_6_read_group_library SAM_V1_6_Read_Group
x) of
                                          Maybe SAM_V1_6_Read_Group_Library
Nothing  -> String
""
                                          Just SAM_V1_6_Read_Group_Library
rgf -> String
"LB:" String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                      ( ByteString -> String
unpack     (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$
                                                        ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$
                                                        SAM_V1_6_Read_Group_Library -> ByteString
sam_v1_6_read_group_library_value SAM_V1_6_Read_Group_Library
rgf
                                                      )
    sam_v1_6_read_group_programs_tos :: SAM_V1_6_Read_Group -> String
sam_v1_6_read_group_programs_tos SAM_V1_6_Read_Group
x = case (SAM_V1_6_Read_Group -> Maybe SAM_V1_6_Read_Group_Programs
sam_v1_6_read_group_programs SAM_V1_6_Read_Group
x) of
                                           Maybe SAM_V1_6_Read_Group_Programs
Nothing  -> String
""
                                           Just SAM_V1_6_Read_Group_Programs
rgf -> String
"PG:" String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                       ( ByteString -> String
unpack     (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$
                                                         ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$
                                                         SAM_V1_6_Read_Group_Programs -> ByteString
sam_v1_6_read_group_programs_value SAM_V1_6_Read_Group_Programs
rgf
                                                       )
    sam_v1_6_read_group_predicted_median_insert_size_tos :: SAM_V1_6_Read_Group -> String
sam_v1_6_read_group_predicted_median_insert_size_tos SAM_V1_6_Read_Group
x = case (SAM_V1_6_Read_Group
-> Maybe SAM_V1_6_Read_Group_Predicted_Median_Insert_Size
sam_v1_6_read_group_predicted_median_insert_size SAM_V1_6_Read_Group
x) of
                                                               Maybe SAM_V1_6_Read_Group_Predicted_Median_Insert_Size
Nothing  -> String
""
                                                               Just SAM_V1_6_Read_Group_Predicted_Median_Insert_Size
rgf -> String
"PI:" String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                                           ( ByteString -> String
unpack     (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$
                                                                             ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$
                                                                             SAM_V1_6_Read_Group_Predicted_Median_Insert_Size -> ByteString
sam_v1_6_read_group_predicted_median_insert_size_value SAM_V1_6_Read_Group_Predicted_Median_Insert_Size
rgf
                                                                           )
    sam_v1_6_read_group_platform_tos :: SAM_V1_6_Read_Group -> String
sam_v1_6_read_group_platform_tos SAM_V1_6_Read_Group
x = case (SAM_V1_6_Read_Group -> Maybe SAM_V1_6_Read_Group_Platform
sam_v1_6_read_group_platform SAM_V1_6_Read_Group
x) of
                                           Maybe SAM_V1_6_Read_Group_Platform
Nothing  -> String
""
                                           Just SAM_V1_6_Read_Group_Platform
rgf -> String
"PL:" String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                       ( ByteString -> String
unpack     (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$
                                                         ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$
                                                         SAM_V1_6_Read_Group_Platform -> ByteString
sam_v1_6_read_group_platform_value SAM_V1_6_Read_Group_Platform
rgf
                                                       )
    sam_v1_6_read_group_platform_model_tos :: SAM_V1_6_Read_Group -> String
sam_v1_6_read_group_platform_model_tos SAM_V1_6_Read_Group
x = case (SAM_V1_6_Read_Group -> Maybe SAM_V1_6_Read_Group_Platform_Model
sam_v1_6_read_group_platform_model SAM_V1_6_Read_Group
x) of
                                                 Maybe SAM_V1_6_Read_Group_Platform_Model
Nothing  -> String
""
                                                 Just SAM_V1_6_Read_Group_Platform_Model
rgf -> String
"PM:" String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                             ( ByteString -> String
unpack     (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$
                                                               ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$
                                                               SAM_V1_6_Read_Group_Platform_Model -> ByteString
sam_v1_6_read_group_platform_model_value SAM_V1_6_Read_Group_Platform_Model
rgf
                                                             )
    sam_v1_6_read_group_platform_unit_tos :: SAM_V1_6_Read_Group -> String
sam_v1_6_read_group_platform_unit_tos SAM_V1_6_Read_Group
x = case (SAM_V1_6_Read_Group -> Maybe SAM_V1_6_Read_Group_Platform_Unit
sam_v1_6_read_group_platform_unit SAM_V1_6_Read_Group
x) of
                                                Maybe SAM_V1_6_Read_Group_Platform_Unit
Nothing  -> String
""
                                                Just SAM_V1_6_Read_Group_Platform_Unit
rgf -> String
"PU:" String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                            ( ByteString -> String
unpack     (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$
                                                              ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$
                                                              SAM_V1_6_Read_Group_Platform_Unit -> ByteString
sam_v1_6_read_group_platform_unit_value SAM_V1_6_Read_Group_Platform_Unit
rgf
                                                            )
    sam_v1_6_read_group_sample_tos :: SAM_V1_6_Read_Group -> String
sam_v1_6_read_group_sample_tos SAM_V1_6_Read_Group
x = case (SAM_V1_6_Read_Group -> Maybe SAM_V1_6_Read_Group_Sample
sam_v1_6_read_group_sample SAM_V1_6_Read_Group
x) of
                                         Maybe SAM_V1_6_Read_Group_Sample
Nothing  -> String
""
                                         Just SAM_V1_6_Read_Group_Sample
rgf -> String
"SM:" String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                     ( ByteString -> String
unpack     (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$
                                                       ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$
                                                       SAM_V1_6_Read_Group_Sample -> ByteString
sam_v1_6_read_group_sample_value SAM_V1_6_Read_Group_Sample
rgf
                                                     )
    sam_v1_6_read_group_tos :: String
sam_v1_6_read_group_tos = case (SAM_V1_6 -> Maybe (Seq SAM_V1_6_Read_Group)
sam_v1_6_read_group SAM_V1_6
samv16) of
                                Maybe (Seq SAM_V1_6_Read_Group)
Nothing  -> String
""
                                Just Seq SAM_V1_6_Read_Group
rgf -> String -> [String] -> String
forall a. [a] -> [[a]] -> [a]
intercalate String
"\n" ([String] -> String) -> [String] -> String
forall a b. (a -> b) -> a -> b
$
                                              (SAM_V1_6_Read_Group -> String)
-> [SAM_V1_6_Read_Group] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map (\SAM_V1_6_Read_Group
x -> String -> [String] -> String
forall a. [a] -> [[a]] -> [a]
intercalate String
"\t" ([String] -> String) -> [String] -> String
forall a b. (a -> b) -> a -> b
$
                                                           (String -> Bool) -> [String] -> [String]
forall a. (a -> Bool) -> [a] -> [a]
Prelude.filter (Bool -> Bool
not (Bool -> Bool) -> (String -> Bool) -> String -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Bool
forall a. [a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
Prelude.null) ([String] -> [String]) -> [String] -> [String]
forall a b. (a -> b) -> a -> b
$
                                                                               [ String
"@RG"
                                                                               , SAM_V1_6_Read_Group -> String
sam_v1_6_read_group_identifer_tos SAM_V1_6_Read_Group
x
                                                                               , SAM_V1_6_Read_Group -> String
sam_v1_6_read_group_barcode_sequence_tos SAM_V1_6_Read_Group
x
                                                                               , SAM_V1_6_Read_Group -> String
sam_v1_6_read_group_sequencing_center_tos SAM_V1_6_Read_Group
x
                                                                               , SAM_V1_6_Read_Group -> String
sam_v1_6_read_group_description_tos SAM_V1_6_Read_Group
x
                                                                               , SAM_V1_6_Read_Group -> String
sam_v1_6_read_group_run_date_tos SAM_V1_6_Read_Group
x
                                                                               , SAM_V1_6_Read_Group -> String
sam_v1_6_read_group_flow_order_tos SAM_V1_6_Read_Group
x
                                                                               , SAM_V1_6_Read_Group -> String
sam_v1_6_read_group_key_sequence_tos SAM_V1_6_Read_Group
x
                                                                               , SAM_V1_6_Read_Group -> String
sam_v1_6_read_group_library_tos SAM_V1_6_Read_Group
x
                                                                               , SAM_V1_6_Read_Group -> String
sam_v1_6_read_group_programs_tos SAM_V1_6_Read_Group
x
                                                                               , SAM_V1_6_Read_Group -> String
sam_v1_6_read_group_predicted_median_insert_size_tos SAM_V1_6_Read_Group
x
                                                                               , SAM_V1_6_Read_Group -> String
sam_v1_6_read_group_platform_tos SAM_V1_6_Read_Group
x
                                                                               , SAM_V1_6_Read_Group -> String
sam_v1_6_read_group_platform_model_tos SAM_V1_6_Read_Group
x
                                                                               , SAM_V1_6_Read_Group -> String
sam_v1_6_read_group_platform_unit_tos SAM_V1_6_Read_Group
x
                                                                               , SAM_V1_6_Read_Group -> String
sam_v1_6_read_group_sample_tos SAM_V1_6_Read_Group
x
                                                                               ]
                                                  ) (Seq SAM_V1_6_Read_Group -> [SAM_V1_6_Read_Group]
forall a. Seq a -> [a]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList Seq SAM_V1_6_Read_Group
rgf)
    sam_v1_6_program_record_identifier_tos :: SAM_V1_6_Program -> String
sam_v1_6_program_record_identifier_tos SAM_V1_6_Program
x = String
"ID:" String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                               ( ByteString -> String
unpack                                   (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$
                                                 ByteString -> ByteString
fromStrict                               (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$
                                                 SAM_V1_6_Program_Record_Identifier -> ByteString
sam_v1_6_program_record_identifier_value (SAM_V1_6_Program_Record_Identifier -> ByteString)
-> SAM_V1_6_Program_Record_Identifier -> ByteString
forall a b. (a -> b) -> a -> b
$
                                                 SAM_V1_6_Program -> SAM_V1_6_Program_Record_Identifier
sam_v1_6_program_record_identifier SAM_V1_6_Program
x
                                               )
    sam_v1_6_program_name_tos :: SAM_V1_6_Program -> String
sam_v1_6_program_name_tos SAM_V1_6_Program
x = case (SAM_V1_6_Program -> Maybe SAM_V1_6_Program_Name
sam_v1_6_program_name SAM_V1_6_Program
x) of
                                    Maybe SAM_V1_6_Program_Name
Nothing  -> String
""
                                    Just SAM_V1_6_Program_Name
rgf -> String
"PN:" String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                ( ByteString -> String
unpack     (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$
                                                  ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$
                                                  SAM_V1_6_Program_Name -> ByteString
sam_v1_6_program_name_value SAM_V1_6_Program_Name
rgf
                                                )
    sam_v1_6_program_command_line_tos :: SAM_V1_6_Program -> String
sam_v1_6_program_command_line_tos SAM_V1_6_Program
x = case (SAM_V1_6_Program -> Maybe SAM_V1_6_Program_Command_Line
sam_v1_6_program_command_line SAM_V1_6_Program
x) of
                                            Maybe SAM_V1_6_Program_Command_Line
Nothing  -> String
""
                                            Just SAM_V1_6_Program_Command_Line
rgf -> String
"CL:" String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                        ( ByteString -> String
unpack     (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$
                                                          ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$
                                                          SAM_V1_6_Program_Command_Line -> ByteString
sam_v1_6_program_command_line_value SAM_V1_6_Program_Command_Line
rgf
                                                        )
    sam_v1_6_program_previous_pg_id_tos :: SAM_V1_6_Program -> String
sam_v1_6_program_previous_pg_id_tos SAM_V1_6_Program
x = case (SAM_V1_6_Program -> Maybe SAM_V1_6_Program_Previous_PG_ID
sam_v1_6_program_previous_pg_id SAM_V1_6_Program
x) of
                                              Maybe SAM_V1_6_Program_Previous_PG_ID
Nothing  -> String
""
                                              Just SAM_V1_6_Program_Previous_PG_ID
rgf -> String
"PP:" String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                          ( ByteString -> String
unpack     (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$
                                                            ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$
                                                            SAM_V1_6_Program_Previous_PG_ID -> ByteString
sam_v1_6_program_previous_pg_id_value SAM_V1_6_Program_Previous_PG_ID
rgf
                                                          )
    sam_v1_6_program_description_tos :: SAM_V1_6_Program -> String
sam_v1_6_program_description_tos SAM_V1_6_Program
x = case (SAM_V1_6_Program -> Maybe SAM_V1_6_Program_Description
sam_v1_6_program_description SAM_V1_6_Program
x) of
                                           Maybe SAM_V1_6_Program_Description
Nothing  -> String
""
                                           Just SAM_V1_6_Program_Description
rgf -> String
"DS:" String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                       ( ByteString -> String
unpack     (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$
                                                         ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$
                                                         SAM_V1_6_Program_Description -> ByteString
sam_v1_6_program_description_value SAM_V1_6_Program_Description
rgf
                                                       )
    sam_v1_6_program_version_tos :: SAM_V1_6_Program -> String
sam_v1_6_program_version_tos SAM_V1_6_Program
x = case (SAM_V1_6_Program -> Maybe SAM_V1_6_Program_Version
sam_v1_6_program_version SAM_V1_6_Program
x) of
                                       Maybe SAM_V1_6_Program_Version
Nothing  -> String
""
                                       Just SAM_V1_6_Program_Version
rgf -> String
"VN:" String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                   ( ByteString -> String
unpack     (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$
                                                     ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$
                                                     SAM_V1_6_Program_Version -> ByteString
sam_v1_6_program_version_value SAM_V1_6_Program_Version
rgf
                                                   )
    sam_v1_6_program_tos :: String
sam_v1_6_program_tos = case (SAM_V1_6 -> Maybe SAM_V1_6_Program
sam_v1_6_program SAM_V1_6
samv16) of
                             Maybe SAM_V1_6_Program
Nothing  -> String
""
                             Just SAM_V1_6_Program
pgf -> String -> [String] -> String
forall a. [a] -> [[a]] -> [a]
intercalate String
"\t" ([String] -> String) -> [String] -> String
forall a b. (a -> b) -> a -> b
$
                                           (String -> Bool) -> [String] -> [String]
forall a. (a -> Bool) -> [a] -> [a]
Prelude.filter (Bool -> Bool
not (Bool -> Bool) -> (String -> Bool) -> String -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Bool
forall a. [a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
Prelude.null) ([String] -> [String]) -> [String] -> [String]
forall a b. (a -> b) -> a -> b
$
                                                               [ String
"@PG"
                                                               , SAM_V1_6_Program -> String
sam_v1_6_program_record_identifier_tos SAM_V1_6_Program
pgf
                                                               , SAM_V1_6_Program -> String
sam_v1_6_program_name_tos SAM_V1_6_Program
pgf
                                                               , SAM_V1_6_Program -> String
sam_v1_6_program_command_line_tos SAM_V1_6_Program
pgf
                                                               , SAM_V1_6_Program -> String
sam_v1_6_program_previous_pg_id_tos SAM_V1_6_Program
pgf
                                                               , SAM_V1_6_Program -> String
sam_v1_6_program_description_tos SAM_V1_6_Program
pgf
                                                               , SAM_V1_6_Program -> String
sam_v1_6_program_version_tos SAM_V1_6_Program
pgf
                                                               ]
    sam_v1_6_one_line_comment_tos :: String
sam_v1_6_one_line_comment_tos = case (SAM_V1_6 -> Maybe (Seq SAM_V1_6_One_Line_Comment)
sam_v1_6_one_line_comment SAM_V1_6
samv16) of
                                      Maybe (Seq SAM_V1_6_One_Line_Comment)
Nothing  -> String
""
                                      Just Seq SAM_V1_6_One_Line_Comment
cof -> String -> [String] -> String
forall a. [a] -> [[a]] -> [a]
intercalate String
"\n" ([String] -> String) -> [String] -> String
forall a b. (a -> b) -> a -> b
$
                                                    (SAM_V1_6_One_Line_Comment -> String)
-> [SAM_V1_6_One_Line_Comment] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map (\SAM_V1_6_One_Line_Comment
x -> String -> [String] -> String
forall a. [a] -> [[a]] -> [a]
intercalate String
"\t" ([String] -> String) -> [String] -> String
forall a b. (a -> b) -> a -> b
$
                                                                 (String -> Bool) -> [String] -> [String]
forall a. (a -> Bool) -> [a] -> [a]
Prelude.filter (Bool -> Bool
not (Bool -> Bool) -> (String -> Bool) -> String -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Bool
forall a. [a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
Prelude.null) 
                                                                                     [ String
"@CO"
                                                                                     , ByteString -> String
unpack     (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$
                                                                                       ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$
                                                                                       SAM_V1_6_One_Line_Comment -> ByteString
sam_v1_6_one_line_comment_value SAM_V1_6_One_Line_Comment
x
                                                                                     ]
                                                        ) (Seq SAM_V1_6_One_Line_Comment -> [SAM_V1_6_One_Line_Comment]
forall a. Seq a -> [a]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList Seq SAM_V1_6_One_Line_Comment
cof)
    sam_v1_6_alignment_tos :: String
sam_v1_6_alignment_tos            = String -> [String] -> String
forall a. [a] -> [[a]] -> [a]
intercalate String
"\n" ([String] -> String) -> [String] -> String
forall a b. (a -> b) -> a -> b
$
                                          (SAM_V1_6_Alignment -> String) -> [SAM_V1_6_Alignment] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map (\SAM_V1_6_Alignment
x -> case (String -> Bool
forall a. [a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
Prelude.null (String -> Bool) -> String -> Bool
forall a b. (a -> b) -> a -> b
$ SAM_V1_6_Alignment -> String
sam_v1_6_alignment_opts SAM_V1_6_Alignment
x) of
                                                       Bool
True  -> SAM_V1_6_Alignment -> String
sam_v1_6_alignment_mand SAM_V1_6_Alignment
x 
                                                       Bool
False -> String -> [String] -> String
forall a. [a] -> [[a]] -> [a]
intercalate String
"\t"
                                                                            [ SAM_V1_6_Alignment -> String
sam_v1_6_alignment_mand SAM_V1_6_Alignment
x
                                                                            , SAM_V1_6_Alignment -> String
sam_v1_6_alignment_opts SAM_V1_6_Alignment
x
                                                                            ] ) (Seq SAM_V1_6_Alignment -> [SAM_V1_6_Alignment]
forall a. Seq a -> [a]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList (Seq SAM_V1_6_Alignment -> [SAM_V1_6_Alignment])
-> Seq SAM_V1_6_Alignment -> [SAM_V1_6_Alignment]
forall a b. (a -> b) -> a -> b
$ SAM_V1_6 -> Seq SAM_V1_6_Alignment
sam_v1_6_alignment SAM_V1_6
samv16)
    sam_v1_6_alignment_mand :: SAM_V1_6_Alignment -> String
sam_v1_6_alignment_mand SAM_V1_6_Alignment
x           = String -> [String] -> String
forall a. [a] -> [[a]] -> [a]
intercalate String
"\t" ([String] -> String) -> [String] -> String
forall a b. (a -> b) -> a -> b
$
                                            (String -> Bool) -> [String] -> [String]
forall a. (a -> Bool) -> [a] -> [a]
Prelude.filter (Bool -> Bool
not (Bool -> Bool) -> (String -> Bool) -> String -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Bool
forall a. [a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
Prelude.null)
                                                                [ ByteString -> String
unpack (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$ ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$ SAM_V1_6_Alignment -> ByteString
sam_v1_6_alignment_qname SAM_V1_6_Alignment
x 
                                                                , Int -> String
forall a. Show a => a -> String
show (Int -> String) -> Int -> String
forall a b. (a -> b) -> a -> b
$ SAM_V1_6_Alignment -> Int
sam_v1_6_alignment_flag SAM_V1_6_Alignment
x 
                                                                , ByteString -> String
unpack (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$ ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$ SAM_V1_6_Alignment -> ByteString
sam_v1_6_alignment_rname SAM_V1_6_Alignment
x 
                                                                , Integer -> String
forall a. Show a => a -> String
show (Integer -> String) -> Integer -> String
forall a b. (a -> b) -> a -> b
$ SAM_V1_6_Alignment -> Integer
sam_v1_6_alignment_pos SAM_V1_6_Alignment
x 
                                                                , Int -> String
forall a. Show a => a -> String
show (Int -> String) -> Int -> String
forall a b. (a -> b) -> a -> b
$ SAM_V1_6_Alignment -> Int
sam_v1_6_alignment_mapq SAM_V1_6_Alignment
x 
                                                                , ByteString -> String
unpack (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$ ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$ SAM_V1_6_Alignment -> ByteString
sam_v1_6_alignment_cigar SAM_V1_6_Alignment
x 
                                                                , ByteString -> String
unpack (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$ ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$ SAM_V1_6_Alignment -> ByteString
sam_v1_6_alignment_rnext SAM_V1_6_Alignment
x 
                                                                , Integer -> String
forall a. Show a => a -> String
show (Integer -> String) -> Integer -> String
forall a b. (a -> b) -> a -> b
$ SAM_V1_6_Alignment -> Integer
sam_v1_6_alignment_pnext SAM_V1_6_Alignment
x 
                                                                , Integer -> String
forall a. Show a => a -> String
show (Integer -> String) -> Integer -> String
forall a b. (a -> b) -> a -> b
$ SAM_V1_6_Alignment -> Integer
sam_v1_6_alignment_tlen SAM_V1_6_Alignment
x 
                                                                , ByteString -> String
unpack (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$ ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$ SAM_V1_6_Alignment -> ByteString
sam_v1_6_alignment_seq SAM_V1_6_Alignment
x 
                                                                , ByteString -> String
unpack (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$ ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$ SAM_V1_6_Alignment -> ByteString
sam_v1_6_alignment_qual SAM_V1_6_Alignment
x
                                                                ]
    sam_v1_6_alignment_opts :: SAM_V1_6_Alignment -> String
sam_v1_6_alignment_opts SAM_V1_6_Alignment
x           = String -> [String] -> String
forall a. [a] -> [[a]] -> [a]
intercalate String
"\t" ([String] -> String) -> [String] -> String
forall a b. (a -> b) -> a -> b
$
                                            (String -> Bool) -> [String] -> [String]
forall a. (a -> Bool) -> [a] -> [a]
Prelude.filter (Bool -> Bool
not (Bool -> Bool) -> (String -> Bool) -> String -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Bool
forall a. [a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
Prelude.null)
                                                                [ SAM_V1_6_Alignment -> String
sam_v1_6_alignment_aopt_d SAM_V1_6_Alignment
x 
                                                                , SAM_V1_6_Alignment -> String
sam_v1_6_alignment_iopt_d SAM_V1_6_Alignment
x 
                                                                , SAM_V1_6_Alignment -> String
sam_v1_6_alignment_fopt_d SAM_V1_6_Alignment
x 
                                                                , SAM_V1_6_Alignment -> String
sam_v1_6_alignment_zopt_d SAM_V1_6_Alignment
x
                                                                , SAM_V1_6_Alignment -> String
sam_v1_6_alignment_hopt_d SAM_V1_6_Alignment
x 
                                                                , SAM_V1_6_Alignment -> String
sam_v1_6_alignment_bopt_d SAM_V1_6_Alignment
x
                                                                ]
    sam_v1_6_alignment_aopt_d :: SAM_V1_6_Alignment -> String
sam_v1_6_alignment_aopt_d SAM_V1_6_Alignment
x         = case (SAM_V1_6_Alignment -> Maybe SAM_V1_6_Alignment_AOPT
sam_v1_6_alignment_aopt SAM_V1_6_Alignment
x) of
                                            Maybe SAM_V1_6_Alignment_AOPT
Nothing   -> String
""
                                            Just SAM_V1_6_Alignment_AOPT
aopt -> ( ByteString -> String
unpack     (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$
                                                           ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$
                                                           SAM_V1_6_Alignment_AOPT -> ByteString
sam_v1_6_alignment_aopt_tag SAM_V1_6_Alignment_AOPT
aopt
                                                         )
                                                         String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                         String
":A:"
                                                         String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                         ( ByteString -> String
unpack     (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$
                                                           ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$
                                                           SAM_V1_6_Alignment_AOPT -> ByteString
sam_v1_6_alignment_aopt_value SAM_V1_6_Alignment_AOPT
aopt
                                                         )
    sam_v1_6_alignment_iopt_d :: SAM_V1_6_Alignment -> String
sam_v1_6_alignment_iopt_d SAM_V1_6_Alignment
x         = case (SAM_V1_6_Alignment -> Maybe SAM_V1_6_Alignment_IOPT
sam_v1_6_alignment_iopt SAM_V1_6_Alignment
x) of
                                            Maybe SAM_V1_6_Alignment_IOPT
Nothing   -> String
""
                                            Just SAM_V1_6_Alignment_IOPT
iopt -> ( ByteString -> String
unpack     (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$
                                                           ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$
                                                           SAM_V1_6_Alignment_IOPT -> ByteString
sam_v1_6_alignment_iopt_tag SAM_V1_6_Alignment_IOPT
iopt
                                                         )
                                                         String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                         String
":i:"
                                                         String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                         ( Integer -> String
forall a. Show a => a -> String
show (Integer -> String) -> Integer -> String
forall a b. (a -> b) -> a -> b
$
                                                           SAM_V1_6_Alignment_IOPT -> Integer
sam_v1_6_alignment_iopt_value SAM_V1_6_Alignment_IOPT
iopt
                                                         )
    sam_v1_6_alignment_fopt_d :: SAM_V1_6_Alignment -> String
sam_v1_6_alignment_fopt_d SAM_V1_6_Alignment
x         = case (SAM_V1_6_Alignment -> Maybe SAM_V1_6_Alignment_FOPT
sam_v1_6_alignment_fopt SAM_V1_6_Alignment
x) of
                                            Maybe SAM_V1_6_Alignment_FOPT
Nothing   -> String
""
                                            Just SAM_V1_6_Alignment_FOPT
fopt -> ( ByteString -> String
unpack     (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$
                                                           ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$
                                                           SAM_V1_6_Alignment_FOPT -> ByteString
sam_v1_6_alignment_fopt_tag SAM_V1_6_Alignment_FOPT
fopt
                                                         )
                                                         String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                         String
":f:"
                                                         String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                         ( Float -> String
forall a. Show a => a -> String
show (Float -> String) -> Float -> String
forall a b. (a -> b) -> a -> b
$
                                                           SAM_V1_6_Alignment_FOPT -> Float
sam_v1_6_alignment_fopt_value SAM_V1_6_Alignment_FOPT
fopt
                                                         )
    sam_v1_6_alignment_zopt_d :: SAM_V1_6_Alignment -> String
sam_v1_6_alignment_zopt_d SAM_V1_6_Alignment
x         = case (SAM_V1_6_Alignment -> Maybe SAM_V1_6_Alignment_ZOPT
sam_v1_6_alignment_zopt SAM_V1_6_Alignment
x) of
                                            Maybe SAM_V1_6_Alignment_ZOPT
Nothing   -> String
""
                                            Just SAM_V1_6_Alignment_ZOPT
zopt -> ( ByteString -> String
unpack     (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$
                                                           ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$
                                                           SAM_V1_6_Alignment_ZOPT -> ByteString
sam_v1_6_alignment_zopt_tag SAM_V1_6_Alignment_ZOPT
zopt
                                                         )
                                                         String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                         String
":Z:"
                                                         String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                         ( ByteString -> String
unpack     (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$
                                                           ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$
                                                           SAM_V1_6_Alignment_ZOPT -> ByteString
sam_v1_6_alignment_zopt_value SAM_V1_6_Alignment_ZOPT
zopt
                                                         )
    sam_v1_6_alignment_hopt_d :: SAM_V1_6_Alignment -> String
sam_v1_6_alignment_hopt_d SAM_V1_6_Alignment
x         = case (SAM_V1_6_Alignment -> Maybe SAM_V1_6_Alignment_HOPT
sam_v1_6_alignment_hopt SAM_V1_6_Alignment
x) of
                                            Maybe SAM_V1_6_Alignment_HOPT
Nothing   -> String
""
                                            Just SAM_V1_6_Alignment_HOPT
hopt -> ( ByteString -> String
unpack     (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$
                                                           ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$
                                                           SAM_V1_6_Alignment_HOPT -> ByteString
sam_v1_6_alignment_hopt_tag SAM_V1_6_Alignment_HOPT
hopt
                                                         )
                                                         String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                         String
":H:"
                                                         String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                         ( ByteString -> String
unpack     (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$
                                                           ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$
                                                           SAM_V1_6_Alignment_HOPT -> ByteString
sam_v1_6_alignment_hopt_value SAM_V1_6_Alignment_HOPT
hopt
                                                         )
    sam_v1_6_alignment_bopt_d :: SAM_V1_6_Alignment -> String
sam_v1_6_alignment_bopt_d SAM_V1_6_Alignment
x         = case (SAM_V1_6_Alignment -> Maybe SAM_V1_6_Alignment_BOPT
sam_v1_6_alignment_bopt SAM_V1_6_Alignment
x) of
                                            Maybe SAM_V1_6_Alignment_BOPT
Nothing   -> String
""
                                            Just SAM_V1_6_Alignment_BOPT
bopt -> [String] -> String
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([String] -> String) -> [String] -> String
forall a b. (a -> b) -> a -> b
$
                                                           (String -> Bool) -> [String] -> [String]
forall a. (a -> Bool) -> [a] -> [a]
Prelude.filter (Bool -> Bool
not (Bool -> Bool) -> (String -> Bool) -> String -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Bool
forall a. [a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
Prelude.null)
                                                                               [ SAM_V1_6_Alignment_BOPT -> String
sam_v1_6_alignment_bopt_int8_d SAM_V1_6_Alignment_BOPT
bopt
                                                                               , SAM_V1_6_Alignment_BOPT -> String
sam_v1_6_alignment_bopt_word8_d SAM_V1_6_Alignment_BOPT
bopt
                                                                               , SAM_V1_6_Alignment_BOPT -> String
sam_v1_6_alignment_bopt_int16_d SAM_V1_6_Alignment_BOPT
bopt
                                                                               , SAM_V1_6_Alignment_BOPT -> String
sam_v1_6_alignment_bopt_word16_d SAM_V1_6_Alignment_BOPT
bopt
                                                                               , SAM_V1_6_Alignment_BOPT -> String
sam_v1_6_alignment_bopt_int32_d SAM_V1_6_Alignment_BOPT
bopt
                                                                               , SAM_V1_6_Alignment_BOPT -> String
sam_v1_6_alignment_bopt_word32_d SAM_V1_6_Alignment_BOPT
bopt
                                                                               , SAM_V1_6_Alignment_BOPT -> String
sam_v1_6_alignment_bopt_float_d SAM_V1_6_Alignment_BOPT
bopt
                                                                               ]
    sam_v1_6_alignment_bopt_int8_d :: SAM_V1_6_Alignment_BOPT -> String
sam_v1_6_alignment_bopt_int8_d SAM_V1_6_Alignment_BOPT
x = case (SAM_V1_6_Alignment_BOPT -> Maybe SAM_V1_6_Alignment_BOPT_Int8
sam_v1_6_alignment_bopt_int8 SAM_V1_6_Alignment_BOPT
x) of
                                         Maybe SAM_V1_6_Alignment_BOPT_Int8
Nothing        -> String
""
                                         Just SAM_V1_6_Alignment_BOPT_Int8
bopt_int8 -> (ByteString -> String
unpack (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$ ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$ [Word8] -> ByteString
pack ([Word8] -> ByteString) -> [Word8] -> ByteString
forall a b. (a -> b) -> a -> b
$ Seq Word8 -> [Word8]
forall a. Seq a -> [a]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList (Seq Word8 -> [Word8]) -> Seq Word8 -> [Word8]
forall a b. (a -> b) -> a -> b
$ SAM_V1_6_Alignment_BOPT_Int8 -> Seq Word8
sam_v1_6_alignment_bopt_int8_tag SAM_V1_6_Alignment_BOPT_Int8
bopt_int8) String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                           String
":"                                                                                String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                           String
"B"                                                                                String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                           String
":"                                                                                String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                           (ByteString -> String
unpack (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$ ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$ Word8 -> ByteString
DB.singleton (Word8 -> ByteString) -> Word8 -> ByteString
forall a b. (a -> b) -> a -> b
$ SAM_V1_6_Alignment_BOPT_Int8 -> Word8
sam_v1_6_alignment_bopt_int8_type SAM_V1_6_Alignment_BOPT_Int8
bopt_int8) String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                           String
","                                                                                String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                           ([String] -> String
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([String] -> String) -> [String] -> String
forall a b. (a -> b) -> a -> b
$ (Int8 -> String) -> [Int8] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map Int8 -> String
forall a. Show a => a -> String
show ([Int8] -> [String]) -> [Int8] -> [String]
forall a b. (a -> b) -> a -> b
$ Seq Int8 -> [Int8]
forall a. Seq a -> [a]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList (Seq Int8 -> [Int8]) -> Seq Int8 -> [Int8]
forall a b. (a -> b) -> a -> b
$ SAM_V1_6_Alignment_BOPT_Int8 -> Seq Int8
sam_v1_6_alignment_bopt_int8_value SAM_V1_6_Alignment_BOPT_Int8
bopt_int8)
    sam_v1_6_alignment_bopt_word8_d :: SAM_V1_6_Alignment_BOPT -> String
sam_v1_6_alignment_bopt_word8_d SAM_V1_6_Alignment_BOPT
x = case (SAM_V1_6_Alignment_BOPT -> Maybe SAM_V1_6_Alignment_BOPT_Word8
sam_v1_6_alignment_bopt_word8 SAM_V1_6_Alignment_BOPT
x) of 
                                          Maybe SAM_V1_6_Alignment_BOPT_Word8
Nothing         -> String
""
                                          Just SAM_V1_6_Alignment_BOPT_Word8
bopt_word8 -> (ByteString -> String
unpack (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$ ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$ [Word8] -> ByteString
pack ([Word8] -> ByteString) -> [Word8] -> ByteString
forall a b. (a -> b) -> a -> b
$ Seq Word8 -> [Word8]
forall a. Seq a -> [a]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList (Seq Word8 -> [Word8]) -> Seq Word8 -> [Word8]
forall a b. (a -> b) -> a -> b
$ SAM_V1_6_Alignment_BOPT_Word8 -> Seq Word8
sam_v1_6_alignment_bopt_word8_tag SAM_V1_6_Alignment_BOPT_Word8
bopt_word8) String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                             String
":"                                                                                  String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                             String
"B"                                                                                  String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                             String
":"                                                                                  String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                             (ByteString -> String
unpack (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$ ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$ Word8 -> ByteString
DB.singleton (Word8 -> ByteString) -> Word8 -> ByteString
forall a b. (a -> b) -> a -> b
$ SAM_V1_6_Alignment_BOPT_Word8 -> Word8
sam_v1_6_alignment_bopt_word8_type SAM_V1_6_Alignment_BOPT_Word8
bopt_word8) String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                             String
","                                                                                  String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                             (ByteString -> String
unpack (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$ ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$ [Word8] -> ByteString
pack ([Word8] -> ByteString) -> [Word8] -> ByteString
forall a b. (a -> b) -> a -> b
$ Seq Word8 -> [Word8]
forall a. Seq a -> [a]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList (Seq Word8 -> [Word8]) -> Seq Word8 -> [Word8]
forall a b. (a -> b) -> a -> b
$ SAM_V1_6_Alignment_BOPT_Word8 -> Seq Word8
sam_v1_6_alignment_bopt_word8_value SAM_V1_6_Alignment_BOPT_Word8
bopt_word8)
    sam_v1_6_alignment_bopt_int16_d :: SAM_V1_6_Alignment_BOPT -> String
sam_v1_6_alignment_bopt_int16_d SAM_V1_6_Alignment_BOPT
x = case (SAM_V1_6_Alignment_BOPT -> Maybe SAM_V1_6_Alignment_BOPT_Int16
sam_v1_6_alignment_bopt_int16 SAM_V1_6_Alignment_BOPT
x) of 
                                          Maybe SAM_V1_6_Alignment_BOPT_Int16
Nothing         -> String
""
                                          Just SAM_V1_6_Alignment_BOPT_Int16
bopt_int16 -> (ByteString -> String
unpack (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$ ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$ [Word8] -> ByteString
pack ([Word8] -> ByteString) -> [Word8] -> ByteString
forall a b. (a -> b) -> a -> b
$ Seq Word8 -> [Word8]
forall a. Seq a -> [a]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList (Seq Word8 -> [Word8]) -> Seq Word8 -> [Word8]
forall a b. (a -> b) -> a -> b
$ SAM_V1_6_Alignment_BOPT_Int16 -> Seq Word8
sam_v1_6_alignment_bopt_int16_tag SAM_V1_6_Alignment_BOPT_Int16
bopt_int16) String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                             String
":"                                                                                  String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                             String
"B"                                                                                  String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                             String
":"                                                                                  String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                             (ByteString -> String
unpack (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$ ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$ Word8 -> ByteString
DB.singleton (Word8 -> ByteString) -> Word8 -> ByteString
forall a b. (a -> b) -> a -> b
$ SAM_V1_6_Alignment_BOPT_Int16 -> Word8
sam_v1_6_alignment_bopt_int16_type SAM_V1_6_Alignment_BOPT_Int16
bopt_int16) String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                             String
","                                                                                  String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                             ([String] -> String
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([String] -> String) -> [String] -> String
forall a b. (a -> b) -> a -> b
$ (Int16 -> String) -> [Int16] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map Int16 -> String
forall a. Show a => a -> String
show ([Int16] -> [String]) -> [Int16] -> [String]
forall a b. (a -> b) -> a -> b
$ Seq Int16 -> [Int16]
forall a. Seq a -> [a]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList (Seq Int16 -> [Int16]) -> Seq Int16 -> [Int16]
forall a b. (a -> b) -> a -> b
$ SAM_V1_6_Alignment_BOPT_Int16 -> Seq Int16
sam_v1_6_alignment_bopt_int16_value SAM_V1_6_Alignment_BOPT_Int16
bopt_int16)
    sam_v1_6_alignment_bopt_word16_d :: SAM_V1_6_Alignment_BOPT -> String
sam_v1_6_alignment_bopt_word16_d SAM_V1_6_Alignment_BOPT
x = case (SAM_V1_6_Alignment_BOPT -> Maybe SAM_V1_6_Alignment_BOPT_Word16
sam_v1_6_alignment_bopt_word16 SAM_V1_6_Alignment_BOPT
x) of
                                           Maybe SAM_V1_6_Alignment_BOPT_Word16
Nothing          -> String
""
                                           Just SAM_V1_6_Alignment_BOPT_Word16
bopt_word16 -> (ByteString -> String
unpack (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$ ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$ [Word8] -> ByteString
pack ([Word8] -> ByteString) -> [Word8] -> ByteString
forall a b. (a -> b) -> a -> b
$ Seq Word8 -> [Word8]
forall a. Seq a -> [a]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList (Seq Word8 -> [Word8]) -> Seq Word8 -> [Word8]
forall a b. (a -> b) -> a -> b
$ SAM_V1_6_Alignment_BOPT_Word16 -> Seq Word8
sam_v1_6_alignment_bopt_word16_tag SAM_V1_6_Alignment_BOPT_Word16
bopt_word16) String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                               String
":"                                                                                    String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                               String
"B"                                                                                    String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                               String
":"                                                                                    String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                               (ByteString -> String
unpack (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$ ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$ Word8 -> ByteString
DB.singleton (Word8 -> ByteString) -> Word8 -> ByteString
forall a b. (a -> b) -> a -> b
$ SAM_V1_6_Alignment_BOPT_Word16 -> Word8
sam_v1_6_alignment_bopt_word16_type SAM_V1_6_Alignment_BOPT_Word16
bopt_word16) String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                               String
","                                                                                    String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                               ([String] -> String
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([String] -> String) -> [String] -> String
forall a b. (a -> b) -> a -> b
$ (Word16 -> String) -> [Word16] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map Word16 -> String
encodeWord16 ([Word16] -> [String]) -> [Word16] -> [String]
forall a b. (a -> b) -> a -> b
$ Seq Word16 -> [Word16]
forall a. Seq a -> [a]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList (Seq Word16 -> [Word16]) -> Seq Word16 -> [Word16]
forall a b. (a -> b) -> a -> b
$ SAM_V1_6_Alignment_BOPT_Word16 -> Seq Word16
sam_v1_6_alignment_bopt_word16_value SAM_V1_6_Alignment_BOPT_Word16
bopt_word16)
    sam_v1_6_alignment_bopt_int32_d :: SAM_V1_6_Alignment_BOPT -> String
sam_v1_6_alignment_bopt_int32_d SAM_V1_6_Alignment_BOPT
x = case (SAM_V1_6_Alignment_BOPT -> Maybe SAM_V1_6_Alignment_BOPT_Int32
sam_v1_6_alignment_bopt_int32 SAM_V1_6_Alignment_BOPT
x) of
                                          Maybe SAM_V1_6_Alignment_BOPT_Int32
Nothing         -> String
""
                                          Just SAM_V1_6_Alignment_BOPT_Int32
bopt_int32 -> (ByteString -> String
unpack (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$ ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$ [Word8] -> ByteString
pack ([Word8] -> ByteString) -> [Word8] -> ByteString
forall a b. (a -> b) -> a -> b
$ Seq Word8 -> [Word8]
forall a. Seq a -> [a]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList (Seq Word8 -> [Word8]) -> Seq Word8 -> [Word8]
forall a b. (a -> b) -> a -> b
$ SAM_V1_6_Alignment_BOPT_Int32 -> Seq Word8
sam_v1_6_alignment_bopt_int32_tag SAM_V1_6_Alignment_BOPT_Int32
bopt_int32) String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                             String
":"                                                                                  String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                             String
"B"                                                                                  String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                             String
":"                                                                                  String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                             (ByteString -> String
unpack (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$ ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$ Word8 -> ByteString
DB.singleton (Word8 -> ByteString) -> Word8 -> ByteString
forall a b. (a -> b) -> a -> b
$ SAM_V1_6_Alignment_BOPT_Int32 -> Word8
sam_v1_6_alignment_bopt_int32_type SAM_V1_6_Alignment_BOPT_Int32
bopt_int32) String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                             String
","                                                                                  String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                             ([String] -> String
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([String] -> String) -> [String] -> String
forall a b. (a -> b) -> a -> b
$ (Int32 -> String) -> [Int32] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map Int32 -> String
forall a. Show a => a -> String
show ([Int32] -> [String]) -> [Int32] -> [String]
forall a b. (a -> b) -> a -> b
$ Seq Int32 -> [Int32]
forall a. Seq a -> [a]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList (Seq Int32 -> [Int32]) -> Seq Int32 -> [Int32]
forall a b. (a -> b) -> a -> b
$ SAM_V1_6_Alignment_BOPT_Int32 -> Seq Int32
sam_v1_6_alignment_bopt_int32_value SAM_V1_6_Alignment_BOPT_Int32
bopt_int32)
    sam_v1_6_alignment_bopt_word32_d :: SAM_V1_6_Alignment_BOPT -> String
sam_v1_6_alignment_bopt_word32_d SAM_V1_6_Alignment_BOPT
x = case (SAM_V1_6_Alignment_BOPT -> Maybe SAM_V1_6_Alignment_BOPT_Word32
sam_v1_6_alignment_bopt_word32 SAM_V1_6_Alignment_BOPT
x) of 
                                           Maybe SAM_V1_6_Alignment_BOPT_Word32
Nothing          -> String
""
                                           Just SAM_V1_6_Alignment_BOPT_Word32
bopt_word32 -> (ByteString -> String
unpack (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$ ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$ [Word8] -> ByteString
pack ([Word8] -> ByteString) -> [Word8] -> ByteString
forall a b. (a -> b) -> a -> b
$ Seq Word8 -> [Word8]
forall a. Seq a -> [a]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList (Seq Word8 -> [Word8]) -> Seq Word8 -> [Word8]
forall a b. (a -> b) -> a -> b
$ SAM_V1_6_Alignment_BOPT_Word32 -> Seq Word8
sam_v1_6_alignment_bopt_word32_tag SAM_V1_6_Alignment_BOPT_Word32
bopt_word32) String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                               String
":"                                                                                    String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                               String
"B"                                                                                    String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                               String
":"                                                                                    String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                               (ByteString -> String
unpack (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$ ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$ Word8 -> ByteString
DB.singleton (Word8 -> ByteString) -> Word8 -> ByteString
forall a b. (a -> b) -> a -> b
$ SAM_V1_6_Alignment_BOPT_Word32 -> Word8
sam_v1_6_alignment_bopt_word32_type SAM_V1_6_Alignment_BOPT_Word32
bopt_word32) String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                               String
","                                                                                    String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                               ([String] -> String
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([String] -> String) -> [String] -> String
forall a b. (a -> b) -> a -> b
$ (Word32 -> String) -> [Word32] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map Word32 -> String
encodeWord32 ([Word32] -> [String]) -> [Word32] -> [String]
forall a b. (a -> b) -> a -> b
$ Seq Word32 -> [Word32]
forall a. Seq a -> [a]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList (Seq Word32 -> [Word32]) -> Seq Word32 -> [Word32]
forall a b. (a -> b) -> a -> b
$ SAM_V1_6_Alignment_BOPT_Word32 -> Seq Word32
sam_v1_6_alignment_bopt_word32_value SAM_V1_6_Alignment_BOPT_Word32
bopt_word32)
    sam_v1_6_alignment_bopt_float_d :: SAM_V1_6_Alignment_BOPT -> String
sam_v1_6_alignment_bopt_float_d SAM_V1_6_Alignment_BOPT
x = case (SAM_V1_6_Alignment_BOPT -> Maybe SAM_V1_6_Alignment_BOPT_Float
sam_v1_6_alignment_bopt_float SAM_V1_6_Alignment_BOPT
x) of 
                                          Maybe SAM_V1_6_Alignment_BOPT_Float
Nothing         -> String
""
                                          Just SAM_V1_6_Alignment_BOPT_Float
bopt_float -> (ByteString -> String
unpack (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$ ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$ [Word8] -> ByteString
pack ([Word8] -> ByteString) -> [Word8] -> ByteString
forall a b. (a -> b) -> a -> b
$ Seq Word8 -> [Word8]
forall a. Seq a -> [a]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList (Seq Word8 -> [Word8]) -> Seq Word8 -> [Word8]
forall a b. (a -> b) -> a -> b
$ SAM_V1_6_Alignment_BOPT_Float -> Seq Word8
sam_v1_6_alignment_bopt_float_tag SAM_V1_6_Alignment_BOPT_Float
bopt_float) String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                             String
":"                                                                                  String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                             String
"B"                                                                                  String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                             String
":"                                                                                  String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                             (ByteString -> String
unpack (ByteString -> String) -> ByteString -> String
forall a b. (a -> b) -> a -> b
$ ByteString -> ByteString
fromStrict (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$ Word8 -> ByteString
DB.singleton (Word8 -> ByteString) -> Word8 -> ByteString
forall a b. (a -> b) -> a -> b
$ SAM_V1_6_Alignment_BOPT_Float -> Word8
sam_v1_6_alignment_bopt_float_type SAM_V1_6_Alignment_BOPT_Float
bopt_float) String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                             String
","                                                                                  String -> String -> String
forall a. [a] -> [a] -> [a]
++
                                                             ([String] -> String
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat ([String] -> String) -> [String] -> String
forall a b. (a -> b) -> a -> b
$ (Float -> String) -> [Float] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map Float -> String
forall a. Show a => a -> String
show ([Float] -> [String]) -> [Float] -> [String]
forall a b. (a -> b) -> a -> b
$ Seq Float -> [Float]
forall a. Seq a -> [a]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList (Seq Float -> [Float]) -> Seq Float -> [Float]
forall a b. (a -> b) -> a -> b
$ SAM_V1_6_Alignment_BOPT_Float -> Seq Float
sam_v1_6_alignment_bopt_float_value SAM_V1_6_Alignment_BOPT_Float
bopt_float)
    encodeWord16 :: Word16 -> [Char]
    encodeWord16 :: Word16 -> String
encodeWord16 = ByteString -> String
unpack (ByteString -> String)
-> (Word16 -> ByteString) -> Word16 -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Word8 -> Bool) -> ByteString -> ByteString
DBL.filter (\Word8
x -> Word8
x Word8 -> Word8 -> Bool
forall a. Eq a => a -> a -> Bool
/= Word8
0) (ByteString -> ByteString)
-> (Word16 -> ByteString) -> Word16 -> ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Builder -> ByteString
toLazyByteString (Builder -> ByteString)
-> (Word16 -> Builder) -> Word16 -> ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word16 -> Builder
word16LE
    encodeWord32 :: Word32 -> [Char]
    encodeWord32 :: Word32 -> String
encodeWord32 = ByteString -> String
unpack (ByteString -> String)
-> (Word32 -> ByteString) -> Word32 -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Word8 -> Bool) -> ByteString -> ByteString
DBL.filter (\Word8
x -> Word8
x Word8 -> Word8 -> Bool
forall a. Eq a => a -> a -> Bool
/= Word8
0) (ByteString -> ByteString)
-> (Word32 -> ByteString) -> Word32 -> ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Builder -> ByteString
toLazyByteString (Builder -> ByteString)
-> (Word32 -> Builder) -> Word32 -> ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word32 -> Builder
word32LE

-- | Write @"SAM_V1_6"@ to a file.
-- Calls deconstructSAM_V1_6.
hPutSAM_V1_6 :: Handle
             -> SAM_V1_6
             -> IO ()
hPutSAM_V1_6 :: Handle -> SAM_V1_6 -> IO ()
hPutSAM_V1_6 Handle
h SAM_V1_6
samv16 = Handle -> String -> IO ()
System.IO.hPutStr Handle
h
                                          (SAM_V1_6 -> String
deconstructSAM_V1_6 SAM_V1_6
samv16)

-- | Write a @"SAM_V1_6"@ to a file.
--
-- See the [SAM v1.6](http://samtools.github.io/hts-specs/SAMv1.pdf) specification documentation.
writeSAM_V1_6 :: FilePath -- ^ Output path to SAM file.
              -> SAM_V1_6
              -> IO ()
writeSAM_V1_6 :: String -> SAM_V1_6 -> IO ()
writeSAM_V1_6 String
fp SAM_V1_6
samv16 = do
  Handle
h <- String -> IOMode -> IO Handle
openFile String
fp
                IOMode
WriteMode
  Handle -> SAM_V1_6 -> IO ()
hPutSAM_V1_6 Handle
h
               SAM_V1_6
samv16
  Handle -> IO ()
hFlush Handle
h
  Handle -> IO ()
hClose Handle
h