nested cell arrays from tables

조회 수: 3 (최근 30일)
Jennifer Sander
Jennifer Sander 2019년 2월 25일
댓글: Jennifer Sander 2019년 2월 26일
Hello,
I have got a question regarding nested cell arrays. I have two tables, one which is giving me values per participant for 50 000 so-called SNPs in total. A second table is referring those 50 000 SNPs to roughly 20 000 genes. Each gene consists of a number of SNPs.
What I want is a cell array which shows the 20 000 genes on it's first interface, and if I click on one of the genes, I want it to open the corresponding table of all associated SNPs and the single values per participant, as given in the first table.
I have looked but found no solution to how to do that, especially because of the size of data, I cannot do that manually, but it needs to be automated in some way. I was also wondering how to take the information about the genes-SNP-correspondance and to sort the SNP values from the other table based on that classification.
I hope it gets clear what I am asking for and excuse me, if I am not clear enough or there is a solution I can adapt from somewhere else.
Best regards

답변 (1개)

Bob Thompson
Bob Thompson 2019년 2월 25일
Without having seen your data I don't know that I will be able to come up with something perfect, but hopefully this will give you somewhere to start.
I think that cells may not be the best choice for you, simply because I think it will be very easy to get lost. I would suggest a structure instead, as then you can have direct names to keep things organized.
SNP = tableread('SNPsFile.txt'); % Just loading your data to define my variable names
Genes = tableread('GenesFile.txt'); % Loading table of gene data
organized = struct('gene',Genes(:,1)); % Put genes into 'gene' field of new structure array.
% Also helps to preallocate.
for i = 1:size(Genes,1); % Loop through each gene
[organized(i).SNPs] = SNP(SNP(:,1) == organized(i).gene,2:end); % No idea how these exactly relate
% You will need to adjust the logic yourself, or describe how things are related
end
Due to the size of the data you're working with it's going to take a few minutes, that's just a guarenteed thing with MATLAB, but this concept should get you started on how to move things around.
  댓글 수: 1
Jennifer Sander
Jennifer Sander 2019년 2월 26일
Thank you for your answer. Sadly the further analysis requires the data to be in a cell array of the above described form.

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

카테고리

Help CenterFile Exchange에서 Tables에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by