saxs_single_bead documentation

saxs_single_bead is all Python package to compute small angle X-ray scattering (SAXS) profiles in one-bead-per-residue approximation with numpy

How to install

python3 -m pip install saxs_single_bead

and you’ll be good to go.

Example usage

Obtain approximate SAXS scattering curve for ubiquitin (1ubq) from locations of Cα atoms.

_images/1ubq_cartoon_and_curve.png

Figure 1: a) Cartoon of ubiquitin (1ubq) created by Rogerdodd (2008) CC-BY-SA, b) Approximate SAXS curve computed using saxs_single_bead package.

Package contents

saxs_single_bead.scattering_curve.scattering_curve(residue_codes, residue_locations, minimal_q=0.0, maximal_q=0.5, points=20)

Computes scattering curve from residue_codes and residue_locations N by 3 array.

Parameters
  • residue_codes (list(string)) – List of residues of length N. Can be 3 letter codes (such as “GLY”) or single letter codes (such as “G”)

  • residue_locations (np.array(float)) – Rectangular array with size N by 3 of locations of C_alpha atoms (one per residue)

  • minimal_q (float, optional) – Minimal scattering vector, default 0.0, units: Angstrom^(-1)

  • maximal_q (float, optional) – Maximal scattering vector, default 0.5, units: Angstrom^(-1)

  • points (int, optional) – Number of points int the plot, default 20.

Returns

A tuple of numpy arrays containing values of q and I(q) respectively.

Return type

(np.array(float),np.array(float))

saxs_single_bead.scattering_curve.scattering_curve_ensemble(residue_codes, residue_locations, minimal_q=0.0, maximal_q=0.5, points=20)

Computes average scattering curve from residue_codes and residue_locations M by N by 3 array.

Parameters
  • residue_codes (list(string)) – List of residues of length N. Can be 3 letter codes (such as “GLY”) or single letter codes (such as “G”)

  • residue_locations (np.array(float)) – Rank 3 array with size M by N by 3 of locations of C_alpha atoms (one per residue)

  • minimal_q (float, optional) – Minimal scattering vector, default 0.0, units: Angstrom^(-1)

  • maximal_q (float, optional) – Maximal scattering vector, default 0.5, units: Angstrom^(-1)

  • points (int, optional) – Number of points int the plot, default 20.

Returns

A tuple of numpy arrays containing values of q and I(q) respectively.

Return type

(np.array(float),np.array(float))

saxs_single_bead.scattering_curve.scattering_curve_one_two_blend(residue_codes, residue_model, residue_locations, minimal_q=0.0, maximal_q=0.5, points=20)

Computes scattering curve from residue_codes and residue_locations N by 2 by 3 array.

Parameters
  • residue_codes (list(string)) – List of residues of length N. Can be 3 letter codes (such as “GLY”) or single letter codes (such as “G”) or “BB” for two bead backbone locaitons.

  • residue_model (list(int)) – List describing which model is used 1 for single bead and 2 for two bead.

  • residue_locations (np.array(float)) – Array with shape N by 3 of locations of C_alpha atoms and COE (one per residue).

  • minimal_q (float, optional) – Minimal scattering vector, default 0.0, units: Angstrom^(-1)

  • maximal_q (float, optional) – Maximal scattering vector, default 0.5, units: Angstrom^(-1)

  • points (int, optional) – Number of points int the plot, default 20.

Returns

A tuple of numpy arrays containing values of q and I(q) respectively.

Return type

(np.array(float),np.array(float))

saxs_single_bead.scattering_curve.scattering_curve_one_two_blend_ensemble(residue_codes, residue_model, residue_locations, minimal_q=0.0, maximal_q=0.5, points=20)

Computes average scattering curve from residue_codes and residue_locations M by N by 2 by 3 array.

Parameters
  • residue_codes (list(string)) – List of residues of length N. Can be 3 letter codes (such as “GLY”) or single letter codes (such as “G”) or “BB” for two bead backbone locaitons.

  • residue_model (list(int)) – List describing which model is used 1 for single bead and 2 for two bead.

  • residue_locations (np.array(float)) – Rank 3 array with size M by N by 2 by 3 of locations of C_alpha atoms and COE

  • minimal_q (float, optional) – Minimal scattering vector, default 0.0, units: Angstrom^(-1)

  • maximal_q (float, optional) – Maximal scattering vector, default 0.5, units: Angstrom^(-1)

  • points (int, optional) – Number of points int the plot, default 20.

Returns

