##--- Read aligned PDB coordinates (CA only)
aln <- read.fasta(system.file("examples/kif1a.fa",package="bio3d"))
pdbs <- read.fasta.pdb(aln)
##--- Read PDB coordinate for a new structure (all atoms)
id <- get.pdb("2kin", URLonly=TRUE)
pdb <- read.pdb(id)
# map the non-gap positions
gap.inds <- gap.inspect(pdbs$resno)
npc.inds <- pdb2aln.ind(aln=pdbs, pdb=pdb, id=id, inds=gap.inds$f.inds)
# If gaps are found in PDB sequence with the predefined indices,
# redefine the non-gap positions
ngap.f.inds <- gap.inds$f.inds[!is.na(npc.inds)]
npc.inds <- npc.inds[!is.na(npc.inds)]
##--- fit the atomic coordinates to the aligned X-ray structure
xyz <- fit.xyz(pdbs$xyz[1,], pdb$xyz, atom2xyz(ngap.f.inds), atom2xyz(npc.inds))
## seq2aln(pdbseq(pdb), aln, id = id)
## do we get the same result
Run the code above in your browser using DataLab