hamsta.io.read_rfmixfb#

hamsta.io.read_rfmixfb(fname, ancestry, exclude=None)#

Reader for RFMIX .fb.tsv output

Reading RFMIX .fb.tsv output as probability dosages

Parameters
  • fname (str) – Path to RFMIX output

  • ancestry (str) – The ancestry to be extracted

  • exclude (Optional[str]) – str = None,

Return type

Tuple[Array, DataFrame]

Returns

a local ancestry matrix (marker, sample) and list of sample

Example

>>> from hamsta import io
>>> A, A_sample = io.read_rfmixfb("tests/testdata/example.fb.tsv", "HCB")
>>> A[:5, :5]
DeviceArray([[2.   , 2.   , 2.   , 1.969, 1.   ],
             [2.   , 2.   , 2.   , 1.969, 1.   ],
             [2.   , 2.   , 2.   , 1.969, 1.   ],
             [2.   , 2.   , 2.   , 1.969, 1.   ],
             [2.   , 2.   , 2.   , 1.969, 1.   ]], dtype=float32)
>>> A_sample.head(5)
   sample
0  HCB182
1  HCB190
2  HCB191
3  HCB193
4  HCB194