Closed alexMarCar closed 2 years ago
I think this is happening bc the "SNP" col in your GWAS has coordinates instead of RSIDs. The step that merges the LD panel with the GWAS sum stats does so using matching RSIDS.
I just changed the the SNP notation from chr:pos to rsIDs, and I am getting the same issue.
[1] "+ Full UKB LD matrix: 20801 x 20801" [1] "+ Full UKB LD SNP data.table: 20801 x 5" [1] "UKB MAF:: Extracting MAF from UKB reference." [1] "+ CONDA:: Identified axel executable in echoR env." Error in `[.data.table`(y, x, nomatch = if (all.x) NA else NULL, on = by, : logical error. i is not a data.table, but 'on' argument is provided. Fine-mapping complete in: Time difference of 2 mins Error in `[.data.table`(x, r, vars, with = FALSE) : column(s) not found: SNP
The GWAS results header after the update:
CHR POS A1 A2 NPD NCO woolf_p log_woolf_OR log_OR1 log_OR2 woolf_p_adjusted tval se prportion_cases SNP 1 798400 G A 26035 441778 0.054355312527485 -0.0129364098436779 -0.0937025329495809 -0.0077974327837792 0.149450021680241 1.92408105275612 -0.00672342250091146 0.058932314420365 rs10900604 1 798959 A G 26035 441778 0.0624429326097045 -0.0166813371949653 -0.0949059766764264 -0.0116961408205252 0.162749942120059 1.86321743251793 -0.00895297398136848 0.058932314420365 rs11240777 1 1037303 C T 33674 449056 0.413943979264559 -0.0415678483019056 -0.0022959606094905 -0.0436749490486619 0.540481742929293 0.816982901531581 -0.0508797041210767 0.0749884201524977 rs11260592 1 1037313 G A 33674 449056 0.398505671669803 -0.0420967280143385 -0.00152942739309308 -0.0442746217585758 0.527025397597339 0.844303781275011 -0.049859693806851 0.0749884201524977 rs11260593
Best and many thanks!, Alejandro.
Did you use force_new_subset = T
to make sure it's not using your old file subset?
Yes. I am actually removing everything under the results directory (rm -rf ./results/*) to make sure each command is run from scratch. There is just one thing I am not sure if it is fine for this tool - I do not have on my GWAS results gene and locus info. When getting top SNPs per chromosome, I get a locus name inferred when using import_topSNPs
21: locus_chr8_rs2513924 locus_chr8_rs2513924 8 103693753 rs2513924 1.234177e-07 -0.061049972 22: locus_chr9_rs2821150 locus_chr9_rs2821150 9 113520979 rs2821150 2.524724e-06 -0.018425605 Locus Gene CHR POS SNP P Effect
Subsequently, the locus name that I pass on the finemap_loci() would be ie locus_chr8_rs2513924. I do not know if this tool is expecting a real locus name? - I deduced this does not really matter as soon as the chromosome and position are correctly passed.
I have tried to run ABF on single locus modifying the top_SNPs df and giving the positions of interest a real locus and gene name. As I was expecting it did not make any difference
Maybe it helps If I share the whole code for a locus example
CHR POS A1 A2 NPD NCO woolf_p log_woolf_OR log_OR1 log_OR2 woolf_p_adjusted tval se prportion_cases SNP 1 798400 G A 26035 441778 0.054355312527485 -0.0129364098436779 -0.0937025329495809 -0.0077974327837792 0.149450021680241 1.92408105275612 -0.00672342250091146 0.058932314420365 rs10900604 1 798959 A G 26035 441778 0.0624429326097045 -0.0166813371949653 -0.0949059766764264 -0.0116961408205252 0.162749942120059 1.86321743251793 -0.00895297398136848 0.058932314420365 rs11240777 1 1037303 C T 33674 449056 0.413943979264559 -0.0415678483019056 -0.0022959606094905 -0.0436749490486619 0.540481742929293 0.816982901531581 -0.0508797041210767 0.0749884201524977 rs11260592 1 1037313 G A 33674 449056 0.398505671669803 -0.0420967280143385 -0.00152942739309308 -0.0442746217585758 0.527025397597339 0.844303781275011 -0.049859693806851 0.0749884201524977 rs11260593 1 1037367 A G 33674 449056 0.388182072806092 -0.0414481828134772 0 -0.043674956004422 0.517950444263371 0.862930050756748 -0.0480319149589577 0.0749884201524977 rs11260594
21: locus_chr8_rs2513924 locus_chr8_rs2513924 8 103693753 rs2513924 1.234177e-07 -0.061049972 22: locus_chr9_rs2821150 locus_chr9_rs2821150 9 113520979 rs2821150 2.524724e-06 -0.018425605 Locus Gene CHR POS SNP P Effect
r$> colocFIneMap_Results <- finemap_loci(top_SNPs = top_SNPs, results_dir = "/data/kronos/kronos/acarrasco/FOR_MARYAM/results", loci = c("locus_chr9_rs2821150"), dataset_name = "GWAS_coloc", dataset_type = "GWAS", force_new_subset = T, force_new_LD = T, force_new_finemap = T, remove_tmps = F, fullSS_path = "/data/kronos/kronos/acarrasco/FOR_MARYAM/DLB-vs-Nalls-all.se.rsID_noPoint.txt", query_by = "tabix", chrom_col = "CHR", position_col = "POS", snp_col = "SNP", pval_col = "woolf_p", effect_col = "log_woolf_OR", stderr_col = "se", N_cases_col = "NPD", N_controls_col = "NCO", proportion_cases = "prportion_cases", bp_distance = 500000*2, trim_gene_limits = F, finemap_methods = c("ABF"), LD_reference = "UKB", superpopulation = "EUR", download_method = "axel", plot.types=c("fancy"), ## Generate multiple plots of different window sizes; ### all SNPs, 4x zoomed-in, and a 50000bp window plot.zoom = c("all","4x","10x"), ## XGR # plot.XGR_libnames=c("ENCODE_TFBS_ClusteredV3_CellTypes"), ## Roadmap plot.Roadmap = F, plot.Roadmap_query = NULL, # Nott et al. (2019) plot.Nott_epigenome = T, plot.Nott_show_placseq = T, verbose = F ) [1] "+ CONDA:: Activating conda env 'echoR'" [1] "Checking for tabix installation..." [1] "Checking for bcftools installation..." ) ) ) ))))))}}}}}}}} {{{{{{{{{(((((( ( ( ( locus_chr9_rs2821150 (1 / 1) ) ) ) ))))))}}}}}}}} {{{{{{{{{(((((( ( ( ( [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] "++ Could not infer MAF" [1] "++ Preparing N_cases,N_controls cols" [1] "++ Preparing `proportion_cases` col" [1] "++ Preparing N col" [1] "+ Preparing sample_size (N) column" [1] "++ Computing effective sample size." [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 ==> /data/kronos/kronos/acarrasco/FOR_MARYAM/results/GWAS/GWAS_coloc/locus_chr9_rs2821150/locus_chr9_rs2821150_GWAS_coloc_subset.tsv.gz" [1] "LD:: Using UK Biobank LD reference panel." [1] "+ UKB LD file name: chr9_112000001_115000001" [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: /data/kronos/kronos/acarrasco/FOR_MARYAM/results/GWAS/GWAS_coloc/locus_chr9_rs2821150/LD/chr9_112000001_115000001" [1] "+ LD:: Reading LD matrix into memory. This could take some time..." /data/kronos/kronos/acarrasco/FOR_MARYAM/results/GWAS/GWAS_coloc/locus_chr9_rs2821150/LD/chr9_112000001_115000001.gz /data/kronos/kronos/acarrasco/FOR_MARYAM/results/GWAS/GWAS_coloc/locus_chr9_rs2821150/LD/chr9_112000001_115000001.npz Processed URL: /data/kronos/kronos/acarrasco/FOR_MARYAM/results/GWAS/GWAS_coloc/locus_chr9_rs2821150/LD/chr9_112000001_115000001 Some other message at the end [1] "+ Full UKB LD matrix: 22590 x 22590" [1] "+ Full UKB LD SNP data.table: 22590 x 5" [1] "UKB MAF:: Extracting MAF from UKB reference." [1] "+ UKB MAF:: Importing pre-existing file" Error in `[.data.table`(y, x, nomatch = if (all.x) NA else NULL, on = by, : logical error. i is not a data.table, but 'on' argument is provided. Fine-mapping complete in: Time difference of 1.4 mins Error in `[.data.table`(x, r, vars, with = FALSE) : column(s) not found: SNP
Hi @alexMarCar, please accept my sincerest apologies for not following up on this.. I finally have some time to go back and address these issues, as well as make some changes to echolocatoR to make it more robust.
You're correct, locus names are arbitrary. The only thing that matters is that the loci you specify in loci=
matches up with the "Locus" column in "top_SNPs". The "Genes" column within "top_SNPs" is optional, as it's only used when a "Locus" column is not given.
Given the error above, it's possible there were simply no overlapping RSIDS between your GWAS locus and the LD panel.
Could you tell me how many SNPs are within "/data/kronos/kronos/acarrasco/FOR_MARYAM/results/GWAS/GWAS_coloc/locus_chr9_rs2821150/locus_chr9_rs2821150_GWAS_coloc_subset.tsv.gz"?
Hi,
My apologies this time.
Re. No SNPs overlapping. I see, it makes sense. The number of SNPs in "data/kronos/kronos/acarrasco/FOR_MARYAM/results/GWAS/GWAS_coloc/locus_chr9_rs2821150/locus_chr9_rs2821150_GWAS_coloc_subset.tsv.gz" is 1367.
No worries, I can add a message making it more clear when the function fails due to lack of overlapping RSIDS. Perhaps with a backup strategy that involves using the genomic coordinates.
Hi,
I am getting the following error that I am not able to understand when using the finemal_loci() function to do ABF
This is the function calling:
Also, this is the header of my GWAS
Of note, the top_SNPs were got by using the import_topSNPs() function after doing a grouping by CHR, and when calling the finemap_loci() function I specify the locus I am interested in through the "loci" flag from the generated top_SNPs datafrmae.
The sessionInfo:
Many thanks!, Alejandro.