PyPop.popanalysis#
Primary access to PyPop’s population genetics statistics modules.
This module handles processing configparser.ConfigParser
instance. The Main class coordinates running the analysis
packages specified in this configparser.ConfigParser instance
which can be:
created from a filename passed from command-line argument oar;
from values populated by the GUI (for example, selected from an
.inifile,created programmatically as part of an external Python program
Here is an example of calling Main programmatically,
explicitly specifying the untypedAllele and alleleDesignator
in the .pop file:
>>> from PyPop.popanalysis import Main
>>> from configparser import ConfigParser
>>>
>>> config = ConfigParser()
>>> config.read_dict({
... "ParseGenotypeFile": {"untypedAllele": "****",
... "alleleDesignator": "*",
... "validSampleFields": "*a_1\n*a_2"}})
>>>
>>> pop_contents = '''a_1\ta_2
... ****\t****
... 01:01\t02:01
... 02:10\t03:01:02'''
>>> with open("my.pop", "w") as f:
... _ = f.write(pop_contents)
...
>>> application = Main(
... config=config,
... fileName="my.pop",
... version="fake",
... )
LOG: no XSL file, skipping text output
LOG: Data file has no header data block
Classes#
Main interface to the PyPop modules. |
Functions#
|
Create and return ConfigParser instance. |
|
Get the directory for the |
Module Contents#
- class Main(config=None, xslFilename=None, xslFilenameDefault=None, fileName=None, datapath=None, thread=None, outputDir=None, version=None, testMode=False)#
Main interface to the PyPop modules.
Runs the analyses specified in the configuration object provided to the
configparameter, and an inputfileName, and generates an output XML file. The XML output file name, appends-out.xmlon to the stem of the providedfileName. For example, iffileName="MyPopulation.pop"is provided as a parameter, the output XML file will beMyPopulation-out.xml.Changed in version 1.4.0: If an
xslFilenameorxslFilenameDefaultis provided, also generate a plain text output. Otherwise no text output is generated. Previous to this version, if neither were provided, the program would exit with an error.- Parameters:
config (configparser.ConfigParser) – configure object
xslFilename (str, optional) – XSLT file to use
xslFilenameDefault (str, optional) – fallback file name
fileName (str) – input
.popfiledatapath (str, optional) – root of data path
thread (str, optional) – specified thread
outputDir (str, optional) – use a different output directory than default
version (str, optional) – current Python version for output
testMode (bool, optional) – enable testing mode
- getXmlOutPath()#
Get name of XML file.
- Returns:
return XML file name
- Return type:
- getTxtOutPath()#
Get name of
.txtoutput file.- Returns:
return txt file name
- Return type:
- getConfigInstance(configFilename=None, altpath=None)#
Create and return ConfigParser instance.
- Parameters:
- Returns:
configuration object
- Return type: