Taxonomy-1.0.1: Libary for parsing, processing and vizualization of taxonomy data

Safe HaskellNone
LanguageHaskell98

Bio.Taxonomy

Contents

Description

Functions for parsing, processing and visualization of taxonomy data.

Usage example:

  • Read in taxonomy data

    eitherTaxtree <- readNamedTaxonomy "/path/to/NCBI_taxonomydump_directory"
  • Process data

    let subtree = extractTaxonomySubTreebyLevel [562] (fromRight eitherTaxTree) (Just 4)
  • Visualize result

    tput "pathto/dotdirectory" subtree

Synopsis

Datatypes

Parsing

readTaxonomy :: String -> IO (Either ParseError (Gr SimpleTaxon Double)) Source

NCBI taxonomy dump nodes and names in the input directory path are parsed and a SimpleTaxon tree is generated.

readNamedTaxonomy :: String -> IO (Either ParseError (Gr SimpleTaxon Double)) Source

NCBI taxonomy dump nodes and names in the input directory path are parsed and a SimpleTaxon tree with scientific names for each node is generated.

parseTaxonomy :: String -> Either ParseError (Gr SimpleTaxon Double) Source

NCBI taxonomy dump nodes and names in the input directory path are parsed and a SimpleTaxon tree is generated.

parseNCBITaxCitations :: String -> Either ParseError [TaxCitation] Source

parse NCBITaxCitations from input string

readNCBITaxCitations :: String -> IO (Either ParseError [TaxCitation]) Source

parse NCBITaxCitations from input filePath

parseNCBITaxDelNodes :: String -> Either ParseError [TaxDelNode] Source

parse NCBITaxDelNodes from input string

readNCBITaxDelNodes :: String -> IO (Either ParseError [TaxDelNode]) Source

parse NCBITaxDelNodes from input filePath

parseNCBITaxDivisions :: String -> Either ParseError [TaxDivision] Source

parse NCBITaxDivisons from input string

readNCBITaxDivisions :: String -> IO (Either ParseError [TaxDivision]) Source

parse NCBITaxDivisons from input filePath

parseNCBITaxGenCodes :: String -> Either ParseError [TaxGenCode] Source

parse NCBITaxGenCodes from input string

readNCBITaxGenCodes :: String -> IO (Either ParseError [TaxGenCode]) Source

parse NCBITaxGenCodes from input filePath

parseNCBITaxMergedNodes :: String -> Either ParseError [TaxMergedNode] Source

parse NCBITaxMergedNodes from input string

readNCBITaxMergedNodes :: String -> IO (Either ParseError [TaxMergedNode]) Source

parse NCBITaxMergedNodes from input filePath

parseNCBITaxNames :: String -> Either ParseError [TaxName] Source

parse NCBITaxNames from input string

readNCBITaxNames :: String -> IO (Either ParseError [TaxName]) Source

parse NCBITaxNames from input filePath

parseNCBITaxNodes :: String -> Either ParseError TaxNode Source

parse NCBITaxNames from input string

readNCBITaxNodes :: String -> IO (Either ParseError [TaxNode]) Source

parse NCBITaxCitations from input filePath

parseNCBISimpleTaxons :: String -> Either ParseError SimpleTaxon Source

parse NCBISimpleTaxNames from input string

readNCBISimpleTaxons :: String -> IO (Either ParseError [SimpleTaxon]) Source

parse NCBITaxCitations from input filePath

readNCBITaxonomyDatabase :: String -> IO (Either [String] NCBITaxDump) Source

Parse the input as NCBITax datatype

Processing

compareSubTrees :: [Gr SimpleTaxon Double] -> (Int, Gr CompareTaxon Double) Source

Extract a subtree correpsonding to input node paths to root. Only nodes in level number distance to root are included. Used in Ids2TreeCompare tool.

extractTaxonomySubTreebyLevel :: [Node] -> Gr SimpleTaxon Double -> Maybe Int -> Gr SimpleTaxon Double Source

Extract a subtree corresponding to input node paths to root. Only nodes in level number distance to root are included. Used in Ids2Tree tool.

extractTaxonomySubTreebyRank :: [Node] -> Gr SimpleTaxon Double -> Maybe Rank -> Gr SimpleTaxon Double Source

Extract a subtree corresponding to input node paths to root. If a Rank is provided, all node that are less or equal are omitted

safeNodePath :: Maybe Node -> Gr SimpleTaxon Double -> Maybe Node -> Either String [Node] Source

Returns path between 2 maybe nodes. Used in TreeDistance tool.

getParentbyRank :: Node -> Gr SimpleTaxon Double -> Maybe Rank -> Maybe (Node, SimpleTaxon) Source

Extract parent node with specified Rank

Visualization

drawTreeComparison :: (Int, Gr CompareTaxon Double) -> String Source

Draw tree comparison graph in dot format. Used in Ids2TreeCompare tool.

drawTaxonomy :: Gr SimpleTaxon Double -> String Source

Draw graph in dot format. Used in Ids2Tree tool.

writeTree :: String -> String -> Gr SimpleTaxon Double -> IO () Source

Write tree representation either as dot or json to provided file path

writeDotTree :: String -> Gr SimpleTaxon Double -> IO () Source

Write tree representation as dot to provided file path. Graphviz tools like dot can be applied to the written .dot file to generate e.g. svg-format images.

writeJsonTree :: String -> Gr SimpleTaxon Double -> IO () Source

Write tree representation as json to provided file path. You can visualize the result for example with 3Djs.