> Hello List,

> Thanks in advance for any help.

> I am trying to use R to combine panels of microsatellite scores in R and
> having troubles.  I am using GeneMarker 1.70 and my files are saved as tab
> delimited text that look like the example below.  I would like the output to
> have a column for individuals ( eg, [ H1]H01.fsa) and then one column for
> each allele at each locus.  One of the spots I am have trouble with is that
> each file has a different permutation of the same individuals.   Has anyone
> already put something together that they are willing to share?


> Cheers
> Grant

Dear Grant, 

I think the simplest way to deal with your issue is to reorder matrices using 
the row names. Then you can safely cbind them if you wish to have all 
information in the same matrix.
For instance :

> A <- matrix(1:12, ncol=3)
> B <- matrix(12:1, ncol=3)
> rownames(A) <- letters[1:4]
> rownames(B) <- letters[4:1]
> A
  [,1] [,2] [,3]
a    1    5    9
b    2    6   10
c    3    7   11
d    4    8   12
> B
  [,1] [,2] [,3]
d   12    8    4
c   11    7    3
b   10    6    2
a    9    5    1

> B[rownames(A),]
  [,1] [,2] [,3]
a    9    5    1
b   10    6    2
c   11    7    3
d   12    8    4

## so to reorder B, just use:
> B <- B[rownames(A),]

Is this what you needed? 

Best, 

Thibaut.

-- 
######################################
Dr Thibaut JOMBART
MRC Centre for Outbreak Analysis and Modelling
Department of Infectious Disease Epidemiology
Imperial College - Faculty of Medicine
St Mary’s Campus
Norfolk Place
London W2 1PG
United Kingdom
Tel. : 0044 (0)20 7594 3658
[email protected]
http://biomserv.univ-lyon1.fr/%7Ejombart/
http://adegenet.r-forge.r-project.org/

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-genetics mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-genetics

Reply via email to