How to convert a meta-analysis file from PLINK (.meta) to a .csv or.txt to be read into R?
2
0
Entering edit mode
5.4 years ago
kl ▴ 10

Hi,

I'm encountering issues with reading .meta files into R. I am assuming the file needs to be reformatted to a .csv or a .txt. Does anyone have any idea of how to convert the PLINK output for meta-analysis (plink.meta) to a file format readable by R?

Thanks!

PLINK R • 2.4k views
ADD COMMENT
1
Entering edit mode

I suggest you provide some more details: Is the .meta file a text file? Pasting the first few lines of the .meta file might increase your chances of getting an answer.

ADD REPLY
0
Entering edit mode

its the default output of plink meta-analysis which is plink.meta (text file). When I try to import it into R it can't differentiate the columns.

CHR          BP            SNP  A1  A2   N           P        P(R)    BETA BETA(R)       Q       I

   1      751343     rs28544273   T   A   2      0.9359      0.6009 -0.0026 -0.0400  0.1193   58.80
   1      751488    rs200141114   D   I   1          NA          NA      NA      NA      NA      NA
   1      751756    rs143225517   T   C   2      0.9346      0.6014 -0.0026 -0.0397  0.1195   58.74
   1      752566      rs3094315   G   A   2      0.9665      0.6312  0.0012  0.0306  0.1445   53.03

Thanks

ADD REPLY
0
Entering edit mode

I added code markup to your post for increased readability. You can do this by selecting the text and clicking the 101010 button. When you compose or edit a post that button is in your toolbar, see image below:

101010 Button

ADD REPLY
3
Entering edit mode
5.4 years ago

See the comments on converting spaces to tabs under https://www.cog-genomics.org/plink/1.9/other#tabspace .

ADD COMMENT
3
Entering edit mode
5.4 years ago
zx8754 11k

Please post the code you are using to read the meta file and R is failing, also add error/warning messages. Plink output is Fixed Width Format, which should be easily read using below commands:

read.table("meta.txt", header = TRUE)

Or using data.table, for faster reading:

data.table::fread("meta.txt")

If above fails, then maybe try to use read as fixed width file using read.fwf function, see below StackOverflow post for more info:

ADD COMMENT
1
Entering edit mode

This is actually a better answer than the one I gave. (I was reposting my reply to the more specific query at https://groups.google.com/forum/#!topic/plink2-users/zbr6cW3LeyU .)

ADD REPLY

Login before adding your answer.

Traffic: 1375 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6