Great idea<div><br></div><div>I know nothing of plink bin format, but many packages make use of it, so it should be not that complicated. Also plink is gnu GPL if I remember correctly so we can use the code if needed</div>
<div><br></div><div>Y<br><br>On Friday, November 22, 2013, L.C. Karssen wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">How difficult would it be to import .bed files [1] instead of the text<br>
conversion? Given the binary data of both the .bed and the GenABEL<br>
format, wouldn't conversion be much quicker?<br>
<br>
<br>
Lennart.<br>
<br>
[1] <a href="http://pngu.mgh.harvard.edu/~purcell/plink/binary.shtml" target="_blank">http://pngu.mgh.harvard.edu/~purcell/plink/binary.shtml</a><br>
<br>
<br>
On 11/22/2013 09:54 AM, Yurii Aulchenko wrote:<br>
> Too slow, too difficult for the user, or both? :)<br>
><br>
> On Friday, November 22, 2013, Maksim Struchalin wrote:<br>
><br>
> Yes. Looks like it was a bad idea to use plink R-plugin for<br>
> converting plink files to *ABEL format.<br>
> Maksim<br>
><br>
> On 18/11/2013 18:48, Yury Aulchenko wrote:<br>
>> I would say that in principle DatABEL::text2databel is the<br>
>> "natural" way to go from text-files to DatABEL-files<br>
>><br>
>> The problem is that 'regular' text input may be allele by allele,<br>
>> not genotype by genotype... (e.g. data are in format "A G", or<br>
>> "A/G", not "0" or "1" or "2").<br>
>><br>
>> Y<br>
>><br>
>> On Nov 15, 2013, at 17:48 PM, L.C. Karssen <<a href="javascript:;" onclick="_e(event, 'cvml', 'lennart@karssen.org')">lennart@karssen.org</a>><br>
>> wrote:<br>
>><br>
>>> Hi Maksim,<br>
>>><br>
>>> On 15-11-13 05:53, Maksim Struchalin wrote:<br>
>>>> An easy way to write a function for conversion a plink format<br>
>>>> file to a<br>
>>>> GenABEL format file:<br>
>>>><br>
>>>> Use plink support of 'plug-in' functions<br>
>>><br>
>>> Nice find. I didn't know that existed.<br>
>>><br>
>>>> (<a href="http://pngu.mgh.harvard.edu/~purcell/plink/rfunc.shtml" target="_blank">http://pngu.mgh.harvard.edu/~purcell/plink/rfunc.shtml</a><br>
>>>> <<a href="http://pngu.mgh.harvard.edu/%7Epurcell/plink/rfunc.shtml" target="_blank">http://pngu.mgh.harvard.edu/%7Epurcell/plink/rfunc.shtml</a>>).<br>
>>>> This allows us<br>
>>>> to write a simple R script (myscript.R) which is called by plink<br>
>>>> (plink<br>
>>>> --file mydata --R myscript.R). plink reads the file mydata<br>
>>>> (which is in<br>
>>>> plink format) and iteratively, SNP by SNP, trasfer all the data to a<br>
>>>> script myscript.R. This script contains a function<br>
>>>> Rplink(PHENO,GENO,CLUSTER,COVAR) which will take every SNP (GENO<br>
>>>> variable) and store it in a *flv format through calling DatABEL<br>
>>>> functions.<br>
>>>><br>
>>>> The whole process of conversion will look like this:<br>
>>>><br>
>>>> 1) User asks GenA convert plink file to GenA file<br>
>>>> 2) GenA looks weather the plink is installed. If it is not<br>
>>>> installed,<br>
>>>> then GenA goes to a plink site and download/install it itself<br>
>>>> (use an R<br>
>>>> function "download.file" from "utils" package)<br>
>>>> 3) GenA run a simple line: system('plink --file mydata --R<br>
>>>> myscript.R')<br>
>>>> 4) Rplink function (from myscript.R) gets every SNP and stote it<br>
>>>> in *flv<br>
>>>> format. This function creates an flv file and then open and<br>
>>>> close it for<br>
>>>> saving every single SNP.<br>
>>>> 5) Work is Done<br>
>>><br>
>>> I'm not sure how portable it is to download and run plink. Also, the<br>
>>> plink page says: Currently, there is only support for R-plugins for<br>
>>> Linux-based and Mac OS PLINK distributions.<br>
>>><br>
>>>><br>
>>>> The only issue is how fast the converssion will run: how much<br>
>>>> time does<br>
>>>> it take to open a filvector file, store one SNP and close it? I<br>
>>>> can not<br>
>>>> find a DatABEL R function for adding SNP to a flv file. Is there a C<br>
>>>> DatABEL function which can do it?<br>
>>><br>
>>> Wouldn't it be easier/possible to use plink to export to text<br>
>>> (.csv) and<br>
>>> then use filevector's txt2fvf binary (of course this could be<br>
>>> done from<br>
>>> R using system())?<br>
>>><br>
>>> I'm also wondering if going per SNP is really necessary. If I<br>
>>> understand<br>
>>> it correctly the R script (myscript.R) has to have a function called:<br>
>>> Rplink <- function(PHENO,GENO,CLUSTER,COVAR)<br>
>>> where GENO is the matrix of genotypes. So we could write that into a<br>
>>> DatABEL file at once. Of course you may want to do this per<br>
>>> chromosome<br>
>>> to reduce memory consumption (not sure how plink/R would handle large<br>
>>> data sets).<br>
>>><br>
><br>
><br>
> --<br>
> -----------------------------------------------------<br>
> Yurii S. Aulchenko<br>
><br>
> [ LinkedIn <<a href="http://nl.linkedin.com/in/yuriiaulchenko" target="_blank">http://nl.linkedin.com/in/yuriiaulchenko</a>> ] [ Twitter<br>
> <<a href="http://twitter.com/YuriiAulchenko" target="_blank">http://twitter.com/YuriiAulchenko</a>> ] [ Blog<br>
> <<a href="http://yurii-aulchenko.blogspot.nl/" target="_blank">http://yurii-aulchenko.blogspot.nl/</a>> ]<br>
><br>
><br>
><br>
> _______________________________________________<br>
> genabel-devel mailing list<br>
> <a href="javascript:;" onclick="_e(event, 'cvml', 'genabel-devel@lists.r-forge.r-project.org')">genabel-devel@lists.r-forge.r-project.org</a><br>
> <a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/genabel-devel" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/genabel-devel</a><br>
><br>
<br>
--<br>
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*<br>
L.C. Karssen<br>
Utrecht<br>
The Netherlands<br>
<br>
<a href="javascript:;" onclick="_e(event, 'cvml', 'lennart@karssen.org')">lennart@karssen.org</a><br>
<a href="http://blog.karssen.org" target="_blank">http://blog.karssen.org</a><br>
GPG key ID: A88F554A<br>
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-<br>
<br>
</blockquote></div><br><br>-- <br>-----------------------------------------------------<br>Yurii S. Aulchenko<br><div><br></div><div>[ <a href="http://nl.linkedin.com/in/yuriiaulchenko" target="_blank">LinkedIn</a> ] [ <a href="http://twitter.com/YuriiAulchenko" target="_blank">Twitter</a> ] [ <a href="http://yurii-aulchenko.blogspot.nl/" target="_blank">Blog</a> ]</div>
<br>