conver.snp.tped

Questions about GenABEL (aka *ABEL) suite of packages
Forum rules
Please remember not to post any sensitive data on this public forum.
The first few posts of newly registered users will be moderated in order to filter out any spammers.

When get a solution to the problem you posted, please change the topic name (e.g. from "how to ..." to "[SOLVED] how to ..."). This will make it easier for the community to follow the posts yet to be attended.
hakosalo
GenABEL suite user
GenABEL suite user
Posts: 12
Joined: Thu May 12, 2011 7:45 am

conver.snp.tped

Postby hakosalo » Wed Dec 07, 2011 1:01 pm

I have a following problem. This might be because of I changed system from PC to MAC? Or maybe it is because of R version?
I have used files data1.tfam, data1.tped which were generated in a UNIX server
In my old PC/R 2.13 I gave the command

Code: Select all

convert.snp.tped(tped="sbt.tped", tfam="data1.tfam", out="data1.raw", strand="+")

and everything went smooth, but now, with same files made by our UNIX system (and with MAC / newest R 2.14)
the same command gives an error message

Code: Select all

Reading individual ids from file 'data1.tfam' ...
... done.  Read 113 individual ids from file 'data1.tfam'
Reading genotypes from file 'data1.tped' ...
Error in convert.snp.tped(tped = "data1.tped", tfam = "data1.tfam", out = "data1.raw",  :
  coding '0ֿ_?' for SNP not recognized !

Does anyone know why?
Last edited by lckarssen on Tue Jan 31, 2012 8:32 am, edited 1 time in total.
Reason: Reformatted output with the code tag.

lckarssen
Site Admin
Site Admin
Posts: 321
Joined: Tue Jan 04, 2011 3:04 pm
Location: Utrecht, The Netherlands

Re: conver.snp.tped

Postby lckarssen » Tue Jan 31, 2012 8:32 am

This might indeed have something to do with your switch from Unix to Mac, although I'm not sure. I know that Windows and Unix encode files in a different way (you can use the programs dos2unix and unix2dos on a Unix/Linux machine o convert between the two), maybe that goes for Mac as well. On the other hand, Mac OS X is based on a member of the Unix family...

Can you open a terminal on you Mac and try if the file command works? On my Linux system I use it to find out the encoding of a text file:

Code: Select all

$ file file_in_dos_format
file_in_dos_format: ASCII English text, with CRLF line terminators
$ file file_in_linux_format
file_in_linux_format: ASCII English text

Alternatively you can run less file.tped to see check by hand if the file is 'corrupt' and indeed has lines with '0ֿ_?'
-------
Lennart Karssen
PolyOmica
The Netherlands
-------

Hugoline
Posts: 3
Joined: Tue Feb 28, 2012 1:55 pm

Re: conver.snp.tped

Postby Hugoline » Tue Feb 28, 2012 2:37 pm

Hi!

I got a similar error code when using the same command: "coding 'AG' for SNP not recognised!"

I checked the file in Linux, but can't figure out what's wrong. My tped.file looks "normal":
1 rs6675798 0 1166460 T T T T C C T T etc.

Missing values are depicted as 0.

Can anyone help me with this?

Thanks,

Hugoline

Nicola Pirastu
GenABEL senior expert
GenABEL senior expert
Posts: 151
Joined: Wed Feb 09, 2011 3:24 pm

Re: conver.snp.tped

Postby Nicola Pirastu » Wed Mar 21, 2012 9:44 am

Have you checked that all SNPs name are like rsXXXXXXX?

Other people reporte this error and it turned that that was the problem.

I actually have no clue why this happens but it does.

Best.

Nicola

Hugoline
Posts: 3
Joined: Tue Feb 28, 2012 1:55 pm

Re: conver.snp.tped

Postby Hugoline » Mon Mar 26, 2012 3:07 pm

Hmmm... that's not it. I've constructed a dummy data-set and still got the "AG coding not recognized" error code.
The tped file runs in Plink, can there be any format error?

Best,

Hugoline

marcin
GenABEL suite user
GenABEL suite user
Posts: 12
Joined: Wed Feb 09, 2011 10:03 am

Re: conver.snp.tped

Postby marcin » Wed Mar 28, 2012 10:03 am

Hi,

UPDATE:
It actually turned out that the reading error was caused by specifying path in a relative way. Weird anyway...
using in convert.snp.ped
~kiero/Research/AtopyGSD/data/atopy.ped ---- more often works
~/Research/AtopyGSD/data/atopy.ped ---- sometimes works
/Users/kiero/Research/AtopyGSD/data/atopy.ped ---- so far always works...
When using tab-autocompletion, all the paths seem correct !!!

MESSAGE:
I previously reported a similar problem. I tried the suggestion from Nicola, but it worked only partially, i.e. error was reported on another error. What I did was t write a php script which read, trimmed and re-wrote every line. This helped with one dataset. I also tried writing it in Obj-C and Java and it ... didn't help. That is very weird. In addition, now sometimes I see a message "could not open file ..." (pertains to map file). This sometimes disappears after restarting R... Extra weird, esp. that I have really checked rights, umasks, and what not. I suspect it may be actually a bug in the newest R itself (file reading mechanism), not in GenABEL. As a role I observe such behavior after using awk on my map file. I should also say that I have OsX and ssd drive (errors coincide with the new R and the new disk, so maybe OS can't handle it [the disk] properly?). Will update you if I come up with stg. clever. For now try maybe to transpose your tied back to ped...

