finding same gene combination
Show older comments
I have two datasets in
final =
'Genes' 'T0&T2' 'T1&T3' 'T2&T4' 'T3&T5' 'T4&t6'
'YAR029W' 'd' [] 'd' [] 'd'
'YBL095W' 'd' [] [] 'd' 'd'
'YBL111C' 'u' 'u' 'u' 'u' []
'YBL113C' 'u' 'u' 'u' 'u' 'u'
'YBR096W' 'u' 'u' 'u' 'u' []
'YBR138C' 'd' [] [] 'd' 'd'
Dataset1 =
'Genes' 'T0&T2' 'T1&T3' 'T2&T4' 'T3&T5' 'T4&T6'
'YAR029W' 'dd' 'uu' 'dd' 'uu' 'du'
'YAR062W' 'du' 'uu' 'ud' 'uu' 'du'
'YAR068W' 'du' 'uu' 'uu' 'uu' 'uu'
'YBL095W' 'du' 'ud' 'ud' 'du' 'du'
'YBL111C' 'uu' 'uu' 'ud' 'ud' 'du'
'YBL113C' 'uu' 'uu' 'uu' 'ud' 'ud'
'YBR028C' 'du' 'uu' 'uu' 'ud' 'ud'
I want to compare two datasets and display the result corresponding to dataset1,for example
In variable final 'YAR029W' has values in intervals 'T0&T2','T2&T4','T4&t6',so i want to display as
'Genes' 'T0&T2' 'T2&T4' 'T4&t6'
'YAR029W' 'd' 'd' 'd'
'YAR062W' 'du' 'ud' 'du'
'YAR068W' 'du' 'uu' 'uu'
'YBL095W' 'du' 'ud' 'du'
'YBL111C' 'uu' 'ud' 'du'
'YBL113C' 'uu' 'uu' 'ud'
'YBR028C' 'du' 'uu' 'ud'
for next gene
'Genes' 'T0&T2' 'T3&T5' 'T4&t6'
'YBL095W' 'd' 'd' 'd'
'YBL111C' 'uu' 'ud' 'du'
'YBL113C' 'uu' 'ud' 'ud'
'YBR028C' 'du' 'ud' 'ud'
i want to display for all genes in 'final' please help
Answers (1)
per isakson
on 18 Aug 2012
Edited: per isakson
on 20 Aug 2012
I failed to come up with an algorithm based on dataset objects. I find the documentation hard to interpret. Here is an algorithm based on cell arrays. The result is in a structure, S, with one gene per field. I guess this dataset is not optimal for this problem.
function S = cssm()
% I have two datasets in
final = {
'Genes' 'T0&T2' 'T1&T3' 'T2&T4' 'T3&T5' 'T4&t6'
'YAR029W' 'd' [] 'd' [] 'd'
'YBL095W' 'd' [] [] 'd' 'd'
'YBL111C' 'u' 'u' 'u' 'u' []
'YBL113C' 'u' 'u' 'u' 'u' 'u'
'YBR096W' 'u' 'u' 'u' 'u' []
'YBR138C' 'd' [] [] 'd' 'd'};
Dataset1 = {
'Genes' 'T0&T2' 'T1&T3' 'T2&T4' 'T3&T5' 'T4&T6'
'YAR029W' 'dd' 'uu' 'dd' 'uu' 'du'
'YAR062W' 'du' 'uu' 'ud' 'uu' 'du'
'YAR068W' 'du' 'uu' 'uu' 'uu' 'uu'
'YBL095W' 'du' 'ud' 'ud' 'du' 'du'
'YBL111C' 'uu' 'uu' 'ud' 'ud' 'du'
'YBL113C' 'uu' 'uu' 'uu' 'ud' 'ud'
'YBR028C' 'du' 'uu' 'uu' 'ud' 'ud' };
for ff = 2 : size( final, 1 )
is_data = not( cellfun( @isempty, final( ff, 1:end ) ) );
S.( final{ff,1} ) = Dataset1( :, is_data );
S.( final{ff,1} )(ff,:) = final( ff, is_data );
end
end
==============
S = cssm()
S =
YAR029W: {8x4 cell}
YBL095W: {8x4 cell}
YBL111C: {8x5 cell}
YBL113C: {8x6 cell}
YBR096W: {8x5 cell}
YBR138C: {8x4 cell}
>> S.YAR029W
ans =
'Genes' 'T0&T2' 'T2&T4' 'T4&T6'
'YAR029W' 'd' 'd' 'd'
'YAR062W' 'du' 'ud' 'du'
'YAR068W' 'du' 'uu' 'uu'
'YBL095W' 'du' 'ud' 'du'
'YBL111C' 'uu' 'ud' 'du'
'YBL113C' 'uu' 'uu' 'ud'
'YBR028C' 'du' 'uu' 'ud'
6 Comments
Pat
on 20 Aug 2012
per isakson
on 20 Aug 2012
I'm not sure I find the rule from your examples. I'm I right that
"for 'YBL111C' i need as (the values of ('YAR029W' 'YAR062W' must not be displayed)" because 'YAR029W' and 'YAR062W' are above 'YBL111C' in the array, final.
and
"for 'YBL095W',i need as (the value of 'YAR029W' must not be displayed )" because 'YAR029W' is above 'YBL095W' in the array, final.
per isakson
on 20 Aug 2012
I'm sure I don't understand the criteria for including rows.
At least half the problem is to specify what the algorithm should do. That is your task! Why shouldn't 'YAR062W' be included?
Pat
on 23 Aug 2012
per isakson
on 23 Aug 2012
Edited: per isakson
on 23 Aug 2012
You did not answer this one:
Why shouldn't 'YAR062W' be included?
I insist, you should try harder on the requirement specification. It's your problem not mine.
Pat
on 27 Aug 2012
Categories
Find more on Operating on Diagonal Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!