フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

can some one help me prepare the data in such a format so i can run the further code.

1 回表示 (過去 30 日間)
naadiya khudabux
naadiya khudabux 2017 年 12 月 17 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
i have downloaded a source code want to intimate the same result. the data is actually in .tsv format i have converted in txt n uploaded. i have to read this file and after reading file, i am suppose to run below mentioned code to create the biadjacency matrix. thanks in advance
bi = zeros(2901,801);
for i=1:length(matador.num)
x=find(strcmp(proteins,matador.txt(i,4))==1);
y=find(chemicals==matador.num(i,1));
bi(x,y)= 1;
end

回答 (1 件)

Walter Roberson
Walter Roberson 2017 年 12 月 18 日
mattab = readtable('matador.txt');
[uprot, ~, protidx] = unique(mattab.protein_name);
[uchem, ~, chemidx] = unique(mattab.chemical_id);
bi = accumarray([protidx, chemidx], 1);
spy(bi);
No loop required.
This might not give the table in the same order as your proteins and chemicals order. The order that will be used is alphanumeric sort order for protein name, and increasing numeric for chemical ID.
  2 件のコメント
naadiya khudabux
naadiya khudabux 2017 年 12 月 18 日
actually,i want create the adjacency matrix of proteins_id and chemical_id. with 2901*801 dimension.
Walter Roberson
Walter Roberson 2017 年 12 月 18 日
>> size(bi)
ans =
2901 801
It already does that.

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!