String Replacing for a DNA sequence
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Reshma Ravi
am 2 Jun. 2017
Kommentiert: Reshma Ravi
am 2 Jun. 2017
I want to extract the row from a table whose count is greater than 1, where the first column consists of strings and second column its count. For eg, Table A = AAGC 1 GCCU 2 AGCU 2 CCGU 1 The desired output is : GCCU 2 AGCU 2
2 Kommentare
Andrei Bobrov
am 2 Jun. 2017
Bearbeitet: Andrei Bobrov
am 2 Jun. 2017
Please example with beginning sequence and with finished result.
Akzeptierte Antwort
Andrei Bobrov
am 2 Jun. 2017
Bearbeitet: Andrei Bobrov
am 2 Jun. 2017
A = {'AAGC', 1 ;'GCCU', 2 ;'AGCU', 2; 'CCGU' 1};
T = cell2table(A,'var',{'DNA','count'});
Tout = T(T.count > 1,:);
Weitere Antworten (1)
Jan
am 2 Jun. 2017
Imagine that you worked out how to get a cell string containing the sub-strings:
C = {'GTTA', 'TTAG', 'TAGC', 'GTTA', 'GTTA', 'GTTA', 'TTAG'};
Now find the repeated strings:
repeated = strcmp(C(1:end-1), C(2:end));
Unfortuinately the description is not clear:
if GTTA is repeated 4 times then replace it with another non terminal for example,
A or something like that.
Do you want to replace each repeated string by the character 'A', or all 4 repetitions by one 'A'? This might be:
C(repeated) = {'A'};
Or the function https://www.mathworks.com/matlabcentral/fileexchange/41813-runlength might be useful:
[B, N, Index] = RunLength(repeated);
As long as I'm not sure, what you are asking for, I will not spend more time in creating an explicite answer. But you can try it by your own.
Siehe auch
Kategorien
Mehr zu Genomics and Next Generation Sequencing 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!