hamsta.io.read_global_ancestry#

hamsta.io.read_global_ancestry(fname, sample_colname, **pd_kwargs)#

Global ancestry reader

The sample column will be stored in strings.
All other keyword arguments will be passed to pandas.read_csv
Parameters
  • fname (str) – filename of the global ancestry file

  • sample_colname (str) – column names of the sample

Example

>>> from hamsta.io import read_global_ancestry
>>> Q_df = read_global_ancestry("tests/testdata/example.rfmix.Q",
...     sample_colname="#sample", skiprows=1)
>>> Q_df.head()
   sample  HCB  JPT
0  HCB182  1.0  0.0
1  HCB190  1.0  0.0
2  HCB191  1.0  0.0
3  HCB193  1.0  0.0
4  HCB194  0.5  0.5
>>> Q_df.dtypes
sample     object
HCB       float64
JPT       float64
dtype: object
Return type

DataFrame