{ "info": { "author": "Francois Aguet (Broad Institute)", "author_email": "francois@broadinstitute.org", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Science/Research", "Programming Language :: Python :: 3", "Topic :: Scientific/Engineering :: Bio-Informatics" ], "description": "## tensorQTL\n\ntensorQTL is a GPU-based QTL mapper, enabling ~200-300 fold faster *cis*- and *trans*-QTL mapping compared to CPU-based implementations.\n\nIf you use tensorQTL in your research, please cite the following paper:\n[Taylor-Weiner, Aguet, et al., bioRxiv, 2019](https://www.biorxiv.org/content/10.1101/470138v3).\n\nEmpirical beta-approximated p-values are computed as described in [FastQTL](http://fastqtl.sourceforge.net/) ([Ongen et al., 2016](https://academic.oup.com/bioinformatics/article/32/10/1479/1742545)).\n\n### Install\nYou can install tensorQTL using pip:\n```\npip3 install tensorqtl\n```\nor directly from this repository:\n```\n$ git clone git@github.com:broadinstitute/tensorqtl.git\n$ cd tensorqtl\n# set up virtual environment and install\n$ virtualenv venv\n$ source venv/bin/activate\n(venv)$ pip install -r install/requirements.txt .\n```\n\n### Requirements\n\ntensorQTL requires an environment configured with a GPU. Instructions for setting up a virtual machine on Google Cloud Platform are provided [here](install/INSTALL.md).\n\n### Input formats\n\ntensorQTL requires three input files: genotypes, phenotypes, and covariates. Phenotypes must be provided in BED format (phenotypes x samples), and covariates as a text file (covariates x samples). Both are in the format used by [FastQTL](http://fastqtl.sourceforge.net/). Genotypes must currently be in [PLINK](https://www.cog-genomics.org/plink/2.0/) format, and can be converted as follows:\n```\nplink2 --make-bed \\\n --output-chr chrM \\\n --vcf ${plink_prefix_path}.vcf.gz \\\n --out ${plink_prefix_path}\n```\n\n### Examples\nFor examples illustrating *cis*- and *trans*-QTL mapping, please see [tensorqtl_examples.ipynb](example/tensorqtl_examples.ipynb).\n\n### Running tensorQTL from the command line\nThis section describes how to run tensorQTL from the command line. For a full list of options, run\n```\npython3 -m tensorqtl --help\n```\n\n#### *cis*-QTL mapping\nPhenotype-level summary statistics with empirical p-values:\n```\npython3 -m tensorqtl ${plink_prefix_path} ${expression_bed} ${prefix} \\\n --covariates ${covariates_file} \\\n --mode cis\n```\nAll variant-phenotype associations:\n```\npython3 -m tensorqtl ${plink_prefix_path} ${expression_bed} ${prefix} \\\n --covariates ${covariates_file} \\\n --mode cis_nominal\n```\nThis will generate a [parquet](https://parquet.apache.org/) file for each chromosome. These files can be read using `pandas`:\n```\nimport pandas as pd\ndf = pd.read_parquet(file_name)\n```\nConditionally independent *cis*-QTL (as described in [GTEx Consortium, 2017](https://www.nature.com/articles/nature24277)):\n```\npython3 -m tensorqtl ${plink_prefix_path} ${expression_bed} ${prefix} \\\n --covariates ${covariates_file} \\\n --cis_results ${cis_results_file} \\\n --mode cis_independent\n```\n\n#### *trans*-QTL mapping\n```\npython3 -m tensorqtl ${plink_prefix_path} ${expression_bed} ${prefix} \\\n --covariates ${covariates_file} \\\n --mode trans\n```\nFor *trans*-QTL mapping, tensorQTL generates sparse output by default (associations with p-value < 1e-5). *cis*-associations are filtered out. The output is in parquet format, with four columns: phenotype_id, variant_id, pval, maf.\n\n### Running tensorQTL as a Python module\nTensorQTL can also be run as a module to more efficiently run multiple analyses:\n```\nimport pandas as pd\nimport tensorqtl\nfrom tensorqtl import genotypeio, cis, trans\n```\n#### Loading input files\nLoad phenotypes and covariates:\n```\nphenotype_df, phenotype_pos_df = tensorqtl.read_phenotype_bed(phenotype_bed_file)\ncovariates_df = pd.read_csv(covariates_file, sep='\\t', index_col=0).T # samples x covariates\n```\nGenotypes can be loaded as follows, where `plink_prefix_path` is the path to the VCF in PLINK format:\n```\npr = genotypeio.PlinkReader(plink_prefix_path)\n# load genotypes and variants into data frames\ngenotype_df = pd.DataFrame(pr.get_all_genotypes(), index=pr.bim['snp'], columns=pr.fam['iid'])\nvariant_df = pr.bim.set_index('snp')[['chrom', 'pos']]\n```\nTo save memory when using genotypes for a subset of samples, you can specify the samples as follows (this is not strictly necessary, since tensorQTL will select the relevant samples from `genotype_df` otherwise):\n```\npr = genotypeio.PlinkReader(plink_prefix_path, select_samples=phenotype_df.columns)\n```\n#### *cis*-QTL mapping\n```\ncis_df = cis.map_cis(genotype_df, variant_df, phenotype_df, phenotype_pos_df, covariates_df)\ntensorqtl.calculate_qvalues(cis_df, qvalue_lambda=0.85)\n```\n#### *trans*-QTL mapping\n```\ntrans_df = trans.map_trans(genotype_df, phenotype_df, covariates_df, return_sparse=True)\n```\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "tensorqtl", "package_url": "https://pypi.org/project/tensorqtl/", "platform": "", "project_url": "https://pypi.org/project/tensorqtl/", "project_urls": null, "release_url": "https://pypi.org/project/tensorqtl/1.0.0-0/", "requires_dist": [ "numpy", "pandas", "pyarrow", "scipy", "pandas-plink", "torch" ], "requires_python": "", "summary": "GPU-based QTL mapper", "version": "1.0.0-0" }, "last_serial": 5914767, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "3b9fc4a66fc8ca59ebdb1f2b9e19de85", "sha256": "efec076d3bc943fc6fc6272f60ebb3ba94826fb93d63d16ea897ac1e0f30e193" }, "downloads": -1, "filename": "tensorqtl-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "3b9fc4a66fc8ca59ebdb1f2b9e19de85", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 28385, "upload_time": "2019-09-03T14:31:47", "url": "https://files.pythonhosted.org/packages/9c/93/e4f537a17b124b648d4076adc9a64d4abf42e26312d573d0410da30a4263/tensorqtl-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ae1ceaa05a4ece495feb101266169238", "sha256": "efb047e9956e76dae0415d21d5f95f27a1ab0fa9cf8189f63ab9b84d3eda10a7" }, "downloads": -1, "filename": "tensorqtl-1.0.0.tar.gz", "has_sig": false, "md5_digest": "ae1ceaa05a4ece495feb101266169238", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24745, "upload_time": "2019-09-03T14:31:50", "url": "https://files.pythonhosted.org/packages/7e/28/f19640a8a8f22b1b9661a13f1ba7405fd7ccf6df77df62c076251618ad9f/tensorqtl-1.0.0.tar.gz" } ], "1.0.0-0": [ { "comment_text": "", "digests": { "md5": "758a4c70904d930e0c364bb4211f5270", "sha256": "8896da4338fd05e94c86ade821dde6d50523e2cd85d379d56cb4a457ed1112e4" }, "downloads": -1, "filename": "tensorqtl-1.0.0-0.tar.gz", "has_sig": false, "md5_digest": "758a4c70904d930e0c364bb4211f5270", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 26904, "upload_time": "2019-10-01T20:41:11", "url": "https://files.pythonhosted.org/packages/dc/95/fe32b1e83ce03882e63949a789b6441e289136bc68966925ddc8221a9ac7/tensorqtl-1.0.0-0.tar.gz" }, { "comment_text": "", "digests": { "md5": "3e557de8397190bc9ab9db2b4732ff2a", "sha256": "38d71a3de4824cc3660c7fd30ed12101fad94842f5a4627ee794322600dd2166" }, "downloads": -1, "filename": "tensorqtl-1.0.0.post0-py3-none-any.whl", "has_sig": false, "md5_digest": "3e557de8397190bc9ab9db2b4732ff2a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 31132, "upload_time": "2019-10-01T20:41:09", "url": "https://files.pythonhosted.org/packages/b1/37/4dc495fad2d30a1f39f0faad87d08ceaa3b8afbea55627055ba72f725946/tensorqtl-1.0.0.post0-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "758a4c70904d930e0c364bb4211f5270", "sha256": "8896da4338fd05e94c86ade821dde6d50523e2cd85d379d56cb4a457ed1112e4" }, "downloads": -1, "filename": "tensorqtl-1.0.0-0.tar.gz", "has_sig": false, "md5_digest": "758a4c70904d930e0c364bb4211f5270", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 26904, "upload_time": "2019-10-01T20:41:11", "url": "https://files.pythonhosted.org/packages/dc/95/fe32b1e83ce03882e63949a789b6441e289136bc68966925ddc8221a9ac7/tensorqtl-1.0.0-0.tar.gz" }, { "comment_text": "", "digests": { "md5": "3e557de8397190bc9ab9db2b4732ff2a", "sha256": "38d71a3de4824cc3660c7fd30ed12101fad94842f5a4627ee794322600dd2166" }, "downloads": -1, "filename": "tensorqtl-1.0.0.post0-py3-none-any.whl", "has_sig": false, "md5_digest": "3e557de8397190bc9ab9db2b4732ff2a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 31132, "upload_time": "2019-10-01T20:41:09", "url": "https://files.pythonhosted.org/packages/b1/37/4dc495fad2d30a1f39f0faad87d08ceaa3b8afbea55627055ba72f725946/tensorqtl-1.0.0.post0-py3-none-any.whl" } ] }