hs-samtools 0.8.0.0 → 0.9.0.0
raw patch · 4 files changed
+137/−105 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +5/−0
- hs-samtools.cabal +1/−1
- src/Data/SAM/Version1_6/Write/Base.hs +112/−103
- test/Main.hs +19/−1
CHANGELOG.md view
@@ -88,3 +88,8 @@ * Adding functionality to write SAM_V1_6(..) to file. * Made show instances of many newtypes/datatypes more verbose to match fields of said newtypes/datatypes. * Added initial writeSAM_V1_6 test case.++## 0.8.0.1 -- 2023-10-31++* Fixed BOPT deconstruction in deconstructSAM_V1_6 (writeSAM_V1_6).+* Added extra writeSAM_V1_6 test cases.
hs-samtools.cabal view
@@ -20,7 +20,7 @@ -- PVP summary: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change-version: 0.8.0.0+version: 0.9.0.0 -- A short (one-line) description of the package. synopsis: Read and write SAM, BAM, and CRAM files.
src/Data/SAM/Version1_6/Write/Base.hs view
@@ -33,9 +33,9 @@ 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.Int (Int8,Int16,Int32) import Data.List (intercalate) import Data.Word import Data.ByteString.Builder (toLazyByteString,word16LE,word32LE)@@ -47,7 +47,8 @@ -> String deconstructSAM_V1_6 samv16 = ( intercalate "\n" $- filter (not . null) [ sam_v1_6_file_level_metadata_tos+ Prelude.filter (not . Prelude.null)+ [ sam_v1_6_file_level_metadata_tos , sam_v1_6_reference_sequence_dictionary_tos , sam_v1_6_read_group_tos , sam_v1_6_program_tos@@ -87,13 +88,13 @@ sam_v1_6_file_level_metadata_tos = case (sam_v1_6_file_level_metadata samv16) of Nothing -> "" Just hdf -> intercalate "\t" $- filter (not . null) $- [ "@HD"- , sam_v1_6_file_level_metadata_format_version_tos hdf- , sam_v1_6_file_level_metadata_sorting_order_tos hdf- , sam_v1_6_file_level_metadata_alignment_grouping_tos hdf- , sam_v1_6_file_level_metadata_subsorting_order_tos hdf - ]+ Prelude.filter (not . Prelude.null) $+ [ "@HD"+ , sam_v1_6_file_level_metadata_format_version_tos hdf+ , sam_v1_6_file_level_metadata_sorting_order_tos hdf+ , sam_v1_6_file_level_metadata_alignment_grouping_tos hdf+ , sam_v1_6_file_level_metadata_subsorting_order_tos hdf + ] sam_v1_6_reference_sequence_dictionary_reference_sequence_name_tos x = "SN:" ++ ( unpack $ fromStrict $@@ -166,19 +167,19 @@ Nothing -> "" Just sqf -> intercalate "\n" $ map (\x -> intercalate "\t" $- filter (not .null) $- [ "@SQ"- , sam_v1_6_reference_sequence_dictionary_reference_sequence_name_tos x- , sam_v1_6_reference_sequence_dictionary_reference_sequence_length_tos x- , sam_v1_6_reference_sequence_dictionary_alternative_locus_tos x- , sam_v1_6_reference_sequence_dictionary_alternative_reference_sequence_names_tos x- , sam_v1_6_reference_sequence_dictionary_genome_assembly_identifier_tos x- , sam_v1_6_reference_sequence_dictionary_description_tos x- , sam_v1_6_reference_sequence_dictionary_md5_checksum_tos x- , sam_v1_6_reference_sequence_dictionary_species_tos x- , sam_v1_6_reference_sequence_dictionary_molecule_topology_tos x- , sam_v1_6_reference_sequence_dictionary_uri_tos x- ]+ Prelude.filter (not . Prelude.null) $+ [ "@SQ"+ , sam_v1_6_reference_sequence_dictionary_reference_sequence_name_tos x+ , sam_v1_6_reference_sequence_dictionary_reference_sequence_length_tos x+ , sam_v1_6_reference_sequence_dictionary_alternative_locus_tos x+ , sam_v1_6_reference_sequence_dictionary_alternative_reference_sequence_names_tos x+ , sam_v1_6_reference_sequence_dictionary_genome_assembly_identifier_tos x+ , sam_v1_6_reference_sequence_dictionary_description_tos x+ , sam_v1_6_reference_sequence_dictionary_md5_checksum_tos x+ , sam_v1_6_reference_sequence_dictionary_species_tos x+ , sam_v1_6_reference_sequence_dictionary_molecule_topology_tos x+ , sam_v1_6_reference_sequence_dictionary_uri_tos x+ ] ) (toList sqf) sam_v1_6_read_group_identifer_tos x = "ID:" ++ ( unpack $@@ -281,23 +282,23 @@ Nothing -> "" Just rgf -> intercalate "\n" $ map (\x -> intercalate "\t" $- filter (not . null) $- [ "@RG"- , sam_v1_6_read_group_identifer_tos x- , sam_v1_6_read_group_barcode_sequence_tos x- , sam_v1_6_read_group_sequencing_center_tos x- , sam_v1_6_read_group_description_tos x- , sam_v1_6_read_group_run_date_tos x- , sam_v1_6_read_group_flow_order_tos x- , sam_v1_6_read_group_key_sequence_tos x- , sam_v1_6_read_group_library_tos x- , sam_v1_6_read_group_programs_tos x- , sam_v1_6_read_group_predicted_median_insert_size_tos x- , sam_v1_6_read_group_platform_tos x- , sam_v1_6_read_group_platform_model_tos x- , sam_v1_6_read_group_platform_unit_tos x- , sam_v1_6_read_group_sample_tos x- ]+ Prelude.filter (not . Prelude.null) $+ [ "@RG"+ , sam_v1_6_read_group_identifer_tos x+ , sam_v1_6_read_group_barcode_sequence_tos x+ , sam_v1_6_read_group_sequencing_center_tos x+ , sam_v1_6_read_group_description_tos x+ , sam_v1_6_read_group_run_date_tos x+ , sam_v1_6_read_group_flow_order_tos x+ , sam_v1_6_read_group_key_sequence_tos x+ , sam_v1_6_read_group_library_tos x+ , sam_v1_6_read_group_programs_tos x+ , sam_v1_6_read_group_predicted_median_insert_size_tos x+ , sam_v1_6_read_group_platform_tos x+ , sam_v1_6_read_group_platform_model_tos x+ , sam_v1_6_read_group_platform_unit_tos x+ , sam_v1_6_read_group_sample_tos x+ ] ) (toList rgf) sam_v1_6_program_record_identifier_tos x = "ID:" ++ ( unpack $@@ -343,56 +344,56 @@ sam_v1_6_program_tos = case (sam_v1_6_program samv16) of Nothing -> "" Just pgf -> intercalate "\t" $- filter (not . null) $- [ "@PG"- , sam_v1_6_program_record_identifier_tos pgf- , sam_v1_6_program_name_tos pgf- , sam_v1_6_program_command_line_tos pgf- , sam_v1_6_program_previous_pg_id_tos pgf- , sam_v1_6_program_description_tos pgf- , sam_v1_6_program_version_tos pgf- ]+ Prelude.filter (not . Prelude.null) $+ [ "@PG"+ , sam_v1_6_program_record_identifier_tos pgf+ , sam_v1_6_program_name_tos pgf+ , sam_v1_6_program_command_line_tos pgf+ , sam_v1_6_program_previous_pg_id_tos pgf+ , sam_v1_6_program_description_tos pgf+ , sam_v1_6_program_version_tos pgf+ ] sam_v1_6_one_line_comment_tos = case (sam_v1_6_one_line_comment samv16) of Nothing -> "" Just cof -> intercalate "\n" $ map (\x -> intercalate "\t" $- filter (not . null) - [ "@CO"- , unpack $- fromStrict $- sam_v1_6_one_line_comment_value x- ]+ Prelude.filter (not . Prelude.null) + [ "@CO"+ , unpack $+ fromStrict $+ sam_v1_6_one_line_comment_value x+ ] ) (toList cof) sam_v1_6_alignment_tos = intercalate "\n" $- map (\x -> case (null $ sam_v1_6_alignment_opts x) of+ map (\x -> case (Prelude.null $ sam_v1_6_alignment_opts x) of True -> sam_v1_6_alignment_mand x False -> intercalate "\t" [ sam_v1_6_alignment_mand x , sam_v1_6_alignment_opts x ] ) (toList $ sam_v1_6_alignment samv16) sam_v1_6_alignment_mand x = intercalate "\t" $- filter (not . null)- [ unpack $ fromStrict $ sam_v1_6_alignment_qname x - , show $ sam_v1_6_alignment_flag x - , unpack $ fromStrict $ sam_v1_6_alignment_rname x - , show $ sam_v1_6_alignment_pos x - , show $ sam_v1_6_alignment_mapq x - , unpack $ fromStrict $ sam_v1_6_alignment_cigar x - , unpack $ fromStrict $ sam_v1_6_alignment_rnext x - , show $ sam_v1_6_alignment_pnext x - , show $ sam_v1_6_alignment_tlen x - , unpack $ fromStrict $ sam_v1_6_alignment_seq x - , unpack $ fromStrict $ sam_v1_6_alignment_qual x- ]+ Prelude.filter (not . Prelude.null)+ [ unpack $ fromStrict $ sam_v1_6_alignment_qname x + , show $ sam_v1_6_alignment_flag x + , unpack $ fromStrict $ sam_v1_6_alignment_rname x + , show $ sam_v1_6_alignment_pos x + , show $ sam_v1_6_alignment_mapq x + , unpack $ fromStrict $ sam_v1_6_alignment_cigar x + , unpack $ fromStrict $ sam_v1_6_alignment_rnext x + , show $ sam_v1_6_alignment_pnext x + , show $ sam_v1_6_alignment_tlen x + , unpack $ fromStrict $ sam_v1_6_alignment_seq x + , unpack $ fromStrict $ sam_v1_6_alignment_qual x+ ] sam_v1_6_alignment_opts x = intercalate "\t" $- filter (not . null)- [ sam_v1_6_alignment_aopt_d x - , sam_v1_6_alignment_iopt_d x - , sam_v1_6_alignment_fopt_d x - , sam_v1_6_alignment_zopt_d x- , sam_v1_6_alignment_hopt_d x - , sam_v1_6_alignment_bopt_d x- ]+ Prelude.filter (not . Prelude.null)+ [ sam_v1_6_alignment_aopt_d x + , sam_v1_6_alignment_iopt_d x + , sam_v1_6_alignment_fopt_d x + , sam_v1_6_alignment_zopt_d x+ , sam_v1_6_alignment_hopt_d x + , sam_v1_6_alignment_bopt_d x+ ] sam_v1_6_alignment_aopt_d x = case (sam_v1_6_alignment_aopt x) of Nothing -> "" Just aopt -> ( unpack $@@ -459,74 +460,82 @@ sam_v1_6_alignment_bopt_d x = case (sam_v1_6_alignment_bopt x) of Nothing -> "" Just bopt -> concat $- filter (not . null)- [ sam_v1_6_alignment_bopt_int8_d bopt- , sam_v1_6_alignment_bopt_word8_d bopt- , sam_v1_6_alignment_bopt_int16_d bopt- , sam_v1_6_alignment_bopt_word16_d bopt- , sam_v1_6_alignment_bopt_int32_d bopt- , sam_v1_6_alignment_bopt_word32_d bopt- , sam_v1_6_alignment_bopt_float_d bopt- ]+ Prelude.filter (not . Prelude.null)+ [ sam_v1_6_alignment_bopt_int8_d bopt+ , sam_v1_6_alignment_bopt_word8_d bopt+ , sam_v1_6_alignment_bopt_int16_d bopt+ , sam_v1_6_alignment_bopt_word16_d bopt+ , sam_v1_6_alignment_bopt_int32_d bopt+ , sam_v1_6_alignment_bopt_word32_d bopt+ , sam_v1_6_alignment_bopt_float_d bopt+ ] sam_v1_6_alignment_bopt_int8_d x = case (sam_v1_6_alignment_bopt_int8 x) of Nothing -> "" Just bopt_int8 -> (unpack $ fromStrict $ pack $ toList $ sam_v1_6_alignment_bopt_int8_tag bopt_int8) ++ ":" ++- (unpack $ fromStrict $ singleton $ sam_v1_6_alignment_bopt_int8_type bopt_int8) +++ "B" ++ ":" ++- (concat $ map encodeInt8 $ toList $ sam_v1_6_alignment_bopt_int8_value bopt_int8)+ (unpack $ fromStrict $ DB.singleton $ sam_v1_6_alignment_bopt_int8_type bopt_int8) +++ "," +++ (concat $ map show $ toList $ sam_v1_6_alignment_bopt_int8_value bopt_int8) sam_v1_6_alignment_bopt_word8_d x = case (sam_v1_6_alignment_bopt_word8 x) of Nothing -> "" Just bopt_word8 -> (unpack $ fromStrict $ pack $ toList $ sam_v1_6_alignment_bopt_word8_tag bopt_word8) ++ ":" ++- (unpack $ fromStrict $ singleton $ sam_v1_6_alignment_bopt_word8_type bopt_word8) +++ "B" ++ ":" +++ (unpack $ fromStrict $ DB.singleton $ sam_v1_6_alignment_bopt_word8_type bopt_word8) +++ "," ++ (unpack $ fromStrict $ pack $ toList $ sam_v1_6_alignment_bopt_word8_value bopt_word8) sam_v1_6_alignment_bopt_int16_d x = case (sam_v1_6_alignment_bopt_int16 x) of Nothing -> "" Just bopt_int16 -> (unpack $ fromStrict $ pack $ toList $ sam_v1_6_alignment_bopt_int16_tag bopt_int16) ++ ":" ++- (unpack $ fromStrict $ singleton $ sam_v1_6_alignment_bopt_int16_type bopt_int16) +++ "B" ++ ":" ++- (concat $ map encodeInt16 $ toList $ sam_v1_6_alignment_bopt_int16_value bopt_int16)+ (unpack $ fromStrict $ DB.singleton $ sam_v1_6_alignment_bopt_int16_type bopt_int16) +++ "," +++ (concat $ map show $ toList $ sam_v1_6_alignment_bopt_int16_value bopt_int16) sam_v1_6_alignment_bopt_word16_d x = case (sam_v1_6_alignment_bopt_word16 x) of Nothing -> "" Just bopt_word16 -> (unpack $ fromStrict $ pack $ toList $ sam_v1_6_alignment_bopt_word16_tag bopt_word16) ++ ":" ++- (unpack $ fromStrict $ singleton $ sam_v1_6_alignment_bopt_word16_type bopt_word16) +++ "B" ++ ":" +++ (unpack $ fromStrict $ DB.singleton $ sam_v1_6_alignment_bopt_word16_type bopt_word16) +++ "," ++ (concat $ map encodeWord16 $ toList $ sam_v1_6_alignment_bopt_word16_value bopt_word16) sam_v1_6_alignment_bopt_int32_d x = case (sam_v1_6_alignment_bopt_int32 x) of Nothing -> "" Just bopt_int32 -> (unpack $ fromStrict $ pack $ toList $ sam_v1_6_alignment_bopt_int32_tag bopt_int32) ++ ":" ++- (unpack $ fromStrict $ singleton $ sam_v1_6_alignment_bopt_int32_type bopt_int32) +++ "B" ++ ":" ++- (concat $ map encodeInt32 $ toList $ sam_v1_6_alignment_bopt_int32_value bopt_int32)+ (unpack $ fromStrict $ DB.singleton $ sam_v1_6_alignment_bopt_int32_type bopt_int32) +++ "," +++ (concat $ map show $ toList $ sam_v1_6_alignment_bopt_int32_value bopt_int32) sam_v1_6_alignment_bopt_word32_d x = case (sam_v1_6_alignment_bopt_word32 x) of Nothing -> "" Just bopt_word32 -> (unpack $ fromStrict $ pack $ toList $ sam_v1_6_alignment_bopt_word32_tag bopt_word32) ++ ":" ++- (unpack $ fromStrict $ singleton $ sam_v1_6_alignment_bopt_word32_type bopt_word32) +++ "B" ++ ":" +++ (unpack $ fromStrict $ DB.singleton $ sam_v1_6_alignment_bopt_word32_type bopt_word32) +++ "," ++ (concat $ map encodeWord32 $ toList $ sam_v1_6_alignment_bopt_word32_value bopt_word32) sam_v1_6_alignment_bopt_float_d x = case (sam_v1_6_alignment_bopt_float x) of Nothing -> "" Just bopt_float -> (unpack $ fromStrict $ pack $ toList $ sam_v1_6_alignment_bopt_float_tag bopt_float) ++ ":" ++- (unpack $ fromStrict $ singleton $ sam_v1_6_alignment_bopt_float_type bopt_float) +++ "B" ++ ":" +++ (unpack $ fromStrict $ DB.singleton $ sam_v1_6_alignment_bopt_float_type bopt_float) +++ "," ++ (concat $ map show $ toList $ sam_v1_6_alignment_bopt_float_value bopt_float)- encodeInt8 :: Int8 -> [Char]- encodeInt8 = show- encodeInt16 :: Int16 -> [Char]- encodeInt16 = show encodeWord16 :: Word16 -> [Char]- encodeWord16 = unpack . toLazyByteString . word16LE- encodeInt32 :: Int32 -> [Char]- encodeInt32 = show+ encodeWord16 = unpack . DBL.filter (\x -> x /= 0) . toLazyByteString . word16LE encodeWord32 :: Word32 -> [Char]- encodeWord32 = unpack . toLazyByteString . word32LE+ encodeWord32 = unpack . DBL.filter (\x -> x /= 0) . toLazyByteString . word32LE -- | Write @"SAM_V1_6"@ to a file. -- Calls deconstructSAM_V1_6.
test/Main.hs view
@@ -31,12 +31,30 @@ readSAM_V1_6 "test/examples/toy1.sam" `shouldReturn` toy1sam describe "Data.SAM.Version1_6.Write.Base" $ do describe "writeSAM_V1_6" $ do+ describe "toy5.sam" $ do+ it "Ensures writeSAM_V1_6 produces the a sam file equivalent to what was parsed via readSAM_V1_6." $ do+ toy5 <- readSAM_V1_6 "test/examples/toy5.sam"+ writeSAM_V1_6 "test/examples/toy5f.sam" toy5+ toy5f <- readSAM_V1_6 "test/examples/toy5f.sam"+ toy5 `shouldBe` toy5f+ describe "toy4.sam" $ do+ it "Ensures writeSAM_V1_6 produces the a sam file equivalent to what was parsed via readSAM_V1_6." $ do+ toy4 <- readSAM_V1_6 "test/examples/toy4.sam"+ writeSAM_V1_6 "test/examples/toy4f.sam" toy4+ toy4f <- readSAM_V1_6 "test/examples/toy4f.sam"+ toy4 `shouldBe` toy4f describe "toy2.sam" $ do it "Ensures writeSAM_V1_6 produces the a sam file equivalent to what was parsed via readSAM_V1_6." $ do toy2 <- readSAM_V1_6 "test/examples/toy2.sam" writeSAM_V1_6 "test/examples/toy2f.sam" toy2 toy2f <- readSAM_V1_6 "test/examples/toy2f.sam"- toy2 `shouldBe` toy2f + toy2 `shouldBe` toy2f+ describe "toy1.sam" $ do+ it "Ensures writeSAM_V1_6 produces the a sam file equivalent to what was parsed via readSAM_V1_6." $ do+ toy1 <- readSAM_V1_6 "test/examples/toy1.sam"+ writeSAM_V1_6 "test/examples/toy1f.sam" toy1+ toy1f <- readSAM_V1_6 "test/examples/toy1f.sam"+ toy1 `shouldBe` toy1f where toy1sam = SAM_V1_6 { sam_v1_6_file_level_metadata = Nothing , sam_v1_6_reference_sequence_dictionary = Just (fromList [SAM_V1_6_Reference_Sequence_Dictionary { sam_v1_6_reference_sequence_dictionary_reference_sequence_name = SAM_V1_6_Reference_Sequence_Dictionary_Reference_Sequence_Name { sam_v1_6_reference_sequence_dictionary_reference_sequence_name_value = fromString "ref" } , sam_v1_6_reference_sequence_dictionary_reference_sequence_length = SAM_V1_6_Reference_Sequence_Dictionary_Reference_Sequence_Length { sam_v1_6_reference_sequence_dictionary_reference_sequence_length_value = fromString "45" } , sam_v1_6_reference_sequence_dictionary_alternative_locus = Nothing , sam_v1_6_reference_sequence_dictionary_alternative_reference_sequence_names = Nothing , sam_v1_6_reference_sequence_dictionary_genome_assembly_identifier = Nothing , sam_v1_6_reference_sequence_dictionary_description = Nothing , sam_v1_6_reference_sequence_dictionary_md5_checksum = Nothing , sam_v1_6_reference_sequence_dictionary_species = Nothing , sam_v1_6_reference_sequence_dictionary_molecule_topology = Nothing , sam_v1_6_reference_sequence_dictionary_uri = Nothing },SAM_V1_6_Reference_Sequence_Dictionary { sam_v1_6_reference_sequence_dictionary_reference_sequence_name = SAM_V1_6_Reference_Sequence_Dictionary_Reference_Sequence_Name { sam_v1_6_reference_sequence_dictionary_reference_sequence_name_value = fromString "ref2" } , sam_v1_6_reference_sequence_dictionary_reference_sequence_length = SAM_V1_6_Reference_Sequence_Dictionary_Reference_Sequence_Length { sam_v1_6_reference_sequence_dictionary_reference_sequence_length_value = fromString "40" } , sam_v1_6_reference_sequence_dictionary_alternative_locus = Nothing , sam_v1_6_reference_sequence_dictionary_alternative_reference_sequence_names = Nothing , sam_v1_6_reference_sequence_dictionary_genome_assembly_identifier = Nothing , sam_v1_6_reference_sequence_dictionary_description = Nothing , sam_v1_6_reference_sequence_dictionary_md5_checksum = Nothing , sam_v1_6_reference_sequence_dictionary_species = Nothing , sam_v1_6_reference_sequence_dictionary_molecule_topology = Nothing , sam_v1_6_reference_sequence_dictionary_uri = Nothing }]) , sam_v1_6_read_group = Nothing , sam_v1_6_program = Nothing , sam_v1_6_one_line_comment = Nothing , sam_v1_6_alignment = fromList [SAM_V1_6_Alignment { sam_v1_6_alignment_qname = fromString "r001" , sam_v1_6_alignment_flag = 163 , sam_v1_6_alignment_rname = fromString "ref" , sam_v1_6_alignment_pos = 7 , sam_v1_6_alignment_mapq = 30 , sam_v1_6_alignment_cigar = fromString "8M4I4M1D3M" , sam_v1_6_alignment_rnext = fromString "=" , sam_v1_6_alignment_pnext = 37 , sam_v1_6_alignment_tlen = 39 , sam_v1_6_alignment_seq = fromString "TTAGATAAAGAGGATACTG" , sam_v1_6_alignment_qual = fromString "*" , sam_v1_6_alignment_aopt = Nothing , sam_v1_6_alignment_iopt = Nothing , sam_v1_6_alignment_fopt = Nothing , sam_v1_6_alignment_zopt = Nothing , sam_v1_6_alignment_hopt = Nothing , sam_v1_6_alignment_bopt = Just SAM_V1_6_Alignment_BOPT { sam_v1_6_alignment_bopt_int8 = Nothing , sam_v1_6_alignment_bopt_word8 = Nothing , sam_v1_6_alignment_bopt_int16 = Nothing , sam_v1_6_alignment_bopt_word16 = Just SAM_V1_6_Alignment_BOPT_Word16 { sam_v1_6_alignment_bopt_word16_tag = fromList [88,88] , sam_v1_6_alignment_bopt_word16_type = 83 , sam_v1_6_alignment_bopt_word16_value = fromList [49,50,53,54,49,44,50,44,50,48,44,49,49,50] } , sam_v1_6_alignment_bopt_int32 = Nothing , sam_v1_6_alignment_bopt_word32 = Nothing , sam_v1_6_alignment_bopt_float = Nothing } },SAM_V1_6_Alignment { sam_v1_6_alignment_qname = fromString "r002" , sam_v1_6_alignment_flag = 0 , sam_v1_6_alignment_rname = fromString "ref" , sam_v1_6_alignment_pos = 9 , sam_v1_6_alignment_mapq = 30 , sam_v1_6_alignment_cigar = fromString "1S2I6M1P1I1P1I4M2I" , sam_v1_6_alignment_rnext = fromString "*" , sam_v1_6_alignment_pnext = 0 , sam_v1_6_alignment_tlen = 0 , sam_v1_6_alignment_seq = fromString "AAAAGATAAGGGATAAA" , sam_v1_6_alignment_qual = fromString "*" , sam_v1_6_alignment_aopt = Nothing , sam_v1_6_alignment_iopt = Nothing , sam_v1_6_alignment_fopt = Nothing , sam_v1_6_alignment_zopt = Nothing , sam_v1_6_alignment_hopt = Nothing , sam_v1_6_alignment_bopt = Nothing },SAM_V1_6_Alignment { sam_v1_6_alignment_qname = fromString "r003" , sam_v1_6_alignment_flag = 0 , sam_v1_6_alignment_rname = fromString "ref" , sam_v1_6_alignment_pos = 9 , sam_v1_6_alignment_mapq = 30 , sam_v1_6_alignment_cigar = fromString "5H6M" , sam_v1_6_alignment_rnext = fromString "*" , sam_v1_6_alignment_pnext = 0 , sam_v1_6_alignment_tlen = 0 , sam_v1_6_alignment_seq = fromString "AGCTAA" , sam_v1_6_alignment_qual = fromString "*" , sam_v1_6_alignment_aopt = Nothing , sam_v1_6_alignment_iopt = Nothing , sam_v1_6_alignment_fopt = Nothing , sam_v1_6_alignment_zopt = Nothing , sam_v1_6_alignment_hopt = Nothing , sam_v1_6_alignment_bopt = Nothing },SAM_V1_6_Alignment { sam_v1_6_alignment_qname = fromString "r004" , sam_v1_6_alignment_flag = 0 , sam_v1_6_alignment_rname = fromString "ref" , sam_v1_6_alignment_pos = 16 , sam_v1_6_alignment_mapq = 30 , sam_v1_6_alignment_cigar = fromString "6M14N1I5M" , sam_v1_6_alignment_rnext = fromString "*" , sam_v1_6_alignment_pnext = 0 , sam_v1_6_alignment_tlen = 0 , sam_v1_6_alignment_seq = fromString "ATAGCTCTCAGC" , sam_v1_6_alignment_qual = fromString "*" , sam_v1_6_alignment_aopt = Nothing , sam_v1_6_alignment_iopt = Nothing , sam_v1_6_alignment_fopt = Nothing , sam_v1_6_alignment_zopt = Nothing , sam_v1_6_alignment_hopt = Nothing , sam_v1_6_alignment_bopt = Nothing },SAM_V1_6_Alignment { sam_v1_6_alignment_qname = fromString "r003" , sam_v1_6_alignment_flag = 16 , sam_v1_6_alignment_rname = fromString "ref" , sam_v1_6_alignment_pos = 29 , sam_v1_6_alignment_mapq = 30 , sam_v1_6_alignment_cigar = fromString "6H5M" , sam_v1_6_alignment_rnext = fromString "*" , sam_v1_6_alignment_pnext = 0 , sam_v1_6_alignment_tlen = 0 , sam_v1_6_alignment_seq = fromString "TAGGC" , sam_v1_6_alignment_qual = fromString "*" , sam_v1_6_alignment_aopt = Nothing , sam_v1_6_alignment_iopt = Nothing , sam_v1_6_alignment_fopt = Nothing , sam_v1_6_alignment_zopt = Nothing , sam_v1_6_alignment_hopt = Nothing , sam_v1_6_alignment_bopt = Nothing },SAM_V1_6_Alignment { sam_v1_6_alignment_qname = fromString "r001" , sam_v1_6_alignment_flag = 83 , sam_v1_6_alignment_rname = fromString "ref" , sam_v1_6_alignment_pos = 37 , sam_v1_6_alignment_mapq = 30 , sam_v1_6_alignment_cigar = fromString "9M" , sam_v1_6_alignment_rnext = fromString "=" , sam_v1_6_alignment_pnext = 7 , sam_v1_6_alignment_tlen = -39 , sam_v1_6_alignment_seq = fromString "CAGCGCCAT" , sam_v1_6_alignment_qual = fromString "*" , sam_v1_6_alignment_aopt = Nothing , sam_v1_6_alignment_iopt = Nothing , sam_v1_6_alignment_fopt = Nothing , sam_v1_6_alignment_zopt = Nothing , sam_v1_6_alignment_hopt = Nothing , sam_v1_6_alignment_bopt = Nothing },SAM_V1_6_Alignment { sam_v1_6_alignment_qname = fromString "x1" , sam_v1_6_alignment_flag = 0 , sam_v1_6_alignment_rname = fromString "ref2" , sam_v1_6_alignment_pos = 1 , sam_v1_6_alignment_mapq = 30 , sam_v1_6_alignment_cigar = fromString "20M" , sam_v1_6_alignment_rnext = fromString "*" , sam_v1_6_alignment_pnext = 0 , sam_v1_6_alignment_tlen = 0 , sam_v1_6_alignment_seq = fromString "aggttttataaaacaaataa" , sam_v1_6_alignment_qual = fromString "????????????????????" , sam_v1_6_alignment_aopt = Nothing , sam_v1_6_alignment_iopt = Nothing , sam_v1_6_alignment_fopt = Nothing , sam_v1_6_alignment_zopt = Nothing , sam_v1_6_alignment_hopt = Nothing , sam_v1_6_alignment_bopt = Nothing },SAM_V1_6_Alignment { sam_v1_6_alignment_qname = fromString "x2" , sam_v1_6_alignment_flag = 0 , sam_v1_6_alignment_rname = fromString "ref2" , sam_v1_6_alignment_pos = 2 , sam_v1_6_alignment_mapq = 30 , sam_v1_6_alignment_cigar = fromString "21M" , sam_v1_6_alignment_rnext = fromString "*" , sam_v1_6_alignment_pnext = 0 , sam_v1_6_alignment_tlen = 0 , sam_v1_6_alignment_seq = fromString "ggttttataaaacaaataatt" , sam_v1_6_alignment_qual = fromString "?????????????????????" , sam_v1_6_alignment_aopt = Nothing , sam_v1_6_alignment_iopt = Nothing , sam_v1_6_alignment_fopt = Nothing , sam_v1_6_alignment_zopt = Nothing , sam_v1_6_alignment_hopt = Nothing , sam_v1_6_alignment_bopt = Nothing },SAM_V1_6_Alignment { sam_v1_6_alignment_qname = fromString "x3" , sam_v1_6_alignment_flag = 0 , sam_v1_6_alignment_rname = fromString "ref2" , sam_v1_6_alignment_pos = 6 , sam_v1_6_alignment_mapq = 30 , sam_v1_6_alignment_cigar = fromString "9M4I13M" , sam_v1_6_alignment_rnext = fromString "*" , sam_v1_6_alignment_pnext = 0 , sam_v1_6_alignment_tlen = 0 , sam_v1_6_alignment_seq = fromString "ttataaaacAAATaattaagtctaca" , sam_v1_6_alignment_qual = fromString "??????????????????????????" , sam_v1_6_alignment_aopt = Nothing , sam_v1_6_alignment_iopt = Nothing , sam_v1_6_alignment_fopt = Nothing , sam_v1_6_alignment_zopt = Nothing , sam_v1_6_alignment_hopt = Nothing , sam_v1_6_alignment_bopt = Nothing },SAM_V1_6_Alignment { sam_v1_6_alignment_qname = fromString "x4" , sam_v1_6_alignment_flag = 0 , sam_v1_6_alignment_rname = fromString "ref2" , sam_v1_6_alignment_pos = 10 , sam_v1_6_alignment_mapq = 30 , sam_v1_6_alignment_cigar = fromString "25M" , sam_v1_6_alignment_rnext = fromString "*" , sam_v1_6_alignment_pnext = 0 , sam_v1_6_alignment_tlen = 0 , sam_v1_6_alignment_seq = fromString "CaaaTaattaagtctacagagcaac" , sam_v1_6_alignment_qual = fromString "?????????????????????????" , sam_v1_6_alignment_aopt = Nothing , sam_v1_6_alignment_iopt = Nothing , sam_v1_6_alignment_fopt = Nothing , sam_v1_6_alignment_zopt = Nothing , sam_v1_6_alignment_hopt = Nothing , sam_v1_6_alignment_bopt = Nothing },SAM_V1_6_Alignment { sam_v1_6_alignment_qname = fromString "x5" , sam_v1_6_alignment_flag = 0 , sam_v1_6_alignment_rname = fromString "ref2" , sam_v1_6_alignment_pos = 12 , sam_v1_6_alignment_mapq = 30 , sam_v1_6_alignment_cigar = fromString "24M" , sam_v1_6_alignment_rnext = fromString "*" , sam_v1_6_alignment_pnext = 0 , sam_v1_6_alignment_tlen = 0 , sam_v1_6_alignment_seq = fromString "aaTaattaagtctacagagcaact" , sam_v1_6_alignment_qual = fromString "????????????????????????" , sam_v1_6_alignment_aopt = Nothing , sam_v1_6_alignment_iopt = Nothing , sam_v1_6_alignment_fopt = Nothing , sam_v1_6_alignment_zopt = Nothing , sam_v1_6_alignment_hopt = Nothing , sam_v1_6_alignment_bopt = Nothing },SAM_V1_6_Alignment { sam_v1_6_alignment_qname = fromString "x6" , sam_v1_6_alignment_flag = 0 , sam_v1_6_alignment_rname = fromString "ref2" , sam_v1_6_alignment_pos = 14 , sam_v1_6_alignment_mapq = 30 , sam_v1_6_alignment_cigar = fromString "23M" , sam_v1_6_alignment_rnext = fromString "*" , sam_v1_6_alignment_pnext = 0 , sam_v1_6_alignment_tlen = 0 , sam_v1_6_alignment_seq = fromString "Taattaagtctacagagcaacta" , sam_v1_6_alignment_qual = fromString "???????????????????????" , sam_v1_6_alignment_aopt = Nothing , sam_v1_6_alignment_iopt = Nothing , sam_v1_6_alignment_fopt = Nothing , sam_v1_6_alignment_zopt = Nothing , sam_v1_6_alignment_hopt = Nothing , sam_v1_6_alignment_bopt = Nothing }] } toy2sam = SAM_V1_6 { sam_v1_6_file_level_metadata = Just 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_format_version_value = fromString "1.6" } , sam_v1_6_file_level_metadata_sorting_order = Just SAM_V1_6_File_Level_Metadata_Sorting_Order { sam_v1_6_file_level_metadata_sorting_order_value = fromString "coordinate" } , sam_v1_6_file_level_metadata_alignment_grouping = Nothing , sam_v1_6_file_level_metadata_subsorting_order = Nothing } , sam_v1_6_reference_sequence_dictionary = Just (fromList [SAM_V1_6_Reference_Sequence_Dictionary { sam_v1_6_reference_sequence_dictionary_reference_sequence_name = SAM_V1_6_Reference_Sequence_Dictionary_Reference_Sequence_Name { sam_v1_6_reference_sequence_dictionary_reference_sequence_name_value = fromString "ref" } , sam_v1_6_reference_sequence_dictionary_reference_sequence_length = SAM_V1_6_Reference_Sequence_Dictionary_Reference_Sequence_Length { sam_v1_6_reference_sequence_dictionary_reference_sequence_length_value = fromString "45" } , sam_v1_6_reference_sequence_dictionary_alternative_locus = Nothing , sam_v1_6_reference_sequence_dictionary_alternative_reference_sequence_names = Nothing , sam_v1_6_reference_sequence_dictionary_genome_assembly_identifier = Nothing , sam_v1_6_reference_sequence_dictionary_description = Nothing , sam_v1_6_reference_sequence_dictionary_md5_checksum = Nothing , sam_v1_6_reference_sequence_dictionary_species = Nothing , sam_v1_6_reference_sequence_dictionary_molecule_topology = Nothing , sam_v1_6_reference_sequence_dictionary_uri = Nothing }]) , sam_v1_6_read_group = Nothing , sam_v1_6_program = Nothing , sam_v1_6_one_line_comment = Nothing , sam_v1_6_alignment = fromList [SAM_V1_6_Alignment { sam_v1_6_alignment_qname = fromString "r001" , sam_v1_6_alignment_flag = 99 , sam_v1_6_alignment_rname = fromString "ref" , sam_v1_6_alignment_pos = 7 , sam_v1_6_alignment_mapq = 30 , sam_v1_6_alignment_cigar = fromString "8M2I4M1D3M" , sam_v1_6_alignment_rnext = fromString "=" , sam_v1_6_alignment_pnext = 37 , sam_v1_6_alignment_tlen = 39 , sam_v1_6_alignment_seq = fromString "TTAGATAAAGGATACTG" , sam_v1_6_alignment_qual = fromString "*" , sam_v1_6_alignment_aopt = Nothing , sam_v1_6_alignment_iopt = Nothing , sam_v1_6_alignment_fopt = Nothing , sam_v1_6_alignment_zopt = Nothing , sam_v1_6_alignment_hopt = Nothing , sam_v1_6_alignment_bopt = Nothing },SAM_V1_6_Alignment { sam_v1_6_alignment_qname = fromString "r002" , sam_v1_6_alignment_flag = 0 , sam_v1_6_alignment_rname = fromString "ref" , sam_v1_6_alignment_pos = 9 , sam_v1_6_alignment_mapq = 30 , sam_v1_6_alignment_cigar = fromString "3S6M1P1I4M" , sam_v1_6_alignment_rnext = fromString "*" , sam_v1_6_alignment_pnext = 0 , sam_v1_6_alignment_tlen = 0 , sam_v1_6_alignment_seq = fromString "AAAAGATAAGGATA" , sam_v1_6_alignment_qual = fromString "*" , sam_v1_6_alignment_aopt = Nothing , sam_v1_6_alignment_iopt = Nothing , sam_v1_6_alignment_fopt = Nothing , sam_v1_6_alignment_zopt = Nothing , sam_v1_6_alignment_hopt = Nothing , sam_v1_6_alignment_bopt = Nothing },SAM_V1_6_Alignment { sam_v1_6_alignment_qname = fromString "r003" , sam_v1_6_alignment_flag = 0 , sam_v1_6_alignment_rname = fromString "ref" , sam_v1_6_alignment_pos = 9 , sam_v1_6_alignment_mapq = 30 , sam_v1_6_alignment_cigar = fromString "5S6M" , sam_v1_6_alignment_rnext = fromString "*" , sam_v1_6_alignment_pnext = 0 , sam_v1_6_alignment_tlen = 0 , sam_v1_6_alignment_seq = fromString "GCCTAAGCTAA" , sam_v1_6_alignment_qual = fromString "*" , sam_v1_6_alignment_aopt = Nothing , sam_v1_6_alignment_iopt = Nothing , sam_v1_6_alignment_fopt = Nothing , sam_v1_6_alignment_zopt = Just SAM_V1_6_Alignment_ZOPT { sam_v1_6_alignment_zopt_tag = fromString "SA" , sam_v1_6_alignment_zopt_value = fromString "ref,29,-,6H5M,17,0;" } , sam_v1_6_alignment_hopt = Nothing , sam_v1_6_alignment_bopt = Nothing },SAM_V1_6_Alignment { sam_v1_6_alignment_qname = fromString "r004" , sam_v1_6_alignment_flag = 0 , sam_v1_6_alignment_rname = fromString "ref" , sam_v1_6_alignment_pos = 16 , sam_v1_6_alignment_mapq = 30 , sam_v1_6_alignment_cigar = fromString "6M14N5M" , sam_v1_6_alignment_rnext = fromString "*" , sam_v1_6_alignment_pnext = 0 , sam_v1_6_alignment_tlen = 0 , sam_v1_6_alignment_seq = fromString "ATAGCTTCAGC" , sam_v1_6_alignment_qual = fromString "*" , sam_v1_6_alignment_aopt = Nothing , sam_v1_6_alignment_iopt = Nothing , sam_v1_6_alignment_fopt = Nothing , sam_v1_6_alignment_zopt = Nothing , sam_v1_6_alignment_hopt = Nothing , sam_v1_6_alignment_bopt = Nothing },SAM_V1_6_Alignment { sam_v1_6_alignment_qname = fromString "r003" , sam_v1_6_alignment_flag = 2064 , sam_v1_6_alignment_rname = fromString "ref" , sam_v1_6_alignment_pos = 29 , sam_v1_6_alignment_mapq = 17 , sam_v1_6_alignment_cigar = fromString "6H5M" , sam_v1_6_alignment_rnext = fromString "*" , sam_v1_6_alignment_pnext = 0 , sam_v1_6_alignment_tlen = 0 , sam_v1_6_alignment_seq = fromString "TAGGC" , sam_v1_6_alignment_qual = fromString "*" , sam_v1_6_alignment_aopt = Nothing , sam_v1_6_alignment_iopt = Nothing , sam_v1_6_alignment_fopt = Nothing , sam_v1_6_alignment_zopt = Just SAM_V1_6_Alignment_ZOPT { sam_v1_6_alignment_zopt_tag = fromString "SA" , sam_v1_6_alignment_zopt_value = fromString "ref,9,+,5S6M,30,1;" } , sam_v1_6_alignment_hopt = Nothing , sam_v1_6_alignment_bopt = Nothing },SAM_V1_6_Alignment { sam_v1_6_alignment_qname = fromString "r001" , sam_v1_6_alignment_flag = 147 , sam_v1_6_alignment_rname = fromString "ref" , sam_v1_6_alignment_pos = 37 , sam_v1_6_alignment_mapq = 30 , sam_v1_6_alignment_cigar = fromString "9M" , sam_v1_6_alignment_rnext = fromString "=" , sam_v1_6_alignment_pnext = 7 , sam_v1_6_alignment_tlen = -39 , sam_v1_6_alignment_seq = fromString "CAGCGGCAT" , sam_v1_6_alignment_qual = fromString "*" , sam_v1_6_alignment_aopt = Nothing , sam_v1_6_alignment_iopt = Just SAM_V1_6_Alignment_IOPT { sam_v1_6_alignment_iopt_tag = fromString "NM" , sam_v1_6_alignment_iopt_value = 1 } , sam_v1_6_alignment_fopt = Nothing , sam_v1_6_alignment_zopt = Nothing , sam_v1_6_alignment_hopt = Nothing , sam_v1_6_alignment_bopt = Nothing }] }