save pdbs after superposition via pdbfit and fit.xyz

Issue #346 resolved
Jiajie Xiao created an issue

Dear Bio3D team,

Nice work first! I've been playing with Bio3D since the BPS annual meeting this year. Now I'm trying to repeat some of my work involved some of our in-house python, vmd and bash scripts using your Bio3D library. I was wondering whether you could provide some help with the following questions.

I would like to superimpose all structures with similar amino acid sequence of pdb 4dii and save them as individual pdbs. Attached is my relevant R script. But I could see the error below no matter whether I was using fit.xyz or pdbfit.

> xyz <- fit.xyz(pdbs$xyz[1,], pdbs,core.inds$xyz, core.inds$xyz, outpath='XXX', full.pdbs=TRUE)
Error in read.pdb(full.files[i], ...) : 
  No input PDB file found: check filename

> pdbfit( pdbs, core.inds, outpath="AlignedPDB")
Error in read.pdb(full.files[i], ...) : 
  No input PDB file found: check filename

Moreover, I'm also curious whether the pdbfit fucntion can return pdb objects instead of the coordinates.

Thanks!

Jiajie

Comments (7)

  1. Xinqiu Yao

    Hi Jiajie,

    Make sure the pdbs$id contains the actual path to your pdb files. If it does not, you may think of using prefix and pdbext arguments in fit.xyz() to specify the paths. For example,

    #Suppose your pdb files are stored under 'pdbs' with file name 'PDBID.pdb'.
    #But your pdbs$id only contains the PDB IDs
    xyz <- fit.xyz(pdbs$xyz[1, ], pdbs, core.inds$xyz, core.inds$xyz, prefix='pdbs/', pdbext='.pdb', outpath='XXX', full.pdbs=TRUE)
    

    The pdbfit() returns only "moved" coordinates. You can read the moved PDB files from disk to generate a new 'pdbs' object or simply loop over files to obtain a list of 'pdb' objects. For example,

    # read moved pdb files to generate a new pdbs
    npdbs <- read.fasta.pdb(pdbs, prefix='XXX', pdbext='_flsq.pdb')
    
    # read every pdb file independently
    files <- list.files('XXX', '.pdb$', full.names=TRUE)
    all.pdb <- lapply(files, read.pdb)
    
  2. Barry Grant

    As Xinqiu notes this is failing because your full original coordinate file names do not match your pdbs$id vector entries. Try the file.exists(pdbs$id) and you will likely see FALSE printed out. Fix this and you should be good to continue.

    For your second question you might also want to try the pdbs2pdb() function.
    Hope this is useful!
    B.

  3. Log in to comment