Dear CCP4,

Thanks for the answers — now I could to do map masking using Gemmi. It is worth 
to post the Python script in case someone else would need it too:


import gemmi

mtz = gemmi.read_mtz_file(‘map.mtz’)
m = gemmi.Ccp4Map()
m.grid = mtz.transform_f_phi_to_map(‘2FOFCWT’,’PH2FOFCWT’,sample_rate=3)
m.update_ccp4_header()
ligand = gemmi.read_structure(‘ligand.pdb’)
m.set_extent(ligand.calculate_fractional_box(margin=3))
m.write_ccp4_map(‘masked.ccp4’)



-- 

Evgenii Osipov

Laboratory for Biocrystallography,
Department of Pharmaceutical Sciences,
KU Leuven O&N2

mobile: +32 484 38 26 01

> On 5 Aug 2022, at 11:30, Evgenii Osipov <e.m.osi...@gmail.com> wrote:
> 
> Dear CCP4 community,
> 
> I am looking for a way to cut a fragment of electron density around specified 
> set of atoms using Python script. In CCP4 I found MAPMASK, which could cut 
> fragment of electron density within specified region around input PDB:
> #!/bin/bash -f
> 
> $CCP4/bin/mapmask \
> MAPIN tmp.map \
> MAPOUT masked.map \
> XYZIN ligand.pdb \
> << 
> eor
> BORDER 3
> eor
> 
>  Of course I could call this shell script from Python script using 
> subprocess, but it looks like unnecessary overcomplication.
>  
> I wonder if the same task could be completed by Python script using either 
> CCTBX or Gemmi. May be someone had this problem in the past and could share 
> their example?
> 
> 
> 
> Kind regards,
> 
> -- 
> 
> Evgenii Osipov
> 
> Laboratory for Biocrystallography,
> Department of Pharmaceutical Sciences,
> KU Leuven O&N2
> 
> mobile: +32 484 38 26 01
> 


########################################################################

To unsubscribe from the CCP4BB list, click the following link:
https://www.jiscmail.ac.uk/cgi-bin/WA-JISC.exe?SUBED1=CCP4BB&A=1

This message was issued to members of www.jiscmail.ac.uk/CCP4BB, a mailing list 
hosted by www.jiscmail.ac.uk, terms & conditions are available at 
https://www.jiscmail.ac.uk/policyandsecurity/

Reply via email to