TreeNode 1.5.2
A library to manipulate phylogenetic trees
Loading...
Searching...
No Matches
PhyloTree.Formats.NcbiAsnBer Class Reference

Contains methods to read and write trees in the NCBI ASN.1 binary format.
Note: this is a hackish reverse-engineering of the NCBI binary ASN format. A lot of this is derived by assumptions and observations. More...

Static Public Member Functions

static IEnumerable< TreeNodeParseTrees (string inputFile)
 Parses a tree from an NCBI ASN.1 binary format file. Note that the tree can only contain a single file, and this method will always return a collection with a single element. More...
 
static IEnumerable< TreeNodeParseTrees (Stream inputStream, bool keepOpen=false)
 Parses a tree from an NCBI ASN.1 binary format file. Note that the tree can only contain a single file, and this method will always return a collection with a single element. More...
 
static List< TreeNodeParseAllTrees (string inputFile)
 Parses a tree from an NCBI ASN.1 binary format file. Note that the tree can only contain a single file, and this method will always return a list with a single element. More...
 
static List< TreeNodeParseAllTrees (Stream inputStream, bool keepOpen=false)
 Parses a tree from an NCBI ASN.1 binary format file. Note that the tree can only contain a single file, and this method will always return a list with a single element. More...
 
static TreeNode ParseTree (BinaryReader reader)
 Parses a tree from a BinaryReader reading a stream in NCBI ASN.1 binary format into a TreeNode object. More...
 
static void WriteTree (TreeNode tree, string outputFile, string treeType=null, string label=null)
 Writes a TreeNode to a file in NCBI ASN.1 binary format. More...
 
static void WriteTree (TreeNode tree, Stream outputStream, bool keepOpen=false, string treeType=null, string label=null)
 Writes a TreeNode to a file in NCBI ASN.1 binary format. More...
 
static void WriteAllTrees (IEnumerable< TreeNode > trees, Stream outputStream, bool keepOpen=false, string treeType=null, string label=null)
 Writes a collection of TreeNodes to a file in NCBI ASN.1 binary format. Note that only one tree can be saved in each file; if the collection contains more than one tree an exception will be thrown. More...
 
static void WriteAllTrees (IEnumerable< TreeNode > trees, string outputFile, string treeType=null, string label=null)
 Writes a collection of TreeNodes to a file in NCBI ASN.1 binary format. Note that only one tree can be saved in each file; if the collection contains more than one tree an exception will be thrown. More...
 
static void WriteAllTrees (List< TreeNode > trees, Stream outputStream, bool keepOpen=false, string treeType=null, string label=null)
 Writes a list of TreeNodes to a file in NCBI ASN.1 binary format. Note that only one tree can be saved in each file; if the tree contains more than one tree an exception will be thrown. More...
 
static void WriteAllTrees (List< TreeNode > trees, string outputFile, string treeType=null, string label=null)
 Writes a list of TreeNodes to a file in NCBI ASN.1 binary format. Note that only one tree can be saved in each file; if the list contains more than one tree an exception will be thrown. More...
 
static void WriteTree (TreeNode tree, BinaryWriter writer, string treeType=null, string label=null)
 Writes a TreeNode to a BinaryWriter in NCBI ASN.1 binary format. More...
 

Detailed Description

Contains methods to read and write trees in the NCBI ASN.1 binary format.
Note: this is a hackish reverse-engineering of the NCBI binary ASN format. A lot of this is derived by assumptions and observations.

Definition at line 13 of file NcbiAsnBer.cs.

Member Function Documentation

◆ ParseAllTrees() [1/2]

static List< TreeNode > PhyloTree.Formats.NcbiAsnBer.ParseAllTrees ( Stream  inputStream,
bool  keepOpen = false 
)
static

Parses a tree from an NCBI ASN.1 binary format file. Note that the tree can only contain a single file, and this method will always return a list with a single element.

Parameters
inputStreamThe Stream from which the file should be read.
keepOpenDetermines whether the stream should be disposed at the end of this method or not.
Returns
A List<T> containing the tree defined in the file. This will always consist of a single element.

Definition at line 145 of file NcbiAsnBer.cs.

◆ ParseAllTrees() [2/2]

static List< TreeNode > PhyloTree.Formats.NcbiAsnBer.ParseAllTrees ( string  inputFile)
static

Parses a tree from an NCBI ASN.1 binary format file. Note that the tree can only contain a single file, and this method will always return a list with a single element.

Parameters
inputFileThe path to the input file.
Returns
A List<T> containing the tree defined in the file. This will always consist of a single element.

Definition at line 132 of file NcbiAsnBer.cs.

◆ ParseTree()

static TreeNode PhyloTree.Formats.NcbiAsnBer.ParseTree ( BinaryReader  reader)
static

Parses a tree from a BinaryReader reading a stream in NCBI ASN.1 binary format into a TreeNode object.

Parameters
readerThe BinaryReader that reads a stream in NCBI ASN.1 binary format.
Returns
The parsed TreeNode object.

Definition at line 156 of file NcbiAsnBer.cs.

◆ ParseTrees() [1/2]

static IEnumerable< TreeNode > PhyloTree.Formats.NcbiAsnBer.ParseTrees ( Stream  inputStream,
bool  keepOpen = false 
)
static

Parses a tree from an NCBI ASN.1 binary format file. Note that the tree can only contain a single file, and this method will always return a collection with a single element.

Parameters
inputStreamThe Stream from which the file should be read.
keepOpenDetermines whether the stream should be disposed at the end of this method or not.
Returns
A IEnumerable<T> containing the tree defined in the file. This will always consist of a single element.

Definition at line 122 of file NcbiAsnBer.cs.

