Azzera filtri
Azzera filtri

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

2 visualizzazioni (ultimi 30 giorni)
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?

Risposta accettata

KSSV
KSSV il 17 Set 2018

Più risposte (0)

Categorie

Scopri di più su Matrices and Arrays in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by