TreeNode 1.5.2
A library to manipulate phylogenetic trees
|
Contains methods to read and write tree files in binary format. More...
Static Public Member Functions | |
static bool | HasValidTrailer (Stream inputStream, bool keepOpen=false) |
Determines whether the tree file stream has a valid trailer. More... | |
static bool | IsValidStream (Stream inputStream, bool keepOpen=false) |
Determines whether the tree file stream is valid (i.e. it has a valid header). More... | |
static BinaryTreeMetadata | ParseMetadata (Stream inputStream, bool keepOpen=false, BinaryReader reader=null, Action< double > progressAction=null) |
Reads the metadata from a file containing trees in binary format. More... | |
static IEnumerable< TreeNode > | ParseTrees (Stream inputStream, bool keepOpen=false, Action< double > progressAction=null) |
Lazily parses trees from a file in binary format. Each tree in the file is not read and parsed until it is requested. More... | |
static List< TreeNode > | ParseAllTrees (Stream inputStream, bool keepOpen=false, Action< double > progressAction=null) |
Parses trees from a file in binary format and completely loads them in memory. More... | |
static IEnumerable< TreeNode > | ParseTrees (string inputFile, Action< double > progressAction=null) |
Lazily parses trees from a file in binary format. Each tree in the file is not read and parsed until it is requested. More... | |
static List< TreeNode > | ParseAllTrees (string inputFile, Action< double > progressAction=null) |
Parses trees from a file in binary format and completely loads them in memory. More... | |
static void | WriteTree (TreeNode tree, Stream outputStream, bool keepOpen=false, Stream additionalDataToCopy=null) |
Writes a single tree in Binary format. More... | |
static void | WriteTree (TreeNode tree, string outputFile, bool append=false, Stream additionalDataToCopy=null) |
Writes a single tree in Binary format. More... | |
static void | WriteAllTrees (IEnumerable< TreeNode > trees, string outputFile, bool append=false, Action< int > progressAction=null, Stream additionalDataToCopy=null) |
Writes trees in binary format. More... | |
static void | WriteAllTrees (IEnumerable< TreeNode > trees, Stream outputStream, bool keepOpen=false, Action< int > progressAction=null, Stream additionalDataToCopy=null) |
Writes trees in binary format. More... | |
static void | WriteAllTrees (IList< TreeNode > trees, string outputFile, bool append=false, Action< double > progressAction=null, Stream additionalDataToCopy=null) |
Writes trees in binary format. More... | |
static void | WriteAllTrees (IList< TreeNode > trees, Stream outputStream, bool keepOpen=false, Action< double > progressAction=null, Stream additionalDataToCopy=null) |
Writes trees in binary format. More... | |
Contains methods to read and write tree files in binary format.
|
static |
Determines whether the tree file stream has a valid trailer.
inputStream | The Stream from which the file should be read. Its Stream.CanSeek must be true . It does not have to be a FileStream. |
keepOpen | Determines whether the stream should be disposed at the end of this method or not. |
true
if the inputStream has a valid trailer, false
otherwise.
|
static |
Determines whether the tree file stream is valid (i.e. it has a valid header).
inputStream | The Stream from which the file should be read. Its Stream.CanSeek must be true . It does not have to be a FileStream. |
keepOpen | Determines whether the stream should be disposed at the end of this method or not. |
true
if the inputStream has a valid header, false
otherwise.
|
static |
Parses trees from a file in binary format and completely loads them in memory.
inputStream | The Stream from which the file should be read. Its Stream.CanSeek must be true . It does not have to be a FileStream. |
keepOpen | Determines whether the stream should be disposed at the end of this method or not. |
progressAction | An Action that might be called after each tree is parsed, with the approximate progress (as determined by the position in the stream), ranging from 0 to 1. |
|
static |
Parses trees from a file in binary format and completely loads them in memory.
inputFile | The path to the input file. |
progressAction | An Action that might be called after each tree is parsed, with the approximate progress (as determined by the position in the stream), ranging from 0 to 1. |
|
static |
Reads the metadata from a file containing trees in binary format.
inputStream | The Stream from which the file should be read. Its Stream.CanSeek must be true . It does not have to be a FileStream. |
keepOpen | Determines whether the stream should be disposed at the end of this method or not. |
reader | A BinaryReader to read from the inputStream . If this is null , a new BinaryReader will be initialised and disposed within this method. |
progressAction | An Action that may be invoked while parsing the tree file, with an argument ranging from 0 to 1 describing the progress made in reading the file (determined by the position in the stream). |
|
static |
Lazily parses trees from a file in binary format. Each tree in the file is not read and parsed until it is requested.
inputStream | The Stream from which the file should be read. Its Stream.CanSeek must be true . It does not have to be a FileStream. |
keepOpen | Determines whether the stream should be disposed at the end of this method or not. |
progressAction | An Action that might be called after each tree is parsed, with the approximate progress (as determined by the position in the stream), ranging from 0 to 1. |
|
static |
Lazily parses trees from a file in binary format. Each tree in the file is not read and parsed until it is requested.
inputFile | The path to the input file. |
progressAction | An Action that might be called after each tree is parsed, with the approximate progress (as determined by the position in the stream), ranging from 0 to 1. |
|
static |
Writes trees in binary format.
trees | An IEnumerable<T> containing the trees to be written. It will ony be enumerated once. |
outputStream | The Stream on which the trees should be written. |
keepOpen | Determines whether the outputStream should be kept open after the end of this method. |
progressAction | An Action that will be invoked after each tree is written, with the number of trees written so far. |
additionalDataToCopy | A stream containing additional data that will be copied into the binary file. |
|
static |
Writes trees in binary format.
trees | An IEnumerable<T> containing the trees to be written. It will ony be enumerated once. |
outputFile | The file on which the trees should be written. |
append | Specifies whether the file should be overwritten or appended to. |
progressAction | An Action that will be invoked after each tree is written, with the number of trees written so far. |
additionalDataToCopy | A stream containing additional data that will be copied into the binary file. |
|
static |
Writes trees in binary format.
trees | A collection of trees to be written. Each tree will be accessed twice. |
outputStream | The Stream on which the trees should be written. |
keepOpen | Determines whether the outputStream should be kept open after the end of this method. |
progressAction | An Action that will be invoked after each tree is written, with a value between 0 and 1 depending on how many trees have been written so far. |
additionalDataToCopy | A stream containing additional data that will be copied into the binary file. |
|
static |
Writes trees in binary format.
trees | A collection of trees to be written. Each tree will be accessed twice. |
outputFile | The file on which the trees should be written. |
append | Specifies whether the file should be overwritten or appended to. |
progressAction | An Action that will be invoked after each tree is written, with a value between 0 and 1 depending on how many trees have been written so far. |
additionalDataToCopy | A stream containing additional data that will be copied into the binary file. |
|
static |
Writes a single tree in Binary format.
tree | The tree to be written. |
outputStream | The Stream on which the tree should be written. |
keepOpen | Determines whether the outputStream should be kept open after the end of this method. |
additionalDataToCopy | A stream containing additional data that will be copied into the binary file. |
|
static |
Writes a single tree in Binary format.
tree | The tree to be written. |
outputFile | The file on which the trees should be written. |
append | Specifies whether the file should be overwritten or appended to. |
additionalDataToCopy | A stream containing additional data that will be copied into the binary file. |