privefl / bigsnpr

R package for the analysis of massive SNP arrays.
https://privefl.github.io/bigsnpr/
186 stars 44 forks source link

Number of SNPs and their wights used for final PRS calculation #435

Closed Mahantesh-Biradar closed 1 year ago

Mahantesh-Biradar commented 1 year ago

Can you please suggest how I can obtain the final number of SNPs and their respective weights used to calculate the PRS in the following step?

if(is.null(obj.bigSNP)){
    obj.bigSNP <- snp_attach("EUR.QC.rds")
}
genotype <- obj.bigSNP$genotypes
# calculate PRS for all samples
ind.test <- 1:nrow(genotype)
pred_auto <-
    big_prodMat(genotype,
                beta_auto,
                ind.row = ind.test,
                ind.col = info_snp$`_NUM_ID_`)
# scale the PRS generated from AUTO
pred_scaled <- apply(pred_auto, 2, sd)
final_beta_auto <-
    rowMeans(beta_auto[,
                abs(pred_scaled -
                    median(pred_scaled)) <
                    3 * mad(pred_scaled)])
pred_auto <-
    big_prodVec(genotype,
        final_beta_auto,
        ind.row = ind.test,
        ind.col = info_snp$`_NUM_ID_`)
privefl commented 1 year ago

The weights are beta_auto, corresponding to variants in obj.bigSNP$map[info_snp$`_NUM_ID_`, ].

Also, it seems you're using some old code filtering on SD differences, maybe have a look at the (updated) tutorial.

Mahantesh-Biradar commented 1 year ago

Thanks Florian! appreciate.