SelectSequencesFromMSA 1.0.2 → 1.0.3
raw patch · 3 files changed
+25/−14 lines, 3 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Bio.SelectSequencesLibrary: preprocessClustalForRNAz :: String -> String -> Int -> Double -> Double -> Bool -> IO (Either String (String, String))
+ Bio.SelectSequencesLibrary: preprocessClustalForRNAz :: String -> String -> Int -> Double -> Double -> Bool -> String -> IO (Either String (String, String))
Files
- SelectSequencesFromMSA.cabal +3/−3
- src/Bio/SelectSequences.hs +5/−3
- src/Bio/SelectSequencesLibrary.hs +17/−8
SelectSequencesFromMSA.cabal view
@@ -1,5 +1,5 @@ name: SelectSequencesFromMSA-version: 1.0.2+version: 1.0.3 synopsis: SelectSequences is a tool for selection of a represenative subset of sequences from a multiple sequence alignment in clustal format. description: SelectSequences is a tool for selection of a represenative subset of sequences from a multiple sequence alignment in clustal format. .@@ -25,8 +25,8 @@ source-repository this type: git- location: https://github.com/eggzilla/SelectSequencesFromMSA/tree/1.0.2- tag: 1.0.2+ location: https://github.com/eggzilla/SelectSequencesFromMSA/tree/1.0.3+ tag: 1.0.3 executable SelectSequencesFromMSA Hs-Source-Dirs: ./src/Bio/
src/Bio/SelectSequences.hs view
@@ -18,7 +18,8 @@ optimalIdentity :: Double, maximalIdenity :: Double, referenceSequence :: Bool,- distanceMatrixPath :: String+ distanceMatrixPath :: String,+ reformatIdOption :: String } deriving (Show,Data,Typeable) options :: Options@@ -30,7 +31,8 @@ optimalIdentity = (80 :: Double) &= name "i" &= help "Optimize for this percentage of mean pairwise identity (Default: 80)", maximalIdenity = (95 :: Double) &= name "m" &= help "Sequences with a higher percentage of pairwise Identity will be removed. (Default: 95)", referenceSequence = True &= name "x" &= help "The first sequence (=reference sequence) is always present in the output alignment per default. Default: True",- distanceMatrixPath = "" &= name "d" &= help "Path to distance matrix output file, only internal for interal sequence selection, e.g. /home/user/distmat (Default: )"+ distanceMatrixPath = "" &= name "d" &= help "Path to distance matrix output file, only internal for interal sequence selection, e.g. /home/user/distmat (Default: )",+ reformatIdOption = "RNAcode" &= name "r" &= help "Defines how sequence id is reformated, e.g. fitting for RNAcode or not (Default: RNAcode)" } &= summary "SelectSequences" &= help "Florian Eggenhofer 2016" &= verbosity main :: IO ()@@ -48,7 +50,7 @@ Control.Monad.unless (null distanceMatrixPath) (writeFile distanceMatrixPath idMatrix) else print ("A problem occured selecting sequences: " ++ fromLeft resultStatus) else do- resultStatus <- preprocessClustalForRNAz inputClustalPath (selectedOutputPath ++ "/") seqenceNumber optimalIdentity maximalIdenity referenceSequence+ resultStatus <- preprocessClustalForRNAz inputClustalPath (selectedOutputPath ++ "/") seqenceNumber optimalIdentity maximalIdenity referenceSequence reformatIdOption if isRight resultStatus then do let (_,resultAln) = fromRight resultStatus
src/Bio/SelectSequencesLibrary.hs view
@@ -70,8 +70,8 @@ selectedClustalText <- readFile selectedClustalpath return (Right ([],selectedClustalText)) -preprocessClustalForRNAz :: String -> String -> Int -> Double -> Double -> Bool -> IO (Either String (String,String))-preprocessClustalForRNAz clustalFilepath outputPath seqenceNumber optimalIdentity maximalIdenity referenceSequence = do+preprocessClustalForRNAz :: String -> String -> Int -> Double -> Double -> Bool -> String -> IO (Either String (String,String))+preprocessClustalForRNAz clustalFilepath outputPath seqenceNumber optimalIdentity maximalIdenity referenceSequence reformatOption = do clustalText <- TI.readFile clustalFilepath let clustalTextLines = T.lines clustalText parsedClustalInput <- readClustalAlignment clustalFilepath@@ -80,7 +80,7 @@ then if isRight parsedClustalInput then do- let (idMatrix,filteredClustalInput) = rnaCodeSelectSeqs2 (fromRight parsedClustalInput) seqenceNumber optimalIdentity maximalIdenity referenceSequence+ let (idMatrix,filteredClustalInput) = rnaCodeSelectSeqs2 (fromRight parsedClustalInput) seqenceNumber optimalIdentity maximalIdenity referenceSequence reformatOption writeFile selectedClustalpath (show filteredClustalInput) let formatedIdMatrix = show (fmap formatIdMatrix idMatrix) return (Right (formatedIdMatrix,selectedClustalpath))@@ -99,8 +99,8 @@ -- | Sequence preselection for RNAz and RNAcode -rnaCodeSelectSeqs2 :: ClustalAlignment -> Int -> Double -> Double -> Bool -> (Matrix (Maybe (Int,Int,Double)),ClustalAlignment)-rnaCodeSelectSeqs2 currentClustalAlignment targetSeqNumber optimalIdentity maximalIdentity referenceSequence = (identityMatrix,newClustalAlignment)+rnaCodeSelectSeqs2 :: ClustalAlignment -> Int -> Double -> Double -> Bool -> String -> (Matrix (Maybe (Int,Int,Double)),ClustalAlignment)+rnaCodeSelectSeqs2 currentClustalAlignment targetSeqNumber optimalIdentity maximalIdentity referenceSequence reformatOption = (identityMatrix,newClustalAlignment) where entryVector = V.fromList (alignmentEntries currentClustalAlignment) entrySequences = V.map entryAlignedSequence entryVector entryReformatedSequences = V.map (T.map reformatRNACodeAln) entrySequences@@ -120,7 +120,9 @@ selectedEntryIndices = selectEntryIndices referenceSequence targetSeqNumber sortedIndices selectedEntries = map (\ind -> entryVector V.! (ind-1)) selectedEntryIndices selectedEntryHeader = map entrySequenceIdentifier selectedEntries- reformatedSelectedEntryHeader = map (T.map reformatRNACodeId) selectedEntryHeader+ selectedReformatFunction = selectReformatFunction reformatOption+ reformatedSelectedEntryHeader = map (T.map selectedReformatFunction) selectedEntryHeader+ --reformatedSelectedEntryHeader = map (T.map reformatRNACodeId) selectedEntryHeader selectedEntrySequences = map (\ind -> entryReformatedSequences V.! (ind-1)) selectedEntryIndices --gapfreeEntrySequences = T.transpose (T.filter (\a -> not (T.all isGap a)) (T.transpose selectedEntrySequences)) gapfreeEntrySequences = T.transpose (filter (not . T.all isGap) (T.transpose selectedEntrySequences))@@ -128,13 +130,19 @@ emptyConservationTrack = setEmptyConservationTrack gapfreeEntries (conservationTrack currentClustalAlignment) newClustalAlignment = currentClustalAlignment {alignmentEntries = gapfreeEntries, conservationTrack = emptyConservationTrack} +selectReformatFunction :: String -> (Char -> Char)+selectReformatFunction reformatOption+ | reformatOption == "RNAcode" = reformatRNACodeId+ | otherwise = id+ selectEntryIndices :: Bool -> Int -> [Int] -> [Int] selectEntryIndices referenceSequence targetSeqNumber sortedIndices- | referenceSequence = if (1 :: Int) `elem` firstX then firstX else 1:firstXm1+ | referenceSequence = if (1 :: Int) `elem` firstX then firstRefX else 1:firstXm1 | otherwise = firstX where firstXm1 = take (targetSeqNumber - 1) sortedIndices firstX = take targetSeqNumber sortedIndices-+ firstRefX =(1 :: Int):(filter (\i -> i /= (1 :: Int)) firstX)+ setEmptyConservationTrack :: [ClustalAlignmentEntry] -> T.Text -> T.Text setEmptyConservationTrack alnentries currentConservationTrack | null alnentries = currentConservationTrack@@ -242,3 +250,4 @@ | c == 'c' = 'C' | c == 'a' = 'A' | otherwise = c+