pandas_genomics.io.to_plink¶
-
pandas_genomics.io.
to_plink
(data: pandas.core.frame.DataFrame, output: str, phenotype_name: Optional[str] = None, phenotype_case: Optional[str] = None, phenotype_control: Optional[str] = None, id_prefix: str = 'sample')[source]¶ Save genetic data to plink v1 files (.bed, .bim, and .fam)
- Parameters
- data: pd.DataFrame
DataFrame containing GenotypeArrays to be saved.
- output: str
Name to use for the output .bed, .bim, and .fam files
- phenotype_name: str, default None
Optional column in data to be saved as the phenotype value in the .fam file.
- phenotype_case, phenotype_control
String values indicating the category to be used as “case” or “control” for binary phenotypes. If provided, the phenotype must be categorical. If not provided, the phenotype is not encoded at all (assumed to be quantitative).
- id_prefix:
If the data index is an integer index, this prefix will be added to generate IDs.
Notes
If the data index has the required columns (FID, IID, IID_father, IID_mother, sex, phenotype) the fam file will be created based on the index. If a phenotype name is provided, this will override any phenotype information in the index. If the data has a single index column this will be used (with the prefix) for FID and IID. Defaults will be used for other .fam data