Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Events
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
PheWAS
PhecodeX
Repository navigation
Code
Issues
2
(2)
Pull requests
2
(2)
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
main
Breadcrumbs
PhecodeX
/
phecodeX_PheWAS_example_R_script.txt
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
executable file
·
43 lines (35 loc) · 1.57 KB
main
Breadcrumbs
PhecodeX
/
phecodeX_PheWAS_example_R_script.txt
Copy path
Top
File metadata and controls
Code
Blame
executable file
·
43 lines (35 loc) · 1.57 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
library(PheWAS)
set.seed(1)
## make sure you add the right path!
phecodeX_labels = read.csv('phecodeX_R_labels.csv')
phecodeX_rollup_map = read.csv('phecodeX_R_rollup_map.csv')
phecodeX_map = read.csv('phecodeX_R_map.csv') ## if you are using ICD-10 (not CM), load phecodeX_R_map_ICD_10_WHO.csv instead
phecodeX_sex = read.csv('phecodeX_R_sex.csv')
#Generate some example data
ex=generateExample()
#Extract the three parts from the returned list
id.vocab.code.count=ex$id.vocab.code.count
genotypes=ex$genotypes
id.sex=ex$id.sex
#Create the phecode table- translates the codes, adds
#exclusions, and reshapes to a wide format.
#Sum up the counts in the data where applicable.
#Note the vocabulary.map and rollup.map are set to
#phecodeX files
phenotypesX = createPhenotypes(id.vocab.code.count,
aggregate.fun=sum, id.sex=id.sex,
vocabulary.map=phecodeX_map,
rollup.map=phecodeX_rollup_map,
sex.restriction=phecodeX_sex)
#Combine the data
data = inner_join(inner_join(phenotypesX,genotypes),id.sex)
#Run the PheWAS
results = phewas_ext(data,phenotypes=names(phenotypesX)[-1], genotypes=c("rsEXAMPLE"), covariates=c("sex"))
## Add phecode_labels
results_annotated = merge(phecodeX_labels, results, by='phenotype')
## Make a plot
phenotypeManhattan(results_annotated,
title="My Example PheWAS Manhattan Plot",
annotate.phenotype.description=T,
sort.by.category.value=F, x.group.labels=T,
use.color=T)
You can’t perform that action at this time.