Welcome to Genonets’ documentation!¶
This package provides a high level interface for construction and analysis of genotype networks from data.
Following features are available:
Parsing of genotype-phenotype maps from an input file, provided in the genonets input-file format
Creation of genotype networks from input data
Various analyses on the constructed genotype networks
Generation of result files with attributes from genotype-network-level analyses, as well as genotype-level analyses
Creation of a phenotype network that shows evolvability and accessibility relationships between the genotype sets
Generation of GML files corresponding to the created genotype networks and the phenotype network
Installation¶
Before installing Genonets, please use the following command to upgrade
pip
and setuptools
:
$ pip install -U pip setuptools
Then install Genonets using the following command:
$ pip install genonets
Note
Only Python 3.8
and above are supported. Also, Linux
and
MacOS
are supported; we plan to add support for Windows
at a
later time.
Getting started¶
Tutorial I: The one-liner¶
The following code snippet shows the simplest possible way of using Genonets:
1from genonets.cmdl_handler import CmdParser
2from genonets.interface import Genonets
3
4Genonets(CmdParser().get_args(), process=True)
Yes, that’s it. Two import statements, and just one line of code to create,
analyze, and save, all the genotype networks in the input file, as well the
phenotype network. In fact, these are the contents of the
minimal.py
sample file included in the package.
Assuming you have already installed Genonets and downloaded the sample input
file available here
, the minimal.py
program can be used to process the sample input file as follows.
$ python -u -m genonets.sample.minimal --alphabet=DNA --input-file=input.csv --include-indels --tau=0.35 --output-path=results --verbose
This creates a directory called results
in which all the result files
are written.
Note
All command-line arguments and configuration parameters are documented here.
Tutorial II: Step-by-step processing¶
Instead of using a single call to perform all the processing steps, one can split these steps into multiple function calls. Here’s a code sample:
1from genonets.cmdl_handler import CmdParser
2from genonets.interface import Genonets
3
4# Parse the command line argument and create the Genonets object
5gn = Genonets(CmdParser().get_args(), process=False)
6
7# Use 'gn' to create genotype networks for all genotype sets.
8gn.create()
9
10# Perform all available analyses on all genotype networks.
11gn.analyze()
12
13# Write all genotype networks to files in GML format. For a genotype network
14# with two or more components, two files are generated: One corresponds to the
15# entire network with all components, and the other corresponds to the dominant
16# component only.
17gn.save()
18
19# Save all genotype network level measures to 'Genotype_set_measures.txt'.
20gn.save_network_results()
21
22# Save all genotype level measures to '<genotypeSetName>_genotype_measures.txt'
23# files. One file per genotype set is generated.
24gn.save_genotype_results()
Tutorial III: Selective processing¶
It is also possible to process only a selection of genotype sets from the input data. Also, it is possible to perform only a selection of available analysis types. Here’s a code sample:
1from genonets.cmdl_handler import CmdParser
2from genonets.interface import Genonets
3
4# Parse the command line argument and create the Genonets object
5gn = Genonets(CmdParser().get_args(), process=False)
6
7# Use 'gn' to create genotype networks for all genotype sets.
8gn.create()
9
10# Perform only 'Robustness' and 'Evolvability' analyses on just two of
11# the genotype sets available in the input file, i.e., 'Foxa2' and 'Bbx'.
12gn.analyze(["Foxa2", "Bbx"], analyses=[ac.ROBUSTNESS, ac.EVOLVABILITY])
13
14# Write the given genotype networks to files in GML format.
15# For a genotype network with two or more components, two files are generated:
16# One corresponds to the entire network with all components, and the other
17# corresponds to the dominant component only.
18gn.save(["Foxa2", "Bbx"])
19
20# Save genotype network level measures for the given genotype sets to
21# 'Genotype_set_measures.txt'.
22gn.save_network_results(["Foxa2", "Bbx"])
23
24# Save all genotype level measures for the given genotype sets to
25# 'Foxa2_genotype_measures.txt' and 'Bbx_genotype_measures.txt' files.
26gn.save_genotype_results(["Foxa2", "Bbx"])
See Analysis constants and Genonets interface methods for more information on a list of analysis constants and API methods.