Warning

This document is for an old release of Galaxy. You can alternatively view this page in the latest release if it exists or view the top of the latest release's documentation.

galaxy.visualization.data_providers.phyloviz package

Data providers code for PhyloViz

class galaxy.visualization.data_providers.phyloviz.PhylovizDataProvider(original_dataset=None)[source]

Bases: BaseDataProvider

dataset_type = 'phylo'
__init__(original_dataset=None)[source]

Create basic data provider.

get_data(tree_index=0)[source]

Returns trees. Trees are actually an array of JsonDicts. It’s usually one tree, except in the case of Nexus

original_dataset: DatasetInstance

Submodules

galaxy.visualization.data_providers.phyloviz.baseparser module

class galaxy.visualization.data_providers.phyloviz.baseparser.Node(nodeName, **kwargs)[source]

Bases: object

Node class of PhyloTree, which represents a CLAUDE in a phylogenetic tree

__init__(nodeName, **kwargs)[source]

Creates a node and adds in the typical annotations

addChildNode(child)[source]

Adds a child node to the current node

toJson() Dict[str, Any][source]

Converts the data in the node to a dict representation of json

addChildrenToJson(jsonDict)[source]

Needs a special method to addChildren, such that the key does not appear in the Jsondict when the children is empty this requirement is due to the layout algorithm used by d3 layout for hiding subtree

addMiscToJson(jsonDict)[source]

Adds other misc attributes to json if they are present

class galaxy.visualization.data_providers.phyloviz.baseparser.PhyloTree[source]

Bases: object

Standardized python based class to represent the phylogenetic tree parsed from different phylogenetic file formats.

__init__()[source]
addAttributesToRoot(attrDict)[source]

Adds attributes to root, but first we put it in a temp store and bind it with root when .toJson is called

makeNode(nodeName, **kwargs)[source]

Called to make a node within PhyloTree, arbitrary kwargs can be passed to annotate nodes Tracks the number of nodes via internally incremented id

addRoot(root: Node)[source]

Creates a root for phyloTree

generateJsonableDict()[source]

Changes itself into a dictonary by recurssively calling the tojson on all its nodes. Think of it as a dict in an array of dict in an array of dict and so on…

class galaxy.visualization.data_providers.phyloviz.baseparser.Base_Parser[source]

Bases: object

Base parsers contain all the methods to handle phylogeny tree creation and converting the data to json that all parsers should have

__init__()[source]
parseFile(filePath)[source]

Base method that all phylogeny file parser should have

toJson(jsonDict)[source]

Convenience method to get a json string from a python json dict

galaxy.visualization.data_providers.phyloviz.newickparser module

class galaxy.visualization.data_providers.phyloviz.newickparser.Newick_Parser[source]

Bases: Base_Parser

For parsing trees stored in the newick format (.nhx) It is necessarily more complex because this parser is later extended by Nexus for parsing newick as well..

__init__()[source]
parseFile(filePath)[source]

Parses a newick file to obtain the string inside. Returns: jsonableDict

parseData(newickString)[source]

To be called on a newickString directly to parse it. Returns: jsonableDict

cleanNewickString(rawNewick)[source]

removing semi colon, and illegal json characters (,’,”) and white spaces

parseNode(string, depth)[source]

Recursive method for parsing newick string, works by stripping down the string into substring of newick contained with brackers, which is used to call itself.

Eg … ( A, B, (D, E)C, F, G ) …

We will make the preceeding nodes first A, B, then the internal node C, its children D, E, and finally the succeeding nodes F, G

galaxy.visualization.data_providers.phyloviz.nexusparser module

class galaxy.visualization.data_providers.phyloviz.nexusparser.Nexus_Parser[source]

Bases: Newick_Parser

__init__()[source]
parseFile(filePath)[source]

passes a file and extracts its Nexus content.

parseNexus(filename)[source]

Nexus data is stored in blocks between a line starting with begin and another line starting with end; Commends inside square brackets are to be ignored, For more information: http://wiki.christophchamp.com/index.php/NEXUS_file_format Nexus can store multiple trees

splitLinebyWhitespaces(line)[source]

replace tabs and write spaces to a single write space, so we can properly split it.

checkComments(line)[source]

Check to see if the line/lines is a comment.

galaxy.visualization.data_providers.phyloviz.phyloxmlparser module

class galaxy.visualization.data_providers.phyloviz.phyloxmlparser.Phyloxml_Parser[source]

Bases: Base_Parser

Parses a phyloxml file into a json file that will be passed to PhyloViz for display

__init__()[source]
parseFile(filePath)[source]

passes a file and extracts its Phylogeny Tree content.

parseNode(node, depth)[source]

Parses any node within a phyloxml tree and looks out for claude, which signals the creation of nodes - internal OR leaf

cleanTag(tagString)[source]