A tuple of numpy arrays containing values of q and I(q) respectively.

Return type

(np.array(float),np.array(float))

saxs_single_bead.scattering_curve.scattering_curve_two_bead(residue_codes, residue_locations, minimal_q=0.0, maximal_q=0.5, points=20)

Computes scattering curve from residue_codes and residue_locations N by 2 by 3 array.

Parameters
  • residue_codes (list(string)) – List of residues of length N. Can be 3 letter codes (such as “GLY”) or single letter codes (such as “G”)

  • residue_locations (np.array(float)) – Array with shape N by 2 by 3 of locations of C_alpha atoms and COE (one per residue)

  • minimal_q (float, optional) – Minimal scattering vector, default 0.0, units: Angstrom^(-1)

  • maximal_q (float, optional) – Maximal scattering vector, default 0.5, units: Angstrom^(-1)

  • points (int, optional) – Number of points int the plot, default 20.

Returns

A tuple of numpy arrays containing values of q and I(q) respectively.

Return type

(np.array(float),np.array(float))

saxs_single_bead.scattering_curve.scattering_curve_two_bead_ensemble(residue_codes, residue_locations, minimal_q=0.0, maximal_q=0.5, points=20)

Computes average scattering curve from residue_codes and residue_locations M by N by 2 by 3 array.

Parameters
  • residue_codes (list(string)) – List of residues of length N. Can be 3 letter codes (such as “GLY”) or single letter codes (such as “G”)

  • residue_locations (np.array(float)) – Rank 3 array with size M by N by 2 by 3 of locations of C_alpha atoms and COE

  • minimal_q (float, optional) – Minimal scattering vector, default 0.0, units: Angstrom^(-1)

  • maximal_q (float, optional) – Maximal scattering vector, default 0.5, units: Angstrom^(-1)

  • points (int, optional) – Number of points int the plot, default 20.

Returns

A tuple of numpy arrays containing values of q and I(q) respectively.

Return type

(np.array(float),np.array(float))

saxs_single_bead.replace_bead.replace_bead(conglomerate, conglomerate_attachment_point, locations, sizes, bead_id)

Replace single bead in chain defined by locations by a conglomerte

Parameters
  • conglomarate (np.array) – N by 3 array of locations of beads within the conglomerate

  • conglomerate_attachment_point (np.array or tuple(np.array)) – vector of length 3 describing attachment point of the conglomerate to the chain or tuple of two such attachment points

  • locations (np.array) – M by 3 array of locations of beads in chain

  • sizes (np.array) – vector of length M of sizes of beads in chain

  • bead_id (int) – index of bead to be replaced

Returns

locations of chain with bead replaced with conglomerate

Return type

np.array

saxs_single_bead.read_pdb.read_backbone_and_coe_pdb(filename)

Reads a .pdb file into np.array

Parameters

filename (string) – Path to file to be read

Returns

Numpy array of shape N by 2 by 3 containing locations of backbone centres and COE of sidechain of each residue (in Angstroms)

Return type

np.array

saxs_single_bead.read_pdb.read_c_alpha_pdb(filename)

Reads a .pdb file into np.array

Parameters

filename (string) – Path to file to be read

Returns

Numpy array of shape N by 3 containing locations of C_alpha atoms (in Angstroms)

Return type

np.array

saxs_single_bead.read_pdb.residue_coe(residue_dict)

Determines centre of electrons of a residue described by residue_dict

Parameters

residue_dict (dict(list())) – Dict containing length 4 lists containing atom locations and masses [x,y,z,m]

Returns

Numpy array of length 3 with location of centre of mass

Return type

np.array

saxs_single_bead.form_factors.form_factor(residue_name, q)

Returns linearly interpolated form factor for a given residue_name.

Parameters
  • residue_name (string) – Name of the residue. Either in single letter format or three letter format.

  • q (float) – Scattering vector, units: Angstrom^(-1)

Returns

Form factor value.

Return type

float

saxs_single_bead.form_factors.form_factor_two_bead(residue_name, q)

Returns linearly interpolated form factor for a given residue_name.

Parameters
  • residue_name (string) – Name of the residue. Either in single letter format or three letter format.

  • q (float) – Scattering vector, units: Angstrom^(-1)

Returns

Form factor value.

Return type

float

Algorithm concept

Dudu Tong, Sichun Yang, Lanyuan Lu Accurate optimization of amino acid form factors for computing small-angle X-ray scattering intensity of atomistic protein structures; J Appl Crystalogr (2016)