[BioC] shuffling distance matrix

Stephen Henderson s.henderson at ucl.ac.uk
Mon Mar 19 14:51:28 CET 2007


"
You can do something like this

> m = matrix(1:144, 12, 12)
> rowRandomIndex = sample(1:12)
> colRandomIndex = sample(1:12)
> m[rowRandomIndex, colRandomIndex]

There must be more elegant ways to do this...but this should work.

"


Or try (replace=T  i.e. bootstrap rather than permute is I think
appropriate for your example

>m = sample(m, length(m), replace=T)

Stephen Henderson
UCL, London WC1E 6BT


Cheers,
--TC

On 3/19/07, prsmra01 at uniroma2.it <prsmra01 at uniroma2.it> wrote:
>
> Dear All,
>
> It may sound a trivial question...but I couldn't find a simple
> solution in R: I'm working
> on all-against-all distance matrices, the values stored in these
> matrices representing
> measures of similarities between pair of proteins; these matrices can
> be considered
> representation of phylogenetic trees; I want to generate other
> matrices with the same
> randomly permuted distances....how can I shuffle these matrices ?
>
> thank you,
>
> Maria
> --
> Maria Persico, PhD. student
> http://cbm.bio.uniroma2.it/~maria/
> MINT database group
> Universita' di Tor Vergata, via della Ricerca scientifica 11
> 00133 Roma, Italy
> Tel +39 0672594315 (Supervisor's room)
> Fax +39 0672594766
> Mobile phone: +393479715662
> e-mail maria.persico at uniroma2.it
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives:
> http://news.gmane.org/gmane.science.biology.informatics.conductor
>

	[[alternative HTML version deleted]]

_______________________________________________
Bioconductor mailing list
Bioconductor at stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/bioconductor
Search the archives:
http://news.gmane.org/gmane.science.biology.informatics.conductor

**********************************************************************
This email and any files transmitted with it are confidentia...{{dropped}}



More information about the Bioconductor mailing list