Skip to content

AkeyLab/DAP_pheweb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a fork of Pheweb specifically for the Dog Aging Project (DAP)

How to Cite PheWeb

This is a slight modification of the original PheWeb which should be cited: Gagliano Taliun, S.A., VandeHaar, P. et al. Exploring and visualizing large-scale genetic associations by using PheWeb. Nat Genet 52, 550–552 (2020).

How to Build a PheWeb for DAP data

1. Install PheWeb

pip3 install pheweb

If on ASU SOL cluster then read the "sol_install_notes.txt"

2. Create a directory and config.py for your new dataset

Traditional PheWeb only works for hg19 or hg38, so I've hardcoded changes for dog. This means that the config.py isn't used, so might as well put hg19.

3. Convert MLMA files into csv files

There are multiple options, but PheWeb expects files to look like:

chrom,pos,ref,alt,pval
1,629,C,T,0.0856026
1,2076,G,T,0.835506
1,2388,C,T,0.0574887

This conversion was done with a simple python script mlma_to_csv.py and the files were stored in the mlmas/ subdir.

4. Make a list of your phenotypes

Inside of your data directory, you need a file named pheno-list.json that looks like this:

[
    {
        "assoc_files": [
            "mlmas/DogAgingProject_gp-0.70_biallelic-snps_N-6358_maf-0.01_geno-0.05_hwe-1.0E-20-midp-keep-fewhet_phe-dd_weight_lbs_N-6279_cov-dd_sex_N-6279_qcov-Estimated_Age_Years_at_HLES_N-6279_chr1.loco.csv"
        ],
        "phenocode": "Weight",
        "category": "Physical"
    },
    {
        "assoc_files": [
            "mlmas/DogAgingProject_gp-0.70_biallelic-snps_N-6358_maf-0.01_geno-0.05_hwe-1.0E-20-midp-keep-fewhet_phe-pa_activity_level_N-6279_cov-dd_sex_N-6279_qcov-Estimated_Age_Years_at_HLES-dd_weight_lbs_N-6279_chr1.loco.csv"
        ],
        "phenocode": "Activity level",
        "category": "Activity"
    },
    {
        "assoc_files": [
            "mlmas/DogAgingProject_gp-0.70_biallelic-snps_N-6358_maf-0.01_mp_dental_extraction_N-1524_cov-dd_sex_N-6279_Estimated_Age_Years_at_HLES-dd_weight_lbs_N-6279_chr1.loco.csv"
        ],
        "phenocode": "Dental extraction",
        "category": "Dental"
    }
]

Each phenotype needs assoc_files (a list of paths to association files) and phenocode (a string representing your phenotype that is used in filenames and URLs, comprised of [A-Za-z0-9_~-]).

If you want, you can also include:

  • phenostring (string): a name for the phenotype. Shown in tables and tooltips and page headers.
  • category (string): groups together phenotypes in the PheWAS plot. Shown in tables and tooltips.
  • num_cases, num_controls, and/or num_samples (number): if your input data only has AC or MAC, this will be used to calculated AF or MAF. Shown in tooltips. If your input data has correctly-named columns for these, the command pheweb phenolist read-info-from-association-files will add them into your existing pheno-list.json.
  • anything else you want, but you'll have to modify templates to use it.

5. Load your association files

Run pheweb process.

To distribute jobs across a cluster, follow these instructions.

To include VEP annotations, follow these instructions.

If something breaks and you can't understand the error message or it's something that PheWeb should support by default, open an issue on github or email me.

6. Serve the website

Run pheweb serve --open.

That command should either open a browser to your new PheWeb, or it should give you a URL that you can open in your browser to access your new PheWeb. If it doesn't, follow the directions for hosting a PheWeb and accessing it from your browser.

More options:

To run pheweb through systemd, see sample file here. To use Apache2 or Nginx, see instructions here. To require login via OAuth, see instructions here. To track page views with Google Analytics, see instructions here. To reduce storage use, see instructions here. To customize page contents, see instructions here.

PheWeb can display phenotype correlations generated by another tool. To use this feature, set show_correlations = True in config.py and place the output of the rg pipeline as pheno-correlations.txt in the same folder as pheno-list.json.

To hide the button for downloading summary stats, add download_pheno_sumstats = "secret" and SECRET_KEY = "your random string" in config.py. That will make a secret page (printed to the console when you start the server) to share summary stats. To hide the button for downloading top hits and phenotypes, add download_top_hits = "hide" and download_phenotypes = "hide" respectively.

To allow dynamically filtering the manhattan plot, run pheweb best-of-pheno and set show_manhattan_filter_button=True in config.py.

Modifying DAP PheWeb

Here are the steps I took to get a development installation of PheWeb running on my mac laptop:

  1. Clone the DAP PheWeb repo
  • git clone https://github.com/AkeyLab/DAP_pheweb.git
  1. cd into the repo and create a virtual environment. I used python 3.8 after I had some trouble with 3.11
  • cd DAP_pheweb

  • python3.8 -m venv .venv

  • source .venv/bin/activate

  1. Install wheel and then pheweb as editable
  • pip install wheel

  • pip install -e .

  1. Check that pheweb is installed
  • which pheweb
  1. Run the included tests, hopefully they should all pass
  • pip install pytest

  • python -m pytest

  1. Do a test run of the server. Run the following command, and while that is running, open a browser window and go to http://0.0.0.0:8000/ and there should be a small pheweb example application running.
  • ./tests/run-all.sh

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 9