Giter Site home page Giter Site logo

Comments (4)

francois-a avatar francois-a commented on August 25, 2024 1

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.

CuteGold0407 avatar CuteGold0407 commented on August 25, 2024

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.

francois-a avatar francois-a commented on August 25, 2024

Please try again with the updated code above, it should work now.

from tensorqtl.

CuteGold0407 avatar CuteGold0407 commented on August 25, 2024

thanks! i fix that,ecoding the phenotype following the updated code solves this problem!

from tensorqtl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.