{"id":21433571,"url":"https://github.com/limix/pandas-plink","last_synced_at":"2025-10-03T19:17:21.388Z","repository":{"id":49487948,"uuid":"75509161","full_name":"limix/pandas-plink","owner":"limix","description":"PLINK reader for Python.","archived":false,"fork":false,"pushed_at":"2025-02-27T11:31:37.000Z","size":2309,"stargazers_count":84,"open_issues_count":4,"forks_count":19,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-13T00:46:42.328Z","etag":null,"topics":["bed-format","file-format","genotype","plink","reader"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/limix.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-12-04T00:46:20.000Z","updated_at":"2025-04-08T03:51:03.000Z","dependencies_parsed_at":"2022-08-25T23:01:08.316Z","dependency_job_id":"6e0ba05d-92c0-443d-9cae-c34120408b1c","html_url":"https://github.com/limix/pandas-plink","commit_stats":{"total_commits":530,"total_committers":5,"mean_commits":106.0,"dds":0.1943396226415094,"last_synced_commit":"b580df7f8d3c566f6cdf8da512c608fd76ff1f0c"},"previous_names":[],"tags_count":52,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/limix%2Fpandas-plink","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/limix%2Fpandas-plink/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/limix%2Fpandas-plink/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/limix%2Fpandas-plink/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/limix","download_url":"https://codeload.github.com/limix/pandas-plink/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248650434,"owners_count":21139672,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bed-format","file-format","genotype","plink","reader"],"created_at":"2024-11-22T23:28:48.594Z","updated_at":"2025-10-03T19:17:16.362Z","avatar_url":"https://github.com/limix.png","language":"Python","funding_links":[],"categories":["زیست شناسی و بیوتکنولوژی"],"sub_categories":["کار با زمان و تقویم"],"readme":"# pandas-plink\n\nPandas-plink is a Python package for reading [PLINK binary file format](https://www.cog-genomics.org/plink2/formats)\nand realized relationship matrices (PLINK or GCTA).\nThe file reading is taken place via [lazy loading](https://en.wikipedia.org/wiki/Lazy_loading), meaning that it saves up memory by actually reading only the genotypes that are actually accessed by the user.\n\nNotable changes can be found at the [CHANGELOG.md](https://raw.githubusercontent.com/limix/pandas-plink/master/CHANGELOG.md).\n\n## Install\n\nIt can be installed using [pip](https://pypi.python.org/pypi/pip):\n\n```bash\npip install pandas-plink\n```\n\nAlternatively it can be intalled via [conda](http://conda.pydata.org/docs/index.html):\n\n```bash\nconda install -c conda-forge pandas-plink\n```\n\n## Usage\n\nIt is as simple as\n\n```python\n\u003e\u003e\u003e from pandas_plink import read_plink1_bin\n\u003e\u003e\u003e G = read_plink1_bin(\"chr11.bed\", \"chr11.bim\", \"chr11.fam\", verbose=False)\n\u003e\u003e\u003e print(G)\n\u003cxarray.DataArray 'genotype' (sample: 14, variant: 779)\u003e\ndask.array\u003cshape=(14, 779), dtype=float64, chunksize=(14, 779)\u003e\nCoordinates:\n  * sample   (sample) object 'B001' 'B002' 'B003' ... 'B012' 'B013' 'B014'\n  * variant  (variant) object '11_316849996' '11_316874359' ... '11_345698259'\n    father   (sample) \u003cU1 '0' '0' '0' '0' '0' '0' ... '0' '0' '0' '0' '0' '0'\n    fid      (sample) \u003cU4 'B001' 'B002' 'B003' 'B004' ... 'B012' 'B013' 'B014'\n    gender   (sample) \u003cU1 '0' '0' '0' '0' '0' '0' ... '0' '0' '0' '0' '0' '0'\n    i        (sample) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 13\n    iid      (sample) \u003cU4 'B001' 'B002' 'B003' 'B004' ... 'B012' 'B013' 'B014'\n    mother   (sample) \u003cU1 '0' '0' '0' '0' '0' '0' ... '0' '0' '0' '0' '0' '0'\n    trait    (sample) \u003cU2 '-9' '-9' '-9' '-9' '-9' ... '-9' '-9' '-9' '-9' '-9'\n    a0       (variant) \u003cU1 'C' 'G' 'G' 'C' 'C' 'T' ... 'T' 'A' 'C' 'A' 'A' 'T'\n    a1       (variant) \u003cU1 'T' 'C' 'C' 'T' 'T' 'A' ... 'C' 'G' 'T' 'G' 'C' 'C'\n    chrom    (variant) \u003cU2 '11' '11' '11' '11' '11' ... '11' '11' '11' '11' '11'\n    cm       (variant) float64 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0\n    pos      (variant) int64 157439 181802 248969 ... 28937375 28961091 29005702\n    snp      (variant) \u003cU9 '316849996' '316874359' ... '345653648' '345698259'\n\u003e\u003e\u003e print(G.sel(sample=\"B003\", variant=\"11_316874359\").values)\n0.0\n\u003e\u003e\u003e print(G.a0.sel(variant=\"11_316874359\").values)\nG\n\u003e\u003e\u003e print(G.sel(sample=\"B003\", variant=\"11_316941526\").values)\n2.0\n\u003e\u003e\u003e print(G.a1.sel(variant=\"11_316941526\").values)\nC\n```\nPortions of the genotype will be read as the user access them.\n\nCovariance matrices can also be read very easily.\nExample:\n\n```python\n\u003e\u003e\u003e from pandas_plink import read_rel\n\u003e\u003e\u003e K = read_rel(\"plink2.rel.bin\")\n\u003e\u003e\u003e print(K)\n\u003cxarray.DataArray (sample_0: 10, sample_1: 10)\u003e\narray([[ 0.885782,  0.233846, -0.186339, -0.009789, -0.138897,  0.287779,\n         0.269977, -0.231279, -0.095472, -0.213979],\n       [ 0.233846,  1.077493, -0.452858,  0.192877, -0.186027,  0.171027,\n         0.406056, -0.013149, -0.131477, -0.134314],\n       [-0.186339, -0.452858,  1.183312, -0.040948, -0.146034, -0.204510,\n        -0.314808, -0.042503,  0.296828, -0.011661],\n       [-0.009789,  0.192877, -0.040948,  0.895360, -0.068605,  0.012023,\n         0.057827, -0.192152, -0.089094,  0.174269],\n       [-0.138897, -0.186027, -0.146034, -0.068605,  1.183237,  0.085104,\n        -0.032974,  0.103608,  0.215769,  0.166648],\n       [ 0.287779,  0.171027, -0.204510,  0.012023,  0.085104,  0.956921,\n         0.065427, -0.043752, -0.091492, -0.227673],\n       [ 0.269977,  0.406056, -0.314808,  0.057827, -0.032974,  0.065427,\n         0.714746, -0.101254, -0.088171, -0.063964],\n       [-0.231279, -0.013149, -0.042503, -0.192152,  0.103608, -0.043752,\n        -0.101254,  1.423033, -0.298255, -0.074334],\n       [-0.095472, -0.131477,  0.296828, -0.089094,  0.215769, -0.091492,\n        -0.088171, -0.298255,  0.910274, -0.024663],\n       [-0.213979, -0.134314, -0.011661,  0.174269,  0.166648, -0.227673,\n        -0.063964, -0.074334, -0.024663,  0.914586]])\nCoordinates:\n  * sample_0  (sample_0) object 'HG00419' 'HG00650' ... 'NA20508' 'NA20753'\n  * sample_1  (sample_1) object 'HG00419' 'HG00650' ... 'NA20508' 'NA20753'\n    fid       (sample_1) object 'HG00419' 'HG00650' ... 'NA20508' 'NA20753'\n    iid       (sample_1) object 'HG00419' 'HG00650' ... 'NA20508' 'NA20753'\n\u003e\u003e\u003e print(K.values)\n[[ 0.89  0.23 -0.19 -0.01 -0.14  0.29  0.27 -0.23 -0.10 -0.21]\n [ 0.23  1.08 -0.45  0.19 -0.19  0.17  0.41 -0.01 -0.13 -0.13]\n [-0.19 -0.45  1.18 -0.04 -0.15 -0.20 -0.31 -0.04  0.30 -0.01]\n [-0.01  0.19 -0.04  0.90 -0.07  0.01  0.06 -0.19 -0.09  0.17]\n [-0.14 -0.19 -0.15 -0.07  1.18  0.09 -0.03  0.10  0.22  0.17]\n [ 0.29  0.17 -0.20  0.01  0.09  0.96  0.07 -0.04 -0.09 -0.23]\n [ 0.27  0.41 -0.31  0.06 -0.03  0.07  0.71 -0.10 -0.09 -0.06]\n [-0.23 -0.01 -0.04 -0.19  0.10 -0.04 -0.10  1.42 -0.30 -0.07]\n [-0.10 -0.13  0.30 -0.09  0.22 -0.09 -0.09 -0.30  0.91 -0.02]\n [-0.21 -0.13 -0.01  0.17  0.17 -0.23 -0.06 -0.07 -0.02  0.91]]\n```\n\nPlease, refer to the [pandas-plink documentation](https://pandas-plink.readthedocs.io/) for more information.\n\n## Authors\n\n* [Danilo Horta](https://github.com/horta)\n\n## License\n\nThis project is licensed under the [MIT License](https://raw.githubusercontent.com/limix/pandas-plink/master/LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flimix%2Fpandas-plink","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flimix%2Fpandas-plink","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flimix%2Fpandas-plink/lists"}