repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_documentation_string
stringlengths
1
47.2k
func_code_url
stringlengths
85
339
cloudmesh/cloudmesh-common
cloudmesh/common/BaseConfigDict.py
read_yaml_config
def read_yaml_config(filename, check=True, osreplace=True, exit=True): """ reads in a yaml file from the specified filename. If check is set to true the code will fail if the file does not exist. However if it is set to false and the file does not exist, None is returned. :param exit: if true is ex...
python
def read_yaml_config(filename, check=True, osreplace=True, exit=True): """ reads in a yaml file from the specified filename. If check is set to true the code will fail if the file does not exist. However if it is set to false and the file does not exist, None is returned. :param exit: if true is ex...
reads in a yaml file from the specified filename. If check is set to true the code will fail if the file does not exist. However if it is set to false and the file does not exist, None is returned. :param exit: if true is exist with sys exit :param osreplace: if true replaces environment variables from...
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/BaseConfigDict.py#L129-L185
cloudmesh/cloudmesh-common
cloudmesh/common/BaseConfigDict.py
custom_print
def custom_print(data_structure, indent): """ prints a given data structure such as a dict or ordered dict at a given indentation level :param data_structure: :param indent: :return: """ for key, value in data_structure.items(): print("\n%s%s:" % (' ' * attribute_indent * indent, ...
python
def custom_print(data_structure, indent): """ prints a given data structure such as a dict or ordered dict at a given indentation level :param data_structure: :param indent: :return: """ for key, value in data_structure.items(): print("\n%s%s:" % (' ' * attribute_indent * indent, ...
prints a given data structure such as a dict or ordered dict at a given indentation level :param data_structure: :param indent: :return:
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/BaseConfigDict.py#L209-L223
cloudmesh/cloudmesh-common
cloudmesh/common/BaseConfigDict.py
OrderedJsonEncoder.encode
def encode(self, o, depth=0): """ encode the json object at given depth :param o: the object :param depth: the depth :return: the json encoding """ if isinstance(o, OrderedDict): return "{" + ",\n ".join([self.encode(k) + ":" + ...
python
def encode(self, o, depth=0): """ encode the json object at given depth :param o: the object :param depth: the depth :return: the json encoding """ if isinstance(o, OrderedDict): return "{" + ",\n ".join([self.encode(k) + ":" + ...
encode the json object at given depth :param o: the object :param depth: the depth :return: the json encoding
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/BaseConfigDict.py#L194-L206
cloudmesh/cloudmesh-common
cloudmesh/common/BaseConfigDict.py
BaseConfigDict._update_meta
def _update_meta(self): """ internal function to define the metadata regarding filename, location, and prefix. """ for v in ["filename", "location", "prefix"]: if "meta" not in self: self["meta"] = {} self["meta"][v] = self[v] d...
python
def _update_meta(self): """ internal function to define the metadata regarding filename, location, and prefix. """ for v in ["filename", "location", "prefix"]: if "meta" not in self: self["meta"] = {} self["meta"][v] = self[v] d...
internal function to define the metadata regarding filename, location, and prefix.
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/BaseConfigDict.py#L264-L273
cloudmesh/cloudmesh-common
cloudmesh/common/BaseConfigDict.py
BaseConfigDict.load
def load(self, filename): """ Loads the yaml file with the given filename. :param filename: the name of the yaml file """ self._set_filename(filename) if os.path.isfile(self['location']): # d = OrderedDict(read_yaml_config(self['location'], check=True)) ...
python
def load(self, filename): """ Loads the yaml file with the given filename. :param filename: the name of the yaml file """ self._set_filename(filename) if os.path.isfile(self['location']): # d = OrderedDict(read_yaml_config(self['location'], check=True)) ...
Loads the yaml file with the given filename. :param filename: the name of the yaml file
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/BaseConfigDict.py#L284-L307
cloudmesh/cloudmesh-common
cloudmesh/common/BaseConfigDict.py
BaseConfigDict.error_keys_not_found
def error_keys_not_found(self, keys): """ Check if the requested keys are found in the dict. :param keys: keys to be looked for """ try: log.error("Filename: {0}".format(self['meta']['location'])) except: log.error("Filename: {0}".format(self['loc...
python
def error_keys_not_found(self, keys): """ Check if the requested keys are found in the dict. :param keys: keys to be looked for """ try: log.error("Filename: {0}".format(self['meta']['location'])) except: log.error("Filename: {0}".format(self['loc...
Check if the requested keys are found in the dict. :param keys: keys to be looked for
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/BaseConfigDict.py#L361-L379
cloudmesh/cloudmesh-common
cloudmesh/common/BaseConfigDict.py
BaseConfigDict.yaml
def yaml(self): """ returns the yaml output of the dict. """ return ordered_dump(OrderedDict(self), Dumper=yaml.SafeDumper, default_flow_style=False)
python
def yaml(self): """ returns the yaml output of the dict. """ return ordered_dump(OrderedDict(self), Dumper=yaml.SafeDumper, default_flow_style=False)
returns the yaml output of the dict.
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/BaseConfigDict.py#L393-L399
cloudmesh/cloudmesh-common
cloudmesh/common/BaseConfigDict.py
BaseConfigDict.get
def get(self, *keys): """ returns the dict of the information as read from the yaml file. To access the file safely, you can use the keys in the order of the access. Example: get("provisioner","policy") will return the value of config["provisioner"]["policy"] from the yam...
python
def get(self, *keys): """ returns the dict of the information as read from the yaml file. To access the file safely, you can use the keys in the order of the access. Example: get("provisioner","policy") will return the value of config["provisioner"]["policy"] from the yam...
returns the dict of the information as read from the yaml file. To access the file safely, you can use the keys in the order of the access. Example: get("provisioner","policy") will return the value of config["provisioner"]["policy"] from the yaml file if it does not exists an er...
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/BaseConfigDict.py#L425-L447
cloudmesh/cloudmesh-common
cloudmesh/common/BaseConfigDict.py
BaseConfigDict.set
def set(self, value, *keys): """ Sets the dict of the information as read from the yaml file. To access the file safely, you can use the keys in the order of the access. Example: set("{'project':{'fg82':[i0-i10]}}", "provisioner","policy") will set the value of config["provisione...
python
def set(self, value, *keys): """ Sets the dict of the information as read from the yaml file. To access the file safely, you can use the keys in the order of the access. Example: set("{'project':{'fg82':[i0-i10]}}", "provisioner","policy") will set the value of config["provisione...
Sets the dict of the information as read from the yaml file. To access the file safely, you can use the keys in the order of the access. Example: set("{'project':{'fg82':[i0-i10]}}", "provisioner","policy") will set the value of config["provisioner"]["policy"] in the yaml file if it does...
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/BaseConfigDict.py#L449-L477
cloudmesh/cloudmesh-common
cloudmesh/common/BaseConfigDict.py
BaseConfigDict.attribute
def attribute(self, keys): """ TODO: document this method :param keys: """ if self['meta']['prefix'] is None: k = keys else: k = self['meta']['prefix'] + "." + keys return self.get(k)
python
def attribute(self, keys): """ TODO: document this method :param keys: """ if self['meta']['prefix'] is None: k = keys else: k = self['meta']['prefix'] + "." + keys return self.get(k)
TODO: document this method :param keys:
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/BaseConfigDict.py#L488-L498
cloudmesh/cloudmesh-common
cloudmesh/common/Printer.py
Printer.flatwrite
def flatwrite(cls, table, order=None, header=None, output="table", sort_keys=True, show_none="", sep="." ): """ writes the information given in the table :param table: th...
python
def flatwrite(cls, table, order=None, header=None, output="table", sort_keys=True, show_none="", sep="." ): """ writes the information given in the table :param table: th...
writes the information given in the table :param table: the table of values :param order: the order of the columns :param header: the header for the columns :param output: the format (default is table, values are raw, csv, json, yaml, dict :param sort_keys: if true the table is s...
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/Printer.py#L24-L50
cloudmesh/cloudmesh-common
cloudmesh/common/Printer.py
Printer.write
def write(cls, table, order=None, header=None, output="table", sort_keys=True, show_none="" ): """ writes the information given in the table :param table: the table of values :param order: the order of th...
python
def write(cls, table, order=None, header=None, output="table", sort_keys=True, show_none="" ): """ writes the information given in the table :param table: the table of values :param order: the order of th...
writes the information given in the table :param table: the table of values :param order: the order of the columns :param header: the header for the columns :param output: the format (default is table, values are raw, csv, json, yaml, dict :param sort_keys: if true the table is s...
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/Printer.py#L53-L88
cloudmesh/cloudmesh-common
cloudmesh/common/Printer.py
Printer.list
def list(cls, l, order=None, header=None, output="table", sort_keys=True, show_none="" ): """ :param l: l is a list not a dict :param order: :param header: :param output: :param sor...
python
def list(cls, l, order=None, header=None, output="table", sort_keys=True, show_none="" ): """ :param l: l is a list not a dict :param order: :param header: :param output: :param sor...
:param l: l is a list not a dict :param order: :param header: :param output: :param sort_keys: :param show_none: :return:
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/Printer.py#L91-L119
cloudmesh/cloudmesh-common
cloudmesh/common/Printer.py
Printer.dict
def dict(cls, d, order=None, header=None, output="table", sort_keys=True, show_none=""): """ TODO :param d: A a dict with dicts of the same type. :type d: dict :param order:The order in which the column...
python
def dict(cls, d, order=None, header=None, output="table", sort_keys=True, show_none=""): """ TODO :param d: A a dict with dicts of the same type. :type d: dict :param order:The order in which the column...
TODO :param d: A a dict with dicts of the same type. :type d: dict :param order:The order in which the columns are printed. The order is specified by the key names of the dict. :type order: :param header: The Header of each of the columns :type header:...
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/Printer.py#L122-L166
cloudmesh/cloudmesh-common
cloudmesh/common/Printer.py
Printer.csv
def csv(cls, d, order=None, header=None, sort_keys=True): """ prints a table in csv format :param d: A a dict with dicts of the same type. :type d: dict :param order:The order in which the columns are printed. T...
python
def csv(cls, d, order=None, header=None, sort_keys=True): """ prints a table in csv format :param d: A a dict with dicts of the same type. :type d: dict :param order:The order in which the columns are printed. T...
prints a table in csv format :param d: A a dict with dicts of the same type. :type d: dict :param order:The order in which the columns are printed. The order is specified by the key names of the dict. :type order: :param header: The Header of each of the colu...
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/Printer.py#L169-L226
cloudmesh/cloudmesh-common
cloudmesh/common/Printer.py
Printer.dict_table
def dict_table(cls, d, order=None, header=None, sort_keys=True, show_none="", max_width=40): """prints a pretty table from an dict of dicts :param d: A a dict with dicts of the same type. ...
python
def dict_table(cls, d, order=None, header=None, sort_keys=True, show_none="", max_width=40): """prints a pretty table from an dict of dicts :param d: A a dict with dicts of the same type. ...
prints a pretty table from an dict of dicts :param d: A a dict with dicts of the same type. Each key will be a column :param order: The order in which the columns are printed. The order is specified by the key names of the dict. :param header: The Hea...
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/Printer.py#L229-L300
cloudmesh/cloudmesh-common
cloudmesh/common/Printer.py
Printer.attribute
def attribute(cls, d, header=None, order=None, sort_keys=True, output="table"): """prints a attribute/key value table :param d: A a dict with dicts of the same type. Each key will be a colu...
python
def attribute(cls, d, header=None, order=None, sort_keys=True, output="table"): """prints a attribute/key value table :param d: A a dict with dicts of the same type. Each key will be a colu...
prints a attribute/key value table :param d: A a dict with dicts of the same type. Each key will be a column :param order: The order in which the columns are printed. The order is specified by the key names of the dict. :param header: The Header...
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/Printer.py#L303-L350
cloudmesh/cloudmesh-common
cloudmesh/common/Printer.py
Printer.print_list
def print_list(cls, l, output='table'): """ prints a list :param l: the list :param output: the output, default is a table :return: """ def dict_from_list(l): """ returns a dict from a list for printing :param l: the list ...
python
def print_list(cls, l, output='table'): """ prints a list :param l: the list :param output: the output, default is a table :return: """ def dict_from_list(l): """ returns a dict from a list for printing :param l: the list ...
prints a list :param l: the list :param output: the output, default is a table :return:
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/Printer.py#L353-L391
cloudmesh/cloudmesh-common
cloudmesh/common/Printer.py
Printer.row_table
def row_table(cls, d, order=None, labels=None): """prints a pretty table from data in the dict. :param d: A dict to be printed :param order: The order in which the columns are printed. The order is specified by the key names of the dict. :param labels: The array of ...
python
def row_table(cls, d, order=None, labels=None): """prints a pretty table from data in the dict. :param d: A dict to be printed :param order: The order in which the columns are printed. The order is specified by the key names of the dict. :param labels: The array of ...
prints a pretty table from data in the dict. :param d: A dict to be printed :param order: The order in which the columns are printed. The order is specified by the key names of the dict. :param labels: The array of labels for the column
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/Printer.py#L394-L424
cloudmesh/cloudmesh-common
cloudmesh/common/ssh/authorized_keys.py
get_fingerprint_from_public_key
def get_fingerprint_from_public_key(pubkey): """Generate the fingerprint of a public key :param str pubkey: the value of the public key :returns: fingerprint :rtype: str """ # TODO: why is there a tmpdir? with tempdir() as workdir: key = os.path.join(workdir, 'key.pub') wit...
python
def get_fingerprint_from_public_key(pubkey): """Generate the fingerprint of a public key :param str pubkey: the value of the public key :returns: fingerprint :rtype: str """ # TODO: why is there a tmpdir? with tempdir() as workdir: key = os.path.join(workdir, 'key.pub') wit...
Generate the fingerprint of a public key :param str pubkey: the value of the public key :returns: fingerprint :rtype: str
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/ssh/authorized_keys.py#L17-L40
cloudmesh/cloudmesh-common
cloudmesh/common/ssh/authorized_keys.py
AuthorizedKeys.load
def load(cls, path): """ load the keys from a path :param path: the filename (path) in which we find the keys :return: """ auth = cls() with open(path) as fd: for pubkey in itertools.imap(str.strip, fd): # skip empty lines ...
python
def load(cls, path): """ load the keys from a path :param path: the filename (path) in which we find the keys :return: """ auth = cls() with open(path) as fd: for pubkey in itertools.imap(str.strip, fd): # skip empty lines ...
load the keys from a path :param path: the filename (path) in which we find the keys :return:
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/ssh/authorized_keys.py#L52-L66
cloudmesh/cloudmesh-common
cloudmesh/common/ssh/authorized_keys.py
AuthorizedKeys.add
def add(self, pubkey): """ add a public key. :param pubkey: the filename to the public key :return: """ f = get_fingerprint_from_public_key(pubkey) if f not in self._keys: self._order[len(self._keys)] = f self._keys[f] = pubkey
python
def add(self, pubkey): """ add a public key. :param pubkey: the filename to the public key :return: """ f = get_fingerprint_from_public_key(pubkey) if f not in self._keys: self._order[len(self._keys)] = f self._keys[f] = pubkey
add a public key. :param pubkey: the filename to the public key :return:
https://github.com/cloudmesh/cloudmesh-common/blob/ae4fae09cd78205d179ea692dc58f0b0c8fea2b8/cloudmesh/common/ssh/authorized_keys.py#L68-L77
ella/ella
ella/photos/newman_admin.py
PhotoAdmin.thumb
def thumb(self, obj): """ Generates html and thumbnails for admin site. """ format, created = Format.objects.get_or_create(name='newman_thumb', defaults={ 'max_width': 100, 'max_height': 100, 'flex...
python
def thumb(self, obj): """ Generates html and thumbnails for admin site. """ format, created = Format.objects.get_or_create(name='newman_thumb', defaults={ 'max_width': 100, 'max_height': 100, 'flex...
Generates html and thumbnails for admin site.
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/photos/newman_admin.py#L125-L146
ssalentin/plip
plip/plipcmd.py
process_pdb
def process_pdb(pdbfile, outpath, as_string=False, outputprefix='report'): """Analysis of a single PDB file. Can generate textual reports XML, PyMOL session files and images as output.""" if not as_string: startmessage = '\nStarting analysis of %s\n' % pdbfile.split('/')[-1] else: startmessa...
python
def process_pdb(pdbfile, outpath, as_string=False, outputprefix='report'): """Analysis of a single PDB file. Can generate textual reports XML, PyMOL session files and images as output.""" if not as_string: startmessage = '\nStarting analysis of %s\n' % pdbfile.split('/')[-1] else: startmessa...
Analysis of a single PDB file. Can generate textual reports XML, PyMOL session files and images as output.
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/plipcmd.py#L53-L97
ssalentin/plip
plip/plipcmd.py
download_structure
def download_structure(inputpdbid): """Given a PDB ID, downloads the corresponding PDB structure. Checks for validity of ID and handles error while downloading. Returns the path of the downloaded file.""" try: if len(inputpdbid) != 4 or extract_pdbid(inputpdbid.lower()) == 'UnknownProtein': ...
python
def download_structure(inputpdbid): """Given a PDB ID, downloads the corresponding PDB structure. Checks for validity of ID and handles error while downloading. Returns the path of the downloaded file.""" try: if len(inputpdbid) != 4 or extract_pdbid(inputpdbid.lower()) == 'UnknownProtein': ...
Given a PDB ID, downloads the corresponding PDB structure. Checks for validity of ID and handles error while downloading. Returns the path of the downloaded file.
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/plipcmd.py#L100-L116
ssalentin/plip
plip/plipcmd.py
remove_duplicates
def remove_duplicates(slist): """Checks input lists for duplicates and returns a list with unique entries""" unique = list(set(slist)) difference = len(slist) - len(unique) if difference == 1: write_message("Removed one duplicate entry from input list.\n") if difference > 1: writ...
python
def remove_duplicates(slist): """Checks input lists for duplicates and returns a list with unique entries""" unique = list(set(slist)) difference = len(slist) - len(unique) if difference == 1: write_message("Removed one duplicate entry from input list.\n") if difference > 1: writ...
Checks input lists for duplicates and returns a list with unique entries
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/plipcmd.py#L119-L128
ssalentin/plip
plip/plipcmd.py
main
def main(inputstructs, inputpdbids): """Main function. Calls functions for processing, report generation and visualization.""" pdbid, pdbpath = None, None # #@todo For multiprocessing, implement better stacktracing for errors # Print title and version title = "* Protein-Ligand Interaction Profiler v...
python
def main(inputstructs, inputpdbids): """Main function. Calls functions for processing, report generation and visualization.""" pdbid, pdbpath = None, None # #@todo For multiprocessing, implement better stacktracing for errors # Print title and version title = "* Protein-Ligand Interaction Profiler v...
Main function. Calls functions for processing, report generation and visualization.
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/plipcmd.py#L131-L177
ssalentin/plip
plip/plipcmd.py
main_init
def main_init(): """Parse command line arguments and start main script for analysis.""" parser = ArgumentParser(prog="PLIP", description=descript) pdbstructure = parser.add_mutually_exclusive_group(required=True) # Needs either PDB ID or file # '-' as file name reads from stdin pdbstructure.add_arg...
python
def main_init(): """Parse command line arguments and start main script for analysis.""" parser = ArgumentParser(prog="PLIP", description=descript) pdbstructure = parser.add_mutually_exclusive_group(required=True) # Needs either PDB ID or file # '-' as file name reads from stdin pdbstructure.add_arg...
Parse command line arguments and start main script for analysis.
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/plipcmd.py#L184-L307
ella/ella
ella/photos/admin.py
FormatedPhotoForm.clean
def clean(self): """ Validation function that checks the dimensions of the crop whether it fits into the original and the format. """ data = self.cleaned_data photo = data['photo'] if ( (data['crop_left'] > photo.width) or (data['crop_top'] > photo...
python
def clean(self): """ Validation function that checks the dimensions of the crop whether it fits into the original and the format. """ data = self.cleaned_data photo = data['photo'] if ( (data['crop_left'] > photo.width) or (data['crop_top'] > photo...
Validation function that checks the dimensions of the crop whether it fits into the original and the format.
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/photos/admin.py#L16-L30
ella/ella
ella/photos/admin.py
FormatForm.clean
def clean(self): """ Check format name uniqueness for sites :return: cleaned_data """ data = self.cleaned_data formats = Format.objects.filter(name=data['name']) if self.instance: formats = formats.exclude(pk=self.instance.pk) exists_sites =...
python
def clean(self): """ Check format name uniqueness for sites :return: cleaned_data """ data = self.cleaned_data formats = Format.objects.filter(name=data['name']) if self.instance: formats = formats.exclude(pk=self.instance.pk) exists_sites =...
Check format name uniqueness for sites :return: cleaned_data
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/photos/admin.py#L37-L58
ella/ella
ella/photos/admin.py
PhotoOptions.format_photo_json
def format_photo_json(self, request, photo, format): "Used in admin image 'crop tool'." try: photo = get_cached_object(Photo, pk=photo) format = get_cached_object(Format, pk=format) content = { 'error': False, 'image':settings.MEDIA_URL...
python
def format_photo_json(self, request, photo, format): "Used in admin image 'crop tool'." try: photo = get_cached_object(Photo, pk=photo) format = get_cached_object(Format, pk=format) content = { 'error': False, 'image':settings.MEDIA_URL...
Used in admin image 'crop tool'.
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/photos/admin.py#L114-L129
ssalentin/plip
plip/modules/chimeraplip.py
ChimeraVisualizer.set_initial_representations
def set_initial_representations(self): """Set the initial representations""" self.update_model_dict() self.rc("background solid white") self.rc("setattr g display 0") # Hide all pseudobonds self.rc("~display #%i & :/isHet & ~:%s" % (self.model_dict[self.plipname], self.hetid))
python
def set_initial_representations(self): """Set the initial representations""" self.update_model_dict() self.rc("background solid white") self.rc("setattr g display 0") # Hide all pseudobonds self.rc("~display #%i & :/isHet & ~:%s" % (self.model_dict[self.plipname], self.hetid))
Set the initial representations
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/chimeraplip.py#L36-L41
ssalentin/plip
plip/modules/chimeraplip.py
ChimeraVisualizer.update_model_dict
def update_model_dict(self): """Updates the model dictionary""" dct = {} models = self.chimera.openModels for md in models.list(): dct[md.name] = md.id self.model_dict = dct
python
def update_model_dict(self): """Updates the model dictionary""" dct = {} models = self.chimera.openModels for md in models.list(): dct[md.name] = md.id self.model_dict = dct
Updates the model dictionary
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/chimeraplip.py#L43-L49
ssalentin/plip
plip/modules/chimeraplip.py
ChimeraVisualizer.atom_by_serialnumber
def atom_by_serialnumber(self): """Provides a dictionary mapping serial numbers to their atom objects.""" atm_by_snum = {} for atom in self.model.atoms: atm_by_snum[atom.serialNumber] = atom return atm_by_snum
python
def atom_by_serialnumber(self): """Provides a dictionary mapping serial numbers to their atom objects.""" atm_by_snum = {} for atom in self.model.atoms: atm_by_snum[atom.serialNumber] = atom return atm_by_snum
Provides a dictionary mapping serial numbers to their atom objects.
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/chimeraplip.py#L51-L56
ssalentin/plip
plip/modules/chimeraplip.py
ChimeraVisualizer.show_hydrophobic
def show_hydrophobic(self): """Visualizes hydrophobic contacts.""" grp = self.getPseudoBondGroup("Hydrophobic Interactions-%i" % self.tid, associateWith=[self.model]) grp.lineType = self.chimera.Dash grp.lineWidth = 3 grp.color = self.colorbyname('gray') for i in self.plc...
python
def show_hydrophobic(self): """Visualizes hydrophobic contacts.""" grp = self.getPseudoBondGroup("Hydrophobic Interactions-%i" % self.tid, associateWith=[self.model]) grp.lineType = self.chimera.Dash grp.lineWidth = 3 grp.color = self.colorbyname('gray') for i in self.plc...
Visualizes hydrophobic contacts.
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/chimeraplip.py#L58-L65
ssalentin/plip
plip/modules/chimeraplip.py
ChimeraVisualizer.show_hbonds
def show_hbonds(self): """Visualizes hydrogen bonds.""" grp = self.getPseudoBondGroup("Hydrogen Bonds-%i" % self.tid, associateWith=[self.model]) grp.lineWidth = 3 for i in self.plcomplex.hbonds.ldon_id: b = grp.newPseudoBond(self.atoms[i[0]], self.atoms[i[1]]) b....
python
def show_hbonds(self): """Visualizes hydrogen bonds.""" grp = self.getPseudoBondGroup("Hydrogen Bonds-%i" % self.tid, associateWith=[self.model]) grp.lineWidth = 3 for i in self.plcomplex.hbonds.ldon_id: b = grp.newPseudoBond(self.atoms[i[0]], self.atoms[i[1]]) b....
Visualizes hydrogen bonds.
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/chimeraplip.py#L67-L78
ssalentin/plip
plip/modules/chimeraplip.py
ChimeraVisualizer.show_halogen
def show_halogen(self): """Visualizes halogen bonds.""" grp = self.getPseudoBondGroup("HalogenBonds-%i" % self.tid, associateWith=[self.model]) grp.lineWidth = 3 for i in self.plcomplex.halogen_bonds: b = grp.newPseudoBond(self.atoms[i[0]], self.atoms[i[1]]) b.col...
python
def show_halogen(self): """Visualizes halogen bonds.""" grp = self.getPseudoBondGroup("HalogenBonds-%i" % self.tid, associateWith=[self.model]) grp.lineWidth = 3 for i in self.plcomplex.halogen_bonds: b = grp.newPseudoBond(self.atoms[i[0]], self.atoms[i[1]]) b.col...
Visualizes halogen bonds.
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/chimeraplip.py#L80-L88
ssalentin/plip
plip/modules/chimeraplip.py
ChimeraVisualizer.show_stacking
def show_stacking(self): """Visualizes pi-stacking interactions.""" grp = self.getPseudoBondGroup("pi-Stacking-%i" % self.tid, associateWith=[self.model]) grp.lineWidth = 3 grp.lineType = self.chimera.Dash for i, stack in enumerate(self.plcomplex.pistacking): m = sel...
python
def show_stacking(self): """Visualizes pi-stacking interactions.""" grp = self.getPseudoBondGroup("pi-Stacking-%i" % self.tid, associateWith=[self.model]) grp.lineWidth = 3 grp.lineType = self.chimera.Dash for i, stack in enumerate(self.plcomplex.pistacking): m = sel...
Visualizes pi-stacking interactions.
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/chimeraplip.py#L90-L112
ssalentin/plip
plip/modules/chimeraplip.py
ChimeraVisualizer.show_cationpi
def show_cationpi(self): """Visualizes cation-pi interactions""" grp = self.getPseudoBondGroup("Cation-Pi-%i" % self.tid, associateWith=[self.model]) grp.lineWidth = 3 grp.lineType = self.chimera.Dash for i, cat in enumerate(self.plcomplex.pication): m = self.model ...
python
def show_cationpi(self): """Visualizes cation-pi interactions""" grp = self.getPseudoBondGroup("Cation-Pi-%i" % self.tid, associateWith=[self.model]) grp.lineWidth = 3 grp.lineType = self.chimera.Dash for i, cat in enumerate(self.plcomplex.pication): m = self.model ...
Visualizes cation-pi interactions
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/chimeraplip.py#L114-L139
ssalentin/plip
plip/modules/chimeraplip.py
ChimeraVisualizer.show_sbridges
def show_sbridges(self): """Visualizes salt bridges.""" # Salt Bridges grp = self.getPseudoBondGroup("Salt Bridges-%i" % self.tid, associateWith=[self.model]) grp.lineWidth = 3 grp.lineType = self.chimera.Dash for i, sbridge in enumerate(self.plcomplex.saltbridges): ...
python
def show_sbridges(self): """Visualizes salt bridges.""" # Salt Bridges grp = self.getPseudoBondGroup("Salt Bridges-%i" % self.tid, associateWith=[self.model]) grp.lineWidth = 3 grp.lineType = self.chimera.Dash for i, sbridge in enumerate(self.plcomplex.saltbridges): ...
Visualizes salt bridges.
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/chimeraplip.py#L141-L167
ssalentin/plip
plip/modules/chimeraplip.py
ChimeraVisualizer.show_wbridges
def show_wbridges(self): """Visualizes water bridges""" grp = self.getPseudoBondGroup("Water Bridges-%i" % self.tid, associateWith=[self.model]) grp.lineWidth = 3 for i, wbridge in enumerate(self.plcomplex.waterbridges): c = grp.newPseudoBond(self.atoms[wbridge.water_id], sel...
python
def show_wbridges(self): """Visualizes water bridges""" grp = self.getPseudoBondGroup("Water Bridges-%i" % self.tid, associateWith=[self.model]) grp.lineWidth = 3 for i, wbridge in enumerate(self.plcomplex.waterbridges): c = grp.newPseudoBond(self.atoms[wbridge.water_id], sel...
Visualizes water bridges
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/chimeraplip.py#L169-L183
ssalentin/plip
plip/modules/chimeraplip.py
ChimeraVisualizer.show_metal
def show_metal(self): """Visualizes metal coordination.""" grp = self.getPseudoBondGroup("Metal Coordination-%i" % self.tid, associateWith=[self.model]) grp.lineWidth = 3 for i, metal in enumerate(self.plcomplex.metal_complexes): c = grp.newPseudoBond(self.atoms[metal.metal_i...
python
def show_metal(self): """Visualizes metal coordination.""" grp = self.getPseudoBondGroup("Metal Coordination-%i" % self.tid, associateWith=[self.model]) grp.lineWidth = 3 for i, metal in enumerate(self.plcomplex.metal_complexes): c = grp.newPseudoBond(self.atoms[metal.metal_i...
Visualizes metal coordination.
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/chimeraplip.py#L185-L197
ssalentin/plip
plip/modules/chimeraplip.py
ChimeraVisualizer.cleanup
def cleanup(self): """Clean up the visualization.""" if not len(self.water_ids) == 0: # Hide all non-interacting water molecules water_selection = [] for wid in self.water_ids: water_selection.append('serialNumber=%i' % wid) self.rc("~disp...
python
def cleanup(self): """Clean up the visualization.""" if not len(self.water_ids) == 0: # Hide all non-interacting water molecules water_selection = [] for wid in self.water_ids: water_selection.append('serialNumber=%i' % wid) self.rc("~disp...
Clean up the visualization.
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/chimeraplip.py#L199-L213
ssalentin/plip
plip/modules/chimeraplip.py
ChimeraVisualizer.zoom_to_ligand
def zoom_to_ligand(self): """Centers the view on the ligand and its binding site residues.""" self.rc("center #%i & :%s" % (self.model_dict[self.plipname], self.hetid))
python
def zoom_to_ligand(self): """Centers the view on the ligand and its binding site residues.""" self.rc("center #%i & :%s" % (self.model_dict[self.plipname], self.hetid))
Centers the view on the ligand and its binding site residues.
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/chimeraplip.py#L215-L217
ssalentin/plip
plip/modules/chimeraplip.py
ChimeraVisualizer.refinements
def refinements(self): """Details for the visualization.""" self.rc("setattr a color gray @CENTROID") self.rc("setattr a radius 0.3 @CENTROID") self.rc("represent sphere @CENTROID") self.rc("setattr a color orange @CHARGE") self.rc("setattr a radius 0.4 @CHARGE") ...
python
def refinements(self): """Details for the visualization.""" self.rc("setattr a color gray @CENTROID") self.rc("setattr a radius 0.3 @CENTROID") self.rc("represent sphere @CENTROID") self.rc("setattr a color orange @CHARGE") self.rc("setattr a radius 0.4 @CHARGE") ...
Details for the visualization.
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/chimeraplip.py#L219-L227
ella/ella
ella/core/migrations/0002_remove_shit_data.py
Migration.forwards
def forwards(self, orm): "Write your forwards methods here." if not db.dry_run: for pl in orm['core.Placement'].objects.all(): pl.listing_set.update(publishable=pl.publishable) publishable = pl.publishable publishable.publish_from = pl.publish_...
python
def forwards(self, orm): "Write your forwards methods here." if not db.dry_run: for pl in orm['core.Placement'].objects.all(): pl.listing_set.update(publishable=pl.publishable) publishable = pl.publishable publishable.publish_from = pl.publish_...
Write your forwards methods here.
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/core/migrations/0002_remove_shit_data.py#L11-L20
ella/ella
ella/photos/formatter.py
Formatter.format
def format(self): """ Crop and resize the supplied image. Return the image and the crop_box used. If the input format is JPEG and in EXIF there is information about rotation, use it and rotate resulting image. """ if hasattr(self.image, '_getexif'): self.rotate_exif()...
python
def format(self): """ Crop and resize the supplied image. Return the image and the crop_box used. If the input format is JPEG and in EXIF there is information about rotation, use it and rotate resulting image. """ if hasattr(self.image, '_getexif'): self.rotate_exif()...
Crop and resize the supplied image. Return the image and the crop_box used. If the input format is JPEG and in EXIF there is information about rotation, use it and rotate resulting image.
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/photos/formatter.py#L22-L31
ella/ella
ella/photos/formatter.py
Formatter.set_format
def set_format(self): """ Check if the format has a flexible height, if so check if the ratio of the flexible format is closer to the actual ratio of the image. If so use that instead of the default values (f.max_width, f.max_height). """ f = self.fmt if f.flexib...
python
def set_format(self): """ Check if the format has a flexible height, if so check if the ratio of the flexible format is closer to the actual ratio of the image. If so use that instead of the default values (f.max_width, f.max_height). """ f = self.fmt if f.flexib...
Check if the format has a flexible height, if so check if the ratio of the flexible format is closer to the actual ratio of the image. If so use that instead of the default values (f.max_width, f.max_height).
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/photos/formatter.py#L33-L47
ella/ella
ella/photos/formatter.py
Formatter.get_crop_box
def get_crop_box(self): """ Get coordinates of the rectangle defining the new image boundaries. It takes into acount any specific wishes from the model (explicitely passed in crop_box), the desired format and it's options (flexible_height, nocrop) and mainly it's ratio. After dim...
python
def get_crop_box(self): """ Get coordinates of the rectangle defining the new image boundaries. It takes into acount any specific wishes from the model (explicitely passed in crop_box), the desired format and it's options (flexible_height, nocrop) and mainly it's ratio. After dim...
Get coordinates of the rectangle defining the new image boundaries. It takes into acount any specific wishes from the model (explicitely passed in crop_box), the desired format and it's options (flexible_height, nocrop) and mainly it's ratio. After dimensions of the format were specified...
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/photos/formatter.py#L49-L89
ella/ella
ella/photos/formatter.py
Formatter.center_important_part
def center_important_part(self, crop_box): """ If important_box was specified, make sure it lies inside the crop box. """ if not self.important_box: return crop_box # shortcuts ib = self.important_box cl, ct, cr, cb = crop_box iw, ih = self.im...
python
def center_important_part(self, crop_box): """ If important_box was specified, make sure it lies inside the crop box. """ if not self.important_box: return crop_box # shortcuts ib = self.important_box cl, ct, cr, cb = crop_box iw, ih = self.im...
If important_box was specified, make sure it lies inside the crop box.
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/photos/formatter.py#L91-L121
ella/ella
ella/photos/formatter.py
Formatter.crop_to_ratio
def crop_to_ratio(self): " Get crop coordinates and perform the crop if we get any. " crop_box = self.get_crop_box() if not crop_box: return crop_box = self.center_important_part(crop_box) iw, ih = self.image.size # see if we want to crop something from out...
python
def crop_to_ratio(self): " Get crop coordinates and perform the crop if we get any. " crop_box = self.get_crop_box() if not crop_box: return crop_box = self.center_important_part(crop_box) iw, ih = self.image.size # see if we want to crop something from out...
Get crop coordinates and perform the crop if we get any.
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/photos/formatter.py#L124-L153
ella/ella
ella/photos/formatter.py
Formatter.get_resized_size
def get_resized_size(self): """ Get target size for the stretched or shirnked image to fit within the target dimensions. Do not stretch images if not format.stretch. Note that this method is designed to operate on already cropped image. """ f = self.fmt iw, ih = ...
python
def get_resized_size(self): """ Get target size for the stretched or shirnked image to fit within the target dimensions. Do not stretch images if not format.stretch. Note that this method is designed to operate on already cropped image. """ f = self.fmt iw, ih = ...
Get target size for the stretched or shirnked image to fit within the target dimensions. Do not stretch images if not format.stretch. Note that this method is designed to operate on already cropped image.
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/photos/formatter.py#L155-L178
ella/ella
ella/photos/formatter.py
Formatter.resize
def resize(self): """ Get target size for a cropped image and do the resizing if we got anything usable. """ resized_size = self.get_resized_size() if not resized_size: return self.image = self.image.resize(resized_size, Image.ANTIALIAS)
python
def resize(self): """ Get target size for a cropped image and do the resizing if we got anything usable. """ resized_size = self.get_resized_size() if not resized_size: return self.image = self.image.resize(resized_size, Image.ANTIALIAS)
Get target size for a cropped image and do the resizing if we got anything usable.
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/photos/formatter.py#L180-L189
ella/ella
ella/photos/formatter.py
Formatter.rotate_exif
def rotate_exif(self): """ Rotate image via exif information. Only 90, 180 and 270 rotations are supported. """ exif = self.image._getexif() or {} rotation = exif.get(TAGS['Orientation'], 1) rotations = { 6: -90, 3: -180, 8: -2...
python
def rotate_exif(self): """ Rotate image via exif information. Only 90, 180 and 270 rotations are supported. """ exif = self.image._getexif() or {} rotation = exif.get(TAGS['Orientation'], 1) rotations = { 6: -90, 3: -180, 8: -2...
Rotate image via exif information. Only 90, 180 and 270 rotations are supported.
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/photos/formatter.py#L191-L207
ssalentin/plip
plip/modules/visualize.py
select_by_ids
def select_by_ids(selname, idlist, selection_exists=False, chunksize=20, restrict=None): """Selection with a large number of ids concatenated into a selection list can cause buffer overflow in PyMOL. This function takes a selection name and and list of IDs (list of integers) as input and makes a careful ...
python
def select_by_ids(selname, idlist, selection_exists=False, chunksize=20, restrict=None): """Selection with a large number of ids concatenated into a selection list can cause buffer overflow in PyMOL. This function takes a selection name and and list of IDs (list of integers) as input and makes a careful ...
Selection with a large number of ids concatenated into a selection list can cause buffer overflow in PyMOL. This function takes a selection name and and list of IDs (list of integers) as input and makes a careful step-by-step selection (packages of 20 by default)
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/visualize.py#L18-L30
ssalentin/plip
plip/modules/visualize.py
visualize_in_pymol
def visualize_in_pymol(plcomplex): """Visualizes the protein-ligand pliprofiler at one site in PyMOL.""" vis = PyMOLVisualizer(plcomplex) ##################### # Set everything up # ##################### pdbid = plcomplex.pdbid lig_members = plcomplex.lig_members chain = plcomplex.cha...
python
def visualize_in_pymol(plcomplex): """Visualizes the protein-ligand pliprofiler at one site in PyMOL.""" vis = PyMOLVisualizer(plcomplex) ##################### # Set everything up # ##################### pdbid = plcomplex.pdbid lig_members = plcomplex.lig_members chain = plcomplex.cha...
Visualizes the protein-ligand pliprofiler at one site in PyMOL.
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/visualize.py#L33-L134
ella/ella
ella/core/views.py
get_content_type
def get_content_type(ct_name): """ A helper function that returns ContentType object based on its slugified verbose_name_plural. Results of this function is cached to improve performance. :Parameters: - `ct_name`: Slugified verbose_name_plural of the target model. :Exceptions: - ...
python
def get_content_type(ct_name): """ A helper function that returns ContentType object based on its slugified verbose_name_plural. Results of this function is cached to improve performance. :Parameters: - `ct_name`: Slugified verbose_name_plural of the target model. :Exceptions: - ...
A helper function that returns ContentType object based on its slugified verbose_name_plural. Results of this function is cached to improve performance. :Parameters: - `ct_name`: Slugified verbose_name_plural of the target model. :Exceptions: - `Http404`: if no matching ContentType is fo...
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/core/views.py#L423-L445
ella/ella
ella/core/views.py
get_templates
def get_templates(name, slug=None, category=None, app_label=None, model_label=None): """ Returns templates in following format and order: * ``'page/category/%s/content_type/%s.%s/%s/%s' % (<CATEGORY_PART>, app_label, model_label, slug, name)`` * ``'page/category/%s/content_type/%s.%s/%s' % (<CATEGORY_P...
python
def get_templates(name, slug=None, category=None, app_label=None, model_label=None): """ Returns templates in following format and order: * ``'page/category/%s/content_type/%s.%s/%s/%s' % (<CATEGORY_PART>, app_label, model_label, slug, name)`` * ``'page/category/%s/content_type/%s.%s/%s' % (<CATEGORY_P...
Returns templates in following format and order: * ``'page/category/%s/content_type/%s.%s/%s/%s' % (<CATEGORY_PART>, app_label, model_label, slug, name)`` * ``'page/category/%s/content_type/%s.%s/%s' % (<CATEGORY_PART>, app_label, model_label, name)`` * ``'page/category/%s/%s' % (<CATEGORY_PART>, name)`` ...
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/core/views.py#L449-L518
ella/ella
ella/core/views.py
get_templates_from_publishable
def get_templates_from_publishable(name, publishable): """ Returns the same template list as `get_templates` but gets values from `Publishable` instance. """ slug = publishable.slug category = publishable.category app_label = publishable.content_type.app_label model_label = publishable.conte...
python
def get_templates_from_publishable(name, publishable): """ Returns the same template list as `get_templates` but gets values from `Publishable` instance. """ slug = publishable.slug category = publishable.category app_label = publishable.content_type.app_label model_label = publishable.conte...
Returns the same template list as `get_templates` but gets values from `Publishable` instance.
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/core/views.py#L521-L529
ella/ella
ella/core/views.py
export
def export(request, count, name='', content_type=None): """ Export banners. :Parameters: - `count`: number of objects to pass into the template - `name`: name of the template ( page/export/banner.html is default ) - `models`: list of Model classes to include """ t_list = [] ...
python
def export(request, count, name='', content_type=None): """ Export banners. :Parameters: - `count`: number of objects to pass into the template - `name`: name of the template ( page/export/banner.html is default ) - `models`: list of Model classes to include """ t_list = [] ...
Export banners. :Parameters: - `count`: number of objects to pass into the template - `name`: name of the template ( page/export/banner.html is default ) - `models`: list of Model classes to include
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/core/views.py#L538-L562
ella/ella
ella/core/views.py
EllaCoreView.get_templates
def get_templates(self, context, template_name=None): " Extract parameters for `get_templates` from the context. " if not template_name: template_name = self.template_name kw = {} if 'object' in context: o = context['object'] kw['slug'] = o.slug ...
python
def get_templates(self, context, template_name=None): " Extract parameters for `get_templates` from the context. " if not template_name: template_name = self.template_name kw = {} if 'object' in context: o = context['object'] kw['slug'] = o.slug ...
Extract parameters for `get_templates` from the context.
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/core/views.py#L82-L97
ella/ella
ella/core/views.py
ListContentType._archive_entry_year
def _archive_entry_year(self, category): " Return ARCHIVE_ENTRY_YEAR from settings (if exists) or year of the newest object in category " year = getattr(settings, 'ARCHIVE_ENTRY_YEAR', None) if not year: n = now() try: year = Listing.objects.filter( ...
python
def _archive_entry_year(self, category): " Return ARCHIVE_ENTRY_YEAR from settings (if exists) or year of the newest object in category " year = getattr(settings, 'ARCHIVE_ENTRY_YEAR', None) if not year: n = now() try: year = Listing.objects.filter( ...
Return ARCHIVE_ENTRY_YEAR from settings (if exists) or year of the newest object in category
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/core/views.py#L321-L334
ella/ella
ella/photos/models.py
Photo.save
def save(self, **kwargs): """Overrides models.Model.save. - Generates slug. - Saves image file. """ if not self.width or not self.height: self.width, self.height = self.image.width, self.image.height # prefill the slug with the ID, it requires double save ...
python
def save(self, **kwargs): """Overrides models.Model.save. - Generates slug. - Saves image file. """ if not self.width or not self.height: self.width, self.height = self.image.width, self.image.height # prefill the slug with the ID, it requires double save ...
Overrides models.Model.save. - Generates slug. - Saves image file.
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/photos/models.py#L110-L152
ella/ella
ella/photos/models.py
Format.get_blank_img
def get_blank_img(self): """ Return fake ``FormatedPhoto`` object to be used in templates when an error occurs in image generation. """ if photos_settings.DEBUG: return self.get_placeholder_img() out = { 'blank': True, 'width': self.ma...
python
def get_blank_img(self): """ Return fake ``FormatedPhoto`` object to be used in templates when an error occurs in image generation. """ if photos_settings.DEBUG: return self.get_placeholder_img() out = { 'blank': True, 'width': self.ma...
Return fake ``FormatedPhoto`` object to be used in templates when an error occurs in image generation.
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/photos/models.py#L216-L230
ella/ella
ella/photos/models.py
Format.get_placeholder_img
def get_placeholder_img(self): """ Returns fake ``FormatedPhoto`` object grabbed from image placeholder generator service for the purpose of debugging when images are not available but we still want to see something. """ pars = { 'width': self.max_width, ...
python
def get_placeholder_img(self): """ Returns fake ``FormatedPhoto`` object grabbed from image placeholder generator service for the purpose of debugging when images are not available but we still want to see something. """ pars = { 'width': self.max_width, ...
Returns fake ``FormatedPhoto`` object grabbed from image placeholder generator service for the purpose of debugging when images are not available but we still want to see something.
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/photos/models.py#L232-L248
ella/ella
ella/photos/models.py
Format.save
def save(self, **kwargs): """Overrides models.Model.save. - Delete formatted photos if format save and not now created (because of possible changes) """ if self.id: for f_photo in self.formatedphoto_set.all(): f_photo.delete() super(Format...
python
def save(self, **kwargs): """Overrides models.Model.save. - Delete formatted photos if format save and not now created (because of possible changes) """ if self.id: for f_photo in self.formatedphoto_set.all(): f_photo.delete() super(Format...
Overrides models.Model.save. - Delete formatted photos if format save and not now created (because of possible changes)
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/photos/models.py#L254-L265
ella/ella
ella/photos/models.py
FormatedPhoto.generate
def generate(self, save=True): """ Generates photo file in current format. If ``save`` is ``True``, file is saved too. """ stretched_photo, crop_box = self._generate_img() # set crop_box to (0,0,0,0) if photo not cropped if not crop_box: crop_box = 0...
python
def generate(self, save=True): """ Generates photo file in current format. If ``save`` is ``True``, file is saved too. """ stretched_photo, crop_box = self._generate_img() # set crop_box to (0,0,0,0) if photo not cropped if not crop_box: crop_box = 0...
Generates photo file in current format. If ``save`` is ``True``, file is saved too.
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/photos/models.py#L375-L400
ella/ella
ella/photos/models.py
FormatedPhoto.save
def save(self, **kwargs): """Overrides models.Model.save - Removes old file from the FS - Generates new file. """ self.remove_file() if not self.image: self.generate(save=False) else: self.image.name = self.file() super(FormatedPho...
python
def save(self, **kwargs): """Overrides models.Model.save - Removes old file from the FS - Generates new file. """ self.remove_file() if not self.image: self.generate(save=False) else: self.image.name = self.file() super(FormatedPho...
Overrides models.Model.save - Removes old file from the FS - Generates new file.
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/photos/models.py#L402-L413
ella/ella
ella/photos/models.py
FormatedPhoto.file
def file(self): """ Method returns formated photo path - derived from format.id and source Photo filename """ if photos_settings.FORMATED_PHOTO_FILENAME is not None: return photos_settings.FORMATED_PHOTO_FILENAME(self) source_file = path.split(self.photo.image.name) return pa...
python
def file(self): """ Method returns formated photo path - derived from format.id and source Photo filename """ if photos_settings.FORMATED_PHOTO_FILENAME is not None: return photos_settings.FORMATED_PHOTO_FILENAME(self) source_file = path.split(self.photo.image.name) return pa...
Method returns formated photo path - derived from format.id and source Photo filename
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/photos/models.py#L427-L432
ella/ella
ella/positions/templatetags/positions.py
_get_category_from_pars_var
def _get_category_from_pars_var(template_var, context): ''' get category from template variable or from tree_path ''' cat = template_var.resolve(context) if isinstance(cat, basestring): cat = Category.objects.get_by_tree_path(cat) return cat
python
def _get_category_from_pars_var(template_var, context): ''' get category from template variable or from tree_path ''' cat = template_var.resolve(context) if isinstance(cat, basestring): cat = Category.objects.get_by_tree_path(cat) return cat
get category from template variable or from tree_path
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/positions/templatetags/positions.py#L11-L18
ella/ella
ella/positions/templatetags/positions.py
position
def position(parser, token): """ Render a given position for category. If some position is not defined for first category, position from its parent category is used unless nofallback is specified. Syntax:: {% position POSITION_NAME for CATEGORY [nofallback] %}{% endposition %} {% p...
python
def position(parser, token): """ Render a given position for category. If some position is not defined for first category, position from its parent category is used unless nofallback is specified. Syntax:: {% position POSITION_NAME for CATEGORY [nofallback] %}{% endposition %} {% p...
Render a given position for category. If some position is not defined for first category, position from its parent category is used unless nofallback is specified. Syntax:: {% position POSITION_NAME for CATEGORY [nofallback] %}{% endposition %} {% position POSITION_NAME for CATEGORY using ...
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/positions/templatetags/positions.py#L22-L40
ella/ella
ella/positions/templatetags/positions.py
ifposition
def ifposition(parser, token): """ Syntax:: {% ifposition POSITION_NAME ... for CATEGORY [nofallback] %} {% else %} {% endifposition %} """ bits = list(token.split_contents()) end_tag = 'end' + bits[0] nofallback = False if bits[-1] == 'nofallback': nofallb...
python
def ifposition(parser, token): """ Syntax:: {% ifposition POSITION_NAME ... for CATEGORY [nofallback] %} {% else %} {% endifposition %} """ bits = list(token.split_contents()) end_tag = 'end' + bits[0] nofallback = False if bits[-1] == 'nofallback': nofallb...
Syntax:: {% ifposition POSITION_NAME ... for CATEGORY [nofallback] %} {% else %} {% endifposition %}
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/positions/templatetags/positions.py#L77-L109
ssalentin/plip
plip/modules/detection.py
filter_contacts
def filter_contacts(pairings): """Filter interactions by two criteria: 1. No interactions between the same residue (important for intra mode). 2. No duplicate interactions (A with B and B with A, also important for intra mode).""" if not config.INTRA: return pairings filtered1_pairings = [p ...
python
def filter_contacts(pairings): """Filter interactions by two criteria: 1. No interactions between the same residue (important for intra mode). 2. No duplicate interactions (A with B and B with A, also important for intra mode).""" if not config.INTRA: return pairings filtered1_pairings = [p ...
Filter interactions by two criteria: 1. No interactions between the same residue (important for intra mode). 2. No duplicate interactions (A with B and B with A, also important for intra mode).
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/detection.py#L22-L45
ssalentin/plip
plip/modules/detection.py
hydrophobic_interactions
def hydrophobic_interactions(atom_set_a, atom_set_b): """Detection of hydrophobic pliprofiler between atom_set_a (binding site) and atom_set_b (ligand). Definition: All pairs of qualified carbon atoms within a distance of HYDROPH_DIST_MAX """ data = namedtuple('hydroph_interaction', 'bsatom bsatom_orig_...
python
def hydrophobic_interactions(atom_set_a, atom_set_b): """Detection of hydrophobic pliprofiler between atom_set_a (binding site) and atom_set_b (ligand). Definition: All pairs of qualified carbon atoms within a distance of HYDROPH_DIST_MAX """ data = namedtuple('hydroph_interaction', 'bsatom bsatom_orig_...
Detection of hydrophobic pliprofiler between atom_set_a (binding site) and atom_set_b (ligand). Definition: All pairs of qualified carbon atoms within a distance of HYDROPH_DIST_MAX
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/detection.py#L52-L72
ssalentin/plip
plip/modules/detection.py
hbonds
def hbonds(acceptors, donor_pairs, protisdon, typ): """Detection of hydrogen bonds between sets of acceptors and donor pairs. Definition: All pairs of hydrogen bond acceptor and donors with donor hydrogens and acceptor showing a distance within HBOND DIST MIN and HBOND DIST MAX and donor angles above HB...
python
def hbonds(acceptors, donor_pairs, protisdon, typ): """Detection of hydrogen bonds between sets of acceptors and donor pairs. Definition: All pairs of hydrogen bond acceptor and donors with donor hydrogens and acceptor showing a distance within HBOND DIST MIN and HBOND DIST MAX and donor angles above HB...
Detection of hydrogen bonds between sets of acceptors and donor pairs. Definition: All pairs of hydrogen bond acceptor and donors with donor hydrogens and acceptor showing a distance within HBOND DIST MIN and HBOND DIST MAX and donor angles above HBOND_DON_ANGLE_MIN
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/detection.py#L75-L117
ssalentin/plip
plip/modules/detection.py
pistacking
def pistacking(rings_bs, rings_lig): """Return all pi-stackings between the given aromatic ring systems in receptor and ligand.""" data = namedtuple( 'pistack', 'proteinring ligandring distance angle offset type restype resnr reschain restype_l resnr_l reschain_l') pairings = [] for r, l in iter...
python
def pistacking(rings_bs, rings_lig): """Return all pi-stackings between the given aromatic ring systems in receptor and ligand.""" data = namedtuple( 'pistack', 'proteinring ligandring distance angle offset type restype resnr reschain restype_l resnr_l reschain_l') pairings = [] for r, l in iter...
Return all pi-stackings between the given aromatic ring systems in receptor and ligand.
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/detection.py#L120-L156
ssalentin/plip
plip/modules/detection.py
pication
def pication(rings, pos_charged, protcharged): """Return all pi-Cation interaction between aromatic rings and positively charged groups. For tertiary and quaternary amines, check also the angle between the ring and the nitrogen. """ data = namedtuple( 'pication', 'ring charge distance offset typ...
python
def pication(rings, pos_charged, protcharged): """Return all pi-Cation interaction between aromatic rings and positively charged groups. For tertiary and quaternary amines, check also the angle between the ring and the nitrogen. """ data = namedtuple( 'pication', 'ring charge distance offset typ...
Return all pi-Cation interaction between aromatic rings and positively charged groups. For tertiary and quaternary amines, check also the angle between the ring and the nitrogen.
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/detection.py#L159-L208
ssalentin/plip
plip/modules/detection.py
saltbridge
def saltbridge(poscenter, negcenter, protispos): """Detect all salt bridges (pliprofiler between centers of positive and negative charge)""" data = namedtuple( 'saltbridge', 'positive negative distance protispos resnr restype reschain resnr_l restype_l reschain_l') pairings = [] for pc, nc in it...
python
def saltbridge(poscenter, negcenter, protispos): """Detect all salt bridges (pliprofiler between centers of positive and negative charge)""" data = namedtuple( 'saltbridge', 'positive negative distance protispos resnr restype reschain resnr_l restype_l reschain_l') pairings = [] for pc, nc in it...
Detect all salt bridges (pliprofiler between centers of positive and negative charge)
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/detection.py#L211-L229
ssalentin/plip
plip/modules/detection.py
halogen
def halogen(acceptor, donor): """Detect all halogen bonds of the type Y-O...X-C""" data = namedtuple('halogenbond', 'acc acc_orig_idx don don_orig_idx distance don_angle acc_angle restype ' 'resnr reschain restype_l resnr_l reschain_l donortype acctype sidechain') pairin...
python
def halogen(acceptor, donor): """Detect all halogen bonds of the type Y-O...X-C""" data = namedtuple('halogenbond', 'acc acc_orig_idx don don_orig_idx distance don_angle acc_angle restype ' 'resnr reschain restype_l resnr_l reschain_l donortype acctype sidechain') pairin...
Detect all halogen bonds of the type Y-O...X-C
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/detection.py#L232-L260
ssalentin/plip
plip/modules/detection.py
water_bridges
def water_bridges(bs_hba, lig_hba, bs_hbd, lig_hbd, water): """Find water-bridged hydrogen bonds between ligand and protein. For now only considers bridged of first degree.""" data = namedtuple('waterbridge', 'a a_orig_idx atype d d_orig_idx dtype h water water_orig_idx distance_aw ' ...
python
def water_bridges(bs_hba, lig_hba, bs_hbd, lig_hbd, water): """Find water-bridged hydrogen bonds between ligand and protein. For now only considers bridged of first degree.""" data = namedtuple('waterbridge', 'a a_orig_idx atype d d_orig_idx dtype h water water_orig_idx distance_aw ' ...
Find water-bridged hydrogen bonds between ligand and protein. For now only considers bridged of first degree.
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/detection.py#L263-L330
ssalentin/plip
plip/modules/detection.py
metal_complexation
def metal_complexation(metals, metal_binding_lig, metal_binding_bs): """Find all metal complexes between metals and appropriate groups in both protein and ligand, as well as water""" data = namedtuple('metal_complex', 'metal metal_orig_idx metal_type target target_orig_idx target_type ' ...
python
def metal_complexation(metals, metal_binding_lig, metal_binding_bs): """Find all metal complexes between metals and appropriate groups in both protein and ligand, as well as water""" data = namedtuple('metal_complex', 'metal metal_orig_idx metal_type target target_orig_idx target_type ' ...
Find all metal complexes between metals and appropriate groups in both protein and ligand, as well as water
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/detection.py#L333-L485
ssalentin/plip
plip/modules/plipxml.py
XMLStorage.getdata
def getdata(self, tree, location, force_string=False): """Gets XML data from a specific element and handles types.""" found = tree.xpath('%s/text()' % location) if not found: return None else: data = found[0] if force_string: return data ...
python
def getdata(self, tree, location, force_string=False): """Gets XML data from a specific element and handles types.""" found = tree.xpath('%s/text()' % location) if not found: return None else: data = found[0] if force_string: return data ...
Gets XML data from a specific element and handles types.
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/plipxml.py#L18-L39
ssalentin/plip
plip/modules/plipxml.py
XMLStorage.getcoordinates
def getcoordinates(self, tree, location): """Gets coordinates from a specific element in PLIP XML""" return tuple(float(x) for x in tree.xpath('.//%s/*/text()' % location))
python
def getcoordinates(self, tree, location): """Gets coordinates from a specific element in PLIP XML""" return tuple(float(x) for x in tree.xpath('.//%s/*/text()' % location))
Gets coordinates from a specific element in PLIP XML
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/plipxml.py#L41-L43
ssalentin/plip
plip/modules/plipxml.py
BSite.get_atom_mapping
def get_atom_mapping(self): """Parses the ligand atom mapping.""" # Atom mappings smiles_to_pdb_mapping = self.bindingsite.xpath('mappings/smiles_to_pdb/text()') if smiles_to_pdb_mapping == []: self.mappings = {'smiles_to_pdb': None, 'pdb_to_smiles': None} else: ...
python
def get_atom_mapping(self): """Parses the ligand atom mapping.""" # Atom mappings smiles_to_pdb_mapping = self.bindingsite.xpath('mappings/smiles_to_pdb/text()') if smiles_to_pdb_mapping == []: self.mappings = {'smiles_to_pdb': None, 'pdb_to_smiles': None} else: ...
Parses the ligand atom mapping.
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/plipxml.py#L249-L259
ssalentin/plip
plip/modules/plipxml.py
BSite.get_counts
def get_counts(self): """counts the interaction types and backbone hydrogen bonding in a binding site""" hbondsback = len([hb for hb in self.hbonds if not hb.sidechain]) counts = {'hydrophobics': len(self.hydrophobics), 'hbonds': len(self.hbonds), 'wbridges': len(self.wbridges...
python
def get_counts(self): """counts the interaction types and backbone hydrogen bonding in a binding site""" hbondsback = len([hb for hb in self.hbonds if not hb.sidechain]) counts = {'hydrophobics': len(self.hydrophobics), 'hbonds': len(self.hbonds), 'wbridges': len(self.wbridges...
counts the interaction types and backbone hydrogen bonding in a binding site
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/plipxml.py#L261-L271
ssalentin/plip
plip/modules/plipxml.py
PLIPXMLREST.load_data
def load_data(self, pdbid): """Loads and parses an XML resource and saves it as a tree if successful""" f = urlopen("http://projects.biotec.tu-dresden.de/plip-rest/pdb/%s?format=xml" % pdbid.lower()) self.doc = etree.parse(f)
python
def load_data(self, pdbid): """Loads and parses an XML resource and saves it as a tree if successful""" f = urlopen("http://projects.biotec.tu-dresden.de/plip-rest/pdb/%s?format=xml" % pdbid.lower()) self.doc = etree.parse(f)
Loads and parses an XML resource and saves it as a tree if successful
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/plipxml.py#L303-L306
ella/ella
ella/articles/migrations/0005_move_updated_to_publishable.py
Migration.forwards
def forwards(self, orm): "Write your forwards methods here." for a in orm.Article.objects.all(): if a.updated: a.last_updated = a.updated a.save(force_update=True)
python
def forwards(self, orm): "Write your forwards methods here." for a in orm.Article.objects.all(): if a.updated: a.last_updated = a.updated a.save(force_update=True)
Write your forwards methods here.
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/articles/migrations/0005_move_updated_to_publishable.py#L16-L21
ssalentin/plip
plip/modules/webservices.py
check_pdb_status
def check_pdb_status(pdbid): """Returns the status and up-to-date entry in the PDB for a given PDB ID""" url = 'http://www.rcsb.org/pdb/rest/idStatus?structureId=%s' % pdbid xmlf = urlopen(url) xml = et.parse(xmlf) xmlf.close() status = None current_pdbid = pdbid for df in xml.xpath('//r...
python
def check_pdb_status(pdbid): """Returns the status and up-to-date entry in the PDB for a given PDB ID""" url = 'http://www.rcsb.org/pdb/rest/idStatus?structureId=%s' % pdbid xmlf = urlopen(url) xml = et.parse(xmlf) xmlf.close() status = None current_pdbid = pdbid for df in xml.xpath('//r...
Returns the status and up-to-date entry in the PDB for a given PDB ID
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/webservices.py#L22-L34
ssalentin/plip
plip/modules/webservices.py
fetch_pdb
def fetch_pdb(pdbid): """Get the newest entry from the RCSB server for the given PDB ID. Exits with '1' if PDB ID is invalid.""" pdbid = pdbid.lower() write_message('\nChecking status of PDB ID %s ... ' % pdbid) state, current_entry = check_pdb_status(pdbid) # Get state and current PDB ID if state...
python
def fetch_pdb(pdbid): """Get the newest entry from the RCSB server for the given PDB ID. Exits with '1' if PDB ID is invalid.""" pdbid = pdbid.lower() write_message('\nChecking status of PDB ID %s ... ' % pdbid) state, current_entry = check_pdb_status(pdbid) # Get state and current PDB ID if state...
Get the newest entry from the RCSB server for the given PDB ID. Exits with '1' if PDB ID is invalid.
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/webservices.py#L37-L59
ella/ella
ella/positions/models.py
PositionBox
def PositionBox(position, *args, **kwargs): " Delegate the boxing. " obj = position.target return getattr(position.target, 'box_class', Box)(obj, *args, **kwargs)
python
def PositionBox(position, *args, **kwargs): " Delegate the boxing. " obj = position.target return getattr(position.target, 'box_class', Box)(obj, *args, **kwargs)
Delegate the boxing.
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/positions/models.py#L57-L60
ella/ella
ella/positions/models.py
PositionManager.get_active_position
def get_active_position(self, category, name, nofallback=False): """ Get active position for given position name. params: category - Category model to look for name - name of the position nofallback - if True than do not fall back to parent ...
python
def get_active_position(self, category, name, nofallback=False): """ Get active position for given position name. params: category - Category model to look for name - name of the position nofallback - if True than do not fall back to parent ...
Get active position for given position name. params: category - Category model to look for name - name of the position nofallback - if True than do not fall back to parent category if active position is not found for category
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/positions/models.py#L26-L54
ella/ella
ella/positions/models.py
Position.render
def render(self, context, nodelist, box_type): " Render the position. " if not self.target: if self.target_ct: # broken Generic FK: log.warning('Broken target for position with pk %r', self.pk) return '' try: return ...
python
def render(self, context, nodelist, box_type): " Render the position. " if not self.target: if self.target_ct: # broken Generic FK: log.warning('Broken target for position with pk %r', self.pk) return '' try: return ...
Render the position.
https://github.com/ella/ella/blob/4a1414991f649dc21c4b777dc6b41a922a13faa7/ella/positions/models.py#L119-L139
ssalentin/plip
plip/modules/pymolplip.py
PyMOLVisualizer.set_initial_representations
def set_initial_representations(self): """General settings for PyMOL""" self.standard_settings() cmd.set('dash_gap', 0) # Show not dashes, but lines for the pliprofiler cmd.set('ray_shadow', 0) # Turn on ray shadows for clearer ray-traced images cmd.set('cartoon_color', 'myligh...
python
def set_initial_representations(self): """General settings for PyMOL""" self.standard_settings() cmd.set('dash_gap', 0) # Show not dashes, but lines for the pliprofiler cmd.set('ray_shadow', 0) # Turn on ray shadows for clearer ray-traced images cmd.set('cartoon_color', 'myligh...
General settings for PyMOL
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/pymolplip.py#L24-L33
ssalentin/plip
plip/modules/pymolplip.py
PyMOLVisualizer.standard_settings
def standard_settings(self): """Sets up standard settings for a nice visualization.""" cmd.set('bg_rgb', [1.0, 1.0, 1.0]) # White background cmd.set('depth_cue', 0) # Turn off depth cueing (no fog) cmd.set('cartoon_side_chain_helper', 1) # Improve combined visualization of sticks and ...
python
def standard_settings(self): """Sets up standard settings for a nice visualization.""" cmd.set('bg_rgb', [1.0, 1.0, 1.0]) # White background cmd.set('depth_cue', 0) # Turn off depth cueing (no fog) cmd.set('cartoon_side_chain_helper', 1) # Improve combined visualization of sticks and ...
Sets up standard settings for a nice visualization.
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/pymolplip.py#L46-L54
ssalentin/plip
plip/modules/pymolplip.py
PyMOLVisualizer.set_custom_colorset
def set_custom_colorset(self): """Defines a colorset with matching colors. Provided by Joachim.""" cmd.set_color('myorange', '[253, 174, 97]') cmd.set_color('mygreen', '[171, 221, 164]') cmd.set_color('myred', '[215, 25, 28]') cmd.set_color('myblue', '[43, 131, 186]') cmd...
python
def set_custom_colorset(self): """Defines a colorset with matching colors. Provided by Joachim.""" cmd.set_color('myorange', '[253, 174, 97]') cmd.set_color('mygreen', '[171, 221, 164]') cmd.set_color('myred', '[215, 25, 28]') cmd.set_color('myblue', '[43, 131, 186]') cmd...
Defines a colorset with matching colors. Provided by Joachim.
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/pymolplip.py#L56-L63
ssalentin/plip
plip/modules/pymolplip.py
PyMOLVisualizer.show_hydrophobic
def show_hydrophobic(self): """Visualizes hydrophobic contacts.""" hydroph = self.plcomplex.hydrophobic_contacts if not len(hydroph.bs_ids) == 0: self.select_by_ids('Hydrophobic-P', hydroph.bs_ids, restrict=self.protname) self.select_by_ids('Hydrophobic-L', hydroph.lig_id...
python
def show_hydrophobic(self): """Visualizes hydrophobic contacts.""" hydroph = self.plcomplex.hydrophobic_contacts if not len(hydroph.bs_ids) == 0: self.select_by_ids('Hydrophobic-P', hydroph.bs_ids, restrict=self.protname) self.select_by_ids('Hydrophobic-L', hydroph.lig_id...
Visualizes hydrophobic contacts.
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/pymolplip.py#L83-L98
ssalentin/plip
plip/modules/pymolplip.py
PyMOLVisualizer.show_hbonds
def show_hbonds(self): """Visualizes hydrogen bonds.""" hbonds = self.plcomplex.hbonds for group in [['HBondDonor-P', hbonds.prot_don_id], ['HBondAccept-P', hbonds.prot_acc_id]]: if not len(group[1]) == 0: self.select_by_ids(group[0], group[1], r...
python
def show_hbonds(self): """Visualizes hydrogen bonds.""" hbonds = self.plcomplex.hbonds for group in [['HBondDonor-P', hbonds.prot_don_id], ['HBondAccept-P', hbonds.prot_acc_id]]: if not len(group[1]) == 0: self.select_by_ids(group[0], group[1], r...
Visualizes hydrogen bonds.
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/pymolplip.py#L100-L120
ssalentin/plip
plip/modules/pymolplip.py
PyMOLVisualizer.show_halogen
def show_halogen(self): """Visualize halogen bonds.""" halogen = self.plcomplex.halogen_bonds all_don_x, all_acc_o = [], [] for h in halogen: all_don_x.append(h.don_id) all_acc_o.append(h.acc_id) cmd.select('tmp_bs', 'id %i & %s' % (h.acc_id, self.prot...
python
def show_halogen(self): """Visualize halogen bonds.""" halogen = self.plcomplex.halogen_bonds all_don_x, all_acc_o = [], [] for h in halogen: all_don_x.append(h.don_id) all_acc_o.append(h.acc_id) cmd.select('tmp_bs', 'id %i & %s' % (h.acc_id, self.prot...
Visualize halogen bonds.
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/pymolplip.py#L122-L137
ssalentin/plip
plip/modules/pymolplip.py
PyMOLVisualizer.show_stacking
def show_stacking(self): """Visualize pi-stacking interactions.""" stacks = self.plcomplex.pistacking for i, stack in enumerate(stacks): pires_ids = '+'.join(map(str, stack.proteinring_atoms)) pilig_ids = '+'.join(map(str, stack.ligandring_atoms)) cmd.select('...
python
def show_stacking(self): """Visualize pi-stacking interactions.""" stacks = self.plcomplex.pistacking for i, stack in enumerate(stacks): pires_ids = '+'.join(map(str, stack.proteinring_atoms)) pilig_ids = '+'.join(map(str, stack.ligandring_atoms)) cmd.select('...
Visualize pi-stacking interactions.
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/pymolplip.py#L139-L166
ssalentin/plip
plip/modules/pymolplip.py
PyMOLVisualizer.show_cationpi
def show_cationpi(self): """Visualize cation-pi interactions.""" for i, p in enumerate(self.plcomplex.pication): cmd.pseudoatom('ps-picat-1-%i' % i, pos=p.ring_center) cmd.pseudoatom('ps-picat-2-%i' % i, pos=p.charge_center) if p.protcharged: cmd.pseud...
python
def show_cationpi(self): """Visualize cation-pi interactions.""" for i, p in enumerate(self.plcomplex.pication): cmd.pseudoatom('ps-picat-1-%i' % i, pos=p.ring_center) cmd.pseudoatom('ps-picat-2-%i' % i, pos=p.charge_center) if p.protcharged: cmd.pseud...
Visualize cation-pi interactions.
https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/pymolplip.py#L168-L191