◆ ParseTrees() [2/2]

static IEnumerable< TreeNode > PhyloTree.Formats.NcbiAsnBer.ParseTrees ( string  inputFile)
static

Parses a tree from an NCBI ASN.1 binary format file. Note that the tree can only contain a single file, and this method will always return a collection with a single element.

Parameters
inputFileThe path to the input file.
Returns
A IEnumerable<T> containing the tree defined in the file. This will always consist of a single element.

Definition at line 111 of file NcbiAsnBer.cs.

◆ WriteAllTrees() [1/4]

static void PhyloTree.Formats.NcbiAsnBer.WriteAllTrees ( IEnumerable< TreeNode trees,
Stream  outputStream,
bool  keepOpen = false,
string  treeType = null,
string  label = null 
)
static

Writes a collection of TreeNodes to a file in NCBI ASN.1 binary format. Note that only one tree can be saved in each file; if the collection contains more than one tree an exception will be thrown.

Parameters
treesThe collection of trees to write. If this contains more than one tree, an exception will be thrown.
outputStreamThe Stream on which the tree should be written.
keepOpenDetermines whether the outputStream should be kept open after the end of this method.
treeTypeAn optional value for the treetype property defined in the NCBI ASN.1 tree format.
labelAn optional value for the label property defined in the NCBI ASN.1 tree format.

Definition at line 550 of file NcbiAsnBer.cs.

◆ WriteAllTrees() [2/4]

static void PhyloTree.Formats.NcbiAsnBer.WriteAllTrees ( IEnumerable< TreeNode trees,
string  outputFile,
string  treeType = null,
string  label = null 
)
static

Writes a collection of TreeNodes to a file in NCBI ASN.1 binary format. Note that only one tree can be saved in each file; if the collection contains more than one tree an exception will be thrown.

Parameters
treesThe collection of trees to write. If this contains more than one tree, an exception will be thrown.
outputFileThe path to the output file.
treeTypeAn optional value for the treetype property defined in the NCBI ASN.1 tree format.
labelAn optional value for the label property defined in the NCBI ASN.1 tree format.

Definition at line 577 of file NcbiAsnBer.cs.

◆ WriteAllTrees() [3/4]

static void PhyloTree.Formats.NcbiAsnBer.WriteAllTrees ( List< TreeNode trees,
Stream  outputStream,
bool  keepOpen = false,
string  treeType = null,
string  label = null 
)
static

Writes a list of TreeNodes to a file in NCBI ASN.1 binary format. Note that only one tree can be saved in each file; if the tree contains more than one tree an exception will be thrown.

Parameters
treesThe list of trees to write. If this contains more than one tree, an exception will be thrown.
outputStreamThe Stream on which the tree should be written.
keepOpenDetermines whether the outputStream should be kept open after the end of this method.
treeTypeAn optional value for the treetype property defined in the NCBI ASN.1 tree format.
labelAn optional value for the label property defined in the NCBI ASN.1 tree format.

Definition at line 605 of file NcbiAsnBer.cs.

◆ WriteAllTrees() [4/4]

static void PhyloTree.Formats.NcbiAsnBer.WriteAllTrees ( List< TreeNode trees,
string  outputFile,
string  treeType = null,
string  label = null 
)
static

Writes a list of TreeNodes to a file in NCBI ASN.1 binary format. Note that only one tree can be saved in each file; if the list contains more than one tree an exception will be thrown.

Parameters
treesThe list of trees to write. If this contains more than one tree, an exception will be thrown.
outputFileThe path to the output file.
treeTypeAn optional value for the treetype property defined in the NCBI ASN.1 tree format.
labelAn optional value for the label property defined in the NCBI ASN.1 tree format.

Definition at line 624 of file NcbiAsnBer.cs.

◆ WriteTree() [1/3]

static void PhyloTree.Formats.NcbiAsnBer.WriteTree ( TreeNode  tree,
BinaryWriter  writer,
string  treeType = null,
string  label = null 
)
static

Writes a TreeNode to a BinaryWriter in NCBI ASN.1 binary format.

Parameters
treeThe tree to write.
writerThe BinaryWriter on which the tree will be written..
treeTypeAn optional value for the treetype property defined in the NCBI ASN.1 tree format.
labelAn optional value for the label property defined in the NCBI ASN.1 tree format.

Definition at line 643 of file NcbiAsnBer.cs.

◆ WriteTree() [2/3]

static void PhyloTree.Formats.NcbiAsnBer.WriteTree ( TreeNode  tree,
Stream  outputStream,
bool  keepOpen = false,
string  treeType = null,
string  label = null 
)
static

Writes a TreeNode to a file in NCBI ASN.1 binary format.

Parameters
treeThe tree to write.
outputStreamThe Stream on which the tree should be written.
keepOpenDetermines whether the outputStream should be kept open after the end of this method.
treeTypeAn optional value for the treetype property defined in the NCBI ASN.1 tree format.
labelAn optional value for the label property defined in the NCBI ASN.1 tree format.

Definition at line 536 of file NcbiAsnBer.cs.

◆ WriteTree() [3/3]

static void PhyloTree.Formats.NcbiAsnBer.WriteTree ( TreeNode  tree,
string  outputFile,
string  treeType = null,
string  label = null 
)
static

Writes a TreeNode to a file in NCBI ASN.1 binary format.

Parameters
treeThe tree to write.
outputFileThe path to the output file.
treeTypeAn optional value for the treetype property defined in the NCBI ASN.1 tree format.
labelAn optional value for the label property defined in the NCBI ASN.1 tree format.

Definition at line 522 of file NcbiAsnBer.cs.


The documentation for this class was generated from the following file: