-
Notifications
You must be signed in to change notification settings - Fork 1
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
error when flipping alleles and question about conversion to polar #5
Comments
Hi Dora, Thanks for the compliment! And thanks for raising an issue on Github. So you're getting a (not very clear) error message in R when you try to flip the alleles in trait1 to align them with the allele 'direction' in trait2. The first thing I notice when I look at your data (and thank you for including this, makes it much easier to help you) is that rownames are included in the data but not in the header. I suspect that what we might think is column "SNP" will actually give you the rownames (1, 2, ...) and the column called "A1" will give us the SNP rsids (rs3094315, rs3131972, ...). Is that correct? I don't know if that will solve all problems, but if this is the case we should at least get rid of the rownames. Let me know what happens if you change this! |
As for your question whether it's a problem to already have a z-score column in your dataframe / tibble: I suspect not, but the function will not change anything to your z-column. It actually expects there to be a "freq", "beta" and "se" column and changes these according to the flipped alleles. I do see the need for a new version of this function that can work without an allele frequency column (because PolarMorphism doesn't need it), and a version that can work with only z-scores if beta and se are not available. I'll think about adding this functionality, and I'll create a new issue for this |
Hi Joanna, Thank you so much for your answer! But now it works properly, thanks for helping me investigate the issues! |
Dear Joanna,
This is a wonderful software, thank you!
I am trying to flip the alleles and make one of the summary statistics as reference.
My sumstats are munged using LDSC, and look like this:
SNP A1 N Z A2
1 rs3094315 G 230059 -1.067 A
2 rs3131972 A 230636 -0.965 G
My code:
trait1 <- AlleleFlip(sumstats = trait1, snps = trait2 %>% select(SNP, A1, A2), snpid = "SNP", only.a2 = F)
I get the following error message:
Error in $<-.data.frame(*tmp*, "a1.b", value = character(0)) : replacement has 0 rows, data has 1217311
Can you help me troubleshoot it? I suppose that this is happening because of adding the Z-score column, what I already have in the data?
Also, in the tutorial when you are converting the data to polar
(CES.AF <- ConvertToPolar(dfnames = traits, snpid = "snpid", whiten = T, LDcorrect = F)
, is it sufficient to define the traits astraits <- c("trait1", "trait2")
before?Thank you in advance for your help!
Dora
The text was updated successfully, but these errors were encountered: