variani / finemapr

Fine-mapping pipeline in R: FINEMAP, CAVIAR, PAINTOR, GCTA-COJO, ABF
GNU General Public License v3.0
27 stars 12 forks source link

Update run_finemap.R for Finemap Version 1.3? #5

Open kathryntsai opened 5 years ago

kathryntsai commented 5 years ago

Hi @variani thank you for creating this package! I've found it really helpful for my summer internship project.

I'm currently working with the run_finemap function. I'm using Finemap version 1.3.1 for Mac OS X, but not with Finemap version 1.1. The errors make sense based on the documention for Finemap 1.3. I've noticed the following changes can be made to update it:

First, the master file for FINEMAP 1.3.1 needs to have columns with the following headings: z;ld;snp;config;cred;[prior-k if applicable];log;n_samples

Second, the z-file for Finemap 1.3.1 has to be 8 columns, unlike the 2 provided in the example. In R, I could modify the example z1 file as the following, using the input z-file documentation for FINEMAP:

z1 <- data.table(z1$snp, 1, 1:5363, "A", "G", 0, z1$zscore, 0)
colnames(z1)[1:8] <- c("snp", "chromosome", "position", "allele1", "allele2", "maf", "zscore", "se")

However, the third issue I have not been able to resolve. Even after I've updated the finemap.R function to address the extra columns, I get this error when I try to run the example with the updated z-file: Error : Expected 'rsid' in line 1 column 1 of file 'region.z'!

I also updated finemapr to use the "rsid" column name for "snp", but this didn't resolve the issue.

Do you know what the issue could be? I've made a pull request so you can see the comparisons between the code.