Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ If MD5 sum is not listed for a certain release then it means that the container

* Miscellaneous goes here

## [1.3.5] - 2023-08-17

### Updated

* Updated LDpred2 README file

## [1.3.4] - 2023-06-22

### Updated
Expand Down
44 changes: 43 additions & 1 deletion scripts/pgs/LDpred2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,45 @@ This README assumes the following two repositories are cloned using [git](https:
We also assume the following commands are executed from the current folder
(the one containing [createBackingFile.R](https://github.com/comorment/containers/blob/main/scripts/pgs/LDpred2/createBackingFile.R) and [ldpred2.R](https://github.com/comorment/containers/blob/main/scripts/pgs/LDpred2/ldpred2.R) scripts).

### Note on help functions

The main R scripts contained in this directory (`ldpred2.R`, `createBackingFile.R`, `imputeGenotypes.R`, `complementSum`) is set up using the [argparser](www.rdocumentation.org/packages/argparser) package for parsing command line arguments.
The help output from each script can printed to the terminal, issuing:

```
export SIF=$COMORMENT/containers/singularity
export RSCRIPT="singularity exec --home=$PWD:/home $SIF/r.sif Rscript"
# invoke ldpred2.R input options:
$RSCRIPT ldpred2.R --help
```

yielding:

```
usage: ldpred2.R [--] [--help] [--out-merge] [--geno-impute-zero]
[--opts OPTS] [--geno-file-rds GENO-FILE-RDS] [--sumstats
SUMSTATS] [--out OUT] [--out-merge-ids OUT-MERGE-IDS]
[--file-keep-snps FILE-KEEP-SNPS] [--ld-file LD-FILE]
[--ld-meta-file LD-META-FILE] [--chr2use CHR2USE] [--col-chr
COL-CHR] [--col-snp-id COL-SNP-ID] [--col-A1 COL-A1] [--col-A2
COL-A2] [--col-bp COL-BP] [--col-stat COL-STAT] [--col-stat-se
COL-STAT-SE] [--col-pvalue COL-PVALUE] [--col-n COL-N]
[--stat-type STAT-TYPE] [--effective-sample-size
EFFECTIVE-SAMPLE-SIZE] [--n-cases N-CASES] [--n-controls
N-CONTROLS] [--name-score NAME-SCORE] [--hyper-p-length
HYPER-P-LENGTH] [--hyper-p-max HYPER-P-MAX] [--ldpred-mode
LDPRED-MODE] [--cores CORES] [--set-seed SET-SEED]
[--merge-by-rsid MERGE-BY-RSID]

Calculate polygenic scores using ldpred2

flags:
-h, --help show this help message and exit
--out-merge Merge output with existing file.
--geno-impute-zero Set missing genotypes to zero.
...
```

### Note on filtering of genotype data

The current version of these scripts conduct no filtering of genotype data (e.g., minor allele frequency, imputation quality) prior to calculating linkage disequillibrium or polygenic scores.
Expand All @@ -32,7 +71,7 @@ create a copy of the genotypes, thus the imputation performed persists. If you w
An example use of [imputeGenotypes.R](https://github.com/comorment/containers/blob/main/scripts/pgs/LDpred2/imputeGenotypes.R):

```
# Conver from plink format to bigSNPR .rds/.bk files
# Convert from plink format to bigSNPR .rds/.bk files
$RSCRIPT createBackingFile.R <fileGeno>.nomiss.bed <fileGeno>.nomiss.rds

# Copy these files if you wish to leave the original files unchanged
Expand Down Expand Up @@ -101,6 +140,7 @@ $RSCRIPT calculateLD.R --geno-file-rds $fileGenoRDS \
### Effective sample-size

LDpred2 requires information on effective sample-size. There are three ways to provide this to LDpred2:

- As a column in the summary statistics, defaulting to column `N`. If it is a different column, provide with argument `--col-n`.
- Manually calculated by providing this number with `--effective-sample-size`.
- Manually specified by providing number of cases and controls with arguments `--n-cases` and `--n-controls`.
Expand Down Expand Up @@ -144,6 +184,8 @@ columns of chromosome and position in the `HRC` reference data (default of `--re
files that are matched. In the example below, output is piped to gzip. To write directly to a file the arguments `--file-output <output file>` and `--file-output-col-sep`
controls the location of the output file and the column separator used (defaults to tab, "\t").

**_NOTE:_** In case the summary statistics file (or any other file used by the scripts) are outside the working directory, make sure to append its directory to the `SINGULARITY_BIND` environment variable as above, and refer to the file accordingly - otherwise the running container won't see the file.

### Synthetic example (chr21 and chr22)

The following set of commands gives an example of how to apply LDpred2 on a synthetic example generated [here](https://github.com/comorment/containers/blob/main/scripts/pgs/LDpred2/ldpred2_simulations.ipynb). This only uses chr21 and chr22, so it runs much faster than previous example.
Expand Down
2 changes: 1 addition & 1 deletion version/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
_MINOR = "3"
# On main and in a nightly release the patch should be one ahead of the last
# released build.
_PATCH = "4"
_PATCH = "5"
# This is mainly for nightly builds which have the suffix ".dev$DATE". See
# https://semver.org/#is-v123-a-semantic-version for the semantics.
_SUFFIX = ""
Expand Down