Index in position 2 exceeds array bounds
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I am trying to find the centre of mass of (sidechain of) tyrosine residues in a protein. I extracted the coordinates and then found the mass of the atoms in the following code. But while trying to find the X coordinate of centre of mass, I had this error show up
% Starting from pdb file
uxc = getpdb('1UXC');
No_of_residues = uxc.Sequence.NumOfResidues
isTYR = ({uxc.Model.Atom.resName} == "TYR");
uxcTYR = uxc.Model.Atom(isTYR) % Extracts particulars of only TYR
%Extracting sidechain coordinates:
uxcTYRt = struct2table(uxcTYR)
atomName=string(uxcTYRt.AtomName); %converting the column AtomName to string array;
REQtyr=uxcTYRt(ismember(atomName,[ "CB","CG","CD1","CD2","CE1","CE2","CZ","OH","HB2","HB3","HD1","HD2","HE1","HE2"]),["AtomName" "resSeq" "X" "Y" "Z"])
Atom_mass = ["CB", 12.01;"CG", 12.01; "CD1",12.01; "CD2",12.01;"CE1", 12.01;"CE2", 12.01; "CZ", 12.01; "OH", 17.006; "HB2", 1.007; "HB3", 1.007; "HD1", 1.007;"HD2", 1.007; "HE1", 1.007; "HE2", 1.007];
DICTAtom_mass = dictionary(Atom_mass(:,1), Atom_mass(:,2));
sizeTyr = size(REQtyr);
numTyr = sizeTyr(1)/14; %number of tyrosine residues
resSeq = REQtyr.resSeq;
sizeresSeq = size(resSeq);
eresSeq = sizeresSeq(1);
% To extract XYZ coordinates of only the tyrosine residues.
uniq = unique(resSeq)
for i = uniq(1,1):uniq(end,end)
Tyro1{i} = table2cell(REQtyr(ismember(resSeq,i),["AtomName","X","Y","Z"]));
Tyro{i} = table2struct(REQtyr(ismember(resSeq,i),["AtomName","X","Y","Z"]));
Tyroc{i} = [Tyro{i}.X;Tyro{i}.Y;Tyro{i}.Z];
Tyrocd{i} = Tyroc{i}';
end
% Finding out the mass of each and every atom in the sidechain of the
% tyrosine residue
for i = uniq(1,1):uniq(end,end)
Tyromas{i} = str2double(DICTAtom_mass(Tyro1{i}(:,1)));
Tyromass{i} = [Tyromas{i}];
end
%X coordinate:
for i= uniq(1,1):uniq(end,end)
TyrocdX{i} = (Tyromass{i}'*Tyrocd{i}(:,1))/sum(Tyromass{i})
end
0 Kommentare
Akzeptierte Antwort
David Hill
am 16 Mär. 2023
for i = 1:numel(uniq)
Tyro1{i} = table2cell(REQtyr(ismember(resSeq,uniq(i)),["AtomName","X","Y","Z"]));
Tyro{i} = table2struct(REQtyr(ismember(resSeq,uniq(i)),["AtomName","X","Y","Z"]));
Tyroc{i} = [Tyro{i}.X;Tyro{i}.Y;Tyro{i}.Z];
Tyrocd{i} = Tyroc{i}';
end
% Finding out the mass of each and every atom in the sidechain of the
% tyrosine residue
for i = 1:numel(uniq)
Tyromas{i} = str2double(DICTAtom_mass(Tyro1{i}(:,1)));
Tyromass{i} = [Tyromas{i}];
end
%X coordinate:
for i= 1:numel(uniq)
TyrocdX{i} = (Tyromass{i}'*Tyrocd{i}(:,1))/sum(Tyromass{i})
end
4 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Audio Processing Algorithm Design finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!