Hi Elaine,

I am trying to omit densities in a scripted fashion using this function:

def mask_density_around_nth_residues(session, nth, model_id, model_name, volume_id, resolution, output_dir, radius):
print("Masking density around every {}th residue".format(nth))
for model in session.models.list(type=Model):
residues = [residue for i, residue in enumerate(model.residues, start=1) if i % nth == 0]
residue_spec = " ".join(["#{}:{}.{}".format(model_id, residue.number, residue.chain_id) for residue in residues])
print("Selecting residues:", residue_spec)
rc(session, "select {}".format(residue_spec))
print("Masking density around selected residues with radius:", radius)
rc(session, "volume #{} mask sel {} invert true".format(volume_id, radius))
output_filename = os.path.join(output_dir, "{}_masked_density_res_{}_nth_{}.mrc".format(model_name, resolution, nth))
volumes = session.models.list(type=Volume)
volume_id_omit = volumes[-1].id
print("Saving masked density map:", output_filename)
rc(session, "volume #{} save {}".format(volume_id_omit, output_filename))


But I am getting these errors:

Summary of feedback from opening
/home/fjansen/data/structures/PDB/7K00_notrna.pdb  
---  
_warnings_ | Duplicate atom serial number found: 99999  
Duplicate atom serial number found: 99999  
Duplicate atom serial number found: 99999  
Duplicate atom serial number found: 99999  
Duplicate atom serial number found: 99999  
46100 messages similar to the above omitted  
 

INFO:
Chain information for 7K00_notrna.pdb #1  
---  
Chain | Description  
[0](cxcmd:select /0:4-54 "Select chain") | [No description
available](cxcmd:sequence chain #1/0 "Show sequence")  
[1](cxcmd:select /1:1-46 "Select chain") | [No description

I am only getting these errors with PDB files I adapted in Chimera and then saved using the save command. I will try and perform the same operations and saving the output as PDB in ChimeraX.

Thank you.

Best,
Flip



On Tue, May 7, 2024 at 11:37 AM Elaine Meng <meng@cgl.ucsf.edu> wrote:
Hi Flip,

If you save a PDB file from ChimeraX it will save the current helix and strand assignments of the protein and peptide residues (as HELIX and SHEET records).  I'm not sure if that is what you were saying is missing, or how you determined that they were missing.  It does not save, however, helix type or which sheets the strands belong to.

Elaine

> On May 7, 2024, at 11:29 AM, Flip Jansen <f.bastiaanjansen@gmail.com> wrote:
>
> Hi Elaine,
>
> Thank you that is very clear!
>
> As for the second point, I meant preserving secondary structure information when saving an adapted PDB file in Chimera. I am now planning on using PyMOL for this purpose.
>
> Thanks again for your help!
>
> Best,
> Flip
>
> On Mon, May 6, 2024 at 11:56 AM Elaine Meng <meng@cgl.ucsf.edu> wrote:
> Hello Flip,
> (1) we would generally recommend using ChimeraX over Chimera for many reasons: performance, enhanced features, current development and support.  The rest of this answer applies to ChimeraX so I'm putting it on the chimerax-users list.
>
> (2) you can create a blank cubic grid first with "volume new" and then refer to that in the "molmap" command "onGrid" option.
> <https://rbvi.ucsf.edu/chimerax/docs/user/commands/volume.html#new>
> <https://rbvi.ucsf.edu/chimerax/docs/user/commands/molmap.html>
>
> (3) I do not understand what you mean by losing secondary structure information when saving a map.  Only atomic structures (not maps) have secondary structure information, i.e. helix and strand assignments.  Can you clarify?
>
> I hope this helps,
> Elaine
> -----
> Elaine C. Meng, Ph.D.
> UCSF Chimera(X) team
> Department of Pharmaceutical Chemistry
> University of California, San Francisco
>
> > On May 6, 2024, at 10:40 AM, Flip Jansen via Chimera-users <chimera-users@cgl.ucsf.edu> wrote:
> >
> > Hello Chimera dev team,
> >
> > I am a junior specialist from across the hall working at the Fraser Lab and I have some questions about using chimera scripting for omitting densities and generating reference maps.
> >
> > One of the issues I have been having has been that using the molMap function in Chimera generates a non-cubic output and I am aware that I can use onGrid with a pre-existing map with the desired dimensions. However, in the workflow, I am setting up I do not yet have a reference map and I am in most scenarios starting with just a PDB or an adapted from PDB map.
> >
> > Is there a way to let Chimera(X) generate a cubic output map from PDB without requiring another map from an external program like cryoSPARC?
> >
> > Another question I have is regarding the loss of secondary structural information when saving a map in Chimera. Is there a way to save a map while maintaining that information?
> >
> > Any help is highly appreciated, I would also be happy to come by an talk in person.
> >
> > Best,
> > Flip Jansen
>