The utils subpackage contains modules providing functions used by several steps of ProCARs. These can be input/output functions, or utility functions in order to work with adjacencies (transform CAR adjacencies to block adjacencies, find non-conflicting adjacencies in a given set, etc.).
Copyright © Bonsai - LIFL (Université Lille 1, CNRS UMR 8022) and Inria-Lille Nord Europe
contact: aida.ouangraoua@inria.fr, amandine.perrin@inria.fr
This software is a computer program whose purpose is to progressively reconstruct ancestral gene orders.
This software is governed by the CeCILL-B license under French law and abiding by the rules of distribution of free software. You can use, modify and/or redistribute the software under the terms of the CeCILL-B license as circulated by CEA, CNRS and Inria at the following URL http://www.cecill.info, or in the LICENCE file at the root directory of this program.
The fact that you are presently reading this means that you have had knowledge of the CeCILL-B license and that you accept its terms.
initial_files_reader module description:
This module contains some methods used to read and parse the initial files:
- Phylogeny tree file (where a node is marked as the ancestor: @)
- Blocks file (with block order of each genome of the tree)
Module author: Aïda Ouangraoua, Amandine PERRIN
May 2014
Method reading blocks from a block file
Parameters: | block_file_name : String
nb_species : int
spe_ids : dict
|
---|---|
Returns: | list
|
Reading one line of a block file, in order to return a new block number, or the positions of a block in a species chromosome.
Parameters: | line : String
chm : dict
spe_ids : dict
blocks : list
bloc_id : int
|
---|---|
Returns: | list
|
Function reading the tree structure from a file
Parameters: | tree_file_name : String
|
---|---|
Returns: | tuple
|
Copyright © Bonsai - LIFL (Université Lille 1, CNRS UMR 8022) and Inria-Lille Nord Europe
contact: aida.ouangraoua@inria.fr, amandine.perrin@inria.fr
This software is a computer program whose purpose is to progressively reconstruct ancestral gene orders.
This software is governed by the CeCILL-B license under French law and abiding by the rules of distribution of free software. You can use, modify and/or redistribute the software under the terms of the CeCILL-B license as circulated by CEA, CNRS and Inria at the following URL http://www.cecill.info, or in the LICENCE file at the root directory of this program.
The fact that you are presently reading this means that you have had knowledge of the CeCILL-B license and that you accept its terms.
util_adjacency_functions module description:
Module containing methods used by other modules like compute_resolved_conflicts and compute_conserved_adjacencies in order to find required adjacencies.
It contains for exemple methods in order to:
- split a set of adjacencies in a set of conflicting adjacencies and a set of non-conflicting ones.
- Find the block numbers involved in a given adjacency according to the adjacency ID in the matrix
Module author: Aïda Ouangraoua, Amandine PERRIN
February 2014
From a signed car, returns the signed block at the side extremity
Parameters: | signed_car : int
side : int
cars : list
|
---|---|
Returns: | int
|
Function computing the CAR adjacencies (car1, car2) stored into an extremity pairs array
Parameters: | extremity_pairs : list
nb_blocks : int
|
---|---|
Returns: | list
|
Function computing the extremity pairs stored into an adjacency matrix: it finds all couples of indexes for which an adjacency exists (=indexes for which adjacencymatrix[x, y] != 0)
Parameters: | adjacencymatrix : SparseMatrix
|
---|---|
Returns: | list
|
Function computing the conservation status of an adjacency
nbgroup = number of group in which adjacency is present. If nbgroup = 3, the adjacency is ‘fully’. If nbgroup = 2, the adjacency is partly. Otherwise, the adjacency is not conserved.
Parameters: | adjacency : list
left : list
right : list
species1_id: list
species2_id: list
species3_id: list
|
---|---|
Returns: | tuple
|
Find information on a car_adjacency: in which genomes it is present
Parameters: | car_adjacency : tuple
car_left : list
car_right : list
species1_id : list
species2_id : list
species3_id : list
|
---|---|
Returns: | list
|
Function splitting an adjacency matrix into two matrices: the non-conflicting and the conflicting adjacency matrices
Parameters: | adjacencymatrix : SparseMatrix
nb_blocks : int
|
---|---|
Returns: | tuple of SparseMatrix
|
Copyright © Bonsai - LIFL (Université Lille 1, CNRS UMR 8022) and Inria-Lille Nord Europe
contact: aida.ouangraoua@inria.fr, amandine.perrin@inria.fr
This software is a computer program whose purpose is to progressively reconstruct ancestral gene orders.
This software is governed by the CeCILL-B license under French law and abiding by the rules of distribution of free software. You can use, modify and/or redistribute the software under the terms of the CeCILL-B license as circulated by CEA, CNRS and Inria at the following URL http://www.cecill.info, or in the LICENCE file at the root directory of this program.
The fact that you are presently reading this means that you have had knowledge of the CeCILL-B license and that you accept its terms.
util_classes module description:
This module contains classes used by ProCARs.
- SparseMatrix: provides a sparse matrix data structure
Module author: Aïda Ouangraoua, Amandine PERRIN
July 2014
Class providing a sparse matrix data structure, used when a matrix with a lot of zeros is needed.
Attributes
sparse_matrix | (dict) dictionary where keys are IDs of lines containing non-null elements, and values are a dictionary with column IDs with non-null elements as keys and value at these positions (line_id, column_id) as values. Ex: {x1: {y1: 1, y3: 7}, x8: {y4: 4, y3: 5}} All other positions in the matrix are zeros. |
line_nb | (int) sparse matrix x size (number of lines) |
col_nb | (int) sparse matrix y size (number of columns) |
Methods
Copyright © Bonsai - LIFL (Université Lille 1, CNRS UMR 8022) and Inria-Lille Nord Europe
contact: aida.ouangraoua@inria.fr, amandine.perrin@inria.fr
This software is a computer program whose purpose is to progressively reconstruct ancestral gene orders.
This software is governed by the CeCILL-B license under French law and abiding by the rules of distribution of free software. You can use, modify and/or redistribute the software under the terms of the CeCILL-B license as circulated by CEA, CNRS and Inria at the following URL http://www.cecill.info, or in the LICENCE file at the root directory of this program.
The fact that you are presently reading this means that you have had knowledge of the CeCILL-B license and that you accept its terms.
utils_IO module description:
This module contains some methods used by the other modules when they need to read/write into files.
Module author: Aïda Ouangraoua, Amandine PERRIN
May 2014
Read an adjacency file (or a discarded adjacency file), and find all blocks and their left and right neighbors
used in compute_pqtree and resolve_conflict
Parameters: | adjacency_file_name : string
nb_blocks : int
discarded : boolean
|
---|---|
Returns: | tuple
|
Reading information stored into a binary file
Parameters: | bin_filename : string
|
---|---|
Returns: | tuple
|
Function reading a CAR file
Parameters: | car_file_name : string
nb_blocks : int
|
---|---|
Returns: | tuple
|
Read file containing previously discarded adjacencies, and yield them with their information
Parameters: | adj_file : string
nb_species : int
leaves : list
tree : dict
spe_ids : dict
|
---|---|
Returns: | tuple
|
Saving information into a binary file
Parameters: | bin_filename : String
information : list
|
---|
Writes all adjacency information into a file handler
Parameters: | output_file : FileHandler
cars : list
car_adjacency : list
adj_type : int
step_nb : int
labels : string
|
---|
Writes all CARs into the given file
Parameters: | car_filename : String
all_cars : list
|
---|
Write retained adjacencies after a conflict resolution into a txt file -> next adjacency file
Parameters: | filename : string
adj_infos : dict
maximum_set : list
adj_ids : dict
|
---|