Navigation

  • index
  • modules |
  • pandas-plink 1.0.14 documentation »

Table of Contents¶

  • Pandas-plink’s documentation
    • Install
    • Usage
    • Functions

Pandas-plink’s documentation¶

You can get the source and open issues on Github.

Install¶

The recommended way of installing it is via conda:

conda install -c conda-forge pandas-plink

An alternative way would be via pip:

pip install pandas-plink

Usage¶

It is as simple as:

from pandas_plink import read_plink
(bim, fam, G) = read_plink('/path/to/data')

assuming that you have the files

  • /path/to/data.bim
  • /path/to/data.fam
  • /path/to/data.bed

Functions¶

pandas_plink.read_plink(file_prefix, verbose=True)[source]¶

Convert PLINK files into Pandas data frames.

Parameters:
  • file_prefix (str) – Path prefix to the set of PLINK files.
  • verbose (bool) – True for progress information; False otherwise.
Returns:

parsed data containing:

  • pandas.DataFrame: alleles.
  • pandas.DataFrame: samples.
  • numpy.ndarray: genotype.

Return type:

tuple

Examples

We have shipped this package with an example so can load and inspect by doing

from pandas_plink import read_plink
from pandas_plink import example_file_prefix
(bim, fam, G) = read_plink(example_file_prefix())
print(bim.head())
print(fam.head())
print(G)

Running the above code will print

                    snp   cm a0 a1  i
chrom pos
1     45162  rs10399749  0.0  G  C  0
      45257   rs2949420  0.0  C  T  1
      45413   rs2949421  0.0  0  0  2
      46844   rs2691310  0.0  A  T  3
      72434   rs4030303  0.0  0  G  4

                     father    mother gender trait  i
fid      iid
Sample_1 Sample_1         0         0      1    -9  0
Sample_2 Sample_2         0         0      2    -9  1
Sample_3 Sample_3  Sample_1  Sample_2      2    -9  2

[[2 2 1]
 [2 1 2]
 [3 3 3]
 [3 3 1]
 [2 2 2]
 [2 2 2]
 [2 1 0]
 [2 2 2]
 [1 2 2]
 [2 1 2]]
pandas_plink.test()[source]¶

Tests this package.

You will need pytest installed in order to use this function.

pandas_plink.example_file_prefix()[source]¶

Data files prefix.

Table Of Contents

  • Pandas-plink’s documentation
    • Install
    • Usage
    • Functions

This Page

  • Show Source

Quick search

Navigation

  • index
  • modules |
  • pandas-plink 1.0.14 documentation »
© Copyright 2016, Danilo Horta. Created using Sphinx 1.5.