PyPop.Main#
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
.ini
file,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.Main 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, debugFlag=0, 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
config
parameter, and an inputfileName
, and generates an output XML file. The XML output file name, appends-out.xml
on 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
xslFilename
orxslFilenameDefault
is 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
debugFlag (int, optional) – enable debugging (
1
)fileName (str) – input
.pop
filedatapath (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
.txt
output file.- Returns:
return txt file name
- Return type:
- getConfigInstance(configFilename=None, altpath=None)#
Create and return ConfigParser instance.
- Parameters:
- Returns:
configuration object
- Return type:
- get_sequence_directory(directory_str, debug=False)#
Get the directory for the
PyPop.Filter.AnthonyNolanFilter
.