Comments (4)
Hi,
Yes, this is definitely possible. The phenotypes and genotypes can be any continuous value, and all you'll need to do is specify a 'variant' mapping (in variant_df
) that links your 'genotype' values to a phenotype via the cis-window.
Here's an example of how you could do this:
import pandas as pd
import numpy as np
from tensorqtl import cis
np.random.seed(12345)
n = 100 # samples
m = 20 # genotypes
genotype_df = pd.DataFrame(np.random.rand(m, n))
phenotype_df = pd.Series(np.random.rand(n), name='phenotype_1').to_frame().T
phenotype_pos_df = pd.DataFrame({'chr':['chr1'], 'pos':[1]}, index=['phenotype_1'])
variant_df = pd.DataFrame({'chrom':['chr1']*m, 'pos':np.arange(m)}, index=genotype_df.index)
# permutations
cis_df = cis.map_cis(genotype_df, variant_df, phenotype_df, phenotype_pos_df, window=1000000)
# nominal associations
cis.map_nominal(genotype_df, variant_df, phenotype_df, phenotype_pos_df, 'test',
output_dir='.', window=1000000)
You'll need to use the latest commit if not including any covariates as in this example (I'll make a new release soon).
Edit: fix for phenotype_pos_df
change ('pos' instead of 'tss').
from tensorqtl.
hi, this code result the error:KeyError: 'start',I'm wondering if there is another way to “encode the phenotype as a dosage for a single genetic variant, across individuals", in order to map pheno to pheno in the new version? thanks!
from tensorqtl.
Please try again with the updated code above, it should work now.
from tensorqtl.
thanks! i fix that,ecoding the phenotype following the updated code solves this problem!
from tensorqtl.
Related Issues (20)
- Issues with TensorQTL in Trans Mode HOT 1
- AttributeError: 'dict' object has no attribute 'T' tensorqtl HOT 2
- broken link HOT 1
- Tensorqtl installation HOT 3
- No credible sets output from susie.map because pval_nominal=0 HOT 3
- ValueError: array must not contain infs or NaNs HOT 1
- interaction HOT 1
- [Susie] ValueError: prior variance must be non-negative HOT 4
- [trans] trans.map_permutations(): KeyError: 'r2' HOT 2
- [map_trans] R2 not returned in interaction analysis HOT 2
- [pval post-processing] Interaction output for cis/trans HOT 1
- Which beta coresponds to which allele in the outputs? HOT 3
- cis-mapping with interaction HOT 1
- Errors in the BackgroundGenerator cause main thread to get stuck HOT 1
- Questions about the `map_permutations` and `apply_permutations` functions
- cis_independent requires covariate_df HOT 1
- Phenotype file format HOT 3
- Any way i can go around this error? HOT 2
- Categorical covariates HOT 1
- Corections for multiple tests for trans-eQTL HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tensorqtl.