heatitup 0.5.3.3 → 0.5.4.0
raw patch · 5 files changed
+40/−22 lines, 5 files
Files
- app/Main.hs +8/−0
- heatitup.cabal +2/−2
- src/Diffusion.hs +5/−5
- src/Spacer.hs +15/−7
- src/Utility.hs +10/−8
app/Main.hs view
@@ -63,6 +63,7 @@ , refField :: Int , posField :: Maybe Int , ignoreField :: Maybe Int+ , ignoreChar :: Maybe String , inputMinSize :: Int , gaussWindow :: Int , gaussTime :: Double@@ -181,6 +182,12 @@ \ and thus helps remove false positives." ) )+ <*> optional ( strOption+ ( long "ignore-char"+ <> metavar "[Nothing] | CHAR"+ <> help "Character to ignore, useful for gaps."+ )+ ) <*> option auto ( long "min-size" <> short 'S'@@ -498,6 +505,7 @@ (Window $ gaussWindow opts) (Time $ gaussTime opts) (Threshold $ gaussThreshold opts)+ (ignoreChar opts >>= headMay) refSeq ) (Query . fastaSeq $ fs)
heatitup.cabal view
@@ -1,5 +1,5 @@ name: heatitup-version: 0.5.3.3+version: 0.5.4.0 synopsis: Find and annotate ITDs. description: Find and annotate ITDs using suffix trees and characterize the exogenous segments within the spacer using heat diffusion. homepage: http://github.com/GregorySchwartz/heatitup#readme@@ -7,7 +7,7 @@ license-file: LICENSE author: Gregory W. Schwartz maintainer: gsch@pennmedicine.upenn.edu-copyright: 2018 Gregory W. Schwartz+copyright: 2019 Gregory W. Schwartz category: Bioinformatics build-type: Simple -- extra-source-files:
src/Diffusion.hs view
@@ -41,8 +41,8 @@ g n = (1 / (sqrt (2 * pi * t))) * (exp ((- n ^ 2) / (2 * t))) -- | Convert a hamming comparison to a signal-mutationSignal :: C.ByteString -> Substring -> Signal-mutationSignal base = Signal- . fmap (\x -> if x then 0 else 1)- . hammingList base- . unSubstring+mutationSignal :: Maybe Char -> C.ByteString -> Substring -> Signal+mutationSignal ignore base = Signal+ . fmap (\x -> if x then 0 else 1)+ . hammingList ignore base+ . unSubstring
src/Spacer.hs view
@@ -33,6 +33,7 @@ getSpacer :: Window -> Time -> Threshold+ -> Maybe Char -> ReferenceSeq -> Duplication -> Query@@ -40,6 +41,7 @@ getSpacer window time threshold+ ignore (ReferenceSeq refSeq) (Duplication { _dupSubstring = s, _dupLocations = [p1, p2] }) q@@ -55,6 +57,7 @@ spacerPos p1 p2+ ignore refSeq s spacer@@ -76,13 +79,14 @@ -- | Get the most similar sequence to a base sequence from the left or -- right substring, along with the base fragment minHammingLeftRight- :: C.ByteString+ :: Maybe Char+ -> C.ByteString -> Substring -> Substring -> Either (Substring, C.ByteString) (Substring, C.ByteString)-minHammingLeftRight base (Substring s) (Substring spacer) =+minHammingLeftRight ignore base (Substring s) (Substring spacer) = either (Left . (Substring leftSeq,)) (Right . (Substring rightSeq,))- . minimumBy (comparing $ either (hamming leftSeq) (hamming rightSeq))+ . minimumBy (comparing $ either (hamming ignore leftSeq) (hamming ignore rightSeq)) . concat $ [ fmap (Left . unSubstring) . baseFragments $ leftSeq , fmap (Right . unSubstring) . baseFragments $ rightSeq@@ -100,6 +104,7 @@ -> Position -> Position -> Position+ -> Maybe Char -> C.ByteString -> Substring -> Substring@@ -110,6 +115,7 @@ (Position spacerPos) (Position p1) (Position p2)+ ignore base (Substring s) (Substring spacer) =@@ -130,9 +136,9 @@ . diffusedSeq diffusedSeq (joinedSubstring, baseFragment) = diffuse window time- . mutationSignal baseFragment+ . mutationSignal ignore baseFragment $ joinedSubstring- minHamming = minHammingLeftRight base (Substring s) (Substring spacer)+ minHamming = minHammingLeftRight ignore base (Substring s) (Substring spacer) spacerPoss = [spacerPos .. p2 - 1] -- | Get the positions that are different between the spacer and the@@ -142,6 +148,7 @@ -> Position -> Position -> Position+ -> Maybe Char -> C.ByteString -> Substring -> Substring@@ -151,15 +158,16 @@ (Position spacerPos) (Position p1) (Position p2)+ ignore base (Substring s) (Substring spacer)- | consecutiveSpacerFalsePositive consecutive base+ | consecutiveSpacerFalsePositive consecutive ignore base . Substring . getLeftRightPortion LeftP spacer $ s = []- | consecutiveSpacerFalsePositive consecutive base+ | consecutiveSpacerFalsePositive consecutive ignore base . Substring . getLeftRightPortion RightP spacer $ s
src/Utility.hs view
@@ -70,13 +70,14 @@ . C.drop 1 $ xs --- | Get the hamming list between two strings-hammingList :: C.ByteString -> C.ByteString -> [Bool]-hammingList xs = C.zipWith (==) xs+-- | Get the hamming list between two strings, ignoring a character.+hammingList :: Maybe Char -> C.ByteString -> C.ByteString -> [Bool]+hammingList Nothing xs = C.zipWith (==) xs+hammingList (Just i) xs = C.zipWith (\x y -> (x == y) || x == i || y == i) xs --- | Get the hamming distance between two strings-hamming :: C.ByteString -> C.ByteString -> Int-hamming xs = length . filter (not . id) . hammingList xs+-- | Get the hamming distance between two strings, ignoring a character.+hamming :: Maybe Char -> C.ByteString -> C.ByteString -> Int+hamming i xs = length . filter (not . id) . hammingList i xs -- | Check if positions overlap isOverlappingByPosition :: Window -> Position -> Position -> Bool@@ -115,11 +116,12 @@ -- a percentage of the spacer with a portion of the duplication (how much -- of that string differs). consecutiveSpacerFalsePositive :: Consecutive+ -> Maybe Char -> C.ByteString -> Substring -> Bool-consecutiveSpacerFalsePositive (Consecutive c) base (Substring s) =- any (not . isConsecutive c . hammingList s . unSubstring)+consecutiveSpacerFalsePositive (Consecutive c) ignore base (Substring s) =+ any (not . isConsecutive c . hammingList ignore s . unSubstring) . fragmentSequence (Window . C.length $ s) $ base