Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LDpred2: Crash with characters and integers in chromosome column #255

Open
espenhgn opened this issue Apr 23, 2024 · 1 comment
Open

LDpred2: Crash with characters and integers in chromosome column #255

espenhgn opened this issue Apr 23, 2024 · 1 comment
Labels
bug Something isn't working no-issue-activity

Comments

@espenhgn
Copy link
Contributor

Problem reported by Siim, similar to #51, except that the order of `chr` <integer> and `chr` <character> is reverted.

I need to run the LDPred2 separately on all chromosomes (can add all the sumstats as final step manually) but get the following error:

8,358,512 variants to be matched.
Error in `vctrs::vec_in()`:
! Can't combine `chr` <integer> and `chr` <character>.
Backtrace:
     x
  1. +-bigsnpr::snp_match(...)
  2. | +-...[]
  3. | +-base::`[.data.frame`(...)
  4. | \-vctrs::vec_in(sumstats[, join_by[1:2]], info_snp[, join_by[1:2]])
  5. \-vctrs (local) `<fn>`()
  6.   \-vctrs::vec_default_ptype2(...)
  7.     +-base::withRestarts(...)
  8.     | \-base (local) withOneRestart(expr, restarts[[1L]])
  9.     |   \-base (local) doWithOneRestart(return(expr), restart)
 10.     \-vctrs::stop_incompatible_type(...)
 11.       \-vctrs:::stop_incompatible(...)
 12.         \-vctrs:::stop_vctrs(...)
 13.           \-rlang::abort(message, class = c(class, "vctrs_error"), ..., call = vctrs_error_call(call))
Execution halted

Has anyone reported this on the updated version while using the .bgen files? Maybe I missed some instructions?

For clartity the run.sh has following content:

#!/bin/bash
#SBATCH --job-name=chr21  # job name
#SBATCH --output=SCF1_chr21_LDpred2.txt  # output
#SBATCH --error=SCF1_chr21.txt  # errors
#SBATCH --mail-type=END
#SBATCH --mail-type=FAIL
#SBATCH --[[email protected]](mailto:[email protected])
#SBATCH --time=48:00:00  # walltime
#SBATCH --cpus-per-task=2  # number of CPUS for task
#SBATCH --mem-per-cpu=30GB
#SBATCH --partition=amd

module load any/singularity/3.7.3

# point to input/output files
export fileGeno=/GEN/4_latest_freeze/imputation_EstRef/hg38/EstBB_chr21.bgen
export fileGenoRDS=chr21.nomiss.rds
export fileSNPList=/COMOR/containers/scripts/pgs/LDpred2/Chr21_for_LDPred2.csv
export fileSumstats=/COMOR/containers/scripts/pgs/LDpred2/SCF_sumstats/SCF1_allBMI_regenie_forPRS.txt
export fileOut=SCF1_chr21
export colPheno=SCF1

# set environmental variables. Replace "<path/to/comorment>" with
# the full path to the folder containing cloned "containers" and "ldpred2_ref" repositories
export GENOMICS=/gpfs/space/GI/GV/EGCUT_data/genotype_data/GSA_arrays
export COMORMENT=/gpfs/space/GI/GV/Projects/PsychGen/CoMorMent
export SIF=$COMORMENT/containers/singularity
export REFERENCE=$COMORMENT/containers/reference
export LDPRED2_REF=$COMORMENT/ldpred2_ref
export SINGULARITY_BIND=$REFERENCE:/REF,${LDPRED2_REF}:/ldpred2_ref,$COMORMENT:/COMOR,$GENOMICS:/GEN

export RSCRIPT="singularity exec --home=$PWD:/home $SIF/r.sif Rscript"

# convert genotype to LDpred2 format
$RSCRIPT createBackingFile.R --file-input $fileGeno --file-output $fileGenoRDS --file-snp-list $fileSNPList


# Generate PGS usign LDPRED-inf
$RSCRIPT ldpred2.R \
 --genomic-build hg38 \
 --ldpred-mode inf \
 --col-stat BETA \
 --col-stat-se SE \
 --col-A1 EFFECT_ALLELE \
 --col-A2 OTHER_ALLELE \
 --col-chr CHR \
 --col-bp POS \
 --col-snp-id RSID \
 --stat-type BETA \
 --geno-file-rds $fileGenoRDS \
 --sumstats $fileSumstats \
 --out $fileOut.inf
@espenhgn espenhgn added the bug Something isn't working label Apr 23, 2024
@espenhgn espenhgn changed the title LDpred2: LDpred2: Crash with characters and integers in chromosome column Apr 23, 2024
Copy link

This issue appears to be stale due to non-activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working no-issue-activity
Projects
None yet
Development

No branches or pull requests

1 participant