Borrar filtros
Borrar filtros

comparison and display the appeared most elements

3 visualizaciones (últimos 30 días)
joha
joha el 11 de Oct. de 2015
Comentada: Star Strider el 11 de Oct. de 2015
The selected patients are with the Status = 1, are patient 1,2 & 4 .
I need to compare the genes among 1, 2, & 4, and display the same gene, for example: E.
Then display the gene appeared most among the 3 patients.
This is how I compare three of them .
P1 = {'A' ,'C' , 'E' , 'F'};
>> P2 = {'B' ,'D' , 'E' , 'G'};
>> P4 = {'C' ,'F' , 'E' , 'K'};
>> cmp_p1_p2=strcmp(P1,P2)
cmp_p1_p2 =
0 0 1 0
>> cmp_p1_p4=strcmp(P1,P4)
cmp_p1_p4 =
0 0 1 0
>> cmp_p2_p4=strcmp(P2,P4)
cmp_p2_p4 =
0 0 1 0

Respuesta aceptada

Walter Roberson
Walter Roberson el 11 de Oct. de 2015
all_genes = union(union(P1,P2),P4);
occurrences = ismember(all_genes, P1) + ismember(all_genes, P2) + ismember(all_genes, P4);
max_count = max(occurrences);
most_common_idx = find(occurrences == max_count);
most_common_genes = all_genes(most_common_idx);
The result might include multiple genes, if there are multiple genes which occur equally often.

Más respuestas (0)

Categorías

Más información sobre Genomics and Next Generation Sequencing en Help Center y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Community Treasure Hunt

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

Start Hunting!

Translated by