Re: [R] Character SNP data to binary MAF data

2009-01-29 Thread Barry Rowlingson
2009/1/29 Patrick Aboyoun : > Hadassa, > You may want to check out the snpMatrix package in Bioconductor > > http://bioconductor.org/packages/2.3/bioc/html/snpMatrix.html > http://bioconductor.org/packages/2.4/bioc/html/snpMatrix.html > > It contains classes that manage this type of information and

Re: [R] Character SNP data to binary MAF data

2009-01-29 Thread Patrick Aboyoun
Hadassa, You may want to check out the snpMatrix package in Bioconductor http://bioconductor.org/packages/2.3/bioc/html/snpMatrix.html http://bioconductor.org/packages/2.4/bioc/html/snpMatrix.html It contains classes that manage this type of information and should minimize your coding effort.

Re: [R] Character SNP data to binary MAF data

2009-01-29 Thread Thomas Lumley
The first step is to convert your data to all uppercase with toupper(). Then it depends on how tidy the data are: are there missing data, are some SNPs monomorphic in your sample, etc. If there are no missing data you can use N<-ncol(the_data) halfN <- N/2 maf_one_row <-function(arow) { r

Re: [R] Character SNP data to binary MAF data

2009-01-29 Thread Barry Rowlingson
2009/1/29 Hadassa Brunschwig : > Hi > > An example is as follows. Consider the character 3x6 matrix: > > a A a T A t > G g t T T t > A a C C c c > > For each row I would like to identify the most frequent letter and > assign a 1 to it and 0 > to the less frequent character. That is, in row 1 the mo

Re: [R] Character SNP data to binary MAF data

2009-01-29 Thread Hadassa Brunschwig
Hi An example is as follows. Consider the character 3x6 matrix: a A a T A t G g t T T t A a C C c c For each row I would like to identify the most frequent letter and assign a 1 to it and 0 to the less frequent character. That is, in row 1 the most frequent letter is A (I do not differentiate be

[R] Character SNP data to binary MAF data

2009-01-28 Thread Hadassa Brunschwig
Hi I am sure there is a function out there already but I couldn't find it. I have SNP data, that is, a matrix which contains in each row two characters (they are different in each row) and I would like to convert this matrix to a binary one according to the minor allele frequency. For non-genetici