diversity 0.3.4.0 → 0.3.4.1
raw patch · 3 files changed
+14/−15 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- diversity.cabal +1/−1
- src/src-exec/Main.hs +2/−1
- src/src-lib/Math/Diversity/Diversity.hs +11/−13
diversity.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: diversity-version: 0.3.4.0+version: 0.3.4.1 synopsis: Return the diversity at each position for all sequences in a fasta file description: Find the diversity of a collection of entities, mainly for use with fasta sequences. Produces a binary which works on fasta files to find the diversity of any order and rarefaction curves for a sliding window across all positions in the sequences. To analyze just a collection of entities, just use the whole sequences and list flag. homepage: https://github.com/GregorySchwartz/diversity
src/src-exec/Main.hs view
@@ -76,7 +76,8 @@ <> value "1 1" <> help "The start point and interval of subsamples in the\ \ rarefaction curve. For instance, '1 1' would be 1, 2, 3, ...\- \ '2 6' would be 2, 8, 14, ..." )+ \ '2 6' would be 2, 8, 14, ... Note: input is a string so\+ \ use quotations around the entry" ) <*> switch ( long "fast-bin" <> short 'f'
src/src-lib/Math/Diversity/Diversity.hs view
@@ -16,7 +16,6 @@ import Data.List import Data.Ratio import qualified Data.Set as Set-import qualified Data.Foldable as F import Numeric.SpecFunctions (choose) import Data.Function (on) @@ -77,7 +76,6 @@ getSampleContents = map (Set.fromList . map snd) . groupBy ((==) `on` fst) . sortBy (compare `on` fst)- . map (\(!x, !y) -> (x, y)) -- | Returns the rarefaction curve for each position in a list rarefactionSampleCurve :: (Ord a, Ord b)@@ -93,21 +91,21 @@ | t == 0 = (t, 0) | t == t_total = (t, richness) | otherwise = (t, richness - inner t)- inner t = ( \x -> if fastBin- then x / choose t_total t- else x )- . F.sum- . Set.map ( \s -> specialBinomial+ inner t = ( \x -> if fastBin+ then x / choose t_total t+ else x )+ . sum+ . map ( \s -> specialBinomial fastBin (fromIntegral t_total) (numHave s samples) (fromIntegral t) )- $ speciesList- numHave s = sum . map (\x -> if Set.member s x then 1 else 0)- richness = fromIntegral . Set.size $ speciesList- speciesList = Set.fromList . map snd $ ls- t_total = genericLength samples- samples = getSampleContents ls+ $ speciesList+ numHave s = sum . map (\x -> if Set.member s x then 1 else 0)+ richness = genericLength speciesList+ speciesList = nub . map snd $ ls+ t_total = genericLength samples+ samples = getSampleContents ls -- | Calculates the percent of the curve that is above 95% of height of the curve rarefactionViable :: [Double] -> Double