# eigenstrat_fstats.py: F-statistics Analysis¶

Automates the calculation of multiple admixture statistics, including: Patterson's D, F4 statistic, F4-ratio statistic, and F3 statistic.

## Command-line Usage¶

The admixture statistics automater may be called using the following command:

eigenstrat_fstats.py


### Example usage¶

Command-line to calculate Patterson's D:

eigenstrat_fstats.py --eigenstrat-prefix snps --calc-admix-statistic D --admix-w-pop French --admix-x-pop Yoruba --admix-y-pop Vindija --admix-z-pop Chimp


Command-line to calculate the F4-ratio:

eigenstrat_fstats.py --eigenstrat-prefix snps --calc-admix-statistic F4-ratio --admix-a-pop Altai --admix-b-pop Vindija --admix-c-pop Yoruba --admix-x-pop French --admix-o-pop Chimp


## Input Command-line Arguments¶

--eigenstrat-prefix <input_prefix>
Argument used to define the filename prefix shared by the genotype file (.geno), the individual file (.ind), and the SNP file (.snp). Should not be used alongside the specific file arguments (e.g. --geno).
--geno <geno_filename>
Argument used to define the filename of the eigenstrat genotype file (.geno). Must be called alongside --ind and --snp. Cannot be called alongside --eigenstrat-prefix.
--ind <ind_filename>
Argument used to define the filename of the eigenstrat individual file (.ind). Must be called alongside --geno and --snp. Cannot be called alongside --eigenstrat-prefix.
--snp <snp_filename>
Argument used to define the filename of the eigenstrat SNP file (.snp). Must be called alongside --geno and --ind. Cannot be called alongside --eigenstrat-prefix.
--model-file <model_filename>
Argument used to define the model file. Please note that this argument cannot be used with the individual-based filters.
--model <model_str>
Argument used to define the model (i.e. the individual(s) to include and/or the populations for relevant statistics). May be used with any statistic. Please note that this argument cannot be used with --pop-file argument or the individual-based filters.

## Output Command-line Arguments¶

--out <output_filename>
Argument used to define the complete output filename, overrides --out-prefix. Cannot be used if multiple output files are created.
--out-prefix <output_prefix>
Argument used to define the output prefix (i.e. filename without file extension)
--overwrite
Argument used to define if previous output should be overwritten.

## Statistic Command-line Specification¶

Argument used to define the admix statistic to be calculated. Patterson's D (D), F4 statistic (F4), F4-ratio statistic (F4-ratio), and F3 statistic (F3). See below for details on the arguments requried by each statistic .

### Statistic Command-line Requirements¶

It should be noted that each admix statistic has a specific set of population labels arguments. These labels are used to specify a representive population. For instance, the argument '--admix-w-pop CEU' will replace the W label of Patterson's D and the F4 statistic with the CEU population. These arguments may be found in the next section.

Argument used to define the population(s) to represent W in the supported admixure statistic. This argument may be used multiple times if desired. If multiple populations the statistic will be repeated until each population has represented W.
Argument used to define a file of population(s) to represent W in the supported admixure statistic. If multiple populations the statistic will be repeated until each population has represented W.
Argument used to define the population(s) to represent X in the supported admixure statistic. This argument may be used multiple times if desired. If multiple populations the statistic will be repeated until each population has represented X.
Argument used to define a file of population(s) to represent X in the supported admixure statistic. If multiple populations the statistic will be repeated until each population has represented X.
Argument used to define the population(s) to represent Y in the supported admixure statistic. This argument may be used multiple times if desired. If multiple populations the statistic will be repeated until each population has represented Y.
Argument used to define a file of population(s) to represent Y in the supported admixure statistic. If multiple populations the statistic will be repeated until each population has represented Y.
Argument used to define the population(s) to represent Z in the supported admixure statistic. This argument may be used multiple times if desired. If multiple populations the statistic will be repeated until each population has represented Z.