packages feed

BioHMM 1.1.1 → 1.1.2

raw patch · 3 files changed

+48/−31 lines, 3 filesdep ~StockholmAlignmentPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: StockholmAlignment

API changes (from Hackage documentation)

Files

BioHMM.cabal view
@@ -1,5 +1,5 @@ name:                BioHMM-version:             1.1.1+version:             1.1.2 synopsis:            Libary for Hidden Markov Models in HMMER3 format.  description:         Libary containing parsing and visualisation functions and datastructures for Hidden Markov Models in HMMER3 format.   license:             GPL-3@@ -20,8 +20,8 @@  source-repository this   type:     git-  location: https://github.com/eggzilla/BioHMM/tree/1.1.1-  tag:      1.1.1+  location: https://github.com/eggzilla/BioHMM/tree/1.1.2+  tag:      1.1.2  library   -- Modules exported by the library.@@ -34,7 +34,7 @@   ghc-options:         -Wall -fno-warn-unused-do-bind    -- Other library packages from which modules are imported.-  build-depends:       base >=4.5 && <5, parsec>=3.1.9, diagrams-lib>=1.3, text, vector, ParsecTools, diagrams-cairo>=1.3, filepath, colour, directory, either-unwrap, SVGFonts >= 1.6, StockholmAlignment>=1.0.2+  build-depends:       base >=4.5 && <5, parsec>=3.1.9, diagrams-lib>=1.3, text, vector, ParsecTools, diagrams-cairo>=1.3, filepath, colour, directory, either-unwrap, SVGFonts >= 1.6, StockholmAlignment>=1.1.0      -- Directories containing source files.   hs-source-dirs:      src
changelog view
@@ -1,6 +1,7 @@ -*-change-log-*--1.1.1 Florian Eggenhofer <egg@informatik.uni-freiburg.de> 21. April 2017-	* Further improvement for model coloring scheme+1.1.2 Florian Eggenhofer <egg@informatik.uni-freiburg.de> 7. May 2017+	* Labels for columns are now passed to alignment visualisation instead of nodes+	* Improved mapping node to column labels 1.1.0 Florian Eggenhofer <egg@informatik.uni-freiburg.de> 13. April 2017 	* Fixed sampling of colors for multiple models 1.0.9 Florian Eggenhofer <egg@informatik.uni-freiburg.de> 13. April 2017
src/Bio/HMMDraw.hs view
@@ -28,6 +28,7 @@ import Data.List import Graphics.SVGFonts import Bio.StockholmFont+import Data.Function     drawSingleHMMComparison :: String -> Int -> Double -> String -> Double -> Double -> [HM.HMMER3] -> [Maybe S.StockholmAlignment] -> [HMMCompareResult] -> [(QDiagram Cairo V2 Double Any,Maybe (QDiagram Cairo V2 Double Any))] drawSingleHMMComparison modelDetail entryNumberCutoff transitionCutoff emissiontype maxWidth scalef hmms alns comparisons@@ -55,7 +56,7 @@  -- | drawHMMER3 :: String -> Int -> Double -> Double -> Double -> String -> V.Vector (String,Colour Double) -> (HM.HMMER3,Maybe S.StockholmAlignment, V.Vector (Int,V.Vector (Colour Double)), Colour Double) -> (QDiagram Cairo V2 Double Any,Maybe (QDiagram Cairo V2 Double Any))-drawHMMER3 modelDetail entriesNumberCutoff transitionCutoff maxWidth scalef emissiontype nameColorVector (model,aln,comparisonNodeLabels,modelColor)+drawHMMER3 modelDetail entryNumberCutoff transitionCutoff maxWidth scalef emissiontype nameColorVector (model,aln,comparisonNodeLabels,modelColor)    | modelDetail == "minimal" = ((applyAll ([bg white]) minimalNodesHeader) # scale scalef,alignmentDiagram)    | modelDetail == "simple" = ((applyAll ([bg white]) simpleNodesHeader) # scale scalef,alignmentDiagram)    | modelDetail == "detailed" = ((applyAll ([bg white]) verboseNodesHeader) # scale scalef,alignmentDiagram)@@ -63,7 +64,7 @@      where nodeNumber = fromIntegral $ V.length currentNodes            --nodes with begin node            currentNodes = HM.begin model `V.cons` HM.nodes model-           nodeAlignmentColIndices =  V.map (fromJust . HM.nma) currentNodes+           --nodeAlignmentColIndices =  V.map (fromJust . HM.nma) currentNodes            alphabet = HM.alpha model            alphabetSymbols = HM.alphabetToSymbols alphabet            boxlength = (fromIntegral (length alphabetSymbols)) * 1.25  + 0.3@@ -77,8 +78,27 @@            simpleNodesHeader = alignTL (vcat' with { _sep = 5 }  [modelHeader,simpleNodes])            verboseNodesHeader = alignTL (vcat' with { _sep = 5 }  [modelHeader,verboseNodes])            modelHeader = makeModelHeader (HM.name model) modelColor nameColorVector-           alignmentDiagram = maybe Nothing (\a -> Just (drawStockholmLines entriesNumberCutoff maxWidth nodeAlignmentColIndices comparisonNodeLabels a)) aln+           alignmentDiagram = drawStockholmLinesComparisonLabel entryNumberCutoff maxWidth comparisonNodeLabels currentNodes aln               +drawStockholmLinesComparisonLabel :: Int -> Double -> V.Vector (Int,V.Vector (Colour Double)) -> V.Vector HM.HMMER3Node -> Maybe S.StockholmAlignment -> Maybe (QDiagram Cairo V2 Double Any)+drawStockholmLinesComparisonLabel entryNumberCutoff maxWidth comparisonNodeLabels nodes maybeAln+   | isJust maybeAln = Just alignmentVis+   | otherwise = Nothing+     where aln = fromJust maybeAln+           columnComparisonLabels = getComparisonPerColumnLabels comparisonNodeLabels nodes+           alignmentVis = drawStockholmLines entryNumberCutoff maxWidth columnComparisonLabels aln++getComparisonPerColumnLabels :: V.Vector (Int,V.Vector (Colour Double)) -> V.Vector HM.HMMER3Node -> V.Vector (Int, V.Vector (Colour Double))+getComparisonPerColumnLabels comparisonNodeLabels nodes = columnComparisonLabels+   where unsortedColumnComparisonLabel = map (nodeToColumnComparisonLabel nodes) (V.toList comparisonNodeLabels)+         columnComparisonLabels = V.fromList (sortBy (compare `on` fst) unsortedColumnComparisonLabel)++nodeToColumnComparisonLabel:: V.Vector HM.HMMER3Node -> (Int, V.Vector (Colour Double)) -> (Int,V.Vector (Colour Double))+nodeToColumnComparisonLabel nodes (nodeIndex,colors) = colLabel+  where currentNode = (V.!) nodes nodeIndex+        colIndex = fromJust (HM.nma currentNode)+        colLabel = (colIndex,colors)                                 +                                   makeModelHeader :: String -> Colour Double -> V.Vector (String,Colour Double) -> QDiagram Cairo V2 Double Any makeModelHeader mName modelColor nameColorVector = strutX 2 ||| setModelName mName ||| strutX 1 ||| rect 6 6 # lw 0.1 # fc modelColor # translate (r2 (negate 0, 3)) ||| strutX 30 ||| modelLegend   where modelLegend = makeModelLegend otherModelsNameColorVector@@ -405,30 +425,26 @@ makeBlankComparisonNodeLabel nodeNumber = (nodeNumber,V.singleton white)  makeColorVector :: Int -> V.Vector (Colour Double)-makeColorVector modelNumber = V.take modelNumber colorVector-   where colorVector = V.fromList [crimson, moccasin, lime, seagreen, aqua ,darkorange ,blue, blueviolet ,brown ,burlywood ,cadetblue ,chartreuse ,chocolate ,coral ,cornflowerblue ,cornsilk ,cyan ,darkblue ,darkcyan ,darkgoldenrod ,darkgray ,darkgreen ,darkgrey ,darkkhaki ,darkmagenta ,darkolivegreen ,darkorchid ,darkred ,darksalmon ,darkseagreen ,darkslateblue ,darkslategray ,darkslategrey ,darkturquoise ,darkviolet ,deeppink ,deepskyblue ,dimgray ,dimgrey ,dodgerblue ,firebrick ,forestgreen ,fuchsia ,gainsboro ,gold ,goldenrod ,gray ,grey ,green ,greenyellow ,honeydew ,hotpink ,indianred,indigo ,ivory ,khaki ,lavender ,lavenderblush ,lawngreen ,lemonchiffon ,lime ,limegreen ,linen ,magenta ,maroon ,mediumaquamarine ,mediumblue ,mediumorchid ,mediumpurple ,mediumseagreen ,mediumslateblue ,mediumspringgreen ,mediumturquoise ,mediumvioletred ,midnightblue ,mintcream ,mistyrose ,navy ,oldlace ,olive ,olivedrab ,orange ,orangered ,orchid ,papayawhip ,peachpuff ,peru ,pink ,plum ,powderblue ,purple ,red ,rosybrown ,royalblue ,saddlebrown ,salmon ,sandybrown ,seagreen]---- makeColorVector :: Int -> V.Vector (Colour Double)--- makeColorVector modelNumber = V.map (\(a,b,c) -> R.rgb a b c) modelRGBTupel---    where indexVector = V.iterateN modelNumber (1+) 0---          stepSize = (765 :: Double) / fromIntegral modelNumber---          modelRGBTupel = V.map (makeRGBTupel stepSize) indexVector+makeColorVector modelNumber = V.map (\(a,b,c) -> R.rgb a b c) modelRGBTupel+   where indexVector = V.iterateN modelNumber (1+) 0+         stepSize = (765 :: Double) / fromIntegral modelNumber+         modelRGBTupel = V.map (makeRGBTupel stepSize) indexVector --- makeRGBTupel :: Double -> Int -> (Double,Double,Double)--- makeRGBTupel stepSize modelNumber = (normA,normB,normC)---   where  totalSize = fromIntegral modelNumber * stepSize---          a = rgbBoundries (totalSize  - 510)---          b = rgbBoundries (totalSize - 255)---          c = rgbBoundries totalSize ---          normA = a/255 ---          normB = b/255---          normC = c/255 +makeRGBTupel :: Double -> Int -> (Double,Double,Double)+makeRGBTupel stepSize modelNumber = (normA,normB,normC)+  where  totalSize = fromIntegral modelNumber * stepSize+         a = rgbBoundries (totalSize  - 510)+         b = rgbBoundries (totalSize - 255)+         c = rgbBoundries totalSize +         normA = a/255 +         normB = b/255+         normC = c/255  --- rgbBoundries :: Double -> Double--- rgbBoundries rgbValue---   | rgbValue>240 = 240---   | rgbValue<10 = 10---   | otherwise = rgbValue+rgbBoundries :: Double -> Double+rgbBoundries rgbValue+  | rgbValue>240 = 240+  | rgbValue<10 = 10+  | otherwise = rgbValue  text' :: String -> QDiagram Cairo V2 Double Any text' t = textSVG_ (TextOpts linLibertineFont INSIDE_H KERN False 3 3) t # fc black # fillRule EvenOdd # lw 0.0 # translate (r2 (negate 0.75, negate 0.75))