The trans output doesn't seem to output these columns necessary for permutations.
(https://github.com/broadinstitute/tensorqtl/blob/master/docs/outputs.md)
I am using trans_df_appliedperm = trans.apply_permutations(trans_df_perm,trans_df) where
trans_df is the dataframe after filtering_cis.
def apply_permutations(res, pairs_df):
"""
res: output from map_permutations()
pairs_df: output from map_trans()
"""
if isinstance(res, pd.Series): # chrs not split
nperms = len(res['minp_true_df'])
for k in ['beta_shape1', 'beta_shape2', 'true_df']:
pairs_df[k] = res[k]
pairs_df['pval_true_dof'] = pval_from_corr(pairs_df['r2'], pairs_df['true_df'])
pairs_df['pval_perm'] = np.array([(np.sum(res['minp_empirical']<=p)+1)/(nperms+1) for p in pairs_df['pval']])
pairs_df['pval_beta'] = stats.beta.cdf(pairs_df['pval_true_dof'], pairs_df['beta_shape1'], pairs_df['beta_shape2'])
The trans output doesn't seem to output these columns necessary for permutations. (https://github.com/broadinstitute/tensorqtl/blob/master/docs/outputs.md) I am using trans_df_appliedperm = trans.apply_permutations(trans_df_perm,trans_df) where trans_df is the dataframe after filtering_cis.
trans_df = trans.map_trans(genotype_df, phenotype_df, covariates_df, batch_size=10000, return_sparse=True, pval_threshold=1e-5, maf_threshold=0.01) trans_df = trans.filter_cis(trans_df, phenotype_pos_df, variant_df, window=5000000)
def apply_permutations(res, pairs_df): """ res: output from map_permutations() pairs_df: output from map_trans() """