broadinstitute / tensorqtl

Ultrafast GPU-enabled QTL mapper
BSD 3-Clause "New" or "Revised" License
162 stars 52 forks source link

pgenlib error #73

Closed blancvccf closed 2 years ago

blancvccf commented 2 years ago

Hi I am trying to run tensorQTL and this is my code:

import pandas as pd import torch import pgenlib as pg import tensorqtl from tensorqtl import genotypeio, cis import rpy2 import rpy2.robjects as RObjects from rpy2.robjects.packages import importr qvalue = importr('qvalue', lib_loc='path')

define paths to data

plink_prefix_path = 'anotherpath' pheno = 'chr22_phenotype_nonan.bed.gz' covar = 'concatted_covar_raw.txt' prefix = 'run1_raw'

load phenotypes and covariates

phenotype_df, phenotype_pos_df = tensorqtl.read_phenotype_bed(pheno) covariates_df = pd.read_csv(covar, sep = '\t', index_col = 0).T pr = genotypeio.Plink2Reader(plink_prefix_path, verbose = True) genotype_df = pr.load_genotypes()

This is the error I receive:

Traceback (most recent call last): File "", line 1, in File "/home/blancv/miniconda3/envs/pQTL/lib/python3.8/site-packages/tensorqtl/genotypeio.py", line 316, in load_genotypes return pd.DataFrame(pgen.read_dosages_range(self.pgen_file, 0, self.pvar.shape[0]-1, sample_subset=sample_idxs), File "/home/blancv/miniconda3/envs/pQTL/lib/python3.8/site-packages/tensorqtl/pgen.py", line 106, in read_dosages_range with pg.PgenReader(pgen_path.encode(), sample_subset=sample_subset) as r: AttributeError: module 'pgenlib' has no attribute 'PgenReader'

The error occurs on the last line (where I call load_genotypes)

I have installed pgenlib so I am not sure what to do here. Thanks for the help

francois-a commented 2 years ago

Hi, which version/repository of pgenlib are you using? I added installation instructions here.