Filter löschen
Filter löschen

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

2 Ansichten (letzte 30 Tage)
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?

Akzeptierte Antwort

KSSV
KSSV am 17 Sep. 2018

Weitere Antworten (0)

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by