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

[1] ".cred not detected. Using .snp instead." #72

Closed
AMCalejandro opened this issue Jan 31, 2022 · 13 comments
Closed

[1] ".cred not detected. Using .snp instead." #72

AMCalejandro opened this issue Jan 31, 2022 · 13 comments
Assignees

Comments

@AMCalejandro
Copy link
Contributor

AMCalejandro commented Jan 31, 2022

I was running FINEMAP and I believe that FINEMAP.check_files() fails to find an existing .cred file

First, I am copying the output of my FINEMAP run:

)   )  ) ))))))}}}}}}}} {{{{{{{{{(((((( (  (   (
AC108211.1 (1 / 10)
)   )  ) ))))))}}}}}}}} {{{{{{{{{(((((( (  (   (
[1] "+ CONDA:: Identified bgzip executable in echoR env."
[1] "Determining chrom type from file header"
[1] "LD:: Standardizing summary statistics subset."
[1] "++ Preparing Gene col"
[1] "++ Preparing A1,A1 cols"
[1] "++ Preparing MAF,Freq cols"
[1] "++ Inferring MAF from frequency column..."
[1] "++ Preparing N_cases,N_controls cols"
[1] "++ Preparing `proportion_cases` col"
[1] "++ 'proportion_cases' not included in data subset."
[1] "++ Preparing N col"
[1] "+ Preparing sample_size (N) column"
[1] "++ Using `sample_size = 3572` TRUE"
[1] "++ Preparing t-stat col"
[1] "+ Calculating t-statistic from Effect and StdErr..."
[1] "++ Assigning lead SNP"
[1] "++ Ensuring Effect, StdErr, P are numeric"
[1] "++ Ensuring 1 SNP per row"
[1] "++ Removing extra whitespace"
[1] "++ Saving subset ==> /mnt/rreal/RDS/acarrasco/ANALYSES_WORKSPACE/EARLY_PD/POST_GWAS/ECHOLOCATOR/RESULTS_2//mixedmodels_GWAS/earlymotorPD_axial/AC108211.1/AC108211.1_earlymotorPD_axial_subset.tsv.gz"
[1] "LD:: Using UK Biobank LD reference panel."
[1] "+ UKB LD file name: chr4_156000001_159000001"
[1] "+ LD:: Downloading full .gz/.npz UKB files and saving to disk."
[1] "+ Overwriting pre-existing file."
[1] "+ CONDA:: Identified axel executable in echoR env."
[1] "+ Overwriting pre-existing file."
[1] "+ CONDA:: Identified axel executable in echoR env."
[1] "+ LD:: load_ld() python function input: /mnt/rreal/RDS/acarrasco/ANALYSES_WORKSPACE/EARLY_PD/POST_GWAS/ECHOLOCATOR/RESULTS_2//mixedmodels_GWAS/earlymotorPD_axial/AC108211.1/LD/chr4_156000001_159000001"
[1] "+ LD:: Reading LD matrix into memory. This could take some time..."
/mnt/rreal/RDS/acarrasco/ANALYSES_WORKSPACE/EARLY_PD/POST_GWAS/ECHOLOCATOR/RESULTS_2//mixedmodels_GWAS/earlymotorPD_axial/AC108211.1/LD/chr4_156000001_159000001.gz
/mnt/rreal/RDS/acarrasco/ANALYSES_WORKSPACE/EARLY_PD/POST_GWAS/ECHOLOCATOR/RESULTS_2//mixedmodels_GWAS/earlymotorPD_axial/AC108211.1/LD/chr4_156000001_159000001.npz
Processed URL: /mnt/rreal/RDS/acarrasco/ANALYSES_WORKSPACE/EARLY_PD/POST_GWAS/ECHOLOCATOR/RESULTS_2//mixedmodels_GWAS/earlymotorPD_axial/AC108211.1/LD/chr4_156000001_159000001
Some other message at the end
[1] "+ Full UKB LD matrix: 21897 x 21897"
[1] "+ Full UKB LD SNP data.table: 21897 x 5"
[1] "+ LD:: Saving LD matrix ==> /mnt/rreal/RDS/acarrasco/ANALYSES_WORKSPACE/EARLY_PD/POST_GWAS/ECHOLOCATOR/RESULTS_2//mixedmodels_GWAS/earlymotorPD_axial/AC108211.1/LD/AC108211.1.UKB_LD.RDS"
[1] "5340 x 5340 LD_matrix (sparse)"
vvvvv-- ABF --vvvvv
✅ All required columns present.
✅ All suggested columns present.
vvvvv-- FINEMAP --vvvvv
✅ All required columns present.
✅ All suggested columns present.
vvvvv-- SUSIE --vvvvv
✅ All required columns present.
✅ All suggested columns present.
vvvvv-- POLYFUN_SUSIE --vvvvv
✅ All required columns present.
✅ All suggested columns present.

+++ Multi-finemap:: ABF +++

+++ Multi-finemap:: FINEMAP +++
[1] "++ FINEMAP:: Constructing master file."
[1] "++ FINEMAP:: Constructing data.z file."
[1] "++ FINEMAP:: Constructing data.ld file."
                                                                                                     [1] "+ Using FINEMAP v1.4"      

|--------------------------------------|
| Welcome to FINEMAP v1.4              |
|                                      |
| (c) 2015-2020 University of Helsinki |
|                                      |
| Help :                               |
| - ./finemap --help                   |
| - www.finemap.me                     |
| - www.christianbenner.com            |
|                                      |
| Contact :                            |
| - christian.benner@helsinki.fi       |
| - matti.pirinen@helsinki.fi          |
|--------------------------------------|

--------
SETTINGS
--------
- dataset            : all
- corr-config        : 0.95
- n-causal-snps      : 5
- n-configs-top      : 50000
- n-conv-sss         : 100
- n-iter             : 100000
- n-threads          : 1
- prior-k0           : 0
- prior-std          : 0.05 
- prob-conv-sss-tol  : 0.001
- prob-cred-set      : 0.95

------------
FINE-MAPPING (1/1)
------------
- GWAS summary stats               : FINEMAP/data.z
- SNP correlations                 : FINEMAP/data.ld
- Causal SNP stats                 : FINEMAP/data.snp
- Causal configurations            : FINEMAP/data.config
- Credible sets                    : FINEMAP/data.cred
- Log file                         : FINEMAP/data.log_sss
- Reading input                    : done!   

- Number of GWAS samples           : 3572
- Number of SNPs                   : 5338
- Prior-Pr(# of causal SNPs is k)  : 
  (0 -> 0)
   1 -> 0.583
   2 -> 0.291
   3 -> 0.0971
   4 -> 0.0243
   5 -> 0.00485
- 367552 configurations evaluated (0.654/100%) : converged after 654 iterations
- Computing causal SNP statistics  : done!   
- Regional SNP heritability        : -2.08e-05 (SD: 0.00215 ; 95% CI: [0.00461,0.0124])
- Log10-BF of >= one causal SNP    : 36.6
- Post-expected # of causal SNPs   : 5
- Post-Pr(# of causal SNPs is k)   : 
  (0 -> 0)
   1 -> 0
   2 -> 0
   3 -> 0
   4 -> 9.65e-08
   5 -> 1
- Computing credible sets          : done!
- Writing output                   : done!   
- Run time                         : 0 hours, 0 minutes, 54 seconds
[1] ".cred not detected. Using .snp instead."
[1] "+ FINEMAP:: Importing prob (.snp)..."
Error in `[[<-.data.frame`(`*tmp*`, col, value = 1) : 
  replacement has 1 row, data has 0
In addition: Warning messages:
1: Python '/home/acarrasco/.conda/envs/echoR/bin/python' was requested but '/tools/anaconda3/bin/python' was loaded instead (see reticulate::py_config() for more information) 
2: In sdY.est(d$varbeta, d$MAF, d$N) :
  estimating sdY from maf and varbeta, please directly supply sdY if known

I then checked the FINEMAP.check_files() function

FINEMAP.check_files <- function(locus_dir,
results_file){
# locus_dir="/Users/schilder/Desktop/echolocatoR/results/GWAS/Nalls23andMe_2019/BST1"
### In FINEMAP v1.3, only one .cred file are produced.
### In FINEMAP v1.4, multiple FINEMAP files with # suffixes are produced.
.cred_files <- list.files(file.path(locus_dir,"FINEMAP"), "data.cred", full.names = T)
.cred_exists <- length(.cred_files)>0
.snp_exists <- file.exists(file.path(locus_dir,"FINEMAP/data.snp"))
.config_exists <- file.exists(file.path(locus_dir,"FINEMAP/data.config"))
file_options <- c(".cred",".snp",".config")[c(.cred_exists,.snp_exists,.config_exists)]
if(!results_file %in% file_options){
printer(results_file,"not detected.",
"Using",file_options[1],"instead.")
return(file_options[1])
}else { return(results_file)}
}
results_file <- FINEMAP.check_files(locus_dir, results_file)

Looking at the output of my run, it says that [1] ".cred not detected. Using .snp instead.", although this file certainly is on my locus dir

acarrasco@kronos:/mnt/rreal/RDS/acarrasco/ANALYSES_WORKSPACE/EARLY_PD/POST_GWAS/ECHOLOCATOR/RESULTS_2/mixedmodels_GWAS/earlymotorPD_axial/AC108211.1/FINEMAP$ ls
data.config  data.cred5  data.ld  data.log_sss  data.snp  data.z  master
acarrasco@kronos:/mnt/rreal/RDS/acarrasco/ANALYSES_WORKSPACE/EARLY_PD/POST_GWAS/ECHOLOCATOR/RESULTS_2/mixedmodels_GWAS/earlymotorPD_axial/AC108211.1/FINEMAP$ cat data.cred5 
# Post-Pr(# of causal SNPs is 5) = 1
#log10bf 34.7481 NA 30.4904 NA 18.9337 NA 18.876 NA 10.8375 NA
#min(|ld|) 0.997835 NA 0.998004 NA 1 NA 0.998703 NA 0.997919 NA
#mean(|ld|) 0.99946 NA 0.998079 NA 1 NA 0.998703 NA 0.999003 NA
#median(|ld|) 1 NA 0.998069 NA 1 NA 0.998703 NA 0.999031 NA
index cred1 prob1 cred2 prob2 cred3 prob3 cred4 prob4 cred5 prob5
1 rs7671031 0.18038 rs6813360 0.386687 rs7689588 0.435622 rs6837253 0.511966 rs72617489 0.35104
2 rs7671539 0.178679 rs56303163 0.231338 rs7664568 0.379368 rs11100000 0.481225 rs12500250 0.214129
3 rs3733392 0.177317 rs1058992 0.200773 rs7663482 0.137654 NA NA rs17032893 0.212246
4 rs6810747 0.156615 rs6846496 0.181201 NA NA NA NA rs17032928 0.209109
5 rs6830576 0.156399 NA NA NA NA NA NA NA NA
6 rs986416 0.0727053 NA NA NA NA NA NA NA NA
7 rs6817266 0.0463756 NA NA NA NA NA NA NA NA

And if we manually run FINEMAP.check_files():

locus_dir = "/mnt/rreal/RDS/acarrasco/ANALYSES_WORKSPACE/EARLY_PD/POST_GWAS/ECHOLOCATOR/RESULTS/mixedmodels_GWAS/earlymotorPD_axial/AC108211.1/" 
.cred_files <- list.files(file.path(locus_dir, "AC108211.1"), "data.cred", full.names = T)
.cred_exists <- length(.cred_files)>0
.snp_exists <- file.exists(file.path(locus_dir,"FINEMAP/data.snp")) 
.config_exists <- file.exists(file.path(locus_dir,"FINEMAP/data.config"))

file_options <- c(".cred",".snp",".config")[c(.cred_exists,.snp_exists,.config_exists)]

if(results_file %in% file_options){print(".cred is present")}                                   
[1] ".cred is present"

Even though the tool does not get to use .cred file, we still could use the .snp file present as well but then the error message arises

[1] "+ FINEMAP:: Importing prob (.snp)..."
Error in `[[<-.data.frame`(`*tmp*`, col, value = 1) : 
  replacement has 1 row, data has 0
In addition: Warning messages:
1: Python '/home/acarrasco/.conda/envs/echoR/bin/python' was requested but '/tools/anaconda3/bin/python' was loaded instead (see reticulate::py_config() for more information) 
2: In sdY.est(d$varbeta, d$MAF, d$N) :
  estimating sdY from maf and varbeta, please directly supply sdY if known
acarrasco@kronos:/mnt/rreal/RDS/acarrasco/ANALYSES_WORKSPACE/EARLY_PD/POST_GWAS/ECHOLOCATOR/RESULTS_2/mixedmodels_GWAS/earlymotorPD_axial/AC108211.1/FINEMAP$ head data.snp 
index rsid chromosome position allele1 allele2 maf beta se z prob log10bf mean sd mean_incl sd_incl
189 rs6837253 4 156322896 A T 0.02075 -0.3057 0.1058 -2.88941 0.521352 3.56637 -0.233238 0.758019 -0.447371 1.00316
190 rs11100000 4 156322989 T C 0.0197 -0.3054 0.1057 -2.88931 0.47397 3.48399 -0.255481 0.558101 -0.539025 0.710162
174 rs7689588 4 156312305 T C 0.01615 0.2786 0.1047 2.66094 0.434588 3.41497 -0.210852 0.639425 -0.485177 0.898729
92 rs6813360 4 156280474 A C 0.02165 0.3478 0.1227 2.83456 0.39096 3.33674 -0.137362 0.586056 -0.351346 0.896285
173 rs7664568 4 156312207 A G 0.01615 0.2777 0.1048 2.64981 0.379836 3.31634 -0.181721 0.607305 -0.47842 0.910522
145 rs72617489 4 156301492 A T 0.00485 -0.1804 0.4355 -0.414237 0.373007 3.30371 -0.254638 0.732986 -0.682663 1.07153
53 rs56303163 4 156269874 T C 0.02165 0.3464 0.1227 2.82315 0.233002 3.01182 -0.130036 0.502011 -0.558091 0.91799
121 rs12500250 4 156291125 T C 0.00485 -0.1248 0.4329 -0.288288 0.207427 2.94708 -0.0772504 0.361459 -0.372423 0.721071
94 rs17032893 4 156281371 T C 0.00485 -0.1248 0.4329 -0.288288 0.204728 2.93992 -0.0783408 0.349633 -0.382658 0.69329

I understand the error is becuase there is no row with a prob value higher than the credset_threshold. Maybe worth adding a message

data.snp[data.snp[[prob_col]] > credset_thresh,] %>% plyr::mutate(CS=1) %>% dplyr::rename(PP=dply
    r::all_of(prob_col))                                                                             
Error in `[[<-.data.frame`(`*tmp*`, col, value = 1) : 
  replacement has 1 row, data has 0

I understand there is no causal SNP on this specific locus by looking at the PIP. Maybe worth adding a message when that happens.

However, there is an issue getting to use cred and snp files that I could not figure out

@bschilder
Copy link
Member

Hi @AMCalejandro, could you send your Session Info? There's some fixes in the dev branch that I haven't merged yet.

@AMCalejandro
Copy link
Contributor Author

Here:

r$> sessionInfo()                                                                                                                                                                                          
R version 4.0.3 (2020-10-10)
Platform: x86_64-conda-linux-gnu (64-bit)
Running under: Ubuntu 20.04.3 LTS

Matrix products: default
BLAS/LAPACK: /home/acarrasco/.conda/envs/echoR/lib/libopenblasp-r0.3.12.so

locale:
 [1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C               LC_TIME=en_GB.UTF-8        LC_COLLATE=en_GB.UTF-8     LC_MONETARY=en_GB.UTF-8    LC_MESSAGES=en_GB.UTF-8    LC_PAPER=en_GB.UTF-8      
 [8] LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] data.table_1.14.2 forcats_0.5.1     stringr_1.4.0     dplyr_1.0.7       purrr_0.3.4       readr_2.1.2       tidyr_1.2.0       tibble_3.1.6      ggplot2_3.3.5     tidyverse_1.3.1   echolocatoR_0.1.2

loaded via a namespace (and not attached):
  [1] readxl_1.3.1                backports_1.4.1             Hmisc_4.5-0                 BiocFileCache_1.14.0        plyr_1.8.6                  lazyeval_0.2.2              splines_4.0.3              
  [8] BiocParallel_1.24.1         GenomeInfoDb_1.26.7         digest_0.6.29               ensembldb_2.14.1            htmltools_0.5.2             fansi_1.0.2                 magrittr_2.0.2             
 [15] checkmate_2.0.0             memoise_2.0.1               BSgenome_1.58.0             cluster_2.1.1               tzdb_0.2.0                  Biostrings_2.58.0           modelr_0.1.8               
 [22] matrixStats_0.61.0          ggbio_1.38.0                askpass_1.1                 prettyunits_1.1.1           jpeg_0.1-8.1                colorspace_2.0-2            rvest_1.0.2                
 [29] blob_1.2.2                  rappdirs_0.3.3              haven_2.4.3                 xfun_0.29                   crayon_1.4.2                RCurl_1.98-1.5              jsonlite_1.7.3             
 [36] graph_1.68.0                Exact_2.1                   survival_3.2-11             VariantAnnotation_1.36.0    glue_1.6.1                  gtable_0.3.0                zlibbioc_1.36.0            
 [43] XVector_0.30.0              DelayedArray_0.16.3         BiocGenerics_0.36.1         scales_1.1.1                mvtnorm_1.1-1               DBI_1.1.2                   GGally_2.1.1               
 [50] Rcpp_1.0.8                  progress_1.2.2              htmlTable_2.1.0             foreign_0.8-81              bit_4.0.4                   proxy_0.4-25                OrganismDbi_1.32.0         
 [57] Formula_1.2-4               stats4_4.0.3                htmlwidgets_1.5.3           httr_1.4.2                  RColorBrewer_1.1-2          ellipsis_0.3.2              pkgconfig_2.0.3            
 [64] reshape_0.8.8               XML_3.99-0.6                nnet_7.3-15                 dbplyr_2.1.1                utf8_1.2.2                  tidyselect_1.1.1            rlang_1.0.1                
 [71] reshape2_1.4.4              AnnotationDbi_1.52.0        munsell_0.5.0               cellranger_1.1.0            tools_4.0.3                 cachem_1.0.6                cli_3.1.1                  
 [78] generics_0.1.2              RSQLite_2.2.9               broom_0.7.12                fastmap_1.1.0               fs_1.5.2                    knitr_1.37                  bit64_4.0.5                
 [85] AnnotationFilter_1.14.0     rootSolve_1.8.2.1           RBGL_1.66.0                 xml2_1.3.3                  biomaRt_2.46.3              compiler_4.0.3              rstudioapi_0.13            
 [92] curl_4.3                    png_0.1-7                   e1071_1.7-6                 reprex_2.0.1                DescTools_0.99.41           stringi_1.7.6               GenomicFeatures_1.42.3     
 [99] lattice_0.20-41             ProtGenerics_1.22.0         Matrix_1.3-2                vctrs_0.3.8                 pillar_1.7.0                lifecycle_1.0.1             BiocManager_1.30.12        
[106] bitops_1.0-7                lmom_2.8                    rtracklayer_1.50.0          GenomicRanges_1.42.0        R6_2.5.1                    latticeExtra_0.6-29         gridExtra_2.3              
[113] IRanges_2.24.1              gld_2.6.2                   dichromat_2.0-0             boot_1.3-27                 MASS_7.3-53.1               assertthat_0.2.1            SummarizedExperiment_1.20.0
[120] openssl_1.4.6               withr_2.4.3                 GenomicAlignments_1.26.0    Rsamtools_2.6.0             S4Vectors_0.28.1            GenomeInfoDbData_1.2.4      expm_0.999-6               
[127] parallel_4.0.3              hms_1.1.1                   grid_4.0.3                  rpart_4.1-15                class_7.3-18                MatrixGenerics_1.2.1        biovizBase_1.38.0          
[134] Biobase_2.50.0              lubridate_1.8.0             base64enc_0.1-3            

r$>  

@dklarin7
Copy link

dklarin7 commented Feb 9, 2022

I am having a similar error at the exact same step, and believe I have found the issue (or at least, an issue). When trying to load the cred file for merging into the multi-finemap file, I see the following error, which I think may be related to the error above:

"[1] "+ FINEMAP:: Importing conditional probabilities (.cred)..."
Error in t(rsids)[, 1] : subscript out of bounds
In addition: Warning message:
In data.table::fread(cred_path, na.strings = c("", "NA"), nThread = 1) :
Detected 9 column names but the data has 3 columns. Filling rows automatically. Set fill=TRUE explicitly to avoid this warning."

The issue here, from what I can gather, has to do with calling fread to load the .cred file. For some reason, despite the comment character leading the first line of the cred file, fread does not seem to register it as such and assumes these are the column names:

"# Post-Pr(# of causal SNPs is 1) = 1
#log10bf 10.5734 NA
#min(|ld|) 1 NA
#mean(|ld|) 1 NA
#median(|ld|) 1 NA
index cred1 prob1
1 rs6025 0.9999"

This may be throwing a resultant error assuming that the cred file "doesn't exist", when in fact it is just that fread is assuming the first commented line (# Post-Pr(# of causal SNPs is 1) = 1) is actually the header. Changing this line to another function may resolve this?

@AMCalejandro
Copy link
Contributor Author

Thanks @dklarin7

Did you try to modify the function on the echolocatoR package and rerun?
I may find some time this weekend to do so.

I wonder if @bschilder already had a look at this.

Thank you guys!

@dklarin7
Copy link

Hi @AMCalejandro
Thanks for your reply. What I ended up doing was modifying the header to see if this would fix the error (I just deleted this first line after running FINEMAP alone with echolocatoR first, then re-running the analysis with SUSIE and ABF finemapping methods). While the "fread" related error then went away, I received an error similar to yours above. I think there are two separate, but related issues. The first is that the header created in the .cred file can't be read by the fread command, and so throws an error. If you game the files to get around this, there is still a bug in incorporating the .cred file/FINEMAP results into the Multi-finemap file. While the FINEMAP results are still viewable in the FINEMAP directory within each locus, they are not merged into the Multi-finemap file so all of these columns are "NA" and this information isnt incorporated into the "consensus SNPs" results.

Thanks,
Derek

@bschilder
Copy link
Member

bschilder commented Mar 4, 2022

Ok, so I was finally able to dig into this and resolve the root issues.
@AMCalejandro you were right on, these were two separate but related issues.

Fixes

I've made some patches to the master branch to address these issues (Version: 0.2.2).

1. Reading .cred files from FINEMAP

The crux of the issue here is that file formats changed across FINEMAP versions, which I hadn't accounted for. I've made some edits to ensure that the .cred files can be read properly regardless of version (though I'll keep an eye out for any further formatting changes in the future).

2. Merged fine-mapping results

This is a weird one, and I still don't fully understand why this was happening, but for some reason merging fine-mapping results from each method on the "SNP" column wasn't working with data.tables. I tried a bunch of different fixes (including ensuring the keys were set to the same column, and that "SNP" were both character vectors) but none of them worked, except temporarily converting the tables to data.frames, merging, and then converting back to data.table format. I confirmed this properly merges the results without inducing NAs or introducing duplicate rows. Though it's generally concerning that data.table behaved in this way, unless I was using it wrong. Looking now for any other places in my code where this might pop up.

echoverse

While I made just these patches on the master branch, I've rewritten much of echolocatoR so it's broken into more managle (and unit tested) subpackages, as suite I'm calling the echoverse. This is currently working well for ABF/SUSIE/FINEMAP if you'd like to give it a try, but I need to do a bit more work to get the rest of the fine-mapping methods up and running before I merge it with master. To install, use:

remotes::install_github("RajLabMSSM/echolocatoR@echoverse")

@mkoromina
Copy link

Hey @bschilder, I tried installing echoverse suite with the above mentioned command: remotes::install_github("RajLabMSSM/echolocatoR/echoverse"), but it was not available for R versions 4.1.0 or 3.5.3. Any tips you may have for this? Thanks a lot!

@bschilder
Copy link
Member

bschilder commented Mar 7, 2022

@mkoromina apologies, that was a typo, should have been an @ before echoverse (not a "/"). Just corrected it

@jdblischak
Copy link
Contributor

Though it's generally concerning that data.table behaved in this way, unless I was using it wrong. Looking now for any other places in my code where this might pop up.

@bschilder If data.table is behaving unexpectedly inside your package functions, try defining .datatable.aware <- TRUE in any of your .R files

https://rdatatable.gitlab.io/data.table/articles/datatable-importing.html#data-table-in-imports-but-nothing-imported-1

@bschilder
Copy link
Member

bschilder commented Mar 7, 2022

@bschilder If data.table is behaving unexpectedly inside your package functions, try defining .datatable.aware <- TRUE in any of your .R files

https://rdatatable.gitlab.io/data.table/articles/datatable-importing.html#data-table-in-imports-but-nothing-imported-1

I'd never heard of this approach before! Thanks so much @jdblischak, I'll try this out, perhaps by adding to a .zzz file.
@Al-Murphy this may be of interest for you too.

@AMCalejandro
Copy link
Contributor Author

Hi,

Apparently the weird issue still persist.

Maybe I should switch to echoverse.....

Just copying the output when finemap fails

vvvvv-- ABF --vvvvv
✅ All required columns present.
✅ All suggested columns present.
vvvvv-- FINEMAP --vvvvv
✅ All required columns present.
✅ All suggested columns present.
vvvvv-- SUSIE --vvvvv
✅ All required columns present.
✅ All suggested columns present.
vvvvv-- POLYFUN_SUSIE --vvvvv
✅ All required columns present.
✅ All suggested columns present.

+++ Multi-finemap:: ABF +++

+++ Multi-finemap:: FINEMAP +++
[1] "++ FINEMAP:: Constructing master file."
[1] "++ FINEMAP:: Constructing data.z file."
[1] "++ FINEMAP:: Constructing data.ld file."
[1] "+ Using FINEMAP v1.4"

|--------------------------------------|
| Welcome to FINEMAP v1.4              |
|                                      |
| (c) 2015-2020 University of Helsinki |
|                                      |
| Help :                               |
| - ./finemap --help                   |
| - www.finemap.me                     |
| - www.christianbenner.com            |
|                                      |
| Contact :                            |
| - christian.benner@helsinki.fi       |
| - matti.pirinen@helsinki.fi          |
|--------------------------------------|

--------
SETTINGS
--------
- dataset            : all
- corr-config        : 0.95
- n-causal-snps      : 5
- n-configs-top      : 50000
- n-conv-sss         : 100
- n-iter             : 100000
- n-threads          : 1
- prior-k0           : 0
- prior-std          : 0.05 
- prob-conv-sss-tol  : 0.001
- prob-cred-set      : 0.95

------------
FINE-MAPPING (1/1)
------------
- GWAS summary stats               : FINEMAP/data.z
- SNP correlations                 : FINEMAP/data.ld
- Causal SNP stats                 : FINEMAP/data.snp
- Causal configurations            : FINEMAP/data.config
- Credible sets                    : FINEMAP/data.cred
- Log file                         : FINEMAP/data.log_sss
- Reading input                    : done!   

- Number of GWAS samples           : 3572
- Number of SNPs                   : 4057
- Prior-Pr(# of causal SNPs is k)  : 
  (0 -> 0)
   1 -> 0.583
   2 -> 0.291
   3 -> 0.0971
   4 -> 0.0243
   5 -> 0.00485
- 100430 configurations evaluated (0.113/100%) : converged after 113 iterations
- Computing causal SNP statistics  : done!   
- Regional SNP heritability        : 93.1 (SD: 0.374 ; 95% CI: [92.3,93.8])
- Log10-BF of >= one causal SNP    : 109
- Post-expected # of causal SNPs   : 5
- Post-Pr(# of causal SNPs is k)   : 
  (0 -> 0)
   1 -> 0
   2 -> 0
   3 -> 1.92e-44
   4 -> 3.85e-32
   5 -> 1
- Computing credible sets          : done!
- Writing output                   : done!   
- Run time                         : 0 hours, 0 minutes, 30 seconds
[1] ".cred not detected. Using .snp instead."
[1] "+ FINEMAP:: Importing prob (.snp)..."
Error in `[.data.table`(x, r, vars, with = FALSE) : 
  column(s) not found: prob
In addition: Warning message:
In sdY.est(d$varbeta, d$MAF, d$N) :
  estimating sdY from maf and varbeta, please directly supply sdY if known

r$> sessionInfo()                                                                                                                                                                                          
R version 4.0.3 (2020-10-10)
Platform: x86_64-conda-linux-gnu (64-bit)
Running under: Ubuntu 20.04.3 LTS

Matrix products: default
BLAS/LAPACK: /home/acarrasco/.conda/envs/echoR/lib/libopenblasp-r0.3.12.so

locale:
 [1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C               LC_TIME=en_GB.UTF-8        LC_COLLATE=en_GB.UTF-8     LC_MONETARY=en_GB.UTF-8    LC_MESSAGES=en_GB.UTF-8    LC_PAPER=en_GB.UTF-8      
 [8] LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] echolocatoR_0.2.3

loaded via a namespace (and not attached):
 [1] magrittr_2.0.2    tidyselect_1.1.2  munsell_0.5.0     colorspace_2.0-3  R6_2.5.1          rlang_1.0.2       fansi_1.0.3       dplyr_1.0.8       grid_4.0.3        data.table_1.14.2 gtable_0.3.0     
[12] utf8_1.2.2        cli_3.2.0         DBI_1.1.2         ellipsis_0.3.2    assertthat_0.2.1  tibble_3.1.6      lifecycle_1.0.1   crayon_1.5.0      purrr_0.3.4       ggplot2_3.3.5     vctrs_0.3.8      
[23] glue_1.6.2        compiler_4.0.3    pillar_1.7.0      generics_0.1.2    scales_1.1.1      pkgconfig_2.0.3  

@mkoromina
Copy link

@AMCalejandro hey, so upon running this, do you not get any results from my understanding?

@AMCalejandro
Copy link
Contributor Author

AMCalejandro commented Mar 28, 2022 via email

@bschilder bschilder self-assigned this Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

5 participants