heatitup-complete 0.5.4.0 → 0.5.4.1
raw patch · 3 files changed
+14/−9 lines, 3 files
Files
- heatitup-complete.cabal +1/−1
- src/Merge.hs +2/−3
- src/Utility.hs +11/−5
heatitup-complete.cabal view
@@ -1,5 +1,5 @@ name: heatitup-complete-version: 0.5.4.0+version: 0.5.4.1 synopsis: Find and annotate ITDs with assembly or read pair joining. description: Find and annotate ITDs with assembly or read pair joining using suffix trees and characterize the exogenous segments within the spacer using heat diffusion. homepage: http://github.com/GregorySchwartz/heatitup-complete#readme
src/Merge.hs view
@@ -88,7 +88,7 @@ -- supplementary alignments. mergePair :: Fill -> [BamRow] -> Maybe BamRow mergePair fill xs =- case filter (not . isSupplementary) xs of+ case filter valid xs of [] -> Nothing [x] -> Just x [BamRow left, BamRow right] ->@@ -103,8 +103,7 @@ posSeq xs = ( either error (Position . fst) . T.decimal $ xs !! 3 , Sequence $ xs !! 9 )- isSupplementary =- (== "1") . drop 11 . decodeSAMFlag . read . T.unpack . (!! 1) . unBamRow+ valid x = not (checkSamFlag 2048 x) && not (checkSamFlag 256 x) -- Make sure not supplementary nor not primary -- | Merge all mate pairs. Assumes that the lines are sorted by mate pair already -- (samtools sort -n).
src/Utility.hs view
@@ -15,15 +15,15 @@ , fastaToMap , getMatchMap , nub'- , decodeSAMFlag+ , checkSamFlag ) where -- Standard+import Data.Bits ((.&.)) import Data.Bool import Data.Char import Data.Maybe import Data.Monoid-import Numeric import qualified Data.ByteString.Char8 as B import qualified Data.Map.Strict as Map import qualified Data.Set as Set@@ -31,6 +31,7 @@ -- Cabal import qualified Control.Foldl as Fold import qualified Data.Text as T+import qualified Data.Text.Read as T import Data.Fasta.Text import Safe import Turtle.Line@@ -100,6 +101,11 @@ nub' :: (Eq a, Ord a) => [a] -> [a] nub' = Set.toList . Set.fromList --- | Decode a SAM flag into the bit representation (as a string).-decodeSAMFlag :: Int -> String-decodeSAMFlag x = showIntAtBase 2 intToDigit x ""+-- | Decode a SAM flag to check a property of the read.+checkSamFlag :: Int -> BamRow -> Bool+checkSamFlag property = (== property)+ . (.&.) property+ . either error fst+ . T.decimal+ . (!! 1)+ . unBamRow