Using INI Files

dlatkInterface can read parameters from an input file (or INI file) using the flag --from_file. These are useful in shortening your commands and keeping track of parameters you've used in past projects. The fromFile() method in FeatureGetter, outcomeGetter and FeatureStar can also read these files.

In general, setup level flags are stored here. For example: database name, message table name, p correction method. Types of analysis (correlation, prediction, wordcloud creation) are not stored in these files.

Creating an init file from the command line

See the --to_file flag. Here is an example:

The command:

dlatkInterface.py -d county_addiction -t msgs_2011to13 -c cnty --word_table \
'feat$1gram$msgs_2011to13$cnty$16to16$0_1' --group_freq_thresh 40000 \
-f 'feat$cat_met_a30_2000_cp_w$msgs_2011to13$cnty$16to16' --outcome_table main_interest_vars_controls \
--outcomes ExcessDrink_Percent AlcDrivingDeaths_Percent --controls age_lt1 age_1to4 --correlate  \
--output_name ~/my_output --p_value 0.05 --p_correction 'bonferroni' --to_file ~/someFile.ini

Creates the file someFile.ini:

[constants]
corpdb = county_addiction
corptable = msgs_2011to13
correl_field = cnty
feattable = feat$cat_met_a30_2000_cp_w$msgs_2011to13$cnty$16to16
outcometable = main_interest_vars_controls
outcomefields = ExcessDrink_Percent, AlcDrivingDeaths_Percent
outcomecontrols = age_lt1, age_1to4
wordTable = feat$1gram$msgs_2011to13$cnty$16to16$0_1
outputname = /home/username/my_output

Using an init file via the command line

The above command then shortens to:

./dlatkInterface.py --from_file ~/someFile.ini --correlate

Using an init file with classes

The above file then shortens your dlatkInterface calls:

from dlatk.featureStar import FeatureStar
fs = FeatureStar.fromFile('~/someFile.ini')

For more examples of using ini files with dlatk classes: Working with DLATK's Classes