diversity 0.7.1.0 → 0.7.1.1
raw patch · 3 files changed
+14/−25 lines, 3 files
Files
- diversity.cabal +1/−1
- src/src-exec/Main.hs +0/−5
- src/src-lib/Math/Diversity/Print.hs +13/−19
diversity.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: diversity-version: 0.7.1.0+version: 0.7.1.1 synopsis: Return the diversity at each position by default for all sequences in a fasta file description: Find the diversity of a collection of entities, mainly for use with fasta sequences. homepage: https://github.com/GregorySchwartz/diversity
src/src-exec/Main.hs view
@@ -240,11 +240,6 @@ $ do s <- printRarefaction (sample opts)- (fastBin opts)- (runs opts)- start- interval- end (inputG opts) label window
src/src-lib/Math/Diversity/Print.hs view
@@ -41,33 +41,26 @@ -- Return the results of the rarefaction analysis in string form for saving -- to a file printRarefaction :: Bool- -> Bool- -> Int- -> Int- -> Int- -> Int -> Double -> Label -> Window -> PositionMap -> IO String printRarefaction- bySample fastBin runs start interval end g label window positionMap = do+ bySample g label window positionMap = do body <- fmap unlines . mapM mapLine . Map.toAscList $ positionMap return (header ++ body) where- header = "label,window,position,weight,percent_above,\+ header = "label,window,position,weight,\ \additional_sampling,g_proportion,richness,S_est\n" mapLine (p, xs) = fmap (intercalate ",") . line p $ xs line p xs = do- curve <- getRarefactionCurve bySample xs -- The minimum number of samples needed before any additional -- sampling returns less than the threshold (min) number of species return [ label , show window , show p , show . Map.foldl' (+) 0 $ xs- , show . rarefactionViable . map (snd . snd) $ curve , show . additionalSampling bySample $ xs , show g , show . sobs $ xs@@ -78,13 +71,6 @@ sobs = fromIntegral . richness additionalSampling True = sampleG g additionalSampling False = individualG g- getRarefactionCurve True = rarefactionSampleCurve fastBin start interval end- getRarefactionCurve False = rarefactionCurve- fastBin- runs- (fromIntegral start)- (fromIntegral interval)- (fromIntegral end) -- Return the results of the rarefaction analysis of the entire curve in -- string form for saving to a file@@ -105,10 +91,10 @@ return (header asDF ++ body) where- header False = "label,window,position,weight,expected_richness,\- \mad\n"- header True = "label,window,position,weight,subsample,\+ header False = "label,window,position,weight,percent_above,\ \expected_richness,mad\n"+ header True = "label,window,position,weight,percent_above,subsample,\+ \expected_richness,mad\n" mapLine (!p, !xs) = line asDF p xs line False p xs = do curve <- getRarefactionCurve bySample xs@@ -116,6 +102,10 @@ , show window , show p , show . Map.foldl' (+) 0 $ xs+ , show+ . rarefactionViable+ . map (snd . snd)+ $ curve , intercalate "/" . map (show . fst . snd) $ curve@@ -131,6 +121,10 @@ , show window , show p , show . Map.foldl' (+) 0 $ xs+ , show+ . rarefactionViable+ . map (snd . snd)+ $ curve , show x , show y , show z