Effacer les filtres
Effacer les filtres

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

2 vues (au cours des 30 derniers jours)
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?

Réponse acceptée

KSSV
KSSV le 17 Sep 2018

Plus de réponses (0)

Catégories

En savoir plus sur Matrices and Arrays dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by