finding same gene combination

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
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

Thanks a lot ,but a small modification in
for 'YBL095W',i need as (the value of 'YAR029W'
must not be displayed )
'YBL095W' 'd' 'd' 'd'
'YAR068W' 'du' 'uu' 'uu'
'YBL095W' 'du' 'du' 'du'
'YBL111C' 'uu' 'ud' 'du'
'YBL113C' 'uu' 'ud' 'ud'
'YBR028C' 'du' 'ud' 'ud'
for 'YBL111C' i need as (the values of ('YAR029W' 'YAR062W' must not be displayed)
'YBL111C' 'u' 'u' 'u' 'u'
'YBL095W' 'du' 'ud' 'ud' 'du'
'YBL111C' 'uu' 'uu' 'ud' 'ud'
'YBL113C' 'uu' 'uu' 'uu' 'ud'
'YBR028C' 'du' 'uu' 'uu' 'ud'
like these i need for all genes please help
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.
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?
yes u r correct the above row for each gene must not be displayed ,the fist row should indicate it is 'u' or 'd' ,other rows are correct a per the code,but as specifeid by perisakson the above rows must not be displayed
please help
per isakson
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.
I could not understand ur comments ,where it should be included

Sign in to comment.

Categories

Tags

Asked:

Pat
on 17 Aug 2012

Community Treasure Hunt

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

Start Hunting!