id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
42,900
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnGetConvolution2dDescriptor
def cudnnGetConvolution2dDescriptor(convDesc): """" Get a convolution descriptor. This function queries a previously initialized 2D convolution descriptor object. Parameters ---------- convDesc : cudnnConvolutionDescriptor Handle to a previously created convolution descriptor. Ret...
python
def cudnnGetConvolution2dDescriptor(convDesc): """" Get a convolution descriptor. This function queries a previously initialized 2D convolution descriptor object. Parameters ---------- convDesc : cudnnConvolutionDescriptor Handle to a previously created convolution descriptor. Ret...
[ "def", "cudnnGetConvolution2dDescriptor", "(", "convDesc", ")", ":", "pad_h", "=", "ctypes", ".", "c_int", "(", ")", "pad_w", "=", "ctypes", ".", "c_int", "(", ")", "u", "=", "ctypes", ".", "c_int", "(", ")", "v", "=", "ctypes", ".", "c_int", "(", ")...
Get a convolution descriptor. This function queries a previously initialized 2D convolution descriptor object. Parameters ---------- convDesc : cudnnConvolutionDescriptor Handle to a previously created convolution descriptor. Returns ------- pad_h : int zero-padding height...
[ "Get", "a", "convolution", "descriptor", "." ]
55aab1242924c2fd43db150cf2ccc2a3df958dd5
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L870-L920
42,901
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnGetConvolution2dForwardOutputDim
def cudnnGetConvolution2dForwardOutputDim(convDesc, inputTensorDesc, wDesc): """" Return the dimensions of the output tensor given a convolution descriptor. This function returns the dimensions of the resulting 4D tensor of a 2D convolution, given the convolution descriptor, the input tensor descriptor...
python
def cudnnGetConvolution2dForwardOutputDim(convDesc, inputTensorDesc, wDesc): """" Return the dimensions of the output tensor given a convolution descriptor. This function returns the dimensions of the resulting 4D tensor of a 2D convolution, given the convolution descriptor, the input tensor descriptor...
[ "def", "cudnnGetConvolution2dForwardOutputDim", "(", "convDesc", ",", "inputTensorDesc", ",", "wDesc", ")", ":", "n", "=", "ctypes", ".", "c_int", "(", ")", "c", "=", "ctypes", ".", "c_int", "(", ")", "h", "=", "ctypes", ".", "c_int", "(", ")", "w", "=...
Return the dimensions of the output tensor given a convolution descriptor. This function returns the dimensions of the resulting 4D tensor of a 2D convolution, given the convolution descriptor, the input tensor descriptor and the filter descriptor. This function can help to setup the output tensor and allo...
[ "Return", "the", "dimensions", "of", "the", "output", "tensor", "given", "a", "convolution", "descriptor", "." ]
55aab1242924c2fd43db150cf2ccc2a3df958dd5
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L925-L965
42,902
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnGetConvolutionForwardAlgorithm
def cudnnGetConvolutionForwardAlgorithm(handle, srcDesc, wDesc, convDesc, destDesc, preference, memoryLimitInbytes): """" This function returns the best algorithm to choose for the forward convolution depending on the critera expressed in the cudnnConvolutionFwdPrefer...
python
def cudnnGetConvolutionForwardAlgorithm(handle, srcDesc, wDesc, convDesc, destDesc, preference, memoryLimitInbytes): """" This function returns the best algorithm to choose for the forward convolution depending on the critera expressed in the cudnnConvolutionFwdPrefer...
[ "def", "cudnnGetConvolutionForwardAlgorithm", "(", "handle", ",", "srcDesc", ",", "wDesc", ",", "convDesc", ",", "destDesc", ",", "preference", ",", "memoryLimitInbytes", ")", ":", "algo", "=", "ctypes", ".", "c_int", "(", ")", "status", "=", "_libcudnn", ".",...
This function returns the best algorithm to choose for the forward convolution depending on the critera expressed in the cudnnConvolutionFwdPreference_t enumerant. Parameters ---------- handle : cudnnHandle Handle to a previously created cuDNN context. srcDesc : cudnnTensorDescriptor ...
[ "This", "function", "returns", "the", "best", "algorithm", "to", "choose", "for", "the", "forward", "convolution", "depending", "on", "the", "critera", "expressed", "in", "the", "cudnnConvolutionFwdPreference_t", "enumerant", "." ]
55aab1242924c2fd43db150cf2ccc2a3df958dd5
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L1049-L1088
42,903
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnGetConvolutionForwardWorkspaceSize
def cudnnGetConvolutionForwardWorkspaceSize(handle, srcDesc, wDesc, convDesc, destDesc, algo): """" This function returns the amount of GPU memory workspace the user needs to allocate to be able to call cudnnConvolutionForward with the specified algorithm. Pa...
python
def cudnnGetConvolutionForwardWorkspaceSize(handle, srcDesc, wDesc, convDesc, destDesc, algo): """" This function returns the amount of GPU memory workspace the user needs to allocate to be able to call cudnnConvolutionForward with the specified algorithm. Pa...
[ "def", "cudnnGetConvolutionForwardWorkspaceSize", "(", "handle", ",", "srcDesc", ",", "wDesc", ",", "convDesc", ",", "destDesc", ",", "algo", ")", ":", "sizeInBytes", "=", "ctypes", ".", "c_size_t", "(", ")", "status", "=", "_libcudnn", ".", "cudnnGetConvolution...
This function returns the amount of GPU memory workspace the user needs to allocate to be able to call cudnnConvolutionForward with the specified algorithm. Parameters ---------- handle : cudnnHandle Handle to a previously created cuDNN context. srcDesc : cudnnTensorDescriptor Handl...
[ "This", "function", "returns", "the", "amount", "of", "GPU", "memory", "workspace", "the", "user", "needs", "to", "allocate", "to", "be", "able", "to", "call", "cudnnConvolutionForward", "with", "the", "specified", "algorithm", "." ]
55aab1242924c2fd43db150cf2ccc2a3df958dd5
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L1097-L1131
42,904
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnSoftmaxForward
def cudnnSoftmaxForward(handle, algorithm, mode, alpha, srcDesc, srcData, beta, destDesc, destData): """" This routing computes the softmax function Parameters ---------- handle : cudnnHandle Handle to a previously created cuDNN context. algorithm : cudnnSoftmaxAlgorithm Enumera...
python
def cudnnSoftmaxForward(handle, algorithm, mode, alpha, srcDesc, srcData, beta, destDesc, destData): """" This routing computes the softmax function Parameters ---------- handle : cudnnHandle Handle to a previously created cuDNN context. algorithm : cudnnSoftmaxAlgorithm Enumera...
[ "def", "cudnnSoftmaxForward", "(", "handle", ",", "algorithm", ",", "mode", ",", "alpha", ",", "srcDesc", ",", "srcData", ",", "beta", ",", "destDesc", ",", "destData", ")", ":", "dataType", "=", "cudnnGetTensor4dDescriptor", "(", "destDesc", ")", "[", "0", ...
This routing computes the softmax function Parameters ---------- handle : cudnnHandle Handle to a previously created cuDNN context. algorithm : cudnnSoftmaxAlgorithm Enumerant to specify the softmax algorithm. mode : cudnnSoftmaxMode Enumerant to specify the softmax mode. ...
[ "This", "routing", "computes", "the", "softmax", "function" ]
55aab1242924c2fd43db150cf2ccc2a3df958dd5
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L1497-L1538
42,905
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnCreatePoolingDescriptor
def cudnnCreatePoolingDescriptor(): """" Create pooling descriptor. This function creates a pooling descriptor object by allocating the memory needed to hold its opaque structure, Returns ------- poolingDesc : cudnnPoolingDescriptor Newly allocated pooling descriptor. """ ...
python
def cudnnCreatePoolingDescriptor(): """" Create pooling descriptor. This function creates a pooling descriptor object by allocating the memory needed to hold its opaque structure, Returns ------- poolingDesc : cudnnPoolingDescriptor Newly allocated pooling descriptor. """ ...
[ "def", "cudnnCreatePoolingDescriptor", "(", ")", ":", "poolingDesc", "=", "ctypes", ".", "c_void_p", "(", ")", "status", "=", "_libcudnn", ".", "cudnnCreatePoolingDescriptor", "(", "ctypes", ".", "byref", "(", "poolingDesc", ")", ")", "cudnnCheckStatus", "(", "s...
Create pooling descriptor. This function creates a pooling descriptor object by allocating the memory needed to hold its opaque structure, Returns ------- poolingDesc : cudnnPoolingDescriptor Newly allocated pooling descriptor.
[ "Create", "pooling", "descriptor", "." ]
55aab1242924c2fd43db150cf2ccc2a3df958dd5
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L1597-L1614
42,906
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnSetPooling2dDescriptor
def cudnnSetPooling2dDescriptor(poolingDesc, mode, windowHeight, windowWidth, verticalPadding, horizontalPadding, verticalStride, horizontalStride): """" Initialize a 2D pooling descriptor. This function initializes a previously created pooling descriptor object. Parame...
python
def cudnnSetPooling2dDescriptor(poolingDesc, mode, windowHeight, windowWidth, verticalPadding, horizontalPadding, verticalStride, horizontalStride): """" Initialize a 2D pooling descriptor. This function initializes a previously created pooling descriptor object. Parame...
[ "def", "cudnnSetPooling2dDescriptor", "(", "poolingDesc", ",", "mode", ",", "windowHeight", ",", "windowWidth", ",", "verticalPadding", ",", "horizontalPadding", ",", "verticalStride", ",", "horizontalStride", ")", ":", "status", "=", "_libcudnn", ".", "cudnnSetPoolin...
Initialize a 2D pooling descriptor. This function initializes a previously created pooling descriptor object. Parameters ---------- poolingDesc : cudnnPoolingDescriptor Handle to a previously created pooling descriptor. mode : cudnnPoolingMode Enumerant to specify the pooling mode....
[ "Initialize", "a", "2D", "pooling", "descriptor", "." ]
55aab1242924c2fd43db150cf2ccc2a3df958dd5
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L1621-L1651
42,907
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnGetPooling2dDescriptor
def cudnnGetPooling2dDescriptor(poolingDesc): """" This function queries a previously created pooling descriptor object. Parameters ---------- poolingDesc : cudnnPoolingDescriptor Handle to a previously created 2D pooling descriptor. Returns ------- mode : cudnnPoolingMode ...
python
def cudnnGetPooling2dDescriptor(poolingDesc): """" This function queries a previously created pooling descriptor object. Parameters ---------- poolingDesc : cudnnPoolingDescriptor Handle to a previously created 2D pooling descriptor. Returns ------- mode : cudnnPoolingMode ...
[ "def", "cudnnGetPooling2dDescriptor", "(", "poolingDesc", ")", ":", "mode", "=", "ctypes", ".", "c_int", "(", ")", "windowHeight", "=", "ctypes", ".", "c_int", "(", ")", "windowWidth", "=", "ctypes", ".", "c_int", "(", ")", "verticalPadding", "=", "ctypes", ...
This function queries a previously created pooling descriptor object. Parameters ---------- poolingDesc : cudnnPoolingDescriptor Handle to a previously created 2D pooling descriptor. Returns ------- mode : cudnnPoolingMode Enumerant to specify the pooling mode. windowHeight : i...
[ "This", "function", "queries", "a", "previously", "created", "pooling", "descriptor", "object", "." ]
55aab1242924c2fd43db150cf2ccc2a3df958dd5
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L1657-L1698
42,908
hannes-brt/cudnn-python-wrappers
libcudnn.py
cudnnActivationBackward
def cudnnActivationBackward(handle, mode, alpha, srcDesc, srcData, srcDiffDesc, srcDiffData, destDesc, destData, beta, destDiffDesc, destDiffData): """" Gradient of activation function. This routine computes the gradient of a neuron activation function. In-place operation i...
python
def cudnnActivationBackward(handle, mode, alpha, srcDesc, srcData, srcDiffDesc, srcDiffData, destDesc, destData, beta, destDiffDesc, destDiffData): """" Gradient of activation function. This routine computes the gradient of a neuron activation function. In-place operation i...
[ "def", "cudnnActivationBackward", "(", "handle", ",", "mode", ",", "alpha", ",", "srcDesc", ",", "srcData", ",", "srcDiffDesc", ",", "srcDiffData", ",", "destDesc", ",", "destData", ",", "beta", ",", "destDiffDesc", ",", "destDiffData", ")", ":", "dataType", ...
Gradient of activation function. This routine computes the gradient of a neuron activation function. In-place operation is allowed for this routine; i.e., srcData and destData pointers may be equal and srcDiffData and destDiffData pointers may be equal. However, this requires the corresponding tensor ...
[ "Gradient", "of", "activation", "function", "." ]
55aab1242924c2fd43db150cf2ccc2a3df958dd5
https://github.com/hannes-brt/cudnn-python-wrappers/blob/55aab1242924c2fd43db150cf2ccc2a3df958dd5/libcudnn.py#L1881-L1940
42,909
xray7224/PyPump
pypump/store.py
AbstractStore.__prefix_key
def __prefix_key(self, key): """ This will add the prefix to the key if one exists on the store """ # If there isn't a prefix don't bother if self.prefix is None: return key # Don't prefix key if it already has it if key.startswith(self.prefix + "-"): ret...
python
def __prefix_key(self, key): """ This will add the prefix to the key if one exists on the store """ # If there isn't a prefix don't bother if self.prefix is None: return key # Don't prefix key if it already has it if key.startswith(self.prefix + "-"): ret...
[ "def", "__prefix_key", "(", "self", ",", "key", ")", ":", "# If there isn't a prefix don't bother", "if", "self", ".", "prefix", "is", "None", ":", "return", "key", "# Don't prefix key if it already has it", "if", "key", ".", "startswith", "(", "self", ".", "prefi...
This will add the prefix to the key if one exists on the store
[ "This", "will", "add", "the", "prefix", "to", "the", "key", "if", "one", "exists", "on", "the", "store" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/store.py#L61-L71
42,910
xray7224/PyPump
pypump/store.py
AbstractStore.export
def export(self): """ Exports as dictionary """ data = {} for key, value in self.items(): data[key] = value return data
python
def export(self): """ Exports as dictionary """ data = {} for key, value in self.items(): data[key] = value return data
[ "def", "export", "(", "self", ")", ":", "data", "=", "{", "}", "for", "key", ",", "value", "in", "self", ".", "items", "(", ")", ":", "data", "[", "key", "]", "=", "value", "return", "data" ]
Exports as dictionary
[ "Exports", "as", "dictionary" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/store.py#L96-L102
42,911
xray7224/PyPump
pypump/store.py
JSONStore.save
def save(self): """ Saves dictionary to disk in JSON format. """ if self.filename is None: raise StoreException("Filename must be set to write store to disk") # We need an atomic way of re-writing the settings, we also need to # prevent only overwriting part of the settings ...
python
def save(self): """ Saves dictionary to disk in JSON format. """ if self.filename is None: raise StoreException("Filename must be set to write store to disk") # We need an atomic way of re-writing the settings, we also need to # prevent only overwriting part of the settings ...
[ "def", "save", "(", "self", ")", ":", "if", "self", ".", "filename", "is", "None", ":", "raise", "StoreException", "(", "\"Filename must be set to write store to disk\"", ")", "# We need an atomic way of re-writing the settings, we also need to", "# prevent only overwriting par...
Saves dictionary to disk in JSON format.
[ "Saves", "dictionary", "to", "disk", "in", "JSON", "format", "." ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/store.py#L151-L176
42,912
xray7224/PyPump
pypump/store.py
JSONStore.get_filename
def get_filename(cls): """ Gets filename of store on disk """ config_home = os.environ.get("XDG_CONFIG_HOME", "~/.config") config_home = os.path.expanduser(config_home) base_path = os.path.join(config_home, "PyPump") if not os.path.isdir(base_path): os.makedirs(base_...
python
def get_filename(cls): """ Gets filename of store on disk """ config_home = os.environ.get("XDG_CONFIG_HOME", "~/.config") config_home = os.path.expanduser(config_home) base_path = os.path.join(config_home, "PyPump") if not os.path.isdir(base_path): os.makedirs(base_...
[ "def", "get_filename", "(", "cls", ")", ":", "config_home", "=", "os", ".", "environ", ".", "get", "(", "\"XDG_CONFIG_HOME\"", ",", "\"~/.config\"", ")", "config_home", "=", "os", ".", "path", ".", "expanduser", "(", "config_home", ")", "base_path", "=", "...
Gets filename of store on disk
[ "Gets", "filename", "of", "store", "on", "disk" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/store.py#L179-L188
42,913
xray7224/PyPump
pypump/store.py
JSONStore.load
def load(cls, webfinger, pypump): """ Load JSON from disk into store object """ filename = cls.get_filename() if os.path.isfile(filename): data = open(filename).read() data = json.loads(data) store = cls(data, filename=filename) else: stor...
python
def load(cls, webfinger, pypump): """ Load JSON from disk into store object """ filename = cls.get_filename() if os.path.isfile(filename): data = open(filename).read() data = json.loads(data) store = cls(data, filename=filename) else: stor...
[ "def", "load", "(", "cls", ",", "webfinger", ",", "pypump", ")", ":", "filename", "=", "cls", ".", "get_filename", "(", ")", "if", "os", ".", "path", ".", "isfile", "(", "filename", ")", ":", "data", "=", "open", "(", "filename", ")", ".", "read", ...
Load JSON from disk into store object
[ "Load", "JSON", "from", "disk", "into", "store", "object" ]
f921f691c39fe021f4fd124b6bc91718c9e49b4a
https://github.com/xray7224/PyPump/blob/f921f691c39fe021f4fd124b6bc91718c9e49b4a/pypump/store.py#L191-L203
42,914
joeyespo/py-getch
getch/pause.py
pause
def pause(message='Press any key to continue . . . '): """ Prints the specified message if it's not None and waits for a keypress. """ if message is not None: print(message, end='') sys.stdout.flush() getch() print()
python
def pause(message='Press any key to continue . . . '): """ Prints the specified message if it's not None and waits for a keypress. """ if message is not None: print(message, end='') sys.stdout.flush() getch() print()
[ "def", "pause", "(", "message", "=", "'Press any key to continue . . . '", ")", ":", "if", "message", "is", "not", "None", ":", "print", "(", "message", ",", "end", "=", "''", ")", "sys", ".", "stdout", ".", "flush", "(", ")", "getch", "(", ")", "print...
Prints the specified message if it's not None and waits for a keypress.
[ "Prints", "the", "specified", "message", "if", "it", "s", "not", "None", "and", "waits", "for", "a", "keypress", "." ]
295f0c2e602e6043ba0d338076abe847a7b29b0b
https://github.com/joeyespo/py-getch/blob/295f0c2e602e6043ba0d338076abe847a7b29b0b/getch/pause.py#L7-L15
42,915
woolfson-group/isambard
isambard/ampal/interactions.py
covalent_bonds
def covalent_bonds(atoms, threshold=1.1): """Returns all the covalent bonds in a list of `Atom` pairs. Notes ----- Uses information `element_data`, which can be accessed directly through this module i.e. `isambard.ampal.interactions.element_data`. Parameters ---------- atoms : [(`Atom`...
python
def covalent_bonds(atoms, threshold=1.1): """Returns all the covalent bonds in a list of `Atom` pairs. Notes ----- Uses information `element_data`, which can be accessed directly through this module i.e. `isambard.ampal.interactions.element_data`. Parameters ---------- atoms : [(`Atom`...
[ "def", "covalent_bonds", "(", "atoms", ",", "threshold", "=", "1.1", ")", ":", "bonds", "=", "[", "]", "for", "a", ",", "b", "in", "atoms", ":", "bond_distance", "=", "(", "element_data", "[", "a", ".", "element", ".", "title", "(", ")", "]", "[", ...
Returns all the covalent bonds in a list of `Atom` pairs. Notes ----- Uses information `element_data`, which can be accessed directly through this module i.e. `isambard.ampal.interactions.element_data`. Parameters ---------- atoms : [(`Atom`, `Atom`)] List of pairs of `Atoms`. ...
[ "Returns", "all", "the", "covalent", "bonds", "in", "a", "list", "of", "Atom", "pairs", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/interactions.py#L178-L203
42,916
woolfson-group/isambard
isambard/ampal/interactions.py
find_covalent_bonds
def find_covalent_bonds(ampal, max_range=2.2, threshold=1.1, tag=True): """Finds all covalent bonds in the AMPAL object. Parameters ---------- ampal : AMPAL Object Any AMPAL object with a `get_atoms` method. max_range : float, optional Used to define the sector size, so interactions...
python
def find_covalent_bonds(ampal, max_range=2.2, threshold=1.1, tag=True): """Finds all covalent bonds in the AMPAL object. Parameters ---------- ampal : AMPAL Object Any AMPAL object with a `get_atoms` method. max_range : float, optional Used to define the sector size, so interactions...
[ "def", "find_covalent_bonds", "(", "ampal", ",", "max_range", "=", "2.2", ",", "threshold", "=", "1.1", ",", "tag", "=", "True", ")", ":", "sectors", "=", "gen_sectors", "(", "ampal", ".", "get_atoms", "(", ")", ",", "max_range", "*", "1.1", ")", "bond...
Finds all covalent bonds in the AMPAL object. Parameters ---------- ampal : AMPAL Object Any AMPAL object with a `get_atoms` method. max_range : float, optional Used to define the sector size, so interactions at longer ranges will not be found. threshold : float, optional ...
[ "Finds", "all", "covalent", "bonds", "in", "the", "AMPAL", "object", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/interactions.py#L206-L242
42,917
woolfson-group/isambard
isambard/ampal/interactions.py
generate_covalent_bond_graph
def generate_covalent_bond_graph(covalent_bonds): """Generates a graph of the covalent bond network described by the interactions. Parameters ---------- covalent_bonds: [CovalentBond] List of `CovalentBond`. Returns ------- bond_graph: networkx.Graph A graph of the covalent...
python
def generate_covalent_bond_graph(covalent_bonds): """Generates a graph of the covalent bond network described by the interactions. Parameters ---------- covalent_bonds: [CovalentBond] List of `CovalentBond`. Returns ------- bond_graph: networkx.Graph A graph of the covalent...
[ "def", "generate_covalent_bond_graph", "(", "covalent_bonds", ")", ":", "bond_graph", "=", "networkx", ".", "Graph", "(", ")", "for", "inter", "in", "covalent_bonds", ":", "bond_graph", ".", "add_edge", "(", "inter", ".", "a", ",", "inter", ".", "b", ")", ...
Generates a graph of the covalent bond network described by the interactions. Parameters ---------- covalent_bonds: [CovalentBond] List of `CovalentBond`. Returns ------- bond_graph: networkx.Graph A graph of the covalent bond network.
[ "Generates", "a", "graph", "of", "the", "covalent", "bond", "network", "described", "by", "the", "interactions", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/interactions.py#L245-L261
42,918
woolfson-group/isambard
isambard/ampal/interactions.py
generate_bond_subgraphs_from_break
def generate_bond_subgraphs_from_break(bond_graph, atom1, atom2): """Splits the bond graph between two atoms to producing subgraphs. Notes ----- This will not work if there are cycles in the bond graph. Parameters ---------- bond_graph: networkx.Graph Graph of covalent bond network...
python
def generate_bond_subgraphs_from_break(bond_graph, atom1, atom2): """Splits the bond graph between two atoms to producing subgraphs. Notes ----- This will not work if there are cycles in the bond graph. Parameters ---------- bond_graph: networkx.Graph Graph of covalent bond network...
[ "def", "generate_bond_subgraphs_from_break", "(", "bond_graph", ",", "atom1", ",", "atom2", ")", ":", "bond_graph", ".", "remove_edge", "(", "atom1", ",", "atom2", ")", "try", ":", "subgraphs", "=", "list", "(", "networkx", ".", "connected_component_subgraphs", ...
Splits the bond graph between two atoms to producing subgraphs. Notes ----- This will not work if there are cycles in the bond graph. Parameters ---------- bond_graph: networkx.Graph Graph of covalent bond network atom1: isambard.ampal.Atom First atom in the bond. atom2...
[ "Splits", "the", "bond", "graph", "between", "two", "atoms", "to", "producing", "subgraphs", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/interactions.py#L264-L293
42,919
woolfson-group/isambard
isambard/ampal/base_ampal.py
cap
def cap(v, l): """Shortens string is above certain length.""" s = str(v) return s if len(s) <= l else s[-l:]
python
def cap(v, l): """Shortens string is above certain length.""" s = str(v) return s if len(s) <= l else s[-l:]
[ "def", "cap", "(", "v", ",", "l", ")", ":", "s", "=", "str", "(", "v", ")", "return", "s", "if", "len", "(", "s", ")", "<=", "l", "else", "s", "[", "-", "l", ":", "]" ]
Shortens string is above certain length.
[ "Shortens", "string", "is", "above", "certain", "length", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/base_ampal.py#L16-L19
42,920
woolfson-group/isambard
isambard/ampal/base_ampal.py
find_atoms_within_distance
def find_atoms_within_distance(atoms, cutoff_distance, point): """Returns atoms within the distance from the point. Parameters ---------- atoms : [ampal.atom] A list of `ampal.atoms`. cutoff_distance : float Maximum distance from point. point : (float, float, float) Refe...
python
def find_atoms_within_distance(atoms, cutoff_distance, point): """Returns atoms within the distance from the point. Parameters ---------- atoms : [ampal.atom] A list of `ampal.atoms`. cutoff_distance : float Maximum distance from point. point : (float, float, float) Refe...
[ "def", "find_atoms_within_distance", "(", "atoms", ",", "cutoff_distance", ",", "point", ")", ":", "return", "[", "x", "for", "x", "in", "atoms", "if", "distance", "(", "x", ",", "point", ")", "<=", "cutoff_distance", "]" ]
Returns atoms within the distance from the point. Parameters ---------- atoms : [ampal.atom] A list of `ampal.atoms`. cutoff_distance : float Maximum distance from point. point : (float, float, float) Reference point, 3D coordinate. Returns ------- filtered_atom...
[ "Returns", "atoms", "within", "the", "distance", "from", "the", "point", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/base_ampal.py#L22-L39
42,921
woolfson-group/isambard
isambard/ampal/base_ampal.py
centre_of_atoms
def centre_of_atoms(atoms, mass_weighted=True): """ Returns centre point of any list of atoms. Parameters ---------- atoms : list List of AMPAL atom objects. mass_weighted : bool, optional If True returns centre of mass, otherwise just geometric centre of points. Returns --...
python
def centre_of_atoms(atoms, mass_weighted=True): """ Returns centre point of any list of atoms. Parameters ---------- atoms : list List of AMPAL atom objects. mass_weighted : bool, optional If True returns centre of mass, otherwise just geometric centre of points. Returns --...
[ "def", "centre_of_atoms", "(", "atoms", ",", "mass_weighted", "=", "True", ")", ":", "points", "=", "[", "x", ".", "_vector", "for", "x", "in", "atoms", "]", "if", "mass_weighted", ":", "masses", "=", "[", "x", ".", "mass", "for", "x", "in", "atoms",...
Returns centre point of any list of atoms. Parameters ---------- atoms : list List of AMPAL atom objects. mass_weighted : bool, optional If True returns centre of mass, otherwise just geometric centre of points. Returns ------- centre_of_mass : numpy.array 3D coordi...
[ "Returns", "centre", "point", "of", "any", "list", "of", "atoms", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/base_ampal.py#L42-L62
42,922
woolfson-group/isambard
isambard/ampal/base_ampal.py
BaseAmpal.assign_force_field
def assign_force_field(self, ff, mol2=False): """Assigns force field parameters to Atoms in the AMPAL object. Parameters ---------- ff: BuffForceField The force field to be used for scoring. mol2: bool, optional If true, mol2 style labels will also be use...
python
def assign_force_field(self, ff, mol2=False): """Assigns force field parameters to Atoms in the AMPAL object. Parameters ---------- ff: BuffForceField The force field to be used for scoring. mol2: bool, optional If true, mol2 style labels will also be use...
[ "def", "assign_force_field", "(", "self", ",", "ff", ",", "mol2", "=", "False", ")", ":", "if", "hasattr", "(", "self", ",", "'ligands'", ")", ":", "atoms", "=", "self", ".", "get_atoms", "(", "ligands", "=", "True", ",", "inc_alt_states", "=", "True",...
Assigns force field parameters to Atoms in the AMPAL object. Parameters ---------- ff: BuffForceField The force field to be used for scoring. mol2: bool, optional If true, mol2 style labels will also be used.
[ "Assigns", "force", "field", "parameters", "to", "Atoms", "in", "the", "AMPAL", "object", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/base_ampal.py#L178-L224
42,923
woolfson-group/isambard
isambard/ampal/base_ampal.py
BaseAmpal.update_ff
def update_ff(self, ff, mol2=False, force_ff_assign=False): """Manages assigning the force field parameters. The aim of this method is to avoid unnecessary assignment of the force field. Parameters ---------- ff: BuffForceField The force field to be used for...
python
def update_ff(self, ff, mol2=False, force_ff_assign=False): """Manages assigning the force field parameters. The aim of this method is to avoid unnecessary assignment of the force field. Parameters ---------- ff: BuffForceField The force field to be used for...
[ "def", "update_ff", "(", "self", ",", "ff", ",", "mol2", "=", "False", ",", "force_ff_assign", "=", "False", ")", ":", "aff", "=", "False", "if", "force_ff_assign", ":", "aff", "=", "True", "elif", "'assigned_ff'", "not", "in", "self", ".", "tags", ":"...
Manages assigning the force field parameters. The aim of this method is to avoid unnecessary assignment of the force field. Parameters ---------- ff: BuffForceField The force field to be used for scoring. mol2: bool, optional If true, mol2 style ...
[ "Manages", "assigning", "the", "force", "field", "parameters", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/base_ampal.py#L226-L251
42,924
woolfson-group/isambard
isambard/ampal/base_ampal.py
BaseAmpal.get_internal_energy
def get_internal_energy(self, assign_ff=True, ff=None, mol2=False, force_ff_assign=False): """Calculates the internal energy of the AMPAL object. This method is assigned to the buff_internal_energy property, using the default arguments. Parameters --...
python
def get_internal_energy(self, assign_ff=True, ff=None, mol2=False, force_ff_assign=False): """Calculates the internal energy of the AMPAL object. This method is assigned to the buff_internal_energy property, using the default arguments. Parameters --...
[ "def", "get_internal_energy", "(", "self", ",", "assign_ff", "=", "True", ",", "ff", "=", "None", ",", "mol2", "=", "False", ",", "force_ff_assign", "=", "False", ")", ":", "if", "not", "ff", ":", "ff", "=", "global_settings", "[", "'buff'", "]", "[", ...
Calculates the internal energy of the AMPAL object. This method is assigned to the buff_internal_energy property, using the default arguments. Parameters ---------- assign_ff: bool, optional If true the force field will be updated if required. ff: BuffForceF...
[ "Calculates", "the", "internal", "energy", "of", "the", "AMPAL", "object", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/base_ampal.py#L253-L284
42,925
woolfson-group/isambard
isambard/ampal/base_ampal.py
BaseAmpal.rotate
def rotate(self, angle, axis, point=None, radians=False, inc_alt_states=True): """Rotates every atom in the AMPAL object. Parameters ---------- angle : float Angle that AMPAL object will be rotated. axis : 3D Vector (tuple, list, numpy.array) Axis about w...
python
def rotate(self, angle, axis, point=None, radians=False, inc_alt_states=True): """Rotates every atom in the AMPAL object. Parameters ---------- angle : float Angle that AMPAL object will be rotated. axis : 3D Vector (tuple, list, numpy.array) Axis about w...
[ "def", "rotate", "(", "self", ",", "angle", ",", "axis", ",", "point", "=", "None", ",", "radians", "=", "False", ",", "inc_alt_states", "=", "True", ")", ":", "q", "=", "Quaternion", ".", "angle_and_axis", "(", "angle", "=", "angle", ",", "axis", "=...
Rotates every atom in the AMPAL object. Parameters ---------- angle : float Angle that AMPAL object will be rotated. axis : 3D Vector (tuple, list, numpy.array) Axis about which the AMPAL object will be rotated. point : 3D Vector (tuple, list, numpy.array...
[ "Rotates", "every", "atom", "in", "the", "AMPAL", "object", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/base_ampal.py#L288-L308
42,926
woolfson-group/isambard
isambard/ampal/base_ampal.py
BaseAmpal.translate
def translate(self, vector, inc_alt_states=True): """Translates every atom in the AMPAL object. Parameters ---------- vector : 3D Vector (tuple, list, numpy.array) Vector used for translation. inc_alt_states : bool, optional If true, will rotate atoms in ...
python
def translate(self, vector, inc_alt_states=True): """Translates every atom in the AMPAL object. Parameters ---------- vector : 3D Vector (tuple, list, numpy.array) Vector used for translation. inc_alt_states : bool, optional If true, will rotate atoms in ...
[ "def", "translate", "(", "self", ",", "vector", ",", "inc_alt_states", "=", "True", ")", ":", "vector", "=", "numpy", ".", "array", "(", "vector", ")", "for", "atom", "in", "self", ".", "get_atoms", "(", "inc_alt_states", "=", "inc_alt_states", ")", ":",...
Translates every atom in the AMPAL object. Parameters ---------- vector : 3D Vector (tuple, list, numpy.array) Vector used for translation. inc_alt_states : bool, optional If true, will rotate atoms in all states i.e. includes alternate conformations ...
[ "Translates", "every", "atom", "in", "the", "AMPAL", "object", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/base_ampal.py#L310-L324
42,927
woolfson-group/isambard
isambard/ampal/base_ampal.py
BaseAmpal.rmsd
def rmsd(self, other, backbone=False): """Calculates the RMSD between two AMPAL objects. Notes ----- No fitting operation is performs and both AMPAL objects must have the same number of atoms. Parameters ---------- other : AMPAL Object Any AM...
python
def rmsd(self, other, backbone=False): """Calculates the RMSD between two AMPAL objects. Notes ----- No fitting operation is performs and both AMPAL objects must have the same number of atoms. Parameters ---------- other : AMPAL Object Any AM...
[ "def", "rmsd", "(", "self", ",", "other", ",", "backbone", "=", "False", ")", ":", "assert", "type", "(", "self", ")", "==", "type", "(", "other", ")", "if", "backbone", "and", "hasattr", "(", "self", ",", "'backbone'", ")", ":", "points1", "=", "s...
Calculates the RMSD between two AMPAL objects. Notes ----- No fitting operation is performs and both AMPAL objects must have the same number of atoms. Parameters ---------- other : AMPAL Object Any AMPAL object with `get_atoms` method. backbo...
[ "Calculates", "the", "RMSD", "between", "two", "AMPAL", "objects", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/base_ampal.py#L326-L350
42,928
woolfson-group/isambard
isambard/ampal/base_ampal.py
Polymer.append
def append(self, item): """Appends a `Monomer to the `Polymer`. Notes ----- Does not update labelling. """ if isinstance(item, Monomer): self._monomers.append(item) else: raise TypeError( 'Only Monomer objects can be append...
python
def append(self, item): """Appends a `Monomer to the `Polymer`. Notes ----- Does not update labelling. """ if isinstance(item, Monomer): self._monomers.append(item) else: raise TypeError( 'Only Monomer objects can be append...
[ "def", "append", "(", "self", ",", "item", ")", ":", "if", "isinstance", "(", "item", ",", "Monomer", ")", ":", "self", ".", "_monomers", ".", "append", "(", "item", ")", "else", ":", "raise", "TypeError", "(", "'Only Monomer objects can be appended to an Po...
Appends a `Monomer to the `Polymer`. Notes ----- Does not update labelling.
[ "Appends", "a", "Monomer", "to", "the", "Polymer", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/base_ampal.py#L449-L461
42,929
woolfson-group/isambard
isambard/ampal/base_ampal.py
Polymer.extend
def extend(self, polymer): """Extends the `Polymer` with the contents of another `Polymer`. Notes ----- Does not update labelling. """ if isinstance(polymer, Polymer): self._monomers.extend(polymer) else: raise TypeError( '...
python
def extend(self, polymer): """Extends the `Polymer` with the contents of another `Polymer`. Notes ----- Does not update labelling. """ if isinstance(polymer, Polymer): self._monomers.extend(polymer) else: raise TypeError( '...
[ "def", "extend", "(", "self", ",", "polymer", ")", ":", "if", "isinstance", "(", "polymer", ",", "Polymer", ")", ":", "self", ".", "_monomers", ".", "extend", "(", "polymer", ")", "else", ":", "raise", "TypeError", "(", "'Only Polymer objects may be merged w...
Extends the `Polymer` with the contents of another `Polymer`. Notes ----- Does not update labelling.
[ "Extends", "the", "Polymer", "with", "the", "contents", "of", "another", "Polymer", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/base_ampal.py#L463-L475
42,930
woolfson-group/isambard
isambard/ampal/base_ampal.py
Polymer.get_monomers
def get_monomers(self, ligands=True): """Retrieves all the `Monomers` from the AMPAL object. Parameters ---------- ligands : bool, optional If true, will include ligand `Monomers`. """ if ligands and self.ligands: monomers = self._monomers + self....
python
def get_monomers(self, ligands=True): """Retrieves all the `Monomers` from the AMPAL object. Parameters ---------- ligands : bool, optional If true, will include ligand `Monomers`. """ if ligands and self.ligands: monomers = self._monomers + self....
[ "def", "get_monomers", "(", "self", ",", "ligands", "=", "True", ")", ":", "if", "ligands", "and", "self", ".", "ligands", ":", "monomers", "=", "self", ".", "_monomers", "+", "self", ".", "ligands", ".", "_monomers", "else", ":", "monomers", "=", "sel...
Retrieves all the `Monomers` from the AMPAL object. Parameters ---------- ligands : bool, optional If true, will include ligand `Monomers`.
[ "Retrieves", "all", "the", "Monomers", "from", "the", "AMPAL", "object", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/base_ampal.py#L477-L489
42,931
woolfson-group/isambard
isambard/ampal/base_ampal.py
Polymer.get_atoms
def get_atoms(self, ligands=True, inc_alt_states=False): """Flat list of all the Atoms in the Polymer. Parameters ---------- inc_alt_states : bool If true atoms from alternate conformations are included rather than only the "active" states. Returns ...
python
def get_atoms(self, ligands=True, inc_alt_states=False): """Flat list of all the Atoms in the Polymer. Parameters ---------- inc_alt_states : bool If true atoms from alternate conformations are included rather than only the "active" states. Returns ...
[ "def", "get_atoms", "(", "self", ",", "ligands", "=", "True", ",", "inc_alt_states", "=", "False", ")", ":", "if", "ligands", "and", "self", ".", "ligands", ":", "monomers", "=", "self", ".", "_monomers", "+", "self", ".", "ligands", ".", "_monomers", ...
Flat list of all the Atoms in the Polymer. Parameters ---------- inc_alt_states : bool If true atoms from alternate conformations are included rather than only the "active" states. Returns ------- atoms : itertools.chain Returns an it...
[ "Flat", "list", "of", "all", "the", "Atoms", "in", "the", "Polymer", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/base_ampal.py#L491-L512
42,932
woolfson-group/isambard
isambard/ampal/base_ampal.py
Polymer.relabel_monomers
def relabel_monomers(self, labels=None): """Relabels the either in numerically 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...
python
def relabel_monomers(self, labels=None): """Relabels the either in numerically 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...
[ "def", "relabel_monomers", "(", "self", ",", "labels", "=", "None", ")", ":", "if", "labels", ":", "if", "len", "(", "self", ".", "_monomers", ")", "==", "len", "(", "labels", ")", ":", "for", "monomer", ",", "label", "in", "zip", "(", "self", ".",...
Relabels the either in numerically 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 component Monoer ob...
[ "Relabels", "the", "either", "in", "numerically", "or", "using", "a", "list", "of", "labels", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/base_ampal.py#L514-L541
42,933
woolfson-group/isambard
isambard/ampal/base_ampal.py
Polymer.relabel_atoms
def relabel_atoms(self, start=1): """Relabels all `Atoms` in numerical order. Parameters ---------- start : int, optional Offset the labelling by `start` residues. """ counter = start for atom in self.get_atoms(): atom.id = counter ...
python
def relabel_atoms(self, start=1): """Relabels all `Atoms` in numerical order. Parameters ---------- start : int, optional Offset the labelling by `start` residues. """ counter = start for atom in self.get_atoms(): atom.id = counter ...
[ "def", "relabel_atoms", "(", "self", ",", "start", "=", "1", ")", ":", "counter", "=", "start", "for", "atom", "in", "self", ".", "get_atoms", "(", ")", ":", "atom", ".", "id", "=", "counter", "counter", "+=", "1", "return" ]
Relabels all `Atoms` in numerical order. Parameters ---------- start : int, optional Offset the labelling by `start` residues.
[ "Relabels", "all", "Atoms", "in", "numerical", "order", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/base_ampal.py#L543-L555
42,934
woolfson-group/isambard
isambard/ampal/base_ampal.py
Polymer.make_pdb
def make_pdb(self, alt_states=False, inc_ligands=True): """Generates a PDB string for the `Polymer`. Parameters ---------- alt_states : bool, optional Include alternate conformations for `Monomers` in PDB. inc_ligands : bool, optional Includes `Ligands` i...
python
def make_pdb(self, alt_states=False, inc_ligands=True): """Generates a PDB string for the `Polymer`. Parameters ---------- alt_states : bool, optional Include alternate conformations for `Monomers` in PDB. inc_ligands : bool, optional Includes `Ligands` i...
[ "def", "make_pdb", "(", "self", ",", "alt_states", "=", "False", ",", "inc_ligands", "=", "True", ")", ":", "if", "any", "(", "[", "False", "if", "x", ".", "id", "else", "True", "for", "x", "in", "self", ".", "_monomers", "]", ")", ":", "self", "...
Generates a PDB string for the `Polymer`. Parameters ---------- alt_states : bool, optional Include alternate conformations for `Monomers` in PDB. inc_ligands : bool, optional Includes `Ligands` in PDB. Returns ------- pdb_str : str ...
[ "Generates", "a", "PDB", "string", "for", "the", "Polymer", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/base_ampal.py#L563-L586
42,935
woolfson-group/isambard
isambard/ampal/base_ampal.py
Atom.rotate
def rotate(self, angle, axis, point=None, radians=False): """Rotates `Atom` by `angle`. Parameters ---------- angle : float Angle that `Atom` will be rotated. axis : 3D Vector (tuple, list, numpy.array) Axis about which the `Atom` will be rotated. ...
python
def rotate(self, angle, axis, point=None, radians=False): """Rotates `Atom` by `angle`. Parameters ---------- angle : float Angle that `Atom` will be rotated. axis : 3D Vector (tuple, list, numpy.array) Axis about which the `Atom` will be rotated. ...
[ "def", "rotate", "(", "self", ",", "angle", ",", "axis", ",", "point", "=", "None", ",", "radians", "=", "False", ")", ":", "q", "=", "Quaternion", ".", "angle_and_axis", "(", "angle", "=", "angle", ",", "axis", "=", "axis", ",", "radians", "=", "r...
Rotates `Atom` by `angle`. Parameters ---------- angle : float Angle that `Atom` will be rotated. axis : 3D Vector (tuple, list, numpy.array) Axis about which the `Atom` will be rotated. point : 3D Vector (tuple, list, numpy.array), optional P...
[ "Rotates", "Atom", "by", "angle", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/base_ampal.py#L865-L881
42,936
woolfson-group/isambard
isambard/tools/file_parsing.py
dict_from_mmcif
def dict_from_mmcif(mmcif, path=True): """Parse mmcif file into a dictionary. Notes ----- Full list of keys/value types, and further information on them can be viewed here: http://mmcif.wwpdb.org/docs/pdb_to_pdbx_correspondences.html All values in the returned dict are str or list(str)....
python
def dict_from_mmcif(mmcif, path=True): """Parse mmcif file into a dictionary. Notes ----- Full list of keys/value types, and further information on them can be viewed here: http://mmcif.wwpdb.org/docs/pdb_to_pdbx_correspondences.html All values in the returned dict are str or list(str)....
[ "def", "dict_from_mmcif", "(", "mmcif", ",", "path", "=", "True", ")", ":", "if", "path", ":", "with", "open", "(", "mmcif", ",", "'r'", ")", "as", "foo", ":", "lines", "=", "foo", ".", "readlines", "(", ")", "else", ":", "lines", "=", "mmcif", "...
Parse mmcif file into a dictionary. Notes ----- Full list of keys/value types, and further information on them can be viewed here: http://mmcif.wwpdb.org/docs/pdb_to_pdbx_correspondences.html All values in the returned dict are str or list(str). This means that some of the data values a...
[ "Parse", "mmcif", "file", "into", "a", "dictionary", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/tools/file_parsing.py#L9-L155
42,937
woolfson-group/isambard
isambard/tools/file_parsing.py
get_protein_dict
def get_protein_dict(cif_data): """ Parse cif_data dict for a subset of its data. Notes ----- cif_data dict contains all the data from the .cif file, with values as strings. This function returns a more 'human readable' dictionary of key-value pairs. The keys have simpler (and still often more ...
python
def get_protein_dict(cif_data): """ Parse cif_data dict for a subset of its data. Notes ----- cif_data dict contains all the data from the .cif file, with values as strings. This function returns a more 'human readable' dictionary of key-value pairs. The keys have simpler (and still often more ...
[ "def", "get_protein_dict", "(", "cif_data", ")", ":", "# Dictionary relating the keys of protein_dict (column names in Protein model) to the keys of cif_data.", "mmcif_data_names", "=", "{", "'keywords'", ":", "'_struct_keywords.text'", ",", "'header'", ":", "'_struct_keywords.pdbx_k...
Parse cif_data dict for a subset of its data. Notes ----- cif_data dict contains all the data from the .cif file, with values as strings. This function returns a more 'human readable' dictionary of key-value pairs. The keys have simpler (and still often more descriptive!) names, and the values are ...
[ "Parse", "cif_data", "dict", "for", "a", "subset", "of", "its", "data", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/tools/file_parsing.py#L158-L277
42,938
woolfson-group/isambard
isambard/tools/file_parsing.py
parse_PISCES_output
def parse_PISCES_output(pisces_output, path=False): """ Takes the output list of a PISCES cull and returns in a usable dictionary. Notes ----- Designed for outputs of protein sequence redundancy culls conducted using the PISCES server. http://dunbrack.fccc.edu/PISCES.php G. Wang and R. L. Dunbr...
python
def parse_PISCES_output(pisces_output, path=False): """ Takes the output list of a PISCES cull and returns in a usable dictionary. Notes ----- Designed for outputs of protein sequence redundancy culls conducted using the PISCES server. http://dunbrack.fccc.edu/PISCES.php G. Wang and R. L. Dunbr...
[ "def", "parse_PISCES_output", "(", "pisces_output", ",", "path", "=", "False", ")", ":", "pisces_dict", "=", "{", "}", "if", "path", ":", "pisces_path", "=", "Path", "(", "pisces_output", ")", "pisces_content", "=", "pisces_path", ".", "read_text", "(", ")",...
Takes the output list of a PISCES cull and returns in a usable dictionary. Notes ----- Designed for outputs of protein sequence redundancy culls conducted using the PISCES server. http://dunbrack.fccc.edu/PISCES.php G. Wang and R. L. Dunbrack, Jr. PISCES: a protein sequence culling server. Bioinfor...
[ "Takes", "the", "output", "list", "of", "a", "PISCES", "cull", "and", "returns", "in", "a", "usable", "dictionary", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/tools/file_parsing.py#L300-L340
42,939
woolfson-group/isambard
isambard/tools/file_parsing.py
download_decode
def download_decode(URL, encoding='utf-8', verbose=True): """ Downloads data from URL and returns decoded contents.""" if verbose: print("Downloading data from " + URL) req = Request(URL) try: with urlopen(req) as u: decoded_file = u.read().decode(encoding) except URLErro...
python
def download_decode(URL, encoding='utf-8', verbose=True): """ Downloads data from URL and returns decoded contents.""" if verbose: print("Downloading data from " + URL) req = Request(URL) try: with urlopen(req) as u: decoded_file = u.read().decode(encoding) except URLErro...
[ "def", "download_decode", "(", "URL", ",", "encoding", "=", "'utf-8'", ",", "verbose", "=", "True", ")", ":", "if", "verbose", ":", "print", "(", "\"Downloading data from \"", "+", "URL", ")", "req", "=", "Request", "(", "URL", ")", "try", ":", "with", ...
Downloads data from URL and returns decoded contents.
[ "Downloads", "data", "from", "URL", "and", "returns", "decoded", "contents", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/tools/file_parsing.py#L343-L359
42,940
woolfson-group/isambard
isambard/tools/file_parsing.py
olderado_best_model
def olderado_best_model(pdb_id): """ Checks the Olderado web server and returns the most representative conformation for PDB NMR structures. Notes ----- Uses OLDERADO from the EBI. See http://www.ebi.ac.uk/pdbe/nmr/olderado/ and citations therein. Parameters ---------- pdb_id : str ...
python
def olderado_best_model(pdb_id): """ Checks the Olderado web server and returns the most representative conformation for PDB NMR structures. Notes ----- Uses OLDERADO from the EBI. See http://www.ebi.ac.uk/pdbe/nmr/olderado/ and citations therein. Parameters ---------- pdb_id : str ...
[ "def", "olderado_best_model", "(", "pdb_id", ")", ":", "pdb_code", "=", "pdb_id", "[", ":", "4", "]", ".", "lower", "(", ")", "olderado_url", "=", "'http://www.ebi.ac.uk/pdbe/nmr/olderado/searchEntry?pdbCode='", "+", "pdb_code", "olderado_page", "=", "download_decode"...
Checks the Olderado web server and returns the most representative conformation for PDB NMR structures. Notes ----- Uses OLDERADO from the EBI. See http://www.ebi.ac.uk/pdbe/nmr/olderado/ and citations therein. Parameters ---------- pdb_id : str The 4-character PDB code for the NMR...
[ "Checks", "the", "Olderado", "web", "server", "and", "returns", "the", "most", "representative", "conformation", "for", "PDB", "NMR", "structures", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/tools/file_parsing.py#L362-L402
42,941
woolfson-group/isambard
isambard/optimisation/optimizer.py
buff_eval
def buff_eval(params): """Builds and evaluates BUFF energy of model in parallelization Parameters ---------- params: list Tuple containing the specification to be built, the sequence, and the parameters for model building. Returns ------- model.bude_score: float BUF...
python
def buff_eval(params): """Builds and evaluates BUFF energy of model in parallelization Parameters ---------- params: list Tuple containing the specification to be built, the sequence, and the parameters for model building. Returns ------- model.bude_score: float BUF...
[ "def", "buff_eval", "(", "params", ")", ":", "specification", ",", "sequence", ",", "parsed_ind", "=", "params", "model", "=", "specification", "(", "*", "parsed_ind", ")", "model", ".", "build", "(", ")", "model", ".", "pack_new_sequences", "(", "sequence",...
Builds and evaluates BUFF energy of model in parallelization Parameters ---------- params: list Tuple containing the specification to be built, the sequence, and the parameters for model building. Returns ------- model.bude_score: float BUFF score for model to be assign...
[ "Builds", "and", "evaluates", "BUFF", "energy", "of", "model", "in", "parallelization" ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/optimisation/optimizer.py#L26-L44
42,942
woolfson-group/isambard
isambard/optimisation/optimizer.py
buff_internal_eval
def buff_internal_eval(params): """Builds and evaluates BUFF internal energy of a model in parallelization Parameters ---------- params: list Tuple containing the specification to be built, the sequence and the parameters for model building. Returns ------- model.bude_score...
python
def buff_internal_eval(params): """Builds and evaluates BUFF internal energy of a model in parallelization Parameters ---------- params: list Tuple containing the specification to be built, the sequence and the parameters for model building. Returns ------- model.bude_score...
[ "def", "buff_internal_eval", "(", "params", ")", ":", "specification", ",", "sequence", ",", "parsed_ind", "=", "params", "model", "=", "specification", "(", "*", "parsed_ind", ")", "model", ".", "build", "(", ")", "model", ".", "pack_new_sequences", "(", "s...
Builds and evaluates BUFF internal energy of a model in parallelization Parameters ---------- params: list Tuple containing the specification to be built, the sequence and the parameters for model building. Returns ------- model.bude_score: float BUFF internal energy sc...
[ "Builds", "and", "evaluates", "BUFF", "internal", "energy", "of", "a", "model", "in", "parallelization" ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/optimisation/optimizer.py#L47-L67
42,943
woolfson-group/isambard
isambard/optimisation/optimizer.py
rmsd_eval
def rmsd_eval(rmsd_params): """Builds a model and runs profit against a reference model. Parameters ---------- rmsd_params Returns ------- rmsd: float rmsd against reference model as calculated by profit. """ specification, sequence, parsed_ind, reference_pdb = rmsd_params ...
python
def rmsd_eval(rmsd_params): """Builds a model and runs profit against a reference model. Parameters ---------- rmsd_params Returns ------- rmsd: float rmsd against reference model as calculated by profit. """ specification, sequence, parsed_ind, reference_pdb = rmsd_params ...
[ "def", "rmsd_eval", "(", "rmsd_params", ")", ":", "specification", ",", "sequence", ",", "parsed_ind", ",", "reference_pdb", "=", "rmsd_params", "model", "=", "specification", "(", "*", "parsed_ind", ")", "model", ".", "pack_new_sequences", "(", "sequence", ")",...
Builds a model and runs profit against a reference model. Parameters ---------- rmsd_params Returns ------- rmsd: float rmsd against reference model as calculated by profit.
[ "Builds", "a", "model", "and", "runs", "profit", "against", "a", "reference", "model", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/optimisation/optimizer.py#L70-L86
42,944
woolfson-group/isambard
isambard/optimisation/optimizer.py
comparator_eval
def comparator_eval(comparator_params): """Gets BUFF score for interaction between two AMPAL objects """ top1, top2, params1, params2, seq1, seq2, movements = comparator_params xrot, yrot, zrot, xtrans, ytrans, ztrans = movements obj1 = top1(*params1) obj2 = top2(*params2) obj2.rotate(xrot, ...
python
def comparator_eval(comparator_params): """Gets BUFF score for interaction between two AMPAL objects """ top1, top2, params1, params2, seq1, seq2, movements = comparator_params xrot, yrot, zrot, xtrans, ytrans, ztrans = movements obj1 = top1(*params1) obj2 = top2(*params2) obj2.rotate(xrot, ...
[ "def", "comparator_eval", "(", "comparator_params", ")", ":", "top1", ",", "top2", ",", "params1", ",", "params2", ",", "seq1", ",", "seq2", ",", "movements", "=", "comparator_params", "xrot", ",", "yrot", ",", "zrot", ",", "xtrans", ",", "ytrans", ",", ...
Gets BUFF score for interaction between two AMPAL objects
[ "Gets", "BUFF", "score", "for", "interaction", "between", "two", "AMPAL", "objects" ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/optimisation/optimizer.py#L89-L103
42,945
woolfson-group/isambard
isambard/optimisation/optimizer.py
BaseOptimizer.parameters
def parameters(self, sequence, value_means, value_ranges, arrangement): """Relates the individual to be evolved to the full parameter string. Parameters ---------- sequence: str Full amino acid sequence for specification object to be optimized. Must be equal to t...
python
def parameters(self, sequence, value_means, value_ranges, arrangement): """Relates the individual to be evolved to the full parameter string. Parameters ---------- sequence: str Full amino acid sequence for specification object to be optimized. Must be equal to t...
[ "def", "parameters", "(", "self", ",", "sequence", ",", "value_means", ",", "value_ranges", ",", "arrangement", ")", ":", "self", ".", "_params", "[", "'sequence'", "]", "=", "sequence", "self", ".", "_params", "[", "'value_means'", "]", "=", "value_means", ...
Relates the individual to be evolved to the full parameter string. Parameters ---------- sequence: str Full amino acid sequence for specification object to be optimized. Must be equal to the number of residues in the model. value_means: list ...
[ "Relates", "the", "individual", "to", "be", "evolved", "to", "the", "full", "parameter", "string", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/optimisation/optimizer.py#L205-L242
42,946
woolfson-group/isambard
isambard/optimisation/optimizer.py
BaseScore.make_energy_funnel_data
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 g...
python
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 g...
[ "def", "make_energy_funnel_data", "(", "self", ",", "cores", "=", "1", ")", ":", "if", "not", "self", ".", "parameter_log", ":", "raise", "AttributeError", "(", "'No parameter log data to make funnel, have you ran the '", "'optimiser?'", ")", "model_cls", "=", "self",...
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.
[ "Compares", "models", "created", "during", "the", "minimisation", "to", "the", "best", "model", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/optimisation/optimizer.py#L348-L382
42,947
woolfson-group/isambard
isambard/optimisation/optimizer.py
BaseScore.funnel_rebuild
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 ...
python
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 ...
[ "def", "funnel_rebuild", "(", "psg_trm_spec", ")", ":", "param_score_gen", ",", "top_result_model", ",", "specification", "=", "psg_trm_spec", "params", ",", "score", ",", "gen", "=", "param_score_gen", "model", "=", "specification", "(", "*", "params", ")", "rm...
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 ...
[ "Rebuilds", "a", "model", "and", "compares", "it", "to", "a", "reference", "model", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/optimisation/optimizer.py#L385-L404
42,948
woolfson-group/isambard
isambard/optimisation/optimizer.py
OptDE.update_pop
def update_pop(self): """Updates the population according to crossover and fitness criteria. """ candidates = [] for ind in self.population: candidates.append(self.crossover(ind)) self._params['model_count'] += len(candidates) self.assign_fitnesses(candidates)...
python
def update_pop(self): """Updates the population according to crossover and fitness criteria. """ candidates = [] for ind in self.population: candidates.append(self.crossover(ind)) self._params['model_count'] += len(candidates) self.assign_fitnesses(candidates)...
[ "def", "update_pop", "(", "self", ")", ":", "candidates", "=", "[", "]", "for", "ind", "in", "self", ".", "population", ":", "candidates", ".", "append", "(", "self", ".", "crossover", "(", "ind", ")", ")", "self", ".", "_params", "[", "'model_count'",...
Updates the population according to crossover and fitness criteria.
[ "Updates", "the", "population", "according", "to", "crossover", "and", "fitness", "criteria", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/optimisation/optimizer.py#L607-L617
42,949
woolfson-group/isambard
isambard/optimisation/optimizer.py
OptPSO.initialize_pop
def initialize_pop(self): """Generates initial population with random positions and speeds.""" 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 ...
python
def initialize_pop(self): """Generates initial population with random positions and speeds.""" 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 ...
[ "def", "initialize_pop", "(", "self", ")", ":", "self", ".", "population", "=", "self", ".", "toolbox", ".", "swarm", "(", "n", "=", "self", ".", "_params", "[", "'popsize'", "]", ")", "if", "self", ".", "_params", "[", "'neighbours'", "]", ":", "for...
Generates initial population with random positions and speeds.
[ "Generates", "initial", "population", "with", "random", "positions", "and", "speeds", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/optimisation/optimizer.py#L647-L669
42,950
woolfson-group/isambard
isambard/optimisation/optimizer.py
OptGA.initialize_pop
def initialize_pop(self): """Assigns initial fitnesses.""" self.toolbox.register("individual", self.generate) self.toolbox.register("population", tools.initRepeat, list, self.toolbox.individual) self.population = self.toolbox.population(n=self._params['popsi...
python
def initialize_pop(self): """Assigns initial fitnesses.""" self.toolbox.register("individual", self.generate) self.toolbox.register("population", tools.initRepeat, list, self.toolbox.individual) self.population = self.toolbox.population(n=self._params['popsi...
[ "def", "initialize_pop", "(", "self", ")", ":", "self", ".", "toolbox", ".", "register", "(", "\"individual\"", ",", "self", ".", "generate", ")", "self", ".", "toolbox", ".", "register", "(", "\"population\"", ",", "tools", ".", "initRepeat", ",", "list",...
Assigns initial fitnesses.
[ "Assigns", "initial", "fitnesses", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/optimisation/optimizer.py#L792-L799
42,951
woolfson-group/isambard
isambard/optimisation/mmc_optimizer.py
MMCParameter.randomise_proposed_value
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. """ if self.parameter_type is MMCPa...
python
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. """ if self.parameter_type is MMCPa...
[ "def", "randomise_proposed_value", "(", "self", ")", ":", "if", "self", ".", "parameter_type", "is", "MMCParameterType", ".", "UNIFORM_DIST", ":", "(", "a", ",", "b", ")", "=", "self", ".", "static_dist_or_list", "self", ".", "proposed_value", "=", "random", ...
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.
[ "Creates", "a", "randomly", "the", "proposed", "value", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/optimisation/mmc_optimizer.py#L87-L114
42,952
woolfson-group/isambard
isambard/optimisation/mmc_optimizer.py
MMCParameter.accept_proposed_value
def accept_proposed_value(self): """Changes the current value to the proposed value.""" if self.proposed_value is not None: self.current_value = self.proposed_value self.proposed_value = None return
python
def accept_proposed_value(self): """Changes the current value to the proposed value.""" if self.proposed_value is not None: self.current_value = self.proposed_value self.proposed_value = None return
[ "def", "accept_proposed_value", "(", "self", ")", ":", "if", "self", ".", "proposed_value", "is", "not", "None", ":", "self", ".", "current_value", "=", "self", ".", "proposed_value", "self", ".", "proposed_value", "=", "None", "return" ]
Changes the current value to the proposed value.
[ "Changes", "the", "current", "value", "to", "the", "proposed", "value", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/optimisation/mmc_optimizer.py#L116-L121
42,953
woolfson-group/isambard
isambard/optimisation/mmc_optimizer.py
MMCParameterOptimisation.start_optimisation
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. """ ...
python
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. """ ...
[ "def", "start_optimisation", "(", "self", ",", "rounds", ",", "temp", "=", "298.15", ")", ":", "self", ".", "_generate_initial_model", "(", ")", "self", ".", "_mmc_loop", "(", "rounds", ",", "temp", "=", "temp", ")", "return" ]
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.
[ "Begin", "the", "optimisation", "run", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/optimisation/mmc_optimizer.py#L194-L206
42,954
woolfson-group/isambard
isambard/optimisation/mmc_optimizer.py
MMCParameterOptimisation._generate_initial_model
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. """ ...
python
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. """ ...
[ "def", "_generate_initial_model", "(", "self", ")", ":", "initial_parameters", "=", "[", "p", ".", "current_value", "for", "p", "in", "self", ".", "current_parameters", "]", "try", ":", "initial_model", "=", "self", ".", "specification", "(", "*", "initial_par...
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.
[ "Creates", "the", "initial", "model", "for", "the", "optimistation", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/optimisation/mmc_optimizer.py#L208-L231
42,955
woolfson-group/isambard
isambard/optimisation/mmc_optimizer.py
MMCParameterOptimisation._mmc_loop
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 :...
python
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 :...
[ "def", "_mmc_loop", "(", "self", ",", "rounds", ",", "temp", "=", "298.15", ",", "verbose", "=", "True", ")", ":", "# TODO add weighted randomisation of altered variable", "current_round", "=", "0", "while", "current_round", "<", "rounds", ":", "modifiable", "=", ...
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...
[ "The", "main", "MMC", "loop", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/optimisation/mmc_optimizer.py#L233-L289
42,956
woolfson-group/isambard
isambard/optimisation/evo_optimizers.py
DE._crossover
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 hand...
python
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 hand...
[ "def", "_crossover", "(", "self", ",", "ind", ")", ":", "if", "self", ".", "neighbours", ":", "a", ",", "b", ",", "c", "=", "random", ".", "sample", "(", "[", "self", ".", "population", "[", "i", "]", "for", "i", "in", "ind", ".", "neighbours", ...
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...
[ "Used", "by", "the", "evolution", "process", "to", "generate", "a", "new", "individual", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/optimisation/evo_optimizers.py#L98-L141
42,957
woolfson-group/isambard
isambard/optimisation/evo_optimizers.py
PSO._generate
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...
python
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...
[ "def", "_generate", "(", "self", ")", ":", "part", "=", "creator", ".", "Particle", "(", "[", "random", ".", "uniform", "(", "-", "1", ",", "1", ")", "for", "_", "in", "range", "(", "len", "(", "self", ".", "value_means", ")", ")", "]", ")", "p...
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...
[ "Generates", "a", "particle", "using", "the", "creator", "function", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/optimisation/evo_optimizers.py#L233-L257
42,958
woolfson-group/isambard
isambard/optimisation/evo_optimizers.py
PSO.update_particle
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. """ neighbour_...
python
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. """ neighbour_...
[ "def", "update_particle", "(", "self", ",", "part", ",", "chi", "=", "0.729843788", ",", "c", "=", "2.05", ")", ":", "neighbour_pool", "=", "[", "self", ".", "population", "[", "i", "]", "for", "i", "in", "part", ".", "neighbours", "]", "best_neighbour...
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.
[ "Constriction", "factor", "update", "particle", "method", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/optimisation/evo_optimizers.py#L259-L287
42,959
woolfson-group/isambard
isambard/optimisation/evo_optimizers.py
CMAES._make_individual
def _make_individual(self, paramlist): """Makes an individual particle.""" part = creator.Individual(paramlist) part.ident = None return part
python
def _make_individual(self, paramlist): """Makes an individual particle.""" part = creator.Individual(paramlist) part.ident = None return part
[ "def", "_make_individual", "(", "self", ",", "paramlist", ")", ":", "part", "=", "creator", ".", "Individual", "(", "paramlist", ")", "part", ".", "ident", "=", "None", "return", "part" ]
Makes an individual particle.
[ "Makes", "an", "individual", "particle", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/optimisation/evo_optimizers.py#L494-L498
42,960
woolfson-group/isambard
isambard/add_ons/filesystem.py
number_of_mmols
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...
python
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...
[ "def", "number_of_mmols", "(", "code", ")", ":", "# If num_mmols is already known, return it", "if", "mmols_numbers", ":", "if", "code", "in", "mmols_numbers", ".", "keys", "(", ")", ":", "mmol", "=", "mmols_numbers", "[", "code", "]", "[", "0", "]", "return",...
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 ------...
[ "Number", "of", ".", "mmol", "files", "associated", "with", "code", "in", "the", "PDBE", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/add_ons/filesystem.py#L229-L280
42,961
woolfson-group/isambard
isambard/add_ons/filesystem.py
get_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...
python
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...
[ "def", "get_mmol", "(", "code", ",", "mmol_number", "=", "None", ",", "outfile", "=", "None", ")", ":", "if", "not", "mmol_number", ":", "try", ":", "mmol_number", "=", "preferred_mmol", "(", "code", "=", "code", ")", "except", "(", "ValueError", ",", ...
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...
[ "Get", "mmol", "file", "from", "PDBe", "and", "return", "its", "content", "as", "a", "string", ".", "Write", "to", "file", "if", "outfile", "given", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/add_ons/filesystem.py#L283-L343
42,962
woolfson-group/isambard
isambard/add_ons/filesystem.py
get_mmcif
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. """ ...
python
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. """ ...
[ "def", "get_mmcif", "(", "code", ",", "outfile", "=", "None", ")", ":", "pdbe_url", "=", "\"http://www.ebi.ac.uk/pdbe/entry-files/download/{0}.cif\"", ".", "format", "(", "code", ")", "r", "=", "requests", ".", "get", "(", "pdbe_url", ")", "if", "r", ".", "s...
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.
[ "Get", "mmcif", "file", "associated", "with", "code", "from", "PDBE", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/add_ons/filesystem.py#L381-L409
42,963
woolfson-group/isambard
isambard/add_ons/filesystem.py
pdbe_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. """ url = 'http://www....
python
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. """ url = 'http://www....
[ "def", "pdbe_status_code", "(", "code", ")", ":", "url", "=", "'http://www.ebi.ac.uk/pdbe/entry-files/download/{0}_1.mmol'", ".", "format", "(", "code", ")", "r", "=", "requests", ".", "head", "(", "url", "=", "url", ")", "return", "r", ".", "status_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.
[ "Check", "if", "a", "PDB", "code", "has", "structure", "files", "on", "the", "PDBE", "site", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/add_ons/filesystem.py#L412-L427
42,964
woolfson-group/isambard
isambard/add_ons/filesystem.py
preferred_mmol
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 ---------- c...
python
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 ---------- c...
[ "def", "preferred_mmol", "(", "code", ")", ":", "# If preferred mmol number is already known, return it", "if", "code", "in", "mmols_numbers", ".", "keys", "(", ")", ":", "mmol", "=", "mmols_numbers", "[", "code", "]", "[", "1", "]", "return", "mmol", "elif", ...
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. ...
[ "Get", "mmol", "number", "of", "preferred", "biological", "assembly", "as", "listed", "in", "the", "PDBe", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/add_ons/filesystem.py#L430-L485
42,965
woolfson-group/isambard
isambard/add_ons/filesystem.py
current_codes_from_pdb
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). """ url = 'http://www.rcsb.org/pdb/rest/getCurrent' r = requests.get(url) if r.status_code == 200: pdb_codes ...
python
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). """ url = 'http://www.rcsb.org/pdb/rest/getCurrent' r = requests.get(url) if r.status_code == 200: pdb_codes ...
[ "def", "current_codes_from_pdb", "(", ")", ":", "url", "=", "'http://www.rcsb.org/pdb/rest/getCurrent'", "r", "=", "requests", ".", "get", "(", "url", ")", "if", "r", ".", "status_code", "==", "200", ":", "pdb_codes", "=", "[", "x", ".", "lower", "(", ")",...
Get list of all PDB codes currently listed in the PDB. Returns ------- pdb_codes : list(str) List of PDB codes (in lower case).
[ "Get", "list", "of", "all", "PDB", "codes", "currently", "listed", "in", "the", "PDB", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/add_ons/filesystem.py#L489-L504
42,966
woolfson-group/isambard
isambard/add_ons/filesystem.py
FileSystem.mmols
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 ...
python
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 ...
[ "def", "mmols", "(", "self", ")", ":", "mmols_dict", "=", "{", "}", "mmol_dir", "=", "os", ".", "path", ".", "join", "(", "self", ".", "parent_dir", ",", "'structures'", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "mmol_dir", ")", ":",...
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...
[ "Dict", "of", "filepaths", "for", "all", "mmol", "files", "associated", "with", "code", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/add_ons/filesystem.py#L65-L91
42,967
woolfson-group/isambard
isambard/add_ons/filesystem.py
FileSystem.dssps
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...
python
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...
[ "def", "dssps", "(", "self", ")", ":", "dssps_dict", "=", "{", "}", "dssp_dir", "=", "os", ".", "path", ".", "join", "(", "self", ".", "parent_dir", ",", "'dssp'", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "dssp_dir", ")", ":", "os...
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 ...
[ "Dict", "of", "filepaths", "for", "all", "dssp", "files", "associated", "with", "code", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/add_ons/filesystem.py#L94-L128
42,968
woolfson-group/isambard
isambard/add_ons/filesystem.py
FileSystem.fastas
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 -...
python
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 -...
[ "def", "fastas", "(", "self", ",", "download", "=", "False", ")", ":", "fastas_dict", "=", "{", "}", "fasta_dir", "=", "os", ".", "path", ".", "join", "(", "self", ".", "parent_dir", ",", "'fasta'", ")", "if", "not", "os", ".", "path", ".", "exists...
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....
[ "Dict", "of", "filepaths", "for", "all", "fasta", "files", "associated", "with", "code", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/add_ons/filesystem.py#L131-L179
42,969
woolfson-group/isambard
isambard/add_ons/filesystem.py
FileSystem.mmcif
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. """ mmcif_dir = os.path.join(self.parent_dir, 'm...
python
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. """ mmcif_dir = os.path.join(self.parent_dir, 'm...
[ "def", "mmcif", "(", "self", ")", ":", "mmcif_dir", "=", "os", ".", "path", ".", "join", "(", "self", ".", "parent_dir", ",", "'mmcif'", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "mmcif_dir", ")", ":", "os", ".", "makedirs", "(", "...
Filepath for mmcif file associated with code. Notes ----- Downloads mmcif file if not already present. Returns ------- mmcif_file : str Filepath for the mmcif file.
[ "Filepath", "for", "mmcif", "file", "associated", "with", "code", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/add_ons/filesystem.py#L197-L216
42,970
woolfson-group/isambard
isambard/ampal/ligands.py
LigandGroup.categories
def categories(self): """Returns the categories of `Ligands` in `LigandGroup`.""" category_dict = {} for ligand in self: if ligand.category in category_dict: category_dict[ligand.category].append(ligand) else: category_dict[ligand.category]...
python
def categories(self): """Returns the categories of `Ligands` in `LigandGroup`.""" category_dict = {} for ligand in self: if ligand.category in category_dict: category_dict[ligand.category].append(ligand) else: category_dict[ligand.category]...
[ "def", "categories", "(", "self", ")", ":", "category_dict", "=", "{", "}", "for", "ligand", "in", "self", ":", "if", "ligand", ".", "category", "in", "category_dict", ":", "category_dict", "[", "ligand", ".", "category", "]", ".", "append", "(", "ligand...
Returns the categories of `Ligands` in `LigandGroup`.
[ "Returns", "the", "categories", "of", "Ligands", "in", "LigandGroup", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/ligands.py#L34-L42
42,971
woolfson-group/isambard
isambard/ampal/ligands.py
LigandGroup.category_count
def category_count(self): """Returns the number of categories in `categories`.""" category_dict = self.categories count_dict = {category: len( category_dict[category]) for category in category_dict} return count_dict
python
def category_count(self): """Returns the number of categories in `categories`.""" category_dict = self.categories count_dict = {category: len( category_dict[category]) for category in category_dict} return count_dict
[ "def", "category_count", "(", "self", ")", ":", "category_dict", "=", "self", ".", "categories", "count_dict", "=", "{", "category", ":", "len", "(", "category_dict", "[", "category", "]", ")", "for", "category", "in", "category_dict", "}", "return", "count_...
Returns the number of categories in `categories`.
[ "Returns", "the", "number", "of", "categories", "in", "categories", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/ligands.py#L45-L50
42,972
woolfson-group/isambard
isambard/ampal/analyse_protein.py
sequence_molecular_weight
def sequence_molecular_weight(seq): """Returns the molecular weight of the polypeptide sequence. Notes ----- Units = Daltons Parameters ---------- seq : str Sequence of amino acids. """ if 'X' in seq: warnings.warn(_nc_warning_str, NoncanonicalWarning) return su...
python
def sequence_molecular_weight(seq): """Returns the molecular weight of the polypeptide sequence. Notes ----- Units = Daltons Parameters ---------- seq : str Sequence of amino acids. """ if 'X' in seq: warnings.warn(_nc_warning_str, NoncanonicalWarning) return su...
[ "def", "sequence_molecular_weight", "(", "seq", ")", ":", "if", "'X'", "in", "seq", ":", "warnings", ".", "warn", "(", "_nc_warning_str", ",", "NoncanonicalWarning", ")", "return", "sum", "(", "[", "residue_mwt", "[", "aa", "]", "*", "n", "for", "aa", ",...
Returns the molecular weight of the polypeptide sequence. Notes ----- Units = Daltons Parameters ---------- seq : str Sequence of amino acids.
[ "Returns", "the", "molecular", "weight", "of", "the", "polypeptide", "sequence", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/analyse_protein.py#L18-L33
42,973
woolfson-group/isambard
isambard/ampal/analyse_protein.py
sequence_molar_extinction_280
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. """ if 'X' in seq: warnings.warn(_nc_warning_str, NoncanonicalWarning) ...
python
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. """ if 'X' in seq: warnings.warn(_nc_warning_str, NoncanonicalWarning) ...
[ "def", "sequence_molar_extinction_280", "(", "seq", ")", ":", "if", "'X'", "in", "seq", ":", "warnings", ".", "warn", "(", "_nc_warning_str", ",", "NoncanonicalWarning", ")", "return", "sum", "(", "[", "residue_ext_280", "[", "aa", "]", "*", "n", "for", "a...
Returns the molar extinction coefficient of the sequence at 280 nm. Notes ----- Units = M/cm Parameters ---------- seq : str Sequence of amino acids.
[ "Returns", "the", "molar", "extinction", "coefficient", "of", "the", "sequence", "at", "280", "nm", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/analyse_protein.py#L38-L52
42,974
woolfson-group/isambard
isambard/ampal/analyse_protein.py
partial_charge
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. """ difference = pH - residue_pka[aa] if residue_charge[aa] > 0: difference *= -1 ratio = ...
python
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. """ difference = pH - residue_pka[aa] if residue_charge[aa] > 0: difference *= -1 ratio = ...
[ "def", "partial_charge", "(", "aa", ",", "pH", ")", ":", "difference", "=", "pH", "-", "residue_pka", "[", "aa", "]", "if", "residue_charge", "[", "aa", "]", ">", "0", ":", "difference", "*=", "-", "1", "ratio", "=", "(", "10", "**", "difference", ...
Calculates the partial charge of the amino acid. Parameters ---------- aa : str Amino acid single-letter code. pH : float pH of interest.
[ "Calculates", "the", "partial", "charge", "of", "the", "amino", "acid", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/analyse_protein.py#L55-L69
42,975
woolfson-group/isambard
isambard/ampal/analyse_protein.py
sequence_charge
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. """ if 'X' in seq: warnings.warn(_nc_warning_str, NoncanonicalWarning) adj_prot...
python
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. """ if 'X' in seq: warnings.warn(_nc_warning_str, NoncanonicalWarning) adj_prot...
[ "def", "sequence_charge", "(", "seq", ",", "pH", "=", "7.4", ")", ":", "if", "'X'", "in", "seq", ":", "warnings", ".", "warn", "(", "_nc_warning_str", ",", "NoncanonicalWarning", ")", "adj_protein_charge", "=", "sum", "(", "[", "partial_charge", "(", "aa",...
Calculates the total charge of the input polypeptide sequence. Parameters ---------- seq : str Sequence of amino acids. pH : float pH of interest.
[ "Calculates", "the", "total", "charge", "of", "the", "input", "polypeptide", "sequence", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/analyse_protein.py#L72-L91
42,976
woolfson-group/isambard
isambard/ampal/analyse_protein.py
charge_series
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...] """ if 'X' in seq: warnings.warn(_nc_war...
python
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...] """ if 'X' in seq: warnings.warn(_nc_war...
[ "def", "charge_series", "(", "seq", ",", "granularity", "=", "0.1", ")", ":", "if", "'X'", "in", "seq", ":", "warnings", ".", "warn", "(", "_nc_warning_str", ",", "NoncanonicalWarning", ")", "ph_range", "=", "numpy", ".", "arange", "(", "1", ",", "13", ...
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...]
[ "Calculates", "the", "charge", "for", "pH", "1", "-", "13", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/analyse_protein.py#L94-L108
42,977
woolfson-group/isambard
isambard/ampal/analyse_protein.py
sequence_isoelectric_point
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...] """ if '...
python
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...] """ if '...
[ "def", "sequence_isoelectric_point", "(", "seq", ",", "granularity", "=", "0.1", ")", ":", "if", "'X'", "in", "seq", ":", "warnings", ".", "warn", "(", "_nc_warning_str", ",", "NoncanonicalWarning", ")", "ph_range", ",", "charge_at_ph", "=", "charge_series", "...
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...]
[ "Calculates", "the", "isoelectric", "point", "of", "the", "sequence", "for", "ph", "1", "-", "13", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/analyse_protein.py#L111-L126
42,978
woolfson-group/isambard
isambard/ampal/analyse_protein.py
measure_sidechain_torsion_angles
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 ...
python
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 ...
[ "def", "measure_sidechain_torsion_angles", "(", "residue", ",", "verbose", "=", "True", ")", ":", "chi_angles", "=", "[", "]", "aa", "=", "residue", ".", "mol_code", "if", "aa", "not", "in", "side_chain_dihedrals", ":", "if", "verbose", ":", "print", "(", ...
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] ...
[ "Calculates", "sidechain", "dihedral", "angles", "for", "a", "residue" ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/analyse_protein.py#L129-L170
42,979
woolfson-group/isambard
isambard/ampal/analyse_protein.py
measure_torsion_angles
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 t...
python
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 t...
[ "def", "measure_torsion_angles", "(", "residues", ")", ":", "if", "len", "(", "residues", ")", "<", "2", ":", "torsion_angles", "=", "[", "(", "None", ",", "None", ",", "None", ")", "]", "*", "len", "(", "residues", ")", "else", ":", "torsion_angles", ...
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]....
[ "Calculates", "the", "dihedral", "angles", "for", "a", "list", "of", "backbone", "atoms", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/analyse_protein.py#L173-L260
42,980
woolfson-group/isambard
isambard/ampal/analyse_protein.py
cc_to_local_params
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 : ...
python
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 : ...
[ "def", "cc_to_local_params", "(", "pitch", ",", "radius", ",", "oligo", ")", ":", "rloc", "=", "numpy", ".", "sin", "(", "numpy", ".", "pi", "/", "oligo", ")", "*", "radius", "alpha", "=", "numpy", ".", "arctan", "(", "(", "2", "*", "numpy", ".", ...
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...
[ "Returns", "local", "parameters", "for", "an", "oligomeric", "assembly", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/analyse_protein.py#L264-L289
42,981
woolfson-group/isambard
isambard/ampal/analyse_protein.py
residues_per_turn
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 ...
python
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 ...
[ "def", "residues_per_turn", "(", "p", ")", ":", "cas", "=", "p", ".", "get_reference_coords", "(", ")", "prim_cas", "=", "p", ".", "primitive", ".", "coordinates", "dhs", "=", "[", "abs", "(", "dihedral", "(", "cas", "[", "i", "]", ",", "prim_cas", "...
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...
[ "The", "number", "of", "residues", "per", "turn", "at", "each", "Monomer", "in", "the", "Polymer", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/analyse_protein.py#L292-L320
42,982
woolfson-group/isambard
isambard/ampal/analyse_protein.py
polymer_to_reference_axis_distances
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 referen...
python
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 referen...
[ "def", "polymer_to_reference_axis_distances", "(", "p", ",", "reference_axis", ",", "tag", "=", "True", ",", "reference_axis_name", "=", "'ref_axis'", ")", ":", "if", "not", "len", "(", "p", ")", "==", "len", "(", "reference_axis", ")", ":", "raise", "ValueE...
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 ...
[ "Returns", "distances", "between", "the", "primitive", "of", "a", "Polymer", "and", "a", "reference_axis", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/analyse_protein.py#L323-L375
42,983
woolfson-group/isambard
isambard/ampal/analyse_protein.py
crick_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_ax...
python
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_ax...
[ "def", "crick_angles", "(", "p", ",", "reference_axis", ",", "tag", "=", "True", ",", "reference_axis_name", "=", "'ref_axis'", ")", ":", "if", "not", "len", "(", "p", ")", "==", "len", "(", "reference_axis", ")", ":", "raise", "ValueError", "(", "\"The ...
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`. ...
[ "Returns", "the", "Crick", "angle", "for", "each", "CA", "atom", "in", "the", "Polymer", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/analyse_protein.py#L378-L428
42,984
woolfson-group/isambard
isambard/ampal/analyse_protein.py
alpha_angles
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 ...
python
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 ...
[ "def", "alpha_angles", "(", "p", ",", "reference_axis", ",", "tag", "=", "True", ",", "reference_axis_name", "=", "'ref_axis'", ")", ":", "if", "not", "len", "(", "p", ")", "==", "len", "(", "reference_axis", ")", ":", "raise", "ValueError", "(", "\"The ...
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...
[ "Alpha", "angle", "calculated", "using", "points", "on", "the", "primitive", "of", "helix", "and", "axis", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/analyse_protein.py#L431-L481
42,985
woolfson-group/isambard
isambard/ampal/analyse_protein.py
reference_axis_from_chains
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 Chain...
python
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 Chain...
[ "def", "reference_axis_from_chains", "(", "chains", ")", ":", "if", "not", "len", "(", "set", "(", "[", "len", "(", "x", ")", "for", "x", "in", "chains", "]", ")", ")", "==", "1", ":", "raise", "ValueError", "(", "\"All chains must be of the same length\""...
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, ...
[ "Average", "coordinates", "from", "a", "set", "of", "primitives", "calculated", "from", "Chains", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/analyse_protein.py#L525-L563
42,986
woolfson-group/isambard
isambard/ampal/analyse_protein.py
flip_reference_axis_if_antiparallel
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 ...
python
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 ...
[ "def", "flip_reference_axis_if_antiparallel", "(", "p", ",", "reference_axis", ",", "start_index", "=", "0", ",", "end_index", "=", "-", "1", ")", ":", "p_vector", "=", "polypeptide_vector", "(", "p", ",", "start_index", "=", "start_index", ",", "end_index", "...
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...
[ "Flips", "reference", "axis", "if", "direction", "opposes", "the", "direction", "of", "the", "Polymer", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/analyse_protein.py#L566-L599
42,987
woolfson-group/isambard
isambard/ampal/analyse_protein.py
make_primitive
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 nu...
python
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 nu...
[ "def", "make_primitive", "(", "cas_coords", ",", "window_length", "=", "3", ")", ":", "if", "len", "(", "cas_coords", ")", ">=", "window_length", ":", "primitive", "=", "[", "]", "count", "=", "0", "for", "_", "in", "cas_coords", "[", ":", "-", "(", ...
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...
[ "Calculates", "running", "average", "of", "cas_coords", "with", "a", "fixed", "averaging", "window_length", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/analyse_protein.py#L602-L638
42,988
woolfson-group/isambard
isambard/ampal/analyse_protein.py
make_primitive_smoothed
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 time...
python
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 time...
[ "def", "make_primitive_smoothed", "(", "cas_coords", ",", "smoothing_level", "=", "2", ")", ":", "try", ":", "s_primitive", "=", "make_primitive", "(", "cas_coords", ")", "for", "x", "in", "range", "(", "smoothing_level", ")", ":", "s_primitive", "=", "make_pr...
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...
[ "Generates", "smoothed", "primitive", "from", "a", "list", "of", "coordinates", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/analyse_protein.py#L641-L671
42,989
woolfson-group/isambard
isambard/ampal/analyse_protein.py
make_primitive_extrapolate_ends
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 calculat...
python
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 calculat...
[ "def", "make_primitive_extrapolate_ends", "(", "cas_coords", ",", "smoothing_level", "=", "2", ")", ":", "try", ":", "smoothed_primitive", "=", "make_primitive_smoothed", "(", "cas_coords", ",", "smoothing_level", "=", "smoothing_level", ")", "except", "ValueError", "...
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' ...
[ "Generates", "smoothed", "helix", "primitives", "and", "extrapolates", "lost", "ends", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/analyse_protein.py#L674-L724
42,990
woolfson-group/isambard
isambard/ampal/assembly.py
AmpalContainer.extend
def extend(self, ampal_container): """Extends an `AmpalContainer` with another `AmpalContainer`.""" if isinstance(ampal_container, AmpalContainer): self._ampal_objects.extend(ampal_container) else: raise TypeError( 'Only AmpalContainer objects may be merge...
python
def extend(self, ampal_container): """Extends an `AmpalContainer` with another `AmpalContainer`.""" if isinstance(ampal_container, AmpalContainer): self._ampal_objects.extend(ampal_container) else: raise TypeError( 'Only AmpalContainer objects may be merge...
[ "def", "extend", "(", "self", ",", "ampal_container", ")", ":", "if", "isinstance", "(", "ampal_container", ",", "AmpalContainer", ")", ":", "self", ".", "_ampal_objects", ".", "extend", "(", "ampal_container", ")", "else", ":", "raise", "TypeError", "(", "'...
Extends an `AmpalContainer` with another `AmpalContainer`.
[ "Extends", "an", "AmpalContainer", "with", "another", "AmpalContainer", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/assembly.py#L82-L90
42,991
woolfson-group/isambard
isambard/ampal/assembly.py
AmpalContainer.pdb
def pdb(self): """Compiles the PDB strings for each state into a single file.""" 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):...
python
def pdb(self): """Compiles the PDB strings for each state into a single file.""" 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):...
[ "def", "pdb", "(", "self", ")", ":", "header_title", "=", "'{:<80}\\n'", ".", "format", "(", "'HEADER {}'", ".", "format", "(", "self", ".", "id", ")", ")", "data_type", "=", "'{:<80}\\n'", ".", "format", "(", "'EXPDTA ISAMBARD Model'", ")", "pdb_strs"...
Compiles the PDB strings for each state into a single file.
[ "Compiles", "the", "PDB", "strings", "for", "each", "state", "into", "a", "single", "file", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/assembly.py#L93-L106
42,992
woolfson-group/isambard
isambard/ampal/assembly.py
AmpalContainer.sort_by_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. """ return AmpalContainer(sorted(self, key=lambda x: x.tags[tag]))
python
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. """ return AmpalContainer(sorted(self, key=lambda x: x.tags[tag]))
[ "def", "sort_by_tag", "(", "self", ",", "tag", ")", ":", "return", "AmpalContainer", "(", "sorted", "(", "self", ",", "key", "=", "lambda", "x", ":", "x", ".", "tags", "[", "tag", "]", ")", ")" ]
Sorts the `AmpalContainer` by a tag on the component objects. Parameters ---------- tag : str Key of tag used for sorting.
[ "Sorts", "the", "AmpalContainer", "by", "a", "tag", "on", "the", "component", "objects", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/assembly.py#L108-L116
42,993
woolfson-group/isambard
isambard/ampal/assembly.py
Assembly.append
def append(self, item): """Adds a `Polymer` to the `Assembly`. Raises ------ TypeError Raised if other is any type other than `Polymer`. """ if isinstance(item, Polymer): self._molecules.append(item) else: raise TypeError( ...
python
def append(self, item): """Adds a `Polymer` to the `Assembly`. Raises ------ TypeError Raised if other is any type other than `Polymer`. """ if isinstance(item, Polymer): self._molecules.append(item) else: raise TypeError( ...
[ "def", "append", "(", "self", ",", "item", ")", ":", "if", "isinstance", "(", "item", ",", "Polymer", ")", ":", "self", ".", "_molecules", ".", "append", "(", "item", ")", "else", ":", "raise", "TypeError", "(", "'Only Polymer objects can be appended to an A...
Adds a `Polymer` to the `Assembly`. Raises ------ TypeError Raised if other is any type other than `Polymer`.
[ "Adds", "a", "Polymer", "to", "the", "Assembly", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/assembly.py#L216-L229
42,994
woolfson-group/isambard
isambard/ampal/assembly.py
Assembly.extend
def extend(self, assembly): """Extends the `Assembly` with the contents of another `Assembly`. Raises ------ TypeError Raised if other is any type other than `Assembly`. """ if isinstance(assembly, Assembly): self._molecules.extend(assembly) ...
python
def extend(self, assembly): """Extends the `Assembly` with the contents of another `Assembly`. Raises ------ TypeError Raised if other is any type other than `Assembly`. """ if isinstance(assembly, Assembly): self._molecules.extend(assembly) ...
[ "def", "extend", "(", "self", ",", "assembly", ")", ":", "if", "isinstance", "(", "assembly", ",", "Assembly", ")", ":", "self", ".", "_molecules", ".", "extend", "(", "assembly", ")", "else", ":", "raise", "TypeError", "(", "'Only Assembly objects may be me...
Extends the `Assembly` with the contents of another `Assembly`. Raises ------ TypeError Raised if other is any type other than `Assembly`.
[ "Extends", "the", "Assembly", "with", "the", "contents", "of", "another", "Assembly", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/assembly.py#L231-L244
42,995
woolfson-group/isambard
isambard/ampal/assembly.py
Assembly.get_monomers
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 i...
python
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 i...
[ "def", "get_monomers", "(", "self", ",", "ligands", "=", "True", ",", "pseudo_group", "=", "False", ")", ":", "base_filters", "=", "dict", "(", "ligands", "=", "ligands", ",", "pseudo_group", "=", "pseudo_group", ")", "restricted_mol_types", "=", "[", "x", ...
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.
[ "Retrieves", "all", "the", "Monomers", "from", "the", "Assembly", "object", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/assembly.py#L246-L261
42,996
woolfson-group/isambard
isambard/ampal/assembly.py
Assembly.get_ligands
def get_ligands(self, solvent=True): """Retrieves all ligands from the `Assembly`. Parameters ---------- solvent : bool, optional If `True`, solvent molecules will be included. """ if solvent: ligand_list = [x for x in self.get_monomers() ...
python
def get_ligands(self, solvent=True): """Retrieves all ligands from the `Assembly`. Parameters ---------- solvent : bool, optional If `True`, solvent molecules will be included. """ if solvent: ligand_list = [x for x in self.get_monomers() ...
[ "def", "get_ligands", "(", "self", ",", "solvent", "=", "True", ")", ":", "if", "solvent", ":", "ligand_list", "=", "[", "x", "for", "x", "in", "self", ".", "get_monomers", "(", ")", "if", "isinstance", "(", "x", ",", "Ligand", ")", "]", "else", ":...
Retrieves all ligands from the `Assembly`. Parameters ---------- solvent : bool, optional If `True`, solvent molecules will be included.
[ "Retrieves", "all", "ligands", "from", "the", "Assembly", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/assembly.py#L263-L277
42,997
woolfson-group/isambard
isambard/ampal/assembly.py
Assembly.get_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 `Ato...
python
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 `Ato...
[ "def", "get_atoms", "(", "self", ",", "ligands", "=", "True", ",", "pseudo_group", "=", "False", ",", "inc_alt_states", "=", "False", ")", ":", "atoms", "=", "itertools", ".", "chain", "(", "*", "(", "list", "(", "m", ".", "get_atoms", "(", "inc_alt_st...
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...
[ "Flat", "list", "of", "all", "the", "Atoms", "in", "the", "Assembly", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/assembly.py#L279-L300
42,998
woolfson-group/isambard
isambard/ampal/assembly.py
Assembly.is_within
def is_within(self, cutoff_dist, point, ligands=True): """Returns all atoms in AMPAL object within `cut-off` distance from the `point`.""" return find_atoms_within_distance(self.get_atoms(ligands=ligands), cutoff_dist, point)
python
def is_within(self, cutoff_dist, point, ligands=True): """Returns all atoms in AMPAL object within `cut-off` distance from the `point`.""" return find_atoms_within_distance(self.get_atoms(ligands=ligands), cutoff_dist, point)
[ "def", "is_within", "(", "self", ",", "cutoff_dist", ",", "point", ",", "ligands", "=", "True", ")", ":", "return", "find_atoms_within_distance", "(", "self", ".", "get_atoms", "(", "ligands", "=", "ligands", ")", ",", "cutoff_dist", ",", "point", ")" ]
Returns all atoms in AMPAL object within `cut-off` distance from the `point`.
[ "Returns", "all", "atoms", "in", "AMPAL", "object", "within", "cut", "-", "off", "distance", "from", "the", "point", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/assembly.py#L302-L304
42,999
woolfson-group/isambard
isambard/ampal/assembly.py
Assembly.relabel_polymers
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...
python
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...
[ "def", "relabel_polymers", "(", "self", ",", "labels", "=", "None", ")", ":", "if", "labels", ":", "if", "len", "(", "self", ".", "_molecules", ")", "==", "len", "(", "labels", ")", ":", "for", "polymer", ",", "label", "in", "zip", "(", "self", "."...
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...
[ "Relabels", "the", "component", "Polymers", "either", "in", "alphabetical", "order", "or", "using", "a", "list", "of", "labels", "." ]
ebc33b48a28ad217e18f93b910dfba46e6e71e07
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/assembly.py#L313-L336