chr1swallace / coloc

Repo for the R package coloc
138 stars 44 forks source link

Update susie.R to retain dimnames in single-variant edge-case #164

Closed cfbeuchel closed 1 month ago

cfbeuchel commented 1 month ago

Hi!

Thanks for the great package! I am currently struggling with an edge-case, where the input to runsusie() is a data set that contains only a single variant. I would expect the function to simply pass the data through (or similar), but it throws a error, since the dimnames are dropped when sub-setting a matrix to a single row, unless drop = FALSE is added to the sub-setting operation:

Error in if (nrow(R) != p) stop(paste0("The dimension of R (", nrow(R),  : 
  argument is of length zero

I am unsure about the consequences of trying to fine-map a single SNP, but if it does not have any downstream consequences, it might be helpful (at least for my workflow) to be able to perform colocalization analysis using runsusie and coloc.susie with a single SNP.

Kind regards,

Carl


Commit message:

Patch edge-case in runsusie()

chr1swallace commented 1 month ago

Dear Carl,

I can make the change to stop this error, but really you can't colocalise when you have a single SNP. H3 becomes impossible. Can I ask how this situation arises? It doesn't seem scientifically sensible.

Chris

-- https://chr1swallace.github.iohttps://chr1swallace.github.io/


From: Carl @.> Sent: Thursday, May 30, 2024 1:50 PM To: chr1swallace/coloc @.> Cc: Subscribed @.***> Subject: [chr1swallace/coloc] Update susie.R to retain dimnames in single-variant edge-case (PR #164)

Hi!

Thanks for the great package! I am currently struggling with an edge-case, where the input to runsusie() is a data set that contains only a single variant. I would expect the function to simply pass the data through (or similar), but it throws a error, since the dimnames are dropped when sub-setting a matrix to a single row, unless drop = FALSE is added to the sub-setting operation:

Error in if (nrow(R) != p) stop(paste0("The dimension of R (", nrow(R), : argument is of length zero

I am unsure about the consequences of trying to fine-map a single SNP, but if it does not have any downstream consequences, it might be helpful (at least for my workflow) to be able to perform colocalization analysis using runsusie and coloc.susie with a single SNP.

Kind regards,

Carl


Commit message:

Patch edge-case in runsusie()


You can view, comment on, or merge this pull request online at:

https://github.com/chr1swallace/coloc/pull/164

Commit Summary

File Changes

(1 filehttps://github.com/chr1swallace/coloc/pull/164/files)

Patch Links:

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

cfbeuchel commented 1 month ago

Dear Chris,

thank you for asking the right question! You're completely right, I was not really thinking about my input data and was subsequently doing several nonsensical things! I was using already fine-mapped input data that did not include SNPs that were not in any credible set. So neither should I have tried to fine-map this data using runsie again, nor should I try to run a colocalization analysis using only SNPs in the credible set. Thank you for pointing this out!

This makes this PR superfluous.

chr1swallace commented 1 month ago

glad you figured it out!

-- https://chr1swallace.github.iohttps://chr1swallace.github.io/


From: Carl @.> Sent: Thursday, May 30, 2024 4:04 PM To: chr1swallace/coloc @.> Cc: Chris Wallace @.>; Comment @.> Subject: Re: [chr1swallace/coloc] Update susie.R to retain dimnames in single-variant edge-case (PR #164)

Dear Chris,

thank you for asking the right question! You're completely right, I was not really thinking about my input data and was subsequently doing several nonsensical things! I was using already fine-mapped input data that did not include SNPs that were not in any credible set. So neither should I have tried to fine-map this data using runsie again, nor should I try to run a colocalization analysis using only SNPs in the credible set. Thank you for pointing this out!

This makes this PR superfluous.

— Reply to this email directly, view it on GitHubhttps://github.com/chr1swallace/coloc/pull/164#issuecomment-2139838827, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAQWR2FTMHTFUDCQ6VS5Z6LZE45WRAVCNFSM6AAAAABIQ3WFV2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZZHAZTQOBSG4. You are receiving this because you commented.Message ID: @.***>