Borrar filtros
Borrar filtros

How to get all possible rearrange permutations of array with repeated elements?

2 visualizaciones (últimos 30 días)
I have some DNA sequences to rearrange
'ACTCACATCTGGTTCCTCTA'
and I need all possible permutations of this (4 'A', 7 'T', 7 'C', 2 'G'). For example,
'AAAATTTTTTTCCCCCCCGG',
'AAATATTTTTTCCCCCCCGG',
'AATAATTTTTTCCCCCCCGG',
...
I used
unique(perms('ACTCACATCTGGTTCCTCTA'),'rows');
It works for smaller array. But for this array, it results error because perms with 20 elements takes up too much memory ( numel is 20! = 2.43e+18).
Actual numbers of permutation would be 20!/4!/7!/7!/2! = 2.00e+09. It's a lot, but still it fits on my memory.
So is there any better way?

Respuesta aceptada

KSSV
KSSV el 17 de Sept. de 2018

Más respuestas (0)

Categorías

Más información sobre Matrices and Arrays en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by