snipar.read.phenotype module
- snipar.read.phenotype.match_phenotype(G, y, pheno_ids)[source]
Match a phenotype to a genotype array by individual IDs.
- Args:
- G
gtarray genotype array to match phenotype to
- y
array vector of phenotype values
- pheno_ids:
array vector of individual IDs corresponding to phenotype vector, y
- G
- Returns:
- y
array vector of phenotype values matched by individual IDs to the genotype array
- y
- snipar.read.phenotype.read_phenotype(file_path, column=None, column_index=None, na_values='NA')[source]
Read data from a text file with header structure where either: - First two columns are ‘FID’ and ‘IID’ - First column is ‘IID’
Parameters: file_path (str): Path to the text file column (str, optional): Name of column to extract (other than ‘FID’ or ‘IID’) column_index (int, optional): Index of column to extract (counting from 1 after ‘IID’/’FID’)
Note: This is 1-based indexing
na_values (str or list, optional): String or list of strings to recognize as NA/NaN. Default is ‘NA’.
- Returns:
- y
snipar.gtarray vector of non-missing phenotype values from specified column of phenofile along with individual IDs
- y
Note: If neither column nor column_index is provided, defaults to first column after IID/FID