フィルターのクリア

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

2 ビュー (過去 30 日間)
Hyeokjin Jho
Hyeokjin Jho 2018 年 9 月 17 日
回答済み: KSSV 2018 年 9 月 17 日
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?

採用された回答

KSSV
KSSV 2018 年 9 月 17 日

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by