packages feed

phybin 0.1 → 0.1.1

raw patch · 2 files changed

+23/−41 lines, 2 files

Files

Bio/Phylogeny/PhyBin/Main.hs view
@@ -29,11 +29,6 @@ -- System.Win32.  Giving up because I think I can just use the -- OS-independent System.Directory --- #ifdef WIN32--- import System.Win32.File--- #else--- import System.Posix.Files--- #endif import System.Directory import System.FilePath @@ -43,7 +38,6 @@ import System.Exit import System.IO ---import StringTable.Atom import Test.HUnit import HSH hiding (run) import qualified HSH @@ -59,7 +53,7 @@  import Debug.Trace -phybin_version = "0.1" -- NOTE: Remember to keep me in sync with the .cabal file+phybin_version = "0.1.1" -- NOTE: Remember to keep me in sync with the .cabal file  ---------------------------------------------------------------------------------------------------- -- Type definitions@@ -222,17 +216,7 @@ name :: Parser String name = option "" $ many1 (letter <|> digit <|> oneOf "_.-") ---spc = oneOf " \t"---wh = many spc ------------------------------------------------------------------------------------- Parser for name translation tables.------------------------------------------------------------------------------------- TODO-- ---------------------------------------------------------------------------------------------------- -- Normal form for unordered, unrooted trees ----------------------------------------------------------------------------------------------------@@ -304,6 +288,7 @@ 	 -------------------------------------------------------------------------------- +-- I ran into a nasty bug as a result of "deriving Ord".  But I didn't end up getting rid of it. --instance Ord AnnotatedTree where  --  compare (NTLeaf _ _) (NTInterior _ _) = LT --  compare (NTLeaf _ _) (NTLeaf _ _)     = EQ@@ -421,7 +406,7 @@  else \ _ nodes -> nodes  -	        	+-- TODO: Salvage any of these tests that are worthwhile and get them into the unit tests:	        	 tt = normalize $ annotateWLabLists $ run newick_parser "(A,(C,D,E),B);"  tt0 = drawNewickTree "tt0" $ annotateWLabLists $ run newick_parser "(A,(C,D,E),B);"@@ -495,7 +480,7 @@ -- Bitvector based normalization. ---------------------------------------------------------------------------------------------------- -+-- TODO: This approach is probably faster. Give it a try.  {- int NumberOfSetBits(int i)@@ -635,7 +620,7 @@   ------------------------------------------------------------------------------------------------------- Utilities and TESTING+-- Utilities and UNIT TESTING ----------------------------------------------------------------------------------------------------  parseNewick :: String -> B.ByteString -> NewickTree BranchLen@@ -731,7 +716,8 @@     ] -t = runTestTT tests+run_tests = runTestTT tests+t = run_tests      ----------------------------------------------------------------------------------------------------@@ -828,11 +814,8 @@ 					    ++ show weight ++"): "++ show file 		    return (0,[], [(weight, file)]) 	    else do -             -- OPTTIONAL DISPLAY:-	     --putStrLn$ show$ runB newick_parser bstr 	     when verbose$ putStr "."-	     --putStrLn$ file ++ " " ++ show (get_weight annot)-           + 	     --evaluate$ deepseq$ runB newick_parser bstr 	     --evaluate$ cnt$ runB newick_parser bstr 	     num <- evaluate$ cnt parsed@@ -1017,6 +1000,8 @@     | View     | TabDelimited Int Int +    | SelfTest+     | NameCutoff String     | NamePrefix Int     | NameTable String  -- Must come after Cutoff/Prefix@@ -1033,6 +1018,9 @@       , Option ['o']     ["output"]  (ReqArg Output "DIR")  "set directory to contain all output files (default \"./\")" +     , Option []     ["selftest"]   (NoArg SelfTest)   "run internal unit tests"++ {- -- TODO: FIXME: IMPLEMENT THIS:      , Option []        []          (NoArg NullOpt)  ""      , Option ['t']     ["tabbed"]  (ReqArg parseTabDelim "NUM1:NUM2")$  "assume the input is a tab-delimited file with gene names \n"++@@ -1099,6 +1087,9 @@ 	   NullOpt -> return cfg 	   Verbose -> return cfg { verbose= True }  	   Version -> do putStrLn$ "phybin version "++phybin_version; exitSuccess++	   SelfTest -> do run_tests; exitSuccess+ 	   Output s -> return cfg { output_dir= s }  	   NumTaxa n -> return cfg { num_taxa= n }@@ -1149,7 +1140,6 @@  -------------------------------------------------------------------------------- -- Every dataset it seems needs a new hack on the names.--- FIXME: These should be read from files: name_table_reader file =    do contents <- readFile file      let mp = M.fromList $ @@ -1166,20 +1156,12 @@ 	     Just x -> x 	     Nothing -> name_to_hack --name_hack_legionella lab = toLabel$ -   case alpha of -     "plpl" -> "lpl"-     "plpp" -> "lpp"-     x -> x- where -  alpha = takeWhile (not . isDigit) $ fromLabel lab--  ---temp = driver True name_hack_legionella 7 "./" ["../datasets/test.tr"] temp = driver default_phybin_config{ num_taxa=7, inputs=["../datasets/test.tr"] }  ----------------------------------------------------------------------------------------------------+-- TODO: expose a command line argument for testing.+-- The below test exposed my normalization bug relating to "deriving Ord".+-- I need to transform it into one or more proper unit tests.  main_test =   withArgs ["-w","~/newton_and_newton_local/datasets/yersinia/yersinia_trees/111.dnd","-m","../datasets/yersinia/name_table_hack_yersinia.txt"]
phybin.cabal view
@@ -1,5 +1,5 @@ Name:           phybin-Version:        0.1+Version:        0.1.1 License: BSD3 License-file:   LICENSE Stability: Beta@@ -18,9 +18,9 @@  build-type: Simple --- source-repository head---   type:     darcs---   location: http://code.haskell.org/phybin+source-repository head+  type:     mercurial+  location: http://code.haskell.org/phybin/repo/  Executable phybin   Main-is:           Bio/Phylogeny/PhyBin/Main.hs