Question: How to convert a meta-analysis file from PLINK (.meta) to a .csv or.txt to be read into R?
0
gravatar for rkl
11 weeks ago by
rkl0
rkl0 wrote:

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 • 206 views
ADD COMMENTlink modified 11 weeks ago by zx87546.6k • written 11 weeks ago by rkl0
1

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 REPLYlink written 11 weeks ago by Fabio Marroni2.1k

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 REPLYlink modified 11 weeks ago by WouterDeCoster36k • written 11 weeks ago by rkl0

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 REPLYlink written 11 weeks ago by WouterDeCoster36k
3
gravatar for chrchang523
11 weeks ago by
chrchang5234.7k
United States
chrchang5234.7k wrote:

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

ADD COMMENTlink written 11 weeks ago by chrchang5234.7k
3
gravatar for zx8754
11 weeks ago by
zx87546.6k
London
zx87546.6k wrote:

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 COMMENTlink written 11 weeks ago by zx87546.6k
1

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 REPLYlink written 11 weeks ago by chrchang5234.7k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1301 users visited in the last hour