code string | signature string | docstring string | loss_without_docstring float64 | loss_with_docstring float64 | factor float64 |
|---|---|---|---|---|---|
if hasattr(self, 'halloffame'):
model = self._params['specification'](
*self.parse_individual(self.halloffame[0]))
model.pack_new_sequences(self._params['sequence'])
return model
else:
raise NameError('No best model found, have you... | def best_model(self) | Rebuilds the top scoring model from an optimisation.
Returns
-------
model: AMPAL
Returns an AMPAL model of the top scoring parameters.
Raises
------
NameError:
Raises a name error if the optimiser has not been run. | 11.093191 | 8.589879 | 1.291426 |
if not self.parameter_log:
raise AttributeError(
'No parameter log data to make funnel, have you ran the '
'optimiser?')
model_cls = self._params['specification']
gen_tagged = []
for gen, models in enumerate(self.parameter_log):
... | def make_energy_funnel_data(self, cores=1) | Compares models created during the minimisation to the best model.
Returns
-------
energy_rmsd_gen: [(float, float, int)]
A list of triples containing the BUFF score, RMSD to the
top model and generation of a model generated during the
minimisation. | 3.769364 | 3.315007 | 1.137061 |
param_score_gen, top_result_model, specification = psg_trm_spec
params, score, gen = param_score_gen
model = specification(*params)
rmsd = top_result_model.rmsd(model)
return rmsd, score, gen | def funnel_rebuild(psg_trm_spec) | Rebuilds a model and compares it to a reference model.
Parameters
----------
psg_trm: (([float], float, int), AMPAL, specification)
A tuple containing the parameters, score and generation for a
model as well as a model of the best scoring parameters.
Returns
... | 8.989049 | 6.98423 | 1.287049 |
self.toolbox.register("individual", self.generate)
self.toolbox.register("population", tools.initRepeat,
list, self.toolbox.individual)
self.population = self.toolbox.population(n=self._params['popsize'])
if self._params['neighbours']:
f... | def initialize_pop(self) | Assigns indices to individuals in population. | 2.488987 | 2.367601 | 1.051269 |
candidates = []
for ind in self.population:
candidates.append(self.crossover(ind))
self._params['model_count'] += len(candidates)
self.assign_fitnesses(candidates)
for i in range(len(self.population)):
if candidates[i].fitness > self.population[i]... | def update_pop(self) | Updates the population according to crossover and fitness criteria. | 3.674508 | 3.241356 | 1.133633 |
self.population = self.toolbox.swarm(n=self._params['popsize'])
if self._params['neighbours']:
for i in range(len(self.population)):
self.population[i].ident = i
self.population[i].neighbours = list(
set(
[(... | def initialize_pop(self) | Generates initial population with random positions and speeds. | 2.692334 | 2.63112 | 1.023265 |
part = creator.Particle(
[random.uniform(-1, 1)
for _ in range(len(self._params['value_means']))])
part.speed = [
random.uniform(-self._params['max_speed'],
self._params['max_speed'])
for _ in range(len(self._params['va... | def generate(self) | Generates a particle using the creator function.
Notes
-----
Position and speed are uniformly randomly seeded within
allowed bounds. The particle also has speed limit settings
taken from global values.
Returns
-------
particle object | 3.884501 | 3.728336 | 1.041886 |
valid_particles = []
invalid_particles = []
for part in self.population:
if any(x > 1 or x < -1 for x in part):
invalid_particles.append(part)
else:
valid_particles.append(part)
self._params['model_count'] += len(valid_part... | def update_pop(self) | Assigns fitnesses to particles that are within bounds. | 2.917053 | 2.646714 | 1.102141 |
self.toolbox.register("individual", self.generate)
self.toolbox.register("population", tools.initRepeat,
list, self.toolbox.individual)
self.population = self.toolbox.population(n=self._params['popsize'])
self.assign_fitnesses(self.population)
... | def initialize_pop(self) | Assigns initial fitnesses. | 3.213952 | 2.884921 | 1.114052 |
self.initialize_cma_es(
sigma=self._params['sigma'], weights=self._params['weights'],
lambda_=self._params['popsize'],
centroid=[0] * len(self._params['value_means']))
self.toolbox.register("individual", self.make_individual)
self.toolbox.register("ge... | def initialize_pop(self) | Generates the initial population and assigns fitnesses. | 3.910517 | 3.773407 | 1.036336 |
ind = creator.Individual(
[random.uniform(-1, 1)
for _ in range(len(self._params['value_means']))])
return ind | def initial_individual(self) | Generates an individual with random parameters within bounds. | 7.784945 | 7.1477 | 1.089154 |
self.params = kwargs
# Create a centroid as a numpy array
self.centroid = numpy.array([0] * len(self._params['value_means']))
self.dim = len(self.centroid)
self.sigma = self.params.get("sigma", 0.5)
self.pc = numpy.zeros(self.dim)
self.ps = numpy.zeros(... | def initialize_cma_es(self, **kwargs) | A strategy that will keep track of the basic parameters.
Notes
-----
+------------+---------------------------+----------------------------+
| Parameter | Default | Details |
+============+===========================+========================... | 3.505049 | 3.226663 | 1.086277 |
population.sort(key=lambda ind: ind.fitness, reverse=True)
old_centroid = self.centroid
self.centroid = numpy.dot(self.weights, population[0:self.mu])
c_diff = self.centroid - old_centroid
# Cumulation : update evolution path
self.ps = (1 - self.cs) * self.ps ... | def update(self, population) | Update the covariance matrix strategy from the *population*.
Parameters
----------
population:
A list of individuals from which to update the
parameters. | 3.311198 | 3.322241 | 0.996676 |
self.mu = params.get("mu", int(self.lambda_ / 2))
rweights = params.get("weights", "superlinear")
if rweights == "superlinear":
self.weights = numpy.log(self.mu + 0.5) - \
numpy.log(numpy.arange(1, self.mu + 1))
elif rweights == "linear":
... | def computeParams(self, params) | Computes the parameters depending on :math:`\lambda`.
Notes
-----
It needs to be called again if :math:`\lambda` changes during
evolution.
Parameters
----------
params:
A dictionary of the manually set parameters. | 2.622003 | 2.593117 | 1.011139 |
if self.parameter_type is MMCParameterType.UNIFORM_DIST:
(a, b) = self.static_dist_or_list
self.proposed_value = random.uniform(a, b)
elif self.parameter_type is MMCParameterType.NORMAL_DIST:
(mu, sigma) = self.static_dist_or_list
self.proposed_va... | def randomise_proposed_value(self) | Creates a randomly the proposed value.
Raises
------
TypeError
Raised if this method is called on a static value.
TypeError
Raised if the parameter type is unknown. | 2.418094 | 2.340308 | 1.033237 |
if self.proposed_value is not None:
self.current_value = self.proposed_value
self.proposed_value = None
return | def accept_proposed_value(self) | Changes the current value to the proposed value. | 2.746799 | 2.090699 | 1.313818 |
self._generate_initial_model()
self._mmc_loop(rounds, temp=temp)
return | def start_optimisation(self, rounds, temp=298.15) | Begin the optimisation run.
Parameters
----------
rounds : int
The number of rounds of optimisation to perform.
temp : float, optional
The temperature (in K) used during the optimisation. | 11.588176 | 18.524538 | 0.625558 |
initial_parameters = [p.current_value for p in self.current_parameters]
try:
initial_model = self.specification(*initial_parameters)
except TypeError:
raise TypeError(
'Failed to build initial model. Make sure that the input '
'par... | def _generate_initial_model(self) | Creates the initial model for the optimistation.
Raises
------
TypeError
Raised if the model failed to build. This could be due to
parameters being passed to the specification in the wrong
format. | 4.144472 | 4.219576 | 0.982201 |
# TODO add weighted randomisation of altered variable
current_round = 0
while current_round < rounds:
modifiable = list(filter(
lambda p: p.parameter_type is not MMCParameterType.STATIC_VALUE,
self.current_parameters))
chosen_param... | def _mmc_loop(self, rounds, temp=298.15, verbose=True) | The main MMC loop.
Parameters
----------
rounds : int
The number of rounds of optimisation to perform.
temp : float, optional
The temperature (in K) used during the optimisation.
verbose : bool, optional
If true, prints information about the r... | 3.199182 | 3.214956 | 0.995094 |
self.toolbox.register("individual", self._generate)
self.toolbox.register("population", tools.initRepeat,
list, self.toolbox.individual)
self.population = self.toolbox.population(n=pop_size)
if self.neighbours:
for i in range(len(self.po... | def _initialize_pop(self, pop_size) | Assigns indices to individuals in population. | 2.476156 | 2.37626 | 1.042039 |
if self.neighbours:
a, b, c = random.sample([self.population[i]
for i in ind.neighbours], 3)
else:
a, b, c = random.sample(self.population, 3)
y = self.toolbox.clone(a)
y.ident = ind.ident
y.neighbours = ind.ne... | def _crossover(self, ind) | Used by the evolution process to generate a new individual.
Notes
-----
This is a tweaked version of the classical DE crossover
algorithm, the main difference that candidate parameters are
generated using a lognormal distribution. Bound handling is
achieved by resampling... | 3.134709 | 3.118249 | 1.005279 |
candidates = []
for ind in self.population:
candidates.append(self._crossover(ind))
self._model_count += len(candidates)
self.assign_fitnesses(candidates)
for i in range(len(self.population)):
if candidates[i].fitness > self.population[i].fitness:... | def _update_pop(self, pop_size) | Updates population according to crossover and fitness criteria. | 3.630518 | 3.270319 | 1.110142 |
part = creator.Particle(
[random.uniform(-1, 1)
for _ in range(len(self.value_means))])
part.speed = [
random.uniform(-self.max_speed, self.max_speed)
for _ in range(len(self.value_means))]
part.smin = -self.max_speed
part.smax = ... | def _generate(self) | Generates a particle using the creator function.
Notes
-----
Position and speed are uniformly randomly seeded within
allowed bounds. The particle also has speed limit settings
taken from global values.
Returns
-------
part : particle object
A... | 4.267082 | 3.658767 | 1.166263 |
neighbour_pool = [self.population[i] for i in part.neighbours]
best_neighbour = max(neighbour_pool, key=lambda x: x.best.fitness)
ce1 = (c * random.uniform(0, 1) for _ in range(len(part)))
ce2 = (c * random.uniform(0, 1) for _ in range(len(part)))
ce1_p = map(operator.mu... | def update_particle(self, part, chi=0.729843788, c=2.05) | Constriction factor update particle method.
Notes
-----
Looks for a list of neighbours attached to a particle and
uses the particle's best position and that of the best
neighbour. | 2.411435 | 2.419803 | 0.996542 |
valid_particles = []
invalid_particles = []
for part in self.population:
if any(x > 1 or x < -1 for x in part):
invalid_particles.append(part)
else:
valid_particles.append(part)
self._model_count += len(valid_particles)
... | def _update_pop(self, pop_size) | Assigns fitnesses to particles that are within bounds. | 3.095229 | 2.812405 | 1.100563 |
self.toolbox.register("individual", self._generate)
self.toolbox.register("population", tools.initRepeat,
list, self.toolbox.individual)
self.population = self.toolbox.population(n=pop_size)
self.assign_fitnesses(self.population)
self._model... | def _initialize_pop(self, pop_size) | Assigns indices to individuals in population. | 3.018528 | 2.863461 | 1.054154 |
offspring = list(map(self.toolbox.clone, self.population))
for _ in range(pop_size // 2):
if random.random() < self.cxpb:
child1, child2 = self.toolbox.select(self.population, 2, 6)
temp1 = self.toolbox.clone(child1)
temp2 = self.toolb... | def _update_pop(self, pop_size) | Updates population according to crossover and fitness criteria. | 2.314765 | 2.260952 | 1.023801 |
self.initialize_cma_es(pop_size)
self.toolbox.register("individual", self._make_individual)
self.toolbox.register("generate", self._generate,
self.toolbox.individual)
self.toolbox.register("population", tools.initRepeat,
... | def _initialize_pop(self, pop_size) | Generates the initial population and assigns fitnesses. | 3.315161 | 3.152151 | 1.051714 |
ind = creator.Individual(
[random.uniform(-1, 1)
for _ in range(len(self.value_means))])
return ind | def _initial_individual(self) | Generates an individual with random parameters within bounds. | 6.482435 | 5.922239 | 1.094592 |
self.toolbox.generate()
# simple bound checking
for i in range(len(self.population)):
for j in range(len(self.population[i])):
if self.population[i][j] > 1:
self.population[i][j] = 1
if self.population[i][j] < -1:
... | def _update_pop(self, pop_size) | Updates population according to crossover and fitness criteria. | 2.862669 | 2.724624 | 1.050666 |
part = creator.Individual(paramlist)
part.ident = None
return part | def _make_individual(self, paramlist) | Makes an individual particle. | 15.66746 | 11.351981 | 1.380152 |
# Create a centroid as a numpy array
self.centroid = numpy.array([0] * len(self.value_means))
self.dim = len(self.centroid)
self.pc = numpy.zeros(self.dim)
self.ps = numpy.zeros(self.dim)
self.chiN = numpy.sqrt(self.dim) * (
1 - 1. / (4. * self.dim) ... | def initialize_cma_es(self, lambda_) | A strategy that will keep track of the basic parameters.
Parameters
----------
centroid:
An iterable object that indicates where to start the
evolution.
parameter:
One or more parameter to pass to the strategy as
described in the following... | 3.345664 | 3.431313 | 0.975039 |
arz = numpy.random.standard_normal((self.lambda_, self.dim))
arz = self.centroid + self.sigma * numpy.dot(arz, self.BD.T)
self.population = list(map(func, arz))
return | def _generate(self, func) | Generate a population of :math:`\lambda` individuals.
Notes
-----
Individuals are of type *ind_init* from the current strategy.
Parameters
----------
ind_init:
A function object that is able to initialize an
individual from a list. | 7.756819 | 5.989724 | 1.295021 |
# If num_mmols is already known, return it
if mmols_numbers:
if code in mmols_numbers.keys():
mmol = mmols_numbers[code][0]
return mmol
counter = 1
while True:
pdbe_url = "http://www.ebi.ac.uk/pdbe/static/entry/download/{0}-assembly-{1}.cif.gz".format(code, c... | def number_of_mmols(code) | Number of .mmol files associated with code in the PDBE.
Notes
-----
This function makes a series of calls to the PDBE website using the requests module. This can make it slow!
Parameters
----------
code : str
PDB code.
Returns
-------
num_mmols : int
Raises
------... | 2.457755 | 2.374889 | 1.034892 |
if not mmol_number:
try:
mmol_number = preferred_mmol(code=code)
except (ValueError, TypeError, IOError):
print("No mmols for {0}".format(code))
return None
# sanity check
if mmols_numbers:
if code in mmols_numbers.keys():
num_mmol... | def get_mmol(code, mmol_number=None, outfile=None) | Get mmol file from PDBe and return its content as a string. Write to file if outfile given.
Parameters
----------
code : str
PDB code.
mmol_number : int
mmol number (biological assembly number) of file to download. Numbers from PDBe.
If None, defaults to the preferred biological... | 2.479831 | 2.272617 | 1.091178 |
pdbe_url = "http://www.ebi.ac.uk/pdbe/static/entry/download/{0}-assembly-{1}.cif.gz".format(code, mmol_number)
r = requests.get(pdbe_url)
if r.status_code == 200:
temp_gz = tempfile.NamedTemporaryFile()
temp_gz.write(r.content)
with gzip.open(temp_gz.name, 'rb') as foo:
... | def get_cif(code, mmol_number, outfile=None) | Parameters
----------
code : str
PDB code.
mmol_number : int
mmol number (biological assembly number) of file to download. Numbers from PDBe.
If None, defaults to the preferred biological assembly listed for code on the PDBe.
outfile : str
Filepath. Writes returned value ... | 2.297446 | 2.092736 | 1.097819 |
pdbe_url = "http://www.ebi.ac.uk/pdbe/entry-files/download/{0}.cif".format(code)
r = requests.get(pdbe_url)
if r.status_code == 200:
mmcif_string = r.text
else:
print("Could not download mmcif file for {0}".format(code))
mmcif_string = None
# Write to file.
if outfi... | def get_mmcif(code, outfile=None) | Get mmcif file associated with code from PDBE.
Parameters
----------
code : str
PDB code.
outfile : str
Filepath. Writes returned value to this file.
Returns
-------
mmcif_file : str
Filepath to the mmcif file. | 2.132224 | 2.156802 | 0.988604 |
url = 'http://www.ebi.ac.uk/pdbe/entry-files/download/{0}_1.mmol'.format(code)
r = requests.head(url=url)
return r.status_code | def pdbe_status_code(code) | Check if a PDB code has structure files on the PDBE site.
Parameters
----------
code : str
PDB code to check for on PDBE.
Returns
-------
status_code : int
HTTP status code of PDBE url associated with input code. | 4.803042 | 4.32499 | 1.110532 |
# If preferred mmol number is already known, return it
if code in mmols_numbers.keys():
mmol = mmols_numbers[code][1]
return mmol
elif is_obsolete(code):
raise ValueError('Obsolete PDB code {0}'.format(code))
# Otherwise, use requests to scrape the PDBE.
else:
ur... | def preferred_mmol(code) | Get mmol number of preferred biological assembly as listed in the PDBe.
Notes
-----
First checks for code in mmols.json.
If code not yet in this json dictionary, uses requests module to scrape the PDBE for the preferred mmol number.
Parameters
----------
code : str
A PDB code.
... | 4.04275 | 3.553348 | 1.13773 |
url = 'http://www.rcsb.org/pdb/rest/getCurrent'
r = requests.get(url)
if r.status_code == 200:
pdb_codes = [x.lower() for x in r.text.split('"') if len(x) == 4]
else:
print('Request for {0} failed with status code {1}'.format(url, r.status_code))
return
return pdb_codes | def current_codes_from_pdb() | Get list of all PDB codes currently listed in the PDB.
Returns
-------
pdb_codes : list(str)
List of PDB codes (in lower case). | 2.54914 | 2.544302 | 1.001901 |
if not data_dir:
data_dir = global_settings["structural_database"]["path"]
p = Path(data_dir)
pdb_parent_dirs = [x for x in p.iterdir() if x.is_dir() and len(x.parts[-1]) == 2]
pdb_folders = [x for test in pdb_parent_dirs for x in test.iterdir() if x.is_dir()]
pdb_code_list = [x.parts[-... | def local_pdb_codes(data_dir=None) | Get list of PDB codes stored in a folder (FileSystem folder hierarchy expected within data_dir).
If no folder is specified, use the database_dir defined in settings.json.
Parameters
----------
data_dir: str
Filepath to a folder containing the PDB folder hierarchy (eg data_dir/eb/2ebo)
Ret... | 2.634989 | 2.605406 | 1.011354 |
fs = FileSystem(code=code)
if os.path.exists(fs.parent_dir):
# Move to obsolete folder
destination_dir = os.path.join(fs._data_dir, 'obsolete', code[1:3], code)
if os.path.exists(destination_dir):
shutil.rmtree(destination_dir)
shutil.move(fs.parent_dir, destinat... | def make_code_obsolete(code) | Moves folders associated with PDB code to obsolete folder in global_settings["database_dir"]
Parameters
----------
code : str
PDB accession code
Returns
-------
None | 3.571172 | 3.570239 | 1.000261 |
mmols_dict = {}
mmol_dir = os.path.join(self.parent_dir, 'structures')
if not os.path.exists(mmol_dir):
os.makedirs(mmol_dir)
mmol_file_names = ['{0}_{1}.mmol'.format(self.code, i) for i in range(1, self.number_of_mmols + 1)]
mmol_files = [os.path.join(mmol_d... | def mmols(self) | Dict of filepaths for all mmol files associated with code.
Notes
-----
Downloads mmol files if not already present.
Returns
-------
mmols_dict : dict, or None.
Keys : int
mmol number
Values : str
Filepath for the c... | 2.299774 | 2.107107 | 1.091437 |
dssps_dict = {}
dssp_dir = os.path.join(self.parent_dir, 'dssp')
if not os.path.exists(dssp_dir):
os.makedirs(dssp_dir)
for i, mmol_file in self.mmols.items():
dssp_file_name = '{0}.dssp'.format(os.path.basename(mmol_file))
dssp_file = os.path... | def dssps(self) | Dict of filepaths for all dssp files associated with code.
Notes
-----
Runs dssp and stores writes output to files if not already present.
Also downloads mmol files if not already present.
Calls isambard.external_programs.dssp and so needs dssp to be installed.
Returns
... | 2.252149 | 2.089138 | 1.078028 |
fastas_dict = {}
fasta_dir = os.path.join(self.parent_dir, 'fasta')
if not os.path.exists(fasta_dir):
os.makedirs(fasta_dir)
for i, mmol_file in self.mmols.items():
mmol_name = os.path.basename(mmol_file)
fasta_file_name = '{0}.fasta'.format(m... | def fastas(self, download=False) | Dict of filepaths for all fasta files associated with code.
Parameters
----------
download : bool
If True, downloads the fasta file from the PDB.
If False, uses the ampal Protein.fasta property
Defaults to False - this is definitely the recommended behaviour.... | 2.601358 | 2.297699 | 1.132158 |
mmcif_dir = os.path.join(self.parent_dir, 'mmcif')
if not os.path.exists(mmcif_dir):
os.makedirs(mmcif_dir)
mmcif_file_name = '{0}.cif'.format(self.code)
mmcif_file = os.path.join(mmcif_dir, mmcif_file_name)
if not os.path.exists(mmcif_file):
get_... | def mmcif(self) | Filepath for mmcif file associated with code.
Notes
-----
Downloads mmcif file if not already present.
Returns
-------
mmcif_file : str
Filepath for the mmcif file. | 1.850072 | 1.784045 | 1.03701 |
category_dict = {}
for ligand in self:
if ligand.category in category_dict:
category_dict[ligand.category].append(ligand)
else:
category_dict[ligand.category] = [ligand]
return category_dict | def categories(self) | Returns the categories of `Ligands` in `LigandGroup`. | 2.321699 | 1.66427 | 1.395025 |
category_dict = self.categories
count_dict = {category: len(
category_dict[category]) for category in category_dict}
return count_dict | def category_count(self) | Returns the number of categories in `categories`. | 3.914068 | 3.388343 | 1.155157 |
if 'X' in seq:
warnings.warn(_nc_warning_str, NoncanonicalWarning)
return sum(
[residue_mwt[aa] * n for aa, n in Counter(seq).items()]) + water_mass | def sequence_molecular_weight(seq) | Returns the molecular weight of the polypeptide sequence.
Notes
-----
Units = Daltons
Parameters
----------
seq : str
Sequence of amino acids. | 10.834332 | 14.069219 | 0.770074 |
if 'X' in seq:
warnings.warn(_nc_warning_str, NoncanonicalWarning)
return sum([residue_ext_280[aa] * n for aa, n in Counter(seq).items()]) | def sequence_molar_extinction_280(seq) | Returns the molar extinction coefficient of the sequence at 280 nm.
Notes
-----
Units = M/cm
Parameters
----------
seq : str
Sequence of amino acids. | 11.362379 | 12.762668 | 0.890282 |
difference = pH - residue_pka[aa]
if residue_charge[aa] > 0:
difference *= -1
ratio = (10 ** difference) / (1 + 10 ** difference)
return ratio | def partial_charge(aa, pH) | Calculates the partial charge of the amino acid.
Parameters
----------
aa : str
Amino acid single-letter code.
pH : float
pH of interest. | 4.720969 | 7.934909 | 0.594962 |
if 'X' in seq:
warnings.warn(_nc_warning_str, NoncanonicalWarning)
adj_protein_charge = sum(
[partial_charge(aa, pH) * residue_charge[aa] * n
for aa, n in Counter(seq).items()])
adj_protein_charge += (
partial_charge('N-term', pH) * residue_charge['N-term'])
adj_pro... | def sequence_charge(seq, pH=7.4) | Calculates the total charge of the input polypeptide sequence.
Parameters
----------
seq : str
Sequence of amino acids.
pH : float
pH of interest. | 4.04179 | 4.409315 | 0.916648 |
if 'X' in seq:
warnings.warn(_nc_warning_str, NoncanonicalWarning)
ph_range = numpy.arange(1, 13, granularity)
charge_at_ph = [sequence_charge(seq, ph) for ph in ph_range]
return ph_range, charge_at_ph | def charge_series(seq, granularity=0.1) | Calculates the charge for pH 1-13.
Parameters
----------
seq : str
Sequence of amino acids.
granularity : float, optional
Granularity of pH values i.e. if 0.1 pH = [1.0, 1.1, 1.2...] | 6.59103 | 6.471999 | 1.018392 |
if 'X' in seq:
warnings.warn(_nc_warning_str, NoncanonicalWarning)
ph_range, charge_at_ph = charge_series(seq, granularity)
abs_charge_at_ph = [abs(ch) for ch in charge_at_ph]
pi_index = min(enumerate(abs_charge_at_ph), key=lambda x: x[1])[0]
return ph_range[pi_index] | def sequence_isoelectric_point(seq, granularity=0.1) | Calculates the isoelectric point of the sequence for ph 1-13.
Parameters
----------
seq : str
Sequence of amino acids.
granularity : float, optional
Granularity of pH values i.e. if 0.1 pH = [1.0, 1.1, 1.2...] | 5.189455 | 5.743831 | 0.903483 |
chi_angles = []
aa = residue.mol_code
if aa not in side_chain_dihedrals:
if verbose:
print("Amino acid {} has no known side-chain dihedral".format(aa))
else:
for set_atoms in side_chain_dihedrals[aa]:
required_for_dihedral = set_atoms[0:4]
try:
... | def measure_sidechain_torsion_angles(residue, verbose=True) | Calculates sidechain dihedral angles for a residue
Parameters
----------
residue : [ampal.Residue]
`Residue` object.
verbose : bool, optional
If `true`, tells you when a residue does not have any known
dihedral angles to measure.
Returns
-------
chi_angles: [float]
... | 2.833694 | 2.806119 | 1.009827 |
if len(residues) < 2:
torsion_angles = [(None, None, None)] * len(residues)
else:
torsion_angles = []
for i in range(len(residues)):
if i == 0:
res1 = residues[i]
res2 = residues[i + 1]
omega = None
phi = No... | def measure_torsion_angles(residues) | Calculates the dihedral angles for a list of backbone atoms.
Parameters
----------
residues : [ampal.Residue]
List of `Residue` objects.
Returns
-------
torsion_angles : (float, float, float)
One triple for each residue, containing torsion angles in
the range [-pi, pi].... | 1.396373 | 1.369015 | 1.019983 |
rloc = numpy.sin(numpy.pi / oligo) * radius
alpha = numpy.arctan((2 * numpy.pi * radius) / pitch)
alphaloc = numpy.cos((numpy.pi / 2) - ((numpy.pi) / oligo)) * alpha
pitchloc = (2 * numpy.pi * rloc) / numpy.tan(alphaloc)
return pitchloc, rloc, numpy.rad2deg(alphaloc) | def cc_to_local_params(pitch, radius, oligo) | Returns local parameters for an oligomeric assembly.
Parameters
----------
pitch : float
Pitch of assembly
radius : float
Radius of assembly
oligo : int
Oligomeric state of assembly
Returns
-------
pitchloc : float
Local pitch of assembly (between 2 adja... | 3.690651 | 3.028298 | 1.218721 |
cas = p.get_reference_coords()
prim_cas = p.primitive.coordinates
dhs = [abs(dihedral(cas[i], prim_cas[i], prim_cas[i + 1], cas[i + 1]))
for i in range(len(prim_cas) - 1)]
rpts = [360.0 / dh for dh in dhs]
rpts.append(None)
return rpts | def residues_per_turn(p) | The number of residues per turn at each Monomer in the Polymer.
Notes
-----
Each element of the returned list is the number of residues
per turn, at a point on the Polymer primitive. Calculated using
the relative positions of the CA atoms and the primitive of the
Polymer. Element i is the calcu... | 4.905966 | 3.304965 | 1.484423 |
if not len(p) == len(reference_axis):
raise ValueError(
"The reference axis must contain the same number of points "
"as the Polymer primitive.")
prim_cas = p.primitive.coordinates
ref_points = reference_axis.coordinates
distances = [distance(prim_cas[i], ref_points[... | def polymer_to_reference_axis_distances(p, reference_axis, tag=True, reference_axis_name='ref_axis') | Returns distances between the primitive of a Polymer and a reference_axis.
Notes
-----
Distances are calculated between each point of the Polymer primitive
and the corresponding point in reference_axis. In the special case
of the helical barrel, if the Polymer is a helix and the reference_axis
... | 3.083026 | 2.887089 | 1.067867 |
if not len(p) == len(reference_axis):
raise ValueError(
"The reference axis must contain the same number of points"
" as the Polymer primitive.")
prim_cas = p.primitive.coordinates
p_cas = p.get_reference_coords()
ref_points = reference_axis.coordinates
cr_angles... | def crick_angles(p, reference_axis, tag=True, reference_axis_name='ref_axis') | Returns the Crick angle for each CA atom in the `Polymer`.
Notes
-----
The final value is in the returned list is `None`, since the angle
calculation requires pairs of points on both the primitive and
reference_axis.
Parameters
----------
p : ampal.Polymer
Reference `Polymer`.
... | 3.329303 | 3.017759 | 1.103237 |
if not len(p) == len(reference_axis):
raise ValueError(
"The reference axis must contain the same number of points "
"as the Polymer primitive.")
prim_cas = p.primitive.coordinates
ref_points = reference_axis.coordinates
alphas = [abs(dihedral(ref_points[i + 1], ref_... | def alpha_angles(p, reference_axis, tag=True, reference_axis_name='ref_axis') | Alpha angle calculated using points on the primitive of helix and axis.
Notes
-----
The final value is None, since the angle calculation requires pairs
of points along the primitive and axis. This is a generalisation
of the calculation used to measure the tilt of a helix in a
coiled-coil with r... | 3.025057 | 2.713585 | 1.114782 |
if len(p) <= 1:
raise ValueError(
"Polymer should have length greater than 1. Polymer length = {0}".format(len(p)))
try:
prim_cas = p.primitive.coordinates
direction_vector = prim_cas[end_index] - prim_cas[start_index]
except ValueError:
direction_vector = p[... | def polypeptide_vector(p, start_index=0, end_index=-1, unit=True) | Vector along the Chain primitive (default is from N-terminus to C-terminus).
Notes
-----
`start_index` and `end_index` can be changed to examine smaller
sections of the Chain, or reversed to change the direction of
the vector.
Parameters
----------
p : ampal.Polymer
Reference `... | 3.866009 | 3.475704 | 1.112295 |
if not len(set([len(x) for x in chains])) == 1:
raise ValueError("All chains must be of the same length")
# First array in coords is the primitive coordinates of the first chain.
# The orientation of the first chain orients the reference_axis.
coords = [numpy.array(chains[0].primitive.coor... | def reference_axis_from_chains(chains) | Average coordinates from a set of primitives calculated from Chains.
Parameters
----------
chains : list(Chain)
Returns
-------
reference_axis : numpy.array
The averaged (x, y, z) coordinates of the primitives for
the list of Chains. In the case of a coiled coil barrel,
... | 4.308679 | 4.035914 | 1.067584 |
p_vector = polypeptide_vector(
p, start_index=start_index, end_index=end_index)
if is_acute(p_vector,
reference_axis[end_index] - reference_axis[start_index]):
reference_axis = numpy.flipud(reference_axis)
return reference_axis | def flip_reference_axis_if_antiparallel(
p, reference_axis, start_index=0, end_index=-1) | Flips reference axis if direction opposes the direction of the `Polymer`.
Notes
-----
If the angle between the vector for the Polymer and the vector
for the reference_axis is > 90 degrees, then the reference axis
is reversed. This is useful to run before running
polymer_to_reference_axis_distan... | 3.239166 | 3.835875 | 0.84444 |
if len(cas_coords) >= window_length:
primitive = []
count = 0
for _ in cas_coords[:-(window_length - 1)]:
group = cas_coords[count:count + window_length]
average_x = sum([x[0] for x in group]) / window_length
average_y = sum([y[1] for y in group]) / ... | def make_primitive(cas_coords, window_length=3) | Calculates running average of cas_coords with a fixed averaging window_length.
Parameters
----------
cas_coords : list(numpy.array or float or tuple)
Each element of the list must have length 3.
window_length : int, optional
The number of coordinate sets to average each time.
Retur... | 2.64164 | 2.538017 | 1.040828 |
try:
s_primitive = make_primitive(cas_coords)
for x in range(smoothing_level):
s_primitive = make_primitive(s_primitive)
except ValueError:
raise ValueError(
'Smoothing level {0} too high, try reducing the number of rounds'
' or give a longer Chai... | def make_primitive_smoothed(cas_coords, smoothing_level=2) | Generates smoothed primitive from a list of coordinates.
Parameters
----------
cas_coords : list(numpy.array or float or tuple)
Each element of the list must have length 3.
smoothing_level : int, optional
Number of times to run the averaging.
Returns
-------
s_primitive : l... | 4.894814 | 4.560216 | 1.073373 |
try:
smoothed_primitive = make_primitive_smoothed(
cas_coords, smoothing_level=smoothing_level)
except ValueError:
smoothed_primitive = make_primitive_smoothed(
cas_coords, smoothing_level=smoothing_level - 1)
# if returned smoothed primitive is too short, lower ... | def make_primitive_extrapolate_ends(cas_coords, smoothing_level=2) | Generates smoothed helix primitives and extrapolates lost ends.
Notes
-----
From an input list of CA coordinates, the running average is
calculated to form a primitive. The smoothing_level dictates how
many times to calculate the running average. A higher
smoothing_level generates a 'smoother' ... | 2.309533 | 2.263577 | 1.020303 |
if isinstance(ampal_container, AmpalContainer):
self._ampal_objects.extend(ampal_container)
else:
raise TypeError(
'Only AmpalContainer objects may be merged with '
'an AmpalContainer.')
return | def extend(self, ampal_container) | Extends an `AmpalContainer` with another `AmpalContainer`. | 3.193271 | 2.914787 | 1.095542 |
header_title = '{:<80}\n'.format('HEADER {}'.format(self.id))
data_type = '{:<80}\n'.format('EXPDTA ISAMBARD Model')
pdb_strs = []
for ampal in self:
if isinstance(ampal, Assembly):
pdb_str = ampal.make_pdb(header=False, footer=False)
... | def pdb(self) | Compiles the PDB strings for each state into a single file. | 4.482908 | 4.214505 | 1.063686 |
return AmpalContainer(sorted(self, key=lambda x: x.tags[tag])) | def sort_by_tag(self, tag) | Sorts the `AmpalContainer` by a tag on the component objects.
Parameters
----------
tag : str
Key of tag used for sorting. | 12.163968 | 8.305644 | 1.464542 |
if isinstance(item, Polymer):
self._molecules.append(item)
else:
raise TypeError(
'Only Polymer objects can be appended to an Assembly.')
return | def append(self, item) | Adds a `Polymer` to the `Assembly`.
Raises
------
TypeError
Raised if other is any type other than `Polymer`. | 5.191349 | 3.668365 | 1.415167 |
if isinstance(assembly, Assembly):
self._molecules.extend(assembly)
else:
raise TypeError(
'Only Assembly objects may be merged with an Assembly.')
return | def extend(self, assembly) | Extends the `Assembly` with the contents of another `Assembly`.
Raises
------
TypeError
Raised if other is any type other than `Assembly`. | 5.545745 | 6.155336 | 0.900965 |
base_filters = dict(ligands=ligands, pseudo_group=pseudo_group)
restricted_mol_types = [x[0] for x in base_filters.items() if not x[1]]
in_groups = [x for x in self.filter_mol_types(restricted_mol_types)]
monomers = itertools.chain(
*(p.get_monomers(ligands=ligands) ... | def get_monomers(self, ligands=True, pseudo_group=False) | Retrieves all the `Monomers` from the `Assembly` object.
Parameters
----------
ligands : bool, optional
If `true`, will include ligand `Monomers`.
pseudo_group : bool, optional
If `True`, will include pseudo atoms. | 3.380305 | 3.876739 | 0.871945 |
if solvent:
ligand_list = [x for x in self.get_monomers()
if isinstance(x, Ligand)]
else:
ligand_list = [x for x in self.get_monomers() if isinstance(
x, Ligand) and not x.is_solvent]
return LigandGroup(monomers=ligand_l... | def get_ligands(self, solvent=True) | Retrieves all ligands from the `Assembly`.
Parameters
----------
solvent : bool, optional
If `True`, solvent molecules will be included. | 2.432996 | 2.792225 | 0.871346 |
atoms = itertools.chain(
*(list(m.get_atoms(inc_alt_states=inc_alt_states))
for m in self.get_monomers(ligands=ligands,
pseudo_group=pseudo_group)))
return atoms | def get_atoms(self, ligands=True, pseudo_group=False, inc_alt_states=False) | Flat list of all the `Atoms` in the `Assembly`.
Parameters
----------
ligands : bool, optional
Include ligand `Atoms`.
pseudo_group : bool, optional
Include pseudo_group `Atoms`.
inc_alt_states : bool, optional
Include alternate sidechain conf... | 3.009298 | 3.239239 | 0.929014 |
return find_atoms_within_distance(self.get_atoms(ligands=ligands), cutoff_dist, point) | def is_within(self, cutoff_dist, point, ligands=True) | Returns all atoms in AMPAL object within `cut-off` distance from the `point`. | 4.624795 | 3.600305 | 1.284556 |
if labels:
if len(self._molecules) == len(labels):
for polymer, label in zip(self._molecules, labels):
polymer.id = label
else:
raise ValueError('Number of polymers ({}) and number of labels ({}) must be equal.'.format(
... | def relabel_polymers(self, labels=None) | Relabels the component Polymers either in alphabetical order or using a list of labels.
Parameters
----------
labels : list, optional
A list of new labels.
Raises
------
ValueError
Raised if the number of labels does not match the number of compo... | 2.1965 | 2.425224 | 0.905689 |
counter = start
for atom in self.get_atoms(ligands=True):
atom.id = counter
counter += 1
return | def relabel_atoms(self, start=1) | Relabels all Atoms in numerical order, offset by the start parameter.
Parameters
----------
start : int, optional
Defines an offset for the labelling. | 5.032367 | 10.265789 | 0.490208 |
base_filters = dict(ligands=ligands, pseudo_group=pseudo_group)
restricted_mol_types = [x[0] for x in base_filters.items() if not x[1]]
in_groups = [x for x in self.filter_mol_types(restricted_mol_types)]
pdb_header = 'HEADER {:<80}\n'.format(
'ISAMBARD Model {}'.fo... | def make_pdb(self, ligands=True, alt_states=False, pseudo_group=False, header=True, footer=True) | Generates a PDB string for the Assembly.
Parameters
----------
ligands : bool, optional
If `True`, will include ligands in the output.
alt_states : bool, optional
If `True`, will include alternate conformations in the output.
pseudo_group : bool, optional... | 3.458896 | 3.597162 | 0.961563 |
bb_molecules = [
p.backbone for p in self._molecules if hasattr(p, 'backbone')]
bb_assembly = Assembly(bb_molecules, assembly_id=self.id)
return bb_assembly | def backbone(self) | Generates a new `Assembly` containing only the backbone atoms.
Notes
-----
Metadata is not currently preserved from the parent object.
Sequence data is retained, but only the main chain atoms are
retained.
Returns
-------
bb_assembly : ampal.Protein
... | 6.564025 | 5.810814 | 1.129622 |
prim_molecules = [
p.primitive for p in self._molecules if hasattr(p, 'primitive')]
prim_assembly = Assembly(molecules=prim_molecules, assembly_id=self.id)
return prim_assembly | def primitives(self) | Generates a new `Assembly` containing the primitives of each Polymer.
Notes
-----
Metadata is not currently preserved from the parent object.
Returns
-------
prim_assembly : ampal.Protein
`Assembly` containing only the primitives of the `Polymers`
... | 5.638306 | 4.83112 | 1.16708 |
hel_molecules = list(itertools.chain(
*[p.helices._molecules
for p in self._molecules if hasattr(p, 'helices')]))
hel_assembly = Assembly(molecules=hel_molecules, assembly_id=self.id)
return hel_assembly | def helices(self) | Generates new `Assembly` containing just α-helices.
Notes
-----
Metadata is not currently preserved from the parent object.
Returns
-------
hel_assembly : ampal.Protein
`Assembly` containing only the α-helices of the original `Assembly`. | 5.656617 | 5.339757 | 1.05934 |
strand_molecules = list(itertools.chain(
*[p.strands._molecules for p in self._molecules if hasattr(p, 'strands')]))
strand_assembly = Assembly(
molecules=strand_molecules, assembly_id=self.id)
return strand_assembly | def strands(self) | Generates a new `Assembly` containing only the β-strands.
Notes
-----
Metadata is not currently preserved from the parent object.
Returns
-------
strand_assembly : ampal.Protein
`Assembly` containing only the β-strands of the original `Assembly`. | 4.589817 | 4.596951 | 0.998448 |
seqs = [x.sequence for x in self._molecules if hasattr(x, 'sequence')]
return seqs | def sequences(self) | Returns the sequence of each `Polymer` in the `Assembly` as a list.
Returns
-------
sequences : [str]
List of sequences. | 5.831829 | 6.414035 | 0.909229 |
fasta_str = ''
max_line_length = 79
for p in self._molecules:
if hasattr(p, 'sequence'):
fasta_str += '>{0}:{1}|PDBID|CHAIN|SEQUENCE\n'.format(
self.id.upper(), p.id)
seq = p.sequence
split_seq = [seq[i: i +... | def fasta(self) | Generates a FASTA string for the `Assembly`.
Notes
-----
Explanation of FASTA format: https://en.wikipedia.org/wiki/FASTA_format
Recommendation that all lines of text be shorter than 80
characters is adhered to. Format of PDBID|CHAIN|SEQUENCE is
consistent with files do... | 2.844124 | 2.662563 | 1.06819 |
if not ff:
ff = global_settings['buff']['force_field']
if assign_ff:
for molecule in self._molecules:
if hasattr(molecule, 'update_ff'):
molecule.update_ff(
ff, mol2=mol2, force_ff_assign=force_ff_assign)
... | def get_interaction_energy(self, assign_ff=True, ff=None, mol2=False,
force_ff_assign=False) | Calculates the interaction energy of the AMPAL object.
Parameters
----------
assign_ff: bool, optional
If true the force field will be updated if required.
ff: BuffForceField, optional
The force field to be used for scoring.
mol2: bool, optional
... | 4.874727 | 3.944281 | 1.235897 |
from ampal.pdb_parser import convert_pdb_to_ampal
assembly_bb = self.backbone
total_seq_len = sum([len(x) for x in sequences])
total_aa_len = sum([len(x) for x in assembly_bb])
if total_seq_len != total_aa_len:
raise ValueError('Total sequence length ({}) doe... | def pack_new_sequences(self, sequences) | Packs a new sequence onto each Polymer in the Assembly using Scwrl4.
Notes
-----
The Scwrl packing score is saved in `Assembly.tags['scwrl_score']`
for reference.
Scwrl must be available to call. Check by running
`isambard.external_programs.scwrl.test_scwrl`. If Scwrl i... | 4.692609 | 3.924349 | 1.195767 |
non_na_sequences = [s for s in self.sequences if ' ' not in s]
self.pack_new_sequences(non_na_sequences)
return | def repack_all(self) | Repacks the side chains of all Polymers in the Assembly. | 7.079544 | 6.943296 | 1.019623 |
for polymer in self._molecules:
if polymer.molecule_type == 'protein':
polymer.tag_secondary_structure(force=force)
return | def tag_secondary_structure(self, force=False) | Tags each `Monomer` in the `Assembly` with it's secondary structure.
Notes
-----
DSSP must be available to call. Check by running
`isambard.external_programs.dssp.test_dssp`. If DSSP is not
available, please follow instruction here to add it:
https://github.com/woolfson-... | 4.273374 | 5.938068 | 0.719657 |
for polymer in self._molecules:
polymer.tag_dssp_solvent_accessibility(force=force)
return | def tag_dssp_solvent_accessibility(self, force=False) | Tags each `Monomer` in the Assembly with its solvent accessibility.
Notes
-----
For more about DSSP's solvent accessibilty metric, see:
http://swift.cmbi.ru.nl/gv/dssp/HTML/descrip.html#ACC
DSSP must be available to call. Check by running
`isambard.external_programs... | 3.859906 | 5.430624 | 0.710767 |
for polymer in self._molecules:
if polymer.molecule_type == 'protein':
polymer.tag_torsion_angles(force=force)
return | def tag_torsion_angles(self, force=False) | Tags each `Monomer` in the `Assembly` with its torsion angles.
Parameters
----------
force : bool, optional
If `True`, the tag will be run even if `Monomers` are already
tagged. | 4.207895 | 5.017855 | 0.838584 |
for polymer in self._molecules:
if polymer.molecule_type == 'protein':
polymer.tag_ca_geometry(
force=force, reference_axis=reference_axis,
reference_axis_name=reference_axis_name)
return | def tag_ca_geometry(self, force=False, reference_axis=None,
reference_axis_name='ref_axis') | Tags each `Monomer` in the `Assembly` with its helical geometry.
Parameters
----------
force : bool, optional
If True the tag will be run even if `Monomers` are already tagged.
reference_axis : list(numpy.array or tuple or list), optional
Coordinates to feed to g... | 2.836095 | 2.938244 | 0.965235 |
tagged = ['unique_id' in x.tags.keys() for x in self.get_atoms()]
if (not all(tagged)) or force:
for m in self.get_monomers():
for atom_type, atom in m.atoms.items():
atom.tags['unique_id'] = (m.unique_id, atom_type)
return | def tag_atoms_unique_ids(self, force=False) | Tags each Atom in the Assembly with its unique_id.
Notes
-----
The unique_id for each atom is a tuple (a double). `unique_id[0]`
is the unique_id for its parent `Monomer` (see `Monomer.unique_id`
for more information). `unique_id[1]` is the atom_type in the
`Assembly` as... | 3.54386 | 3.870476 | 0.915613 |
with open(str(REF_PATH / 'hydroxyproline_ref_1bkv_0_6.pickle'), 'rb') as inf:
hyp_ref = pickle.load(inf)
align_nab(hyp_ref, pro)
to_remove = ['CB', 'CG', 'CD']
for (label, atom) in pro.atoms.items():
if atom.element == 'H':
to_remove.append(label)
for label in to_rem... | def convert_pro_to_hyp(pro) | Converts a pro residue to a hydroxypro residue.
All metadata associated with the original pro will be lost i.e. tags.
As a consequence, it is advisable to relabel all atoms in the structure
in order to make them contiguous.
Parameters
----------
pro: ampal.Residue
The proline residue t... | 4.669224 | 4.744285 | 0.984179 |
rot_trans_1 = find_transformations(
tar['N'].array, tar['CA'].array, ref['N'].array, ref['CA'].array)
apply_trans_rot(tar, *rot_trans_1)
rot_ang_ca_cb = dihedral(tar['CB'], ref['CA'], ref['N'], ref['CB'])
tar.rotate(rot_ang_ca_cb, ref['N'].array - ref['CA'].array, ref['N'].array)
return | def align_nab(tar, ref) | Aligns the N-CA and CA-CB vector of the target monomer.
Parameters
----------
tar: ampal.Residue
The residue that will be aligned to the reference.
ref: ampal.Residue
The reference residue for the alignment. | 5.653099 | 5.679258 | 0.995394 |
if not numpy.isclose(angle, 0.0):
ampal.rotate(angle=angle, axis=axis, point=point, radians=radians)
ampal.translate(vector=translation)
return | def apply_trans_rot(ampal, translation, angle, axis, point, radians=False) | Applies a translation and rotation to an AMPAL object. | 2.616888 | 2.675499 | 0.978093 |
if isinstance(ss, str):
ss = [ss[:]]
tag_key = 'secondary_structure'
monomers = [x for x in polymer if tag_key in x.tags.keys()]
if len(monomers) == 0:
return Assembly()
if (len(ss) == 1) and (all([m.tags[tag_key] == ss[0] for m in monomers])):
return Assembly(polymer)
... | def find_ss_regions_polymer(polymer, ss) | Returns an `Assembly` of regions tagged as secondary structure.
Parameters
----------
polymer : Polypeptide
`Polymer` object to be searched secondary structure regions.
ss : list
List of secondary structure tags to be separate i.e. ['H']
would return helices, ['H', 'E'] would re... | 2.686643 | 2.434771 | 1.103448 |
atom_labels = ['N', 'CA', 'C', 'O', 'CB']
atom_elements = ['N', 'C', 'C', 'O', 'C']
atoms_coords = [atom_list[x:x + atom_group_s]
for x in range(0, len(atom_list), atom_group_s)]
atoms = [[Atom(x[0], x[1]) for x in zip(y, atom_elements)]
for y in atoms_coords]
i... | def flat_list_to_polymer(atom_list, atom_group_s=4) | Takes a flat list of atomic coordinates and converts it to a `Polymer`.
Parameters
----------
atom_list : [Atom]
Flat list of coordinates.
atom_group_s : int, optional
Size of atom groups.
Returns
-------
polymer : Polypeptide
`Polymer` object containing atom coords... | 2.346584 | 2.402717 | 0.976638 |
# First, align N->CA vectors.
s1, e1, s2, e2 = [x._vector
for x in [mobile[mobile_i]['N'], mobile[mobile_i]['CA'],
target[target_i]['N'], target[target_i]['CA']]]
translation, angle, axis, point = find_transformations(
s1, e1, s2, e2, radian... | def align(target, mobile, target_i=0, mobile_i=0) | Aligns one Polypeptide (mobile) to another (target).
Notes
-----
This function directly modifies atoms of the mobile Polypeptide!
It does not return a new object.
Parameters
----------
target : Polypeptide
Polypeptide to be aligned to.
mobile : Polypeptide
Polypeptide t... | 3.66686 | 3.585035 | 1.022824 |
id_dict = {str(m.id): m for m in self._monomers}
slice_polymer = Polypeptide(
[id_dict[str(x)] for x in range(int(start), int(end) + 1)], self.id)
return slice_polymer | def get_slice_from_res_id(self, start, end) | Returns a new `Polypeptide` containing the `Residues` in start/end range.
Parameters
----------
start : str
string representing start residue id (PDB numbering)
end : str
string representing end residue id (PDB numbering)
Returns
-------
... | 4.882955 | 4.083627 | 1.19574 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.