GTEx eQTL Reader

Function that reads the files of fine-mapped eQTLs from GTEx to ease working with the data with pybedtools.

GTEx_eQTLReader.get_eqtls(hg38_annotation, gtex_folder, gtex_tissues=None, max_distance=None)

From the three fine-mapping methods provided on GTEx, go through the fixed file paths, and get the eQTL-gene pairs matching the tissues queried. Written for version phs000424.v8.p2, downloaded from the GTEx portal.

Parameters:
  • hg38_annotation – The GENCODE hg38 annotation. Must be hg38 to match the fixed versions expected in the gtex_folder.

  • gtex_folder – Path to the directory with the files from the three fine-mapping methods provided on GTEx. “/projects/apog/work/IHEC/ValidateInteractions/eQTL_Validation/”

  • gtex_tissues – List of GTEx tissues (must match exactly), one entry can be a comma-separated list of GTEx tissues. Set to False to get all.

  • max_distance – Maximum allowed distance between eQTL and the gene’s TSS. Don’t define to get all.

Returns:

  • eqtl_beds: Dict of {tissues: {eqtl_type: bed object}} with the bed-object being all eQTL-gene pairs in format EnsemblID|POS-1|POS.

  • unique_eqtls_beds: Dict of {tissues: {eqtl_type: bed object}} with the entries being unique eQTLs and all their associated genes in the last field as CHR|POS-1|POS|CSV targets.

  • tissue_genes: Dict of {tissues: {eqtl_type: gene set}} with gene set being the genes which had at least one eQTL in the tissue and the eQTL type.

Return type:

tuple

# Get the fine-mapped eQTLs from files subsetted for the first 1k lines from chr21.
import GTEx_eQTLReader
annotation = 'ExampleData/gencode.v38.annotation_chr21Genes.gtf'
gtex_folder = 'ExampleData/GTEx_phs000424.v8.p2_chr21/'
eqtl_beds, unique_eqtl_beds, tissue_genes = GTEx_eQTLReader.get_eqtls(hg38_annotation=annotation, gtex_folder=gtex_folder, gtex_tissues=None, max_distance=None)
print(eqtl_beds['Adipose_Subcutaneous']['CaVEMaN'][0])
print(unique_eqtl_beds['Adipose_Subcutaneous']['CaVEMaN'][0])
print(list(tissue_genes['Adipose_Subcutaneous']['CaVEMaN'])[:2])
ENSG00000160223 44209709        44209710

chr21   5089936 5089937 ENSG00000275464,ENSG00000280071,ENSG00000280433

ENSG00000160194
ENSG00000180509