Large cif to pdb conversion

Issue #785 new
Mihaly Badonyi created an issue

Hi bio3d team,

I would like to know what the proper way is to save a large cif file as pdb. Below is a code I scripted to read in pdb/cif files in a job array.

require(bio3d); 

args <- commandArgs() # pass command line variables to R

pdb_id <- args[6]

options(download.file.method = "libcurl")

pdb <- tryCatch({
  read.pdb(get.pdb(pdb_id, URL = TRUE, overwrite = TRUE))
}, warning = function(w) {
  read.cif(bio3d::get.pdb(pdb_id, URL = TRUE, format = 'cif', overwrite = TRUE), maxlines = 1e7)
}) # .pdb or, if not available, .mmCIF

# clean
pdb <- clean.pdb(pdb = pdb, fix.aa = TRUE, rm.wat = TRUE, rm.lig = TRUE)

# keep only protein atoms
pdb <- trim.pdb(pdb, atom.select(pdb, 'protein'))

# write out file
write.pdb(pdb, paste0(pdb_id, '.pdb'), chainter = TRUE)

# END

I tested this with pdb: 4u50, and PyMol could not graphically display the result anymore (jumbled up coordinates).

I could post session info, but I'm pretty sure this isn't a bug but a methodological error. I do have a python script that can efficiently convert cif to pdb, but I would like to do everything within the same R pipeline.

I appreciate your help with this.

Comments (1)

  1. Barry Grant

    Can you write a more minimal reproducible example that leads to an error or other problem please. Otherwise it is hard for us to help with this. Thanks!

  2. Log in to comment