chr1swallace / coloc

Repo for the R package coloc
152 stars 43 forks source link

Error when running COLOC #117

Open smsinks opened 1 year ago

smsinks commented 1 year ago

Could you please help with the following error message.

I am attempting to execute COLOC on two GWAS summary statistics. However, when I try to run COLOC using the code provided below, an error is produced and displayed as follows:

> coloc_results <- coloc.abf(trait_eur_common,trait_afr_common, p1 = 1e-4, p2 = 1e-4)
Error in if (!(d$type %in% c("quant", "cc"))) stop("dataset ", suffix,  : 
  the condition has length > 1

Below are the headers of the two data frames for the GWAS summary statistics:

head(trait_eur_common)
                         SNP      beta   varbeta         p    freq  type
2  10:100090169_CTGCAGAAGA_C -2.622807 0.9998531 8.711e-03 0.21322 quant
25        10:101375113_CAA_C -3.900371 1.0001900 9.634e-05 0.86621 quant
30          10:10153657_TA_T  3.840330 1.0001721 1.232e-04 0.31934 quant
32         10:101662858_AT_A -5.319106 1.0000399 1.044e-07 0.45663 quant
39         10:101872090_GT_G -3.459913 0.9999495 5.400e-04 0.50672 quant
45        10:102617719_ACT_A  0.000000 0.0000000 1.745e-22 0.10627 quant

> head(trait_afr_common)
                         SNP      beta   varbeta        p     freq  type
2  10:100090169_CTGCAGAAGA_C -2.903418 1.0002879 0.003701 0.032139 quant
25        10:101375113_CAA_C -2.613851 0.9998860 0.008945 0.757490 quant
30          10:10153657_TA_T -2.857322 1.0002255 0.004281 0.363300 quant
32         10:101662858_AT_A  2.597431 1.0003320 0.009416 0.577550 quant
39         10:101872090_GT_G  2.616783 0.9998343 0.008865 0.333510 quant
45        10:102617719_ACT_A  2.831188 1.0001328 0.004643 0.204350 quant
jeffreypullin commented 1 year ago

A more informative error is thrown by the current version of coloc:

Error in check_dataset(d = dataset1, 1) : 
  dataset 1: missing required element(s) snp

The error highlights the issue: the "SNP" column needs to be renamed to "snp".

chr1swallace commented 11 months ago

The dataset is supposed to be a list, not a data frame. There should be a single value for type, not one for each SNP. This is to emphasise that type is a study level, not snp level variable

-- https://chr1swallace.github.io


From: catheriz @.> Sent: Sunday, December 17, 2023 2:53:46 AM To: chr1swallace/coloc @.> Cc: Subscribed @.***> Subject: Re: [chr1swallace/coloc] Error when running COLOC (Issue #117)

same error: Error in if (!(d$type %in% c("quant", "cc"))) stop("dataset ", suffix, : the condition has length > 1 My data looks like this: snp chromosome position allele1 allele2 maf 35112 1:113709948:T:C 1 113709948 C T 0.017673257 485129 1:113710657:G:T 1 113710657 T G 0.008543363 617108 1:113710779:C:T 1 113710779 T C 0.008247302 36097 1:113710928:G:A 1 113710928 A G 0.017593139 10906 1:113711017:C:T 1 113711017 T C 0.248750745 10822 1:113711270:A:G 1 113711270 G A 0.250942147 beta se z N varbeta type 35112 -0.591678 0.2111050 -2.8027664 12791 0.044565321 cc 485129 0.240849 0.2486460 0.9686422 12791 0.061824833 cc 617108 0.187615 0.2451400 0.7653382 12791 0.060093620 cc 36097 -0.587967 0.2112820 -2.7828542 12791 0.044640084 cc 10906 -0.233390 0.0506506 -4.6078428 12791 0.002565483 cc 10822 -0.235175 0.0506890 -4.6395668 12791 0.002569375 cc

— Reply to this email directly, view it on GitHubhttps://github.com/chr1swallace/coloc/issues/117#issuecomment-1859021220, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAQWR2HJ627EQDEIHCUBR7DYJZNDVAVCNFSM6AAAAAAWF2FUM2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJZGAZDCMRSGA. You are receiving this because you are subscribed to this thread.Message ID: @.***>