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
Copy file name to clipboardExpand all lines: README.md
+17-6Lines changed: 17 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,12 +9,21 @@
9
9
10
10
11
11
## Description
12
-
This R package provides a set of utilities to simply and transparently parse genotype/dosage data from an input VCF, match genotype coordinates to the component SNPs of an existing polygenic score, and apply SNP weights to dosages to calculate a polygenic score for each individual in accordance with the additive weighted sum of dosages model.
12
+
This R package provides a set of utilities to simply and transparently parse genotype/dosage data from an input VCF, match genotype coordinates to the component SNPs of an existing polygenic score model, and apply SNP weights to dosages to calculate a polygenic score for each individual in accordance with the additive weighted sum of dosages method.
13
13
14
14
## Installation
15
+
16
+
To install the last release on CRAN:
17
+
18
+
```
19
+
# In an R session
20
+
install.packages("ApplyPolygenicScore")
21
+
```
22
+
15
23
To install the latest development version from GitHub:
@@ -40,7 +49,7 @@ You will need only two pieces of data to get started:
40
49
- Others have done a great job of describing Variant Call Format. For those with a basic understanding of genetic nomenclature, we recommend the GATK [resource](https://gatk.broadinstitute.org/hc/en-us/articles/360035531692-VCF-Variant-Call-Format).
41
50
- For those who need a refresher on genomics and genomic data, we recommend starting with the [fact sheets](https://www.genome.gov/about-genomics/fact-sheets) curated by the National Human Genome Research Institute (NHGRI).
42
51
43
-
If you wish to apply a PGS to a cohort, we recommend that genotypes for the whole cohort be aggregated in one VCF file, either through a regenotyping process, or through VCF merging with an external tool designed for manipulating VCF files. VCF files can be very large, causing memory-related complications in the R environment. To reduce memory usage and improve speed of PGS application, we recommend pre-filtering the input VCF for only the coordinates that compose the PGS you wish to apply. This action can be performed using a coordinate BED file and tools such as bcftools or bedtools. To facilitate this process, ApplyPolygenicScore provides a function that outputs a BED file containing coordinates for any number of PGS weight files provided as input.
52
+
If you wish to apply a PGS to a cohort, we recommend that genotypes for the whole cohort be aggregated in one VCF file, either through a regenotyping process, or through VCF merging with an external tool designed for manipulating VCF files. VCF files can be very large, causing memory-related complications in the R environment. To reduce memory usage and improve speed of PGS application, we recommend pre-filtering the input VCF for only the coordinates that compose the PGS you wish to apply. This action can be performed using a genomic coordinate file in BED format and tools such as bcftools or bedtools. To facilitate this process, ApplyPolygenicScore provides a function that outputs a BED-formatted file containing genomic coordinates for any number of PGS weight files provided as input.
44
53
45
54
#### PGS weight file
46
55
- The PGS weight file describes a PGS by providing a list of component SNPs, their genomic coordinates, and their respective weights.
@@ -61,9 +70,9 @@ If you wish to apply a PGS to a cohort, we recommend that genotypes for the whol
61
70
### Recommended Workflow
62
71
63
72
64
-
1. Convert PGS weight files to BED coordinate files.
73
+
1. Convert PGS weight files to BED-formatted coordinate files.
65
74
66
-
We recommend starting by filtering your input VCF for just the variants in your PGS weight files. Several software tools are available to do this, and most all require a coordinate BED file. A description of BED format can be found [here](https://bedtools.readthedocs.io/en/latest/content/general-usage.html).
75
+
We recommend starting by filtering your input VCF for just the variants in your PGS weight files. Several software tools are available to do this, and most all require a coordinate file in BED format. A description of BED format can be found [here](https://bedtools.readthedocs.io/en/latest/content/general-usage.html).
67
76
68
77
The function `import.pgs.weight.file` can be used to import your PGS weight files into R.
69
78
The functions `convert.pgs.to.bed` and `combine.pgs.bed` can be used to make the conversion, and merge several BED dataframes into one, respectively.
@@ -83,10 +92,12 @@ If you wish to apply a PGS to a cohort, we recommend that genotypes for the whol
83
92
84
93
ApplyPolygenicScore comes with several plotting functions designed to operate on the results of `apply.polygenic.score`. Display PGS density curves with `create.pgs.density.plot` and PGS percentile ranks with `create.pgs.rank.plot`. If you provided phenotype data in step 3, you can incorporate categorical data into the density plots and categorical and continuous phenotype data into the rank plots, and use `create.pgs.with.continuous.phenotype.plot` to make scatterplots of your PGS against any continuous phenotype data.
85
94
86
-
For more step-by-step instructions, check out our vignettes.
95
+
For more step-by-step instructions, check out our [vignettes](https://CRAN.R-project.org/package=ApplyPolygenicScore).
87
96
88
97
## Resources
89
-
This package is in the process of being submitted to CRAN, where the manual and vignettes will be readily available. In the meantime, if you have installed the package from GitHub with `build_vignettes = TRUE`, you may view the vignette by running the following:
98
+
This package is hosted on CRAN. The manual of all functions and the User Guide vignette can be accessed on the [ApplyPolygenicScore CRAN page](https://CRAN.R-project.org/package=ApplyPolygenicScore).
99
+
100
+
If you have installed the package from GitHub with `build_vignettes = TRUE`, you may view the vignette by running the following:
VCF files can be very large. Sometimes they are too large to be imported into R. In these cases, it is useful to first filter the VCF file to just the variants
122
122
that are included in the PGS you wish to calculate and reduce file size. This is best done using command line tools designed for VCF file manipulation. For filtering, they typically
123
123
require a BED file containing the coordinates of the variants you wish to keep. To simplify this process, ApplyPolygenicScore provides functions for converting PGS weight files
124
-
to BED coordinate files.
124
+
to BED-formatted coordinate files.
125
125
126
-
### Conversion of PGS weight files to BED coordinate format
126
+
### Conversion of PGS weight files to a coordinate file in BED format
127
127
128
128
BED format requires the following first three columns: chromosome name, start position, and end position.
129
129
PGS weight files only contain the chromosome name and end position of each variant, so must be reformatted
@@ -133,7 +133,7 @@ with an additional column for the start position, and with the correct column or
133
133
Additionally, most tools do not accept BED files with column names. If you wish to maintain a header, you may need to add
134
134
a comment character to the first line of the file: `# chr start end`
135
135
136
-
Use the `convert.pgs.to.bed` function to convert a PGS weight file to a BED coordinate data frame.
136
+
Use the `convert.pgs.to.bed` function to convert a PGS weight file to a BED-formatted coordinate data frame.
137
137
138
138
```{r convert-pgs-to-bed}
139
139
@@ -156,7 +156,7 @@ format the X and Y chromosomes as 'X' and 'Y' respectively, and `numeric.sex.chr
156
156
157
157
The `slop` option imitates `bedtools` nomenclature for adding base pairs to the start and end of a set of coordinates. `slop = 10` adds 10 base pairs to the start and end of each variant coordinate.
158
158
159
-
Here is an example of BED coordinates for a variant on chromosome 1 at the 20th base pair.
159
+
Here is an example of genomic coordinates in BED file format for a variant on chromosome 1 at the 20th base pair.
160
160
161
161
No slop:
162
162
@@ -173,7 +173,7 @@ With slop of 10 base pairs:
173
173
### Merging coordinates from multiple polygenic scores
174
174
175
175
What if you want to apply multiple polygenic scores to the same VCF file?
176
-
Instead of filtering the VCF file multiple times, you can use the `combine.pgs.bed` function to merge multiple BED data frames
176
+
Instead of filtering the VCF file multiple times, you can use the `combine.pgs.bed` function to merge multiple BED-formatted data frames
177
177
into a single set of coordinates, and filter your VCF just once for the union of all variants in multiple PGSs.
0 commit comments