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:
Ggtarray

genotype array to match phenotype to

yarray

vector of phenotype values

pheno_ids: array

vector of individual IDs corresponding to phenotype vector, y

Returns:
yarray

vector of phenotype values matched by individual IDs to the genotype array

snipar.read.phenotype.read_covariates(covar, pheno_ids=None, missing_char='NA')[source]
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:
ysnipar.gtarray

vector of non-missing phenotype values from specified column of phenofile along with individual IDs

Note: If neither column nor column_index is provided, defaults to first column after IID/FID