Marcin

yurii
GenABEL developer
GenABEL developer
Posts: 263
Joined: Fri Jan 21, 2011 5:20 pm

Re: conver.snp.tped

Postby yurii » Tue Apr 17, 2012 6:10 pm

RE: Hugoline

and still got the "AG coding not recognized" error code


can you please attach a toy TPED and TFAM files and exact sequence of commands so we could reproduce and look into the error?

Yurii
Note that (Gen)ABELs are dynamically developing; while this post is intended to provide full information at the time of posting, please read on further posts, if any, as the topic may be updated with novel solutions at a later stage.

best regards,
Yurii

Hugoline
Posts: 3
Joined: Tue Feb 28, 2012 1:55 pm

Re: conver.snp.tped

Postby Hugoline » Wed Apr 18, 2012 7:49 am

Hi,

Specifying the path differently does not seem to make a difference.


My commands are as following:

Code: Select all

convert.snp.tped(tped="test_2snp_5ID.tped", tfam="test_2snp_5ID.tfam",out="test_2snp_5ID.raw",bcast=1)


Code: Select all

 Reading individual ids from file 'test_2snp_5ID.tfam' ...
... done.  Read 5 individual ids from file 'test_2snp_5ID.tfam'
Reading genotypes from file 'test_2snp_5ID.tped' ...
Error in convert.snp.tped(tped = "test_2snp_5ID.tped", tfam = "test_2snp_5ID.tfam",  :
        coding 'AG' for SNP not recognised !


While trying to upload the dummy tped and tfam files, I got an error that "The extension tfam is not allowed". So I've copy-pasted the test data-set.

test_2snp_5ID.tfam:

Code: Select all

1   001   0   0   1   2
1   002   0   0   1   2
1   003   0   0   2   2
1   004   0   0   1   2
1   005   0   0   2   2


test_2snp_5ID.tped:

Code: Select all

1   rs3094315   0   742429   G G   A A   A A   G G   A A
1   rs3934834   0   995669   C C   C C   C C   T C   C C


Hugoline

yurii
GenABEL developer
GenABEL developer
Posts: 263
Joined: Fri Jan 21, 2011 5:20 pm

Re: conver.snp.tped

Postby yurii » Wed Jun 06, 2012 10:37 am

This is strange; see what I get:

Code: Select all

> library(GenABEL)
> convert.snp.tped(tped="test_2snp_5ID.tped", tfam="test_2snp_5ID.tfam",out="test_2snp_5ID.raw",bcast=1)
Reading individual ids from file 'test_2snp_5ID.tfam' ...
... done.  Read 5 individual ids from file 'test_2snp_5ID.tfam'
Reading genotypes from file 'test_2snp_5ID.tped' ...
  ... read 1 lines ...
  ... read 2 lines ...
...done.  Read 2 SNPs from file 'test_2snp_5ID.tped'
Writing to file 'test_2snp_5ID.raw' ...
... done.
>


So it all work well. Zip-file with files you can run, and also outputs, attached (just try R -f runMe.R in the unpacked dir).
Attachments
test_Hugolin.zip
test files and outputs
(1.96 KiB) Downloaded 175 times
Note that (Gen)ABELs are dynamically developing; while this post is intended to provide full information at the time of posting, please read on further posts, if any, as the topic may be updated with novel solutions at a later stage.

best regards,
Yurii

rdlady
Posts: 1
Joined: Fri Dec 16, 2016 11:52 pm

Re: conver.snp.tped

Postby rdlady » Fri Dec 16, 2016 11:59 pm

I had a similar problem, when I tried to import my tped using the convert.snp.tped function from GenABEL I had the following error:
coding '' for SNP not recognised !

Or sometimes it would say:
coding '??' for SNP not recognised !

Or sometimes it would put a weir character between those quotes.

After a day of struggle I discovered that this problem was happening because the tped import function doesn't accept markers that have 100% missing data. I had in my tped files some markers that were like this: "0 rs123456 0 0 0 0 0 0 0 0 0 0 0 0 ... (all zeroes)".
So I used a simple reverse grep command in the bash terminal to remove all the markers that consisted only of zeroes. and now my convert.snp.tped works like a charm!

I hope this helps anybody that is having the same problem that I had.


Return to “GenABEL”

Who is online

Users browsing this forum: No registered users and 2 guests