필터 지우기
필터 지우기

String Replacing for a DNA sequence

조회 수: 1 (최근 30일)
Reshma Ravi
Reshma Ravi 2017년 6월 2일
댓글: Reshma Ravi 2017년 6월 2일
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
Andrei Bobrov
Andrei Bobrov 2017년 6월 2일
편집: Andrei Bobrov 2017년 6월 2일
Please example with beginning sequence and with finished result.
Jan
Jan 2017년 6월 2일
What are "repeated substring" exactly?

댓글을 달려면 로그인하십시오.

채택된 답변

Andrei Bobrov
Andrei Bobrov 2017년 6월 2일
편집: Andrei Bobrov 2017년 6월 2일
A = {'AAGC', 1 ;'GCCU', 2 ;'AGCU', 2; 'CCGU' 1};
T = cell2table(A,'var',{'DNA','count'});
Tout = T(T.count > 1,:);

추가 답변 (1개)

Jan
Jan 2017년 6월 2일
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'};
[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.

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by