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 listlengths 20 707 | docstring stringlengths 3 17.3k | docstring_tokens listlengths 3 222 | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value | idx int64 0 252k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
SBRG/ssbio | ssbio/protein/structure/properties/residues.py | resname_in_proximity | def resname_in_proximity(resname, model, chains, resnums, threshold=5):
"""Search within the proximity of a defined list of residue numbers and their chains for any specifed residue name.
Args:
resname (str): Residue name to search for in proximity of specified chains + resnums
model: Biopython... | python | def resname_in_proximity(resname, model, chains, resnums, threshold=5):
"""Search within the proximity of a defined list of residue numbers and their chains for any specifed residue name.
Args:
resname (str): Residue name to search for in proximity of specified chains + resnums
model: Biopython... | [
"def",
"resname_in_proximity",
"(",
"resname",
",",
"model",
",",
"chains",
",",
"resnums",
",",
"threshold",
"=",
"5",
")",
":",
"residues",
"=",
"[",
"r",
"for",
"r",
"in",
"model",
".",
"get_residues",
"(",
")",
"if",
"r",
".",
"get_resname",
"(",
... | Search within the proximity of a defined list of residue numbers and their chains for any specifed residue name.
Args:
resname (str): Residue name to search for in proximity of specified chains + resnums
model: Biopython Model object
chains (str, list): Chain ID or IDs to check
resn... | [
"Search",
"within",
"the",
"proximity",
"of",
"a",
"defined",
"list",
"of",
"residue",
"numbers",
"and",
"their",
"chains",
"for",
"any",
"specifed",
"residue",
"name",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/structure/properties/residues.py#L92-L120 | train | 28,900 |
SBRG/ssbio | ssbio/protein/structure/properties/residues.py | match_structure_sequence | def match_structure_sequence(orig_seq, new_seq, match='X', fill_with='X', ignore_excess=False):
"""Correct a sequence to match inserted X's in a structure sequence
This is useful for mapping a sequence obtained from structural tools like MSMS or DSSP
to the sequence obtained by the get_structure_seqs m... | python | def match_structure_sequence(orig_seq, new_seq, match='X', fill_with='X', ignore_excess=False):
"""Correct a sequence to match inserted X's in a structure sequence
This is useful for mapping a sequence obtained from structural tools like MSMS or DSSP
to the sequence obtained by the get_structure_seqs m... | [
"def",
"match_structure_sequence",
"(",
"orig_seq",
",",
"new_seq",
",",
"match",
"=",
"'X'",
",",
"fill_with",
"=",
"'X'",
",",
"ignore_excess",
"=",
"False",
")",
":",
"if",
"len",
"(",
"orig_seq",
")",
"==",
"len",
"(",
"new_seq",
")",
":",
"log",
"... | Correct a sequence to match inserted X's in a structure sequence
This is useful for mapping a sequence obtained from structural tools like MSMS or DSSP
to the sequence obtained by the get_structure_seqs method.
Examples:
>>> structure_seq = 'XXXABCDEF'
>>> prop_list = [4, 5, 6, 7, 8, 9... | [
"Correct",
"a",
"sequence",
"to",
"match",
"inserted",
"X",
"s",
"in",
"a",
"structure",
"sequence"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/structure/properties/residues.py#L287-L358 | train | 28,901 |
SBRG/ssbio | ssbio/databases/hmmer.py | manual_get_pfam_annotations | def manual_get_pfam_annotations(seq, outpath, searchtype='phmmer', force_rerun=False):
"""Retrieve and download PFAM results from the HMMER search tool.
Args:
seq:
outpath:
searchtype:
force_rerun:
Returns:
Todo:
* Document and test!
"""
if op.exists(o... | python | def manual_get_pfam_annotations(seq, outpath, searchtype='phmmer', force_rerun=False):
"""Retrieve and download PFAM results from the HMMER search tool.
Args:
seq:
outpath:
searchtype:
force_rerun:
Returns:
Todo:
* Document and test!
"""
if op.exists(o... | [
"def",
"manual_get_pfam_annotations",
"(",
"seq",
",",
"outpath",
",",
"searchtype",
"=",
"'phmmer'",
",",
"force_rerun",
"=",
"False",
")",
":",
"if",
"op",
".",
"exists",
"(",
"outpath",
")",
":",
"with",
"open",
"(",
"outpath",
",",
"'r'",
")",
"as",
... | Retrieve and download PFAM results from the HMMER search tool.
Args:
seq:
outpath:
searchtype:
force_rerun:
Returns:
Todo:
* Document and test! | [
"Retrieve",
"and",
"download",
"PFAM",
"results",
"from",
"the",
"HMMER",
"search",
"tool",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/databases/hmmer.py#L10-L46 | train | 28,902 |
SBRG/ssbio | ssbio/utils.py | is_ipynb | def is_ipynb():
"""Return True if the module is running in IPython kernel,
False if in IPython shell or other Python shell.
Copied from: http://stackoverflow.com/a/37661854/1592810
There are other methods there too
>>> is_ipynb()
False
"""
try:
shell = get_ipython().__class__.... | python | def is_ipynb():
"""Return True if the module is running in IPython kernel,
False if in IPython shell or other Python shell.
Copied from: http://stackoverflow.com/a/37661854/1592810
There are other methods there too
>>> is_ipynb()
False
"""
try:
shell = get_ipython().__class__.... | [
"def",
"is_ipynb",
"(",
")",
":",
"try",
":",
"shell",
"=",
"get_ipython",
"(",
")",
".",
"__class__",
".",
"__name__",
"if",
"shell",
"==",
"'ZMQInteractiveShell'",
":",
"# Jupyter notebook or qtconsole?",
"return",
"True",
"elif",
"shell",
"==",
"'TerminalInte... | Return True if the module is running in IPython kernel,
False if in IPython shell or other Python shell.
Copied from: http://stackoverflow.com/a/37661854/1592810
There are other methods there too
>>> is_ipynb()
False | [
"Return",
"True",
"if",
"the",
"module",
"is",
"running",
"in",
"IPython",
"kernel",
"False",
"if",
"in",
"IPython",
"shell",
"or",
"other",
"Python",
"shell",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/utils.py#L26-L46 | train | 28,903 |
SBRG/ssbio | ssbio/utils.py | clean_single_dict | def clean_single_dict(indict, prepend_to_keys=None, remove_keys_containing=None):
"""Clean a dict with values that contain single item iterators to single items
Args:
indict (dict): Dictionary to be cleaned
prepend_to_keys (str): String to prepend to all keys
remove_keys_containing (str... | python | def clean_single_dict(indict, prepend_to_keys=None, remove_keys_containing=None):
"""Clean a dict with values that contain single item iterators to single items
Args:
indict (dict): Dictionary to be cleaned
prepend_to_keys (str): String to prepend to all keys
remove_keys_containing (str... | [
"def",
"clean_single_dict",
"(",
"indict",
",",
"prepend_to_keys",
"=",
"None",
",",
"remove_keys_containing",
"=",
"None",
")",
":",
"if",
"not",
"prepend_to_keys",
":",
"prepend_to_keys",
"=",
"''",
"outdict",
"=",
"{",
"}",
"for",
"k",
",",
"v",
"in",
"... | Clean a dict with values that contain single item iterators to single items
Args:
indict (dict): Dictionary to be cleaned
prepend_to_keys (str): String to prepend to all keys
remove_keys_containing (str): Text to check for in keys to ignore
Returns:
dict: Cleaned dictionary
... | [
"Clean",
"a",
"dict",
"with",
"values",
"that",
"contain",
"single",
"item",
"iterators",
"to",
"single",
"items"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/utils.py#L153-L185 | train | 28,904 |
SBRG/ssbio | ssbio/utils.py | double_check_attribute | def double_check_attribute(object, setter, backup_attribute, custom_error_text=None):
"""Check if a parameter to be used is None, if it is, then check the specified backup attribute and throw
an error if it is also None.
Args:
object: The original object
setter: Any input object
bac... | python | def double_check_attribute(object, setter, backup_attribute, custom_error_text=None):
"""Check if a parameter to be used is None, if it is, then check the specified backup attribute and throw
an error if it is also None.
Args:
object: The original object
setter: Any input object
bac... | [
"def",
"double_check_attribute",
"(",
"object",
",",
"setter",
",",
"backup_attribute",
",",
"custom_error_text",
"=",
"None",
")",
":",
"if",
"not",
"setter",
":",
"next_checker",
"=",
"getattr",
"(",
"object",
",",
"backup_attribute",
")",
"if",
"not",
"next... | Check if a parameter to be used is None, if it is, then check the specified backup attribute and throw
an error if it is also None.
Args:
object: The original object
setter: Any input object
backup_attribute (str): Attribute in <object> to be double checked
custom_error_text (st... | [
"Check",
"if",
"a",
"parameter",
"to",
"be",
"used",
"is",
"None",
"if",
"it",
"is",
"then",
"check",
"the",
"specified",
"backup",
"attribute",
"and",
"throw",
"an",
"error",
"if",
"it",
"is",
"also",
"None",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/utils.py#L199-L219 | train | 28,905 |
SBRG/ssbio | ssbio/utils.py | split_folder_and_path | def split_folder_and_path(filepath):
"""Split a file path into its folder, filename, and extension
Args:
path (str): Path to a file
Returns:
tuple: of (folder, filename (without extension), extension)
"""
dirname = op.dirname(filepath)
filename = op.basename(filepath)
spli... | python | def split_folder_and_path(filepath):
"""Split a file path into its folder, filename, and extension
Args:
path (str): Path to a file
Returns:
tuple: of (folder, filename (without extension), extension)
"""
dirname = op.dirname(filepath)
filename = op.basename(filepath)
spli... | [
"def",
"split_folder_and_path",
"(",
"filepath",
")",
":",
"dirname",
"=",
"op",
".",
"dirname",
"(",
"filepath",
")",
"filename",
"=",
"op",
".",
"basename",
"(",
"filepath",
")",
"splitext",
"=",
"op",
".",
"splitext",
"(",
"filename",
")",
"filename_wit... | Split a file path into its folder, filename, and extension
Args:
path (str): Path to a file
Returns:
tuple: of (folder, filename (without extension), extension) | [
"Split",
"a",
"file",
"path",
"into",
"its",
"folder",
"filename",
"and",
"extension"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/utils.py#L222-L238 | train | 28,906 |
SBRG/ssbio | ssbio/utils.py | outfile_maker | def outfile_maker(inname, outext='.out', outname='', outdir='', append_to_name=''):
"""Create a default name for an output file based on the inname name, unless a output name is specified.
Args:
inname: Path to input file
outext: Optional specified extension for output file (with the "."). Defa... | python | def outfile_maker(inname, outext='.out', outname='', outdir='', append_to_name=''):
"""Create a default name for an output file based on the inname name, unless a output name is specified.
Args:
inname: Path to input file
outext: Optional specified extension for output file (with the "."). Defa... | [
"def",
"outfile_maker",
"(",
"inname",
",",
"outext",
"=",
"'.out'",
",",
"outname",
"=",
"''",
",",
"outdir",
"=",
"''",
",",
"append_to_name",
"=",
"''",
")",
":",
"# TODO: CHECK IF OUTNAME IS A VALID FILE NAME!",
"orig_dir",
",",
"orig_name",
",",
"orig_ext",... | Create a default name for an output file based on the inname name, unless a output name is specified.
Args:
inname: Path to input file
outext: Optional specified extension for output file (with the "."). Default is ".out".
outfile: Optional specified name of output file.
outdir: Opt... | [
"Create",
"a",
"default",
"name",
"for",
"an",
"output",
"file",
"based",
"on",
"the",
"inname",
"name",
"unless",
"a",
"output",
"name",
"is",
"specified",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/utils.py#L254-L324 | train | 28,907 |
SBRG/ssbio | ssbio/utils.py | force_rerun | def force_rerun(flag, outfile):
"""Check if we should force rerunning of a command if an output file exists.
Args:
flag (bool): Flag to force rerun.
outfile (str): Path to output file which may already exist.
Returns:
bool: If we should force rerunning of a command
Examples:
... | python | def force_rerun(flag, outfile):
"""Check if we should force rerunning of a command if an output file exists.
Args:
flag (bool): Flag to force rerun.
outfile (str): Path to output file which may already exist.
Returns:
bool: If we should force rerunning of a command
Examples:
... | [
"def",
"force_rerun",
"(",
"flag",
",",
"outfile",
")",
":",
"# If flag is True, always run",
"if",
"flag",
":",
"return",
"True",
"# If flag is False but file doesn't exist, also run",
"elif",
"not",
"flag",
"and",
"not",
"op",
".",
"exists",
"(",
"outfile",
")",
... | Check if we should force rerunning of a command if an output file exists.
Args:
flag (bool): Flag to force rerun.
outfile (str): Path to output file which may already exist.
Returns:
bool: If we should force rerunning of a command
Examples:
>>> force_rerun(flag=True, outfi... | [
"Check",
"if",
"we",
"should",
"force",
"rerunning",
"of",
"a",
"command",
"if",
"an",
"output",
"file",
"exists",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/utils.py#L327-L362 | train | 28,908 |
SBRG/ssbio | ssbio/utils.py | gunzip_file | def gunzip_file(infile, outfile=None, outdir=None, delete_original=False, force_rerun_flag=False):
"""Decompress a gzip file and optionally set output values.
Args:
infile: Path to .gz file
outfile: Name of output file
outdir: Path to output directory
delete_original: If origina... | python | def gunzip_file(infile, outfile=None, outdir=None, delete_original=False, force_rerun_flag=False):
"""Decompress a gzip file and optionally set output values.
Args:
infile: Path to .gz file
outfile: Name of output file
outdir: Path to output directory
delete_original: If origina... | [
"def",
"gunzip_file",
"(",
"infile",
",",
"outfile",
"=",
"None",
",",
"outdir",
"=",
"None",
",",
"delete_original",
"=",
"False",
",",
"force_rerun_flag",
"=",
"False",
")",
":",
"if",
"not",
"outfile",
":",
"outfile",
"=",
"infile",
".",
"replace",
"(... | Decompress a gzip file and optionally set output values.
Args:
infile: Path to .gz file
outfile: Name of output file
outdir: Path to output directory
delete_original: If original .gz file should be deleted
force_rerun_flag: If file should be decompressed if outfile already e... | [
"Decompress",
"a",
"gzip",
"file",
"and",
"optionally",
"set",
"output",
"values",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/utils.py#L365-L403 | train | 28,909 |
SBRG/ssbio | ssbio/utils.py | request_file | def request_file(link, outfile, force_rerun_flag=False):
"""Download a file given a URL if the outfile does not exist already.
Args:
link (str): Link to download file.
outfile (str): Path to output file, will make a new file if it does not exist. Will not download if it does
exist, ... | python | def request_file(link, outfile, force_rerun_flag=False):
"""Download a file given a URL if the outfile does not exist already.
Args:
link (str): Link to download file.
outfile (str): Path to output file, will make a new file if it does not exist. Will not download if it does
exist, ... | [
"def",
"request_file",
"(",
"link",
",",
"outfile",
",",
"force_rerun_flag",
"=",
"False",
")",
":",
"if",
"force_rerun",
"(",
"flag",
"=",
"force_rerun_flag",
",",
"outfile",
"=",
"outfile",
")",
":",
"req",
"=",
"requests",
".",
"get",
"(",
"link",
")"... | Download a file given a URL if the outfile does not exist already.
Args:
link (str): Link to download file.
outfile (str): Path to output file, will make a new file if it does not exist. Will not download if it does
exist, unless force_rerun_flag is True.
force_rerun_flag (bool)... | [
"Download",
"a",
"file",
"given",
"a",
"URL",
"if",
"the",
"outfile",
"does",
"not",
"exist",
"already",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/utils.py#L406-L427 | train | 28,910 |
SBRG/ssbio | ssbio/utils.py | request_json | def request_json(link, outfile, force_rerun_flag, outdir=None):
"""Download a file in JSON format from a web request
Args:
link: Link to web request
outfile: Name of output file
outdir: Directory of output file
force_rerun_flag: If true, redownload the file
Returns:
... | python | def request_json(link, outfile, force_rerun_flag, outdir=None):
"""Download a file in JSON format from a web request
Args:
link: Link to web request
outfile: Name of output file
outdir: Directory of output file
force_rerun_flag: If true, redownload the file
Returns:
... | [
"def",
"request_json",
"(",
"link",
",",
"outfile",
",",
"force_rerun_flag",
",",
"outdir",
"=",
"None",
")",
":",
"if",
"not",
"outdir",
":",
"outdir",
"=",
"''",
"outfile",
"=",
"op",
".",
"join",
"(",
"outdir",
",",
"outfile",
")",
"if",
"force_reru... | Download a file in JSON format from a web request
Args:
link: Link to web request
outfile: Name of output file
outdir: Directory of output file
force_rerun_flag: If true, redownload the file
Returns:
dict: contents of the JSON request | [
"Download",
"a",
"file",
"in",
"JSON",
"format",
"from",
"a",
"web",
"request"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/utils.py#L430-L459 | train | 28,911 |
SBRG/ssbio | ssbio/utils.py | command_runner | def command_runner(shell_command, force_rerun_flag, outfile_checker, cwd=None, silent=False):
"""Run a shell command with subprocess, with additional options to check if output file exists and printing stdout.
Args:
shell_command (str): Command as it would be formatted in the command-line (ie. "program... | python | def command_runner(shell_command, force_rerun_flag, outfile_checker, cwd=None, silent=False):
"""Run a shell command with subprocess, with additional options to check if output file exists and printing stdout.
Args:
shell_command (str): Command as it would be formatted in the command-line (ie. "program... | [
"def",
"command_runner",
"(",
"shell_command",
",",
"force_rerun_flag",
",",
"outfile_checker",
",",
"cwd",
"=",
"None",
",",
"silent",
"=",
"False",
")",
":",
"program_and_args",
"=",
"shlex",
".",
"split",
"(",
"shell_command",
")",
"# Check if program is instal... | Run a shell command with subprocess, with additional options to check if output file exists and printing stdout.
Args:
shell_command (str): Command as it would be formatted in the command-line (ie. "program -i test.in -o test.out").
force_rerun_flag: If the program should be rerun even if the outpu... | [
"Run",
"a",
"shell",
"command",
"with",
"subprocess",
"with",
"additional",
"options",
"to",
"check",
"if",
"output",
"file",
"exists",
"and",
"printing",
"stdout",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/utils.py#L478-L518 | train | 28,912 |
SBRG/ssbio | ssbio/utils.py | dict_head | def dict_head(d, N=5):
"""Return the head of a dictionary. It will be random!
Default is to return the first 5 key/value pairs in a dictionary.
Args:
d: Dictionary to get head.
N: Number of elements to display.
Returns:
dict: the first N items of the dictionary.
"""
r... | python | def dict_head(d, N=5):
"""Return the head of a dictionary. It will be random!
Default is to return the first 5 key/value pairs in a dictionary.
Args:
d: Dictionary to get head.
N: Number of elements to display.
Returns:
dict: the first N items of the dictionary.
"""
r... | [
"def",
"dict_head",
"(",
"d",
",",
"N",
"=",
"5",
")",
":",
"return",
"{",
"k",
":",
"d",
"[",
"k",
"]",
"for",
"k",
"in",
"list",
"(",
"d",
".",
"keys",
"(",
")",
")",
"[",
":",
"N",
"]",
"}"
] | Return the head of a dictionary. It will be random!
Default is to return the first 5 key/value pairs in a dictionary.
Args:
d: Dictionary to get head.
N: Number of elements to display.
Returns:
dict: the first N items of the dictionary. | [
"Return",
"the",
"head",
"of",
"a",
"dictionary",
".",
"It",
"will",
"be",
"random!"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/utils.py#L551-L564 | train | 28,913 |
SBRG/ssbio | ssbio/utils.py | rank_dated_files | def rank_dated_files(pattern, dir, descending=True):
"""Search a directory for files that match a pattern. Return an ordered list of these files by filename.
Args:
pattern: The glob pattern to search for.
dir: Path to directory where the files will be searched for.
descending: Default T... | python | def rank_dated_files(pattern, dir, descending=True):
"""Search a directory for files that match a pattern. Return an ordered list of these files by filename.
Args:
pattern: The glob pattern to search for.
dir: Path to directory where the files will be searched for.
descending: Default T... | [
"def",
"rank_dated_files",
"(",
"pattern",
",",
"dir",
",",
"descending",
"=",
"True",
")",
":",
"files",
"=",
"glob",
".",
"glob",
"(",
"op",
".",
"join",
"(",
"dir",
",",
"pattern",
")",
")",
"return",
"sorted",
"(",
"files",
",",
"reverse",
"=",
... | Search a directory for files that match a pattern. Return an ordered list of these files by filename.
Args:
pattern: The glob pattern to search for.
dir: Path to directory where the files will be searched for.
descending: Default True, will sort alphabetically by descending order.
Retu... | [
"Search",
"a",
"directory",
"for",
"files",
"that",
"match",
"a",
"pattern",
".",
"Return",
"an",
"ordered",
"list",
"of",
"these",
"files",
"by",
"filename",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/utils.py#L567-L580 | train | 28,914 |
SBRG/ssbio | ssbio/utils.py | find | def find(lst, a, case_sensitive=True):
"""Return indices of a list which have elements that match an object or list of objects
Args:
lst: list of values
a: object(s) to check equality
case_sensitive: if the search should be case sensitive
Returns:
list: list of indicies of ... | python | def find(lst, a, case_sensitive=True):
"""Return indices of a list which have elements that match an object or list of objects
Args:
lst: list of values
a: object(s) to check equality
case_sensitive: if the search should be case sensitive
Returns:
list: list of indicies of ... | [
"def",
"find",
"(",
"lst",
",",
"a",
",",
"case_sensitive",
"=",
"True",
")",
":",
"a",
"=",
"force_list",
"(",
"a",
")",
"if",
"not",
"case_sensitive",
":",
"lst",
"=",
"[",
"x",
".",
"lower",
"(",
")",
"for",
"x",
"in",
"lst",
"]",
"a",
"=",
... | Return indices of a list which have elements that match an object or list of objects
Args:
lst: list of values
a: object(s) to check equality
case_sensitive: if the search should be case sensitive
Returns:
list: list of indicies of lst which equal a | [
"Return",
"indices",
"of",
"a",
"list",
"which",
"have",
"elements",
"that",
"match",
"an",
"object",
"or",
"list",
"of",
"objects"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/utils.py#L583-L601 | train | 28,915 |
SBRG/ssbio | ssbio/utils.py | filter_list | def filter_list(lst, takeout, case_sensitive=True):
"""Return a modified list removing items specified.
Args:
lst: Original list of values
takeout: Object or objects to remove from lst
case_sensitive: if the search should be case sensitive
Returns:
list: Filtered list of va... | python | def filter_list(lst, takeout, case_sensitive=True):
"""Return a modified list removing items specified.
Args:
lst: Original list of values
takeout: Object or objects to remove from lst
case_sensitive: if the search should be case sensitive
Returns:
list: Filtered list of va... | [
"def",
"filter_list",
"(",
"lst",
",",
"takeout",
",",
"case_sensitive",
"=",
"True",
")",
":",
"takeout",
"=",
"force_list",
"(",
"takeout",
")",
"if",
"not",
"case_sensitive",
":",
"lst",
"=",
"[",
"x",
".",
"lower",
"(",
")",
"for",
"x",
"in",
"ls... | Return a modified list removing items specified.
Args:
lst: Original list of values
takeout: Object or objects to remove from lst
case_sensitive: if the search should be case sensitive
Returns:
list: Filtered list of values | [
"Return",
"a",
"modified",
"list",
"removing",
"items",
"specified",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/utils.py#L625-L643 | train | 28,916 |
SBRG/ssbio | ssbio/utils.py | filter_list_by_indices | def filter_list_by_indices(lst, indices):
"""Return a modified list containing only the indices indicated.
Args:
lst: Original list of values
indices: List of indices to keep from the original list
Returns:
list: Filtered list of values
"""
return [x for i, x in enumerate(... | python | def filter_list_by_indices(lst, indices):
"""Return a modified list containing only the indices indicated.
Args:
lst: Original list of values
indices: List of indices to keep from the original list
Returns:
list: Filtered list of values
"""
return [x for i, x in enumerate(... | [
"def",
"filter_list_by_indices",
"(",
"lst",
",",
"indices",
")",
":",
"return",
"[",
"x",
"for",
"i",
",",
"x",
"in",
"enumerate",
"(",
"lst",
")",
"if",
"i",
"in",
"indices",
"]"
] | Return a modified list containing only the indices indicated.
Args:
lst: Original list of values
indices: List of indices to keep from the original list
Returns:
list: Filtered list of values | [
"Return",
"a",
"modified",
"list",
"containing",
"only",
"the",
"indices",
"indicated",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/utils.py#L646-L657 | train | 28,917 |
SBRG/ssbio | ssbio/utils.py | force_string | def force_string(val=None):
"""Force a string representation of an object
Args:
val: object to parse into a string
Returns:
str: String representation
"""
if val is None:
return ''
if isinstance(val, list):
newval = [str(x) for x in val]
return ';'.join... | python | def force_string(val=None):
"""Force a string representation of an object
Args:
val: object to parse into a string
Returns:
str: String representation
"""
if val is None:
return ''
if isinstance(val, list):
newval = [str(x) for x in val]
return ';'.join... | [
"def",
"force_string",
"(",
"val",
"=",
"None",
")",
":",
"if",
"val",
"is",
"None",
":",
"return",
"''",
"if",
"isinstance",
"(",
"val",
",",
"list",
")",
":",
"newval",
"=",
"[",
"str",
"(",
"x",
")",
"for",
"x",
"in",
"val",
"]",
"return",
"... | Force a string representation of an object
Args:
val: object to parse into a string
Returns:
str: String representation | [
"Force",
"a",
"string",
"representation",
"of",
"an",
"object"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/utils.py#L660-L678 | train | 28,918 |
SBRG/ssbio | ssbio/utils.py | force_list | def force_list(val=None):
"""Force a list representation of an object
Args:
val: object to parse into a list
Returns:
"""
if val is None:
return []
if isinstance(val, pd.Series):
return val.tolist()
return val if isinstance(val, list) else [val] | python | def force_list(val=None):
"""Force a list representation of an object
Args:
val: object to parse into a list
Returns:
"""
if val is None:
return []
if isinstance(val, pd.Series):
return val.tolist()
return val if isinstance(val, list) else [val] | [
"def",
"force_list",
"(",
"val",
"=",
"None",
")",
":",
"if",
"val",
"is",
"None",
":",
"return",
"[",
"]",
"if",
"isinstance",
"(",
"val",
",",
"pd",
".",
"Series",
")",
":",
"return",
"val",
".",
"tolist",
"(",
")",
"return",
"val",
"if",
"isin... | Force a list representation of an object
Args:
val: object to parse into a list
Returns: | [
"Force",
"a",
"list",
"representation",
"of",
"an",
"object"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/utils.py#L681-L694 | train | 28,919 |
SBRG/ssbio | ssbio/utils.py | split_list_by_n | def split_list_by_n(l, n):
"""Split a list into lists of size n.
Args:
l: List of stuff.
n: Size of new lists.
Returns:
list: List of lists each of size n derived from l.
"""
n = max(1, n)
return list(l[i:i+n] for i in range(0, len(l), n)) | python | def split_list_by_n(l, n):
"""Split a list into lists of size n.
Args:
l: List of stuff.
n: Size of new lists.
Returns:
list: List of lists each of size n derived from l.
"""
n = max(1, n)
return list(l[i:i+n] for i in range(0, len(l), n)) | [
"def",
"split_list_by_n",
"(",
"l",
",",
"n",
")",
":",
"n",
"=",
"max",
"(",
"1",
",",
"n",
")",
"return",
"list",
"(",
"l",
"[",
"i",
":",
"i",
"+",
"n",
"]",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"l",
")",
",",
"n",
"... | Split a list into lists of size n.
Args:
l: List of stuff.
n: Size of new lists.
Returns:
list: List of lists each of size n derived from l. | [
"Split",
"a",
"list",
"into",
"lists",
"of",
"size",
"n",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/utils.py#L723-L735 | train | 28,920 |
SBRG/ssbio | ssbio/utils.py | input_list_parser | def input_list_parser(infile_list):
"""Always return a list of files with varying input.
>>> input_list_parser(['/path/to/folder/'])
['/path/to/folder/file1.txt', '/path/to/folder/file2.txt', '/path/to/folder/file3.txt']
>>> input_list_parser(['/path/to/file.txt'])
['/path/to/file.txt']
>>> i... | python | def input_list_parser(infile_list):
"""Always return a list of files with varying input.
>>> input_list_parser(['/path/to/folder/'])
['/path/to/folder/file1.txt', '/path/to/folder/file2.txt', '/path/to/folder/file3.txt']
>>> input_list_parser(['/path/to/file.txt'])
['/path/to/file.txt']
>>> i... | [
"def",
"input_list_parser",
"(",
"infile_list",
")",
":",
"final_list_of_files",
"=",
"[",
"]",
"for",
"x",
"in",
"infile_list",
":",
"# If the input is a folder",
"if",
"op",
".",
"isdir",
"(",
"x",
")",
":",
"os",
".",
"chdir",
"(",
"x",
")",
"final_list... | Always return a list of files with varying input.
>>> input_list_parser(['/path/to/folder/'])
['/path/to/folder/file1.txt', '/path/to/folder/file2.txt', '/path/to/folder/file3.txt']
>>> input_list_parser(['/path/to/file.txt'])
['/path/to/file.txt']
>>> input_list_parser(['file1.txt'])
['file1... | [
"Always",
"return",
"a",
"list",
"of",
"files",
"with",
"varying",
"input",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/utils.py#L752-L785 | train | 28,921 |
SBRG/ssbio | ssbio/utils.py | flatlist_dropdup | def flatlist_dropdup(list_of_lists):
"""Make a single list out of a list of lists, and drop all duplicates.
Args:
list_of_lists: List of lists.
Returns:
list: List of single objects.
"""
return list(set([str(item) for sublist in list_of_lists for item in sublist])) | python | def flatlist_dropdup(list_of_lists):
"""Make a single list out of a list of lists, and drop all duplicates.
Args:
list_of_lists: List of lists.
Returns:
list: List of single objects.
"""
return list(set([str(item) for sublist in list_of_lists for item in sublist])) | [
"def",
"flatlist_dropdup",
"(",
"list_of_lists",
")",
":",
"return",
"list",
"(",
"set",
"(",
"[",
"str",
"(",
"item",
")",
"for",
"sublist",
"in",
"list_of_lists",
"for",
"item",
"in",
"sublist",
"]",
")",
")"
] | Make a single list out of a list of lists, and drop all duplicates.
Args:
list_of_lists: List of lists.
Returns:
list: List of single objects. | [
"Make",
"a",
"single",
"list",
"out",
"of",
"a",
"list",
"of",
"lists",
"and",
"drop",
"all",
"duplicates",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/utils.py#L788-L798 | train | 28,922 |
SBRG/ssbio | ssbio/utils.py | scale_calculator | def scale_calculator(multiplier, elements, rescale=None):
"""Get a dictionary of scales for each element in elements.
Examples:
>>> scale_calculator(1, [2,7,8])
{8: 1, 2: 1, 7: 1}
>>> scale_calculator(1, [2,2,2,3,4,5,5,6,7,8])
{2: 3, 3: 1, 4: 1, 5: 2, 6: 1, 7: 1, 8: 1}
... | python | def scale_calculator(multiplier, elements, rescale=None):
"""Get a dictionary of scales for each element in elements.
Examples:
>>> scale_calculator(1, [2,7,8])
{8: 1, 2: 1, 7: 1}
>>> scale_calculator(1, [2,2,2,3,4,5,5,6,7,8])
{2: 3, 3: 1, 4: 1, 5: 2, 6: 1, 7: 1, 8: 1}
... | [
"def",
"scale_calculator",
"(",
"multiplier",
",",
"elements",
",",
"rescale",
"=",
"None",
")",
":",
"# TODO: think about what happens when:",
"# TODO: 1. there is only one (or n) of each element, and rescale is set to seomthing. what is the original min/max to scale from?",
"# TODO: 2.... | Get a dictionary of scales for each element in elements.
Examples:
>>> scale_calculator(1, [2,7,8])
{8: 1, 2: 1, 7: 1}
>>> scale_calculator(1, [2,2,2,3,4,5,5,6,7,8])
{2: 3, 3: 1, 4: 1, 5: 2, 6: 1, 7: 1, 8: 1}
>>> scale_calculator(1, [2,2,2,3,4,5,5,6,7,8], rescale=(0.5,1))
... | [
"Get",
"a",
"dictionary",
"of",
"scales",
"for",
"each",
"element",
"in",
"elements",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/utils.py#L929-L985 | train | 28,923 |
SBRG/ssbio | ssbio/utils.py | label_sequential_regions | def label_sequential_regions(inlist):
"""Input a list of labeled tuples and return a dictionary of sequentially labeled regions.
Args:
inlist (list): A list of tuples with the first number representing the index and the second the index label.
Returns:
dict: Dictionary of labeled regions.
... | python | def label_sequential_regions(inlist):
"""Input a list of labeled tuples and return a dictionary of sequentially labeled regions.
Args:
inlist (list): A list of tuples with the first number representing the index and the second the index label.
Returns:
dict: Dictionary of labeled regions.
... | [
"def",
"label_sequential_regions",
"(",
"inlist",
")",
":",
"import",
"more_itertools",
"as",
"mit",
"df",
"=",
"pd",
".",
"DataFrame",
"(",
"inlist",
")",
".",
"set_index",
"(",
"0",
")",
"labeled",
"=",
"{",
"}",
"for",
"label",
"in",
"df",
"[",
"1",... | Input a list of labeled tuples and return a dictionary of sequentially labeled regions.
Args:
inlist (list): A list of tuples with the first number representing the index and the second the index label.
Returns:
dict: Dictionary of labeled regions.
Examples:
>>> label_sequential_... | [
"Input",
"a",
"list",
"of",
"labeled",
"tuples",
"and",
"return",
"a",
"dictionary",
"of",
"sequentially",
"labeled",
"regions",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/utils.py#L988-L1013 | train | 28,924 |
SBRG/ssbio | ssbio/protein/sequence/seqprop.py | SeqProp.sequence_path | def sequence_path(self, fasta_path):
"""Provide pointers to the paths of the FASTA file
Args:
fasta_path: Path to FASTA file
"""
if not fasta_path:
self.sequence_dir = None
self.sequence_file = None
else:
if not op.exists(fasta_p... | python | def sequence_path(self, fasta_path):
"""Provide pointers to the paths of the FASTA file
Args:
fasta_path: Path to FASTA file
"""
if not fasta_path:
self.sequence_dir = None
self.sequence_file = None
else:
if not op.exists(fasta_p... | [
"def",
"sequence_path",
"(",
"self",
",",
"fasta_path",
")",
":",
"if",
"not",
"fasta_path",
":",
"self",
".",
"sequence_dir",
"=",
"None",
"self",
".",
"sequence_file",
"=",
"None",
"else",
":",
"if",
"not",
"op",
".",
"exists",
"(",
"fasta_path",
")",
... | Provide pointers to the paths of the FASTA file
Args:
fasta_path: Path to FASTA file | [
"Provide",
"pointers",
"to",
"the",
"paths",
"of",
"the",
"FASTA",
"file"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/seqprop.py#L253-L286 | train | 28,925 |
SBRG/ssbio | ssbio/protein/sequence/seqprop.py | SeqProp.feature_path | def feature_path(self, gff_path):
"""Load a GFF file with information on a single sequence and store features in the ``features`` attribute
Args:
gff_path: Path to GFF file.
"""
if not gff_path:
self.feature_dir = None
self.feature_file = None
... | python | def feature_path(self, gff_path):
"""Load a GFF file with information on a single sequence and store features in the ``features`` attribute
Args:
gff_path: Path to GFF file.
"""
if not gff_path:
self.feature_dir = None
self.feature_file = None
... | [
"def",
"feature_path",
"(",
"self",
",",
"gff_path",
")",
":",
"if",
"not",
"gff_path",
":",
"self",
".",
"feature_dir",
"=",
"None",
"self",
".",
"feature_file",
"=",
"None",
"else",
":",
"if",
"not",
"op",
".",
"exists",
"(",
"gff_path",
")",
":",
... | Load a GFF file with information on a single sequence and store features in the ``features`` attribute
Args:
gff_path: Path to GFF file. | [
"Load",
"a",
"GFF",
"file",
"with",
"information",
"on",
"a",
"single",
"sequence",
"and",
"store",
"features",
"in",
"the",
"features",
"attribute"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/seqprop.py#L354-L373 | train | 28,926 |
SBRG/ssbio | ssbio/protein/sequence/seqprop.py | SeqProp.feature_path_unset | def feature_path_unset(self):
"""Copy features to memory and remove the association of the feature file."""
if not self.feature_file:
raise IOError('No feature file to unset')
with open(self.feature_path) as handle:
feats = list(GFF.parse(handle))
if len(feat... | python | def feature_path_unset(self):
"""Copy features to memory and remove the association of the feature file."""
if not self.feature_file:
raise IOError('No feature file to unset')
with open(self.feature_path) as handle:
feats = list(GFF.parse(handle))
if len(feat... | [
"def",
"feature_path_unset",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"feature_file",
":",
"raise",
"IOError",
"(",
"'No feature file to unset'",
")",
"with",
"open",
"(",
"self",
".",
"feature_path",
")",
"as",
"handle",
":",
"feats",
"=",
"list",
... | Copy features to memory and remove the association of the feature file. | [
"Copy",
"features",
"to",
"memory",
"and",
"remove",
"the",
"association",
"of",
"the",
"feature",
"file",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/seqprop.py#L375-L389 | train | 28,927 |
SBRG/ssbio | ssbio/protein/sequence/seqprop.py | SeqProp.get_dict | def get_dict(self, only_attributes=None, exclude_attributes=None, df_format=False):
"""Get a dictionary of this object's attributes. Optional format for storage in a Pandas DataFrame.
Args:
only_attributes (str, list): Attributes that should be returned. If not provided, all are returned.
... | python | def get_dict(self, only_attributes=None, exclude_attributes=None, df_format=False):
"""Get a dictionary of this object's attributes. Optional format for storage in a Pandas DataFrame.
Args:
only_attributes (str, list): Attributes that should be returned. If not provided, all are returned.
... | [
"def",
"get_dict",
"(",
"self",
",",
"only_attributes",
"=",
"None",
",",
"exclude_attributes",
"=",
"None",
",",
"df_format",
"=",
"False",
")",
":",
"# Choose attributes to return, return everything in the object if a list is not specified",
"if",
"not",
"only_attributes"... | Get a dictionary of this object's attributes. Optional format for storage in a Pandas DataFrame.
Args:
only_attributes (str, list): Attributes that should be returned. If not provided, all are returned.
exclude_attributes (str, list): Attributes that should be excluded.
df_f... | [
"Get",
"a",
"dictionary",
"of",
"this",
"object",
"s",
"attributes",
".",
"Optional",
"format",
"for",
"storage",
"in",
"a",
"Pandas",
"DataFrame",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/seqprop.py#L419-L466 | train | 28,928 |
SBRG/ssbio | ssbio/protein/sequence/seqprop.py | SeqProp.equal_to | def equal_to(self, seq_prop):
"""Test if the sequence is equal to another SeqProp's sequence
Args:
seq_prop: SeqProp object
Returns:
bool: If the sequences are the same
"""
if not self.seq or not seq_prop or not seq_prop.seq:
return False
... | python | def equal_to(self, seq_prop):
"""Test if the sequence is equal to another SeqProp's sequence
Args:
seq_prop: SeqProp object
Returns:
bool: If the sequences are the same
"""
if not self.seq or not seq_prop or not seq_prop.seq:
return False
... | [
"def",
"equal_to",
"(",
"self",
",",
"seq_prop",
")",
":",
"if",
"not",
"self",
".",
"seq",
"or",
"not",
"seq_prop",
"or",
"not",
"seq_prop",
".",
"seq",
":",
"return",
"False",
"return",
"self",
".",
"seq",
"==",
"seq_prop",
".",
"seq"
] | Test if the sequence is equal to another SeqProp's sequence
Args:
seq_prop: SeqProp object
Returns:
bool: If the sequences are the same | [
"Test",
"if",
"the",
"sequence",
"is",
"equal",
"to",
"another",
"SeqProp",
"s",
"sequence"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/seqprop.py#L485-L498 | train | 28,929 |
SBRG/ssbio | ssbio/protein/sequence/seqprop.py | SeqProp.write_fasta_file | def write_fasta_file(self, outfile, force_rerun=False):
"""Write a FASTA file for the protein sequence, ``seq`` will now load directly from this file.
Args:
outfile (str): Path to new FASTA file to be written to
force_rerun (bool): If an existing file should be overwritten
... | python | def write_fasta_file(self, outfile, force_rerun=False):
"""Write a FASTA file for the protein sequence, ``seq`` will now load directly from this file.
Args:
outfile (str): Path to new FASTA file to be written to
force_rerun (bool): If an existing file should be overwritten
... | [
"def",
"write_fasta_file",
"(",
"self",
",",
"outfile",
",",
"force_rerun",
"=",
"False",
")",
":",
"if",
"ssbio",
".",
"utils",
".",
"force_rerun",
"(",
"flag",
"=",
"force_rerun",
",",
"outfile",
"=",
"outfile",
")",
":",
"SeqIO",
".",
"write",
"(",
... | Write a FASTA file for the protein sequence, ``seq`` will now load directly from this file.
Args:
outfile (str): Path to new FASTA file to be written to
force_rerun (bool): If an existing file should be overwritten | [
"Write",
"a",
"FASTA",
"file",
"for",
"the",
"protein",
"sequence",
"seq",
"will",
"now",
"load",
"directly",
"from",
"this",
"file",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/seqprop.py#L500-L512 | train | 28,930 |
SBRG/ssbio | ssbio/protein/sequence/seqprop.py | SeqProp.write_gff_file | def write_gff_file(self, outfile, force_rerun=False):
"""Write a GFF file for the protein features, ``features`` will now load directly from this file.
Args:
outfile (str): Path to new FASTA file to be written to
force_rerun (bool): If an existing file should be overwritten
... | python | def write_gff_file(self, outfile, force_rerun=False):
"""Write a GFF file for the protein features, ``features`` will now load directly from this file.
Args:
outfile (str): Path to new FASTA file to be written to
force_rerun (bool): If an existing file should be overwritten
... | [
"def",
"write_gff_file",
"(",
"self",
",",
"outfile",
",",
"force_rerun",
"=",
"False",
")",
":",
"if",
"ssbio",
".",
"utils",
".",
"force_rerun",
"(",
"outfile",
"=",
"outfile",
",",
"flag",
"=",
"force_rerun",
")",
":",
"with",
"open",
"(",
"outfile",
... | Write a GFF file for the protein features, ``features`` will now load directly from this file.
Args:
outfile (str): Path to new FASTA file to be written to
force_rerun (bool): If an existing file should be overwritten | [
"Write",
"a",
"GFF",
"file",
"for",
"the",
"protein",
"features",
"features",
"will",
"now",
"load",
"directly",
"from",
"this",
"file",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/seqprop.py#L514-L526 | train | 28,931 |
SBRG/ssbio | ssbio/protein/sequence/seqprop.py | SeqProp.add_point_feature | def add_point_feature(self, resnum, feat_type=None, feat_id=None, qualifiers=None):
"""Add a feature to the features list describing a single residue.
Args:
resnum (int): Protein sequence residue number
feat_type (str, optional): Optional description of the feature type (ie. 'ca... | python | def add_point_feature(self, resnum, feat_type=None, feat_id=None, qualifiers=None):
"""Add a feature to the features list describing a single residue.
Args:
resnum (int): Protein sequence residue number
feat_type (str, optional): Optional description of the feature type (ie. 'ca... | [
"def",
"add_point_feature",
"(",
"self",
",",
"resnum",
",",
"feat_type",
"=",
"None",
",",
"feat_id",
"=",
"None",
",",
"qualifiers",
"=",
"None",
")",
":",
"if",
"self",
".",
"feature_file",
":",
"raise",
"ValueError",
"(",
"'Feature file associated with seq... | Add a feature to the features list describing a single residue.
Args:
resnum (int): Protein sequence residue number
feat_type (str, optional): Optional description of the feature type (ie. 'catalytic residue')
feat_id (str, optional): Optional ID of the feature type (ie. 'TM... | [
"Add",
"a",
"feature",
"to",
"the",
"features",
"list",
"describing",
"a",
"single",
"residue",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/seqprop.py#L528-L548 | train | 28,932 |
SBRG/ssbio | ssbio/protein/sequence/seqprop.py | SeqProp.add_region_feature | def add_region_feature(self, start_resnum, end_resnum, feat_type=None, feat_id=None, qualifiers=None):
"""Add a feature to the features list describing a region of the protein sequence.
Args:
start_resnum (int): Start residue number of the protein sequence feature
end_resnum (in... | python | def add_region_feature(self, start_resnum, end_resnum, feat_type=None, feat_id=None, qualifiers=None):
"""Add a feature to the features list describing a region of the protein sequence.
Args:
start_resnum (int): Start residue number of the protein sequence feature
end_resnum (in... | [
"def",
"add_region_feature",
"(",
"self",
",",
"start_resnum",
",",
"end_resnum",
",",
"feat_type",
"=",
"None",
",",
"feat_id",
"=",
"None",
",",
"qualifiers",
"=",
"None",
")",
":",
"if",
"self",
".",
"feature_file",
":",
"raise",
"ValueError",
"(",
"'Fe... | Add a feature to the features list describing a region of the protein sequence.
Args:
start_resnum (int): Start residue number of the protein sequence feature
end_resnum (int): End residue number of the protein sequence feature
feat_type (str, optional): Optional description... | [
"Add",
"a",
"feature",
"to",
"the",
"features",
"list",
"describing",
"a",
"region",
"of",
"the",
"protein",
"sequence",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/seqprop.py#L550-L571 | train | 28,933 |
SBRG/ssbio | ssbio/protein/sequence/seqprop.py | SeqProp.get_subsequence | def get_subsequence(self, resnums, new_id=None, copy_letter_annotations=True):
"""Get a subsequence as a new SeqProp object given a list of residue numbers"""
# XTODO: documentation
biop_compound_list = []
for resnum in resnums:
# XTODO can be sped up by separating into range... | python | def get_subsequence(self, resnums, new_id=None, copy_letter_annotations=True):
"""Get a subsequence as a new SeqProp object given a list of residue numbers"""
# XTODO: documentation
biop_compound_list = []
for resnum in resnums:
# XTODO can be sped up by separating into range... | [
"def",
"get_subsequence",
"(",
"self",
",",
"resnums",
",",
"new_id",
"=",
"None",
",",
"copy_letter_annotations",
"=",
"True",
")",
":",
"# XTODO: documentation",
"biop_compound_list",
"=",
"[",
"]",
"for",
"resnum",
"in",
"resnums",
":",
"# XTODO can be sped up ... | Get a subsequence as a new SeqProp object given a list of residue numbers | [
"Get",
"a",
"subsequence",
"as",
"a",
"new",
"SeqProp",
"object",
"given",
"a",
"list",
"of",
"residue",
"numbers"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/seqprop.py#L573-L604 | train | 28,934 |
SBRG/ssbio | ssbio/protein/sequence/seqprop.py | SeqProp.get_subsequence_from_property | def get_subsequence_from_property(self, property_key, property_value, condition,
return_resnums=False, copy_letter_annotations=True):
"""Get a subsequence as a new SeqProp object given a certain property you want to find in the
original SeqProp's letter_annotation
... | python | def get_subsequence_from_property(self, property_key, property_value, condition,
return_resnums=False, copy_letter_annotations=True):
"""Get a subsequence as a new SeqProp object given a certain property you want to find in the
original SeqProp's letter_annotation
... | [
"def",
"get_subsequence_from_property",
"(",
"self",
",",
"property_key",
",",
"property_value",
",",
"condition",
",",
"return_resnums",
"=",
"False",
",",
"copy_letter_annotations",
"=",
"True",
")",
":",
"if",
"property_key",
"not",
"in",
"self",
".",
"letter_a... | Get a subsequence as a new SeqProp object given a certain property you want to find in the
original SeqProp's letter_annotation
This can be used to do something like extract the subsequence of exposed residues, so you can can run
calculations on that subsequence. Useful if you have questions li... | [
"Get",
"a",
"subsequence",
"as",
"a",
"new",
"SeqProp",
"object",
"given",
"a",
"certain",
"property",
"you",
"want",
"to",
"find",
"in",
"the",
"original",
"SeqProp",
"s",
"letter_annotation"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/seqprop.py#L606-L658 | train | 28,935 |
SBRG/ssbio | ssbio/protein/sequence/seqprop.py | SeqProp.get_biopython_pepstats | def get_biopython_pepstats(self, clean_seq=False):
"""Run Biopython's built in ProteinAnalysis module and store statistics in the ``annotations`` attribute."""
if self.seq:
if clean_seq: # TODO: can make this a property of the SeqProp class
seq = self.seq_str.replace('X', '... | python | def get_biopython_pepstats(self, clean_seq=False):
"""Run Biopython's built in ProteinAnalysis module and store statistics in the ``annotations`` attribute."""
if self.seq:
if clean_seq: # TODO: can make this a property of the SeqProp class
seq = self.seq_str.replace('X', '... | [
"def",
"get_biopython_pepstats",
"(",
"self",
",",
"clean_seq",
"=",
"False",
")",
":",
"if",
"self",
".",
"seq",
":",
"if",
"clean_seq",
":",
"# TODO: can make this a property of the SeqProp class",
"seq",
"=",
"self",
".",
"seq_str",
".",
"replace",
"(",
"'X'"... | Run Biopython's built in ProteinAnalysis module and store statistics in the ``annotations`` attribute. | [
"Run",
"Biopython",
"s",
"built",
"in",
"ProteinAnalysis",
"module",
"and",
"store",
"statistics",
"in",
"the",
"annotations",
"attribute",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/seqprop.py#L660-L679 | train | 28,936 |
SBRG/ssbio | ssbio/protein/sequence/seqprop.py | SeqProp.get_emboss_pepstats | def get_emboss_pepstats(self):
"""Run the EMBOSS pepstats program on the protein sequence.
Stores statistics in the ``annotations`` attribute.
Saves a ``.pepstats`` file of the results where the sequence file is located.
"""
if not self.sequence_file:
raise IOError('... | python | def get_emboss_pepstats(self):
"""Run the EMBOSS pepstats program on the protein sequence.
Stores statistics in the ``annotations`` attribute.
Saves a ``.pepstats`` file of the results where the sequence file is located.
"""
if not self.sequence_file:
raise IOError('... | [
"def",
"get_emboss_pepstats",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"sequence_file",
":",
"raise",
"IOError",
"(",
"'FASTA file needs to be written for EMBOSS pepstats to be run'",
")",
"outfile",
"=",
"ssbio",
".",
"protein",
".",
"sequence",
".",
"prope... | Run the EMBOSS pepstats program on the protein sequence.
Stores statistics in the ``annotations`` attribute.
Saves a ``.pepstats`` file of the results where the sequence file is located. | [
"Run",
"the",
"EMBOSS",
"pepstats",
"program",
"on",
"the",
"protein",
"sequence",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/seqprop.py#L681-L691 | train | 28,937 |
SBRG/ssbio | ssbio/protein/sequence/seqprop.py | SeqProp.get_sliding_window_properties | def get_sliding_window_properties(self, scale, window):
"""Run a property calculator given a sliding window size
Stores statistics in the ``letter_annotations`` attribute.
Todo:
- Add and document all scales available to set
"""
# XTODO: documentation
if sel... | python | def get_sliding_window_properties(self, scale, window):
"""Run a property calculator given a sliding window size
Stores statistics in the ``letter_annotations`` attribute.
Todo:
- Add and document all scales available to set
"""
# XTODO: documentation
if sel... | [
"def",
"get_sliding_window_properties",
"(",
"self",
",",
"scale",
",",
"window",
")",
":",
"# XTODO: documentation",
"if",
"self",
".",
"seq",
":",
"# if clean_seq: # TODO: can't do this because letter_annotations will complain about differing seqlen",
"# seq = self.seq_str.r... | Run a property calculator given a sliding window size
Stores statistics in the ``letter_annotations`` attribute.
Todo:
- Add and document all scales available to set | [
"Run",
"a",
"property",
"calculator",
"given",
"a",
"sliding",
"window",
"size"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/seqprop.py#L693-L720 | train | 28,938 |
SBRG/ssbio | ssbio/protein/sequence/seqprop.py | SeqProp.blast_pdb | def blast_pdb(self, seq_ident_cutoff=0, evalue=0.0001, display_link=False,
outdir=None, force_rerun=False):
"""BLAST this sequence to the PDB"""
if not outdir:
outdir = self.sequence_dir
if not outdir:
raise ValueError('Output directory must be s... | python | def blast_pdb(self, seq_ident_cutoff=0, evalue=0.0001, display_link=False,
outdir=None, force_rerun=False):
"""BLAST this sequence to the PDB"""
if not outdir:
outdir = self.sequence_dir
if not outdir:
raise ValueError('Output directory must be s... | [
"def",
"blast_pdb",
"(",
"self",
",",
"seq_ident_cutoff",
"=",
"0",
",",
"evalue",
"=",
"0.0001",
",",
"display_link",
"=",
"False",
",",
"outdir",
"=",
"None",
",",
"force_rerun",
"=",
"False",
")",
":",
"if",
"not",
"outdir",
":",
"outdir",
"=",
"sel... | BLAST this sequence to the PDB | [
"BLAST",
"this",
"sequence",
"to",
"the",
"PDB"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/seqprop.py#L722-L747 | train | 28,939 |
SBRG/ssbio | ssbio/protein/sequence/seqprop.py | SeqProp.get_residue_annotations | def get_residue_annotations(self, start_resnum, end_resnum=None):
"""Retrieve letter annotations for a residue or a range of residues
Args:
start_resnum (int): Residue number
end_resnum (int): Optional residue number, specify if a range is desired
Returns:
d... | python | def get_residue_annotations(self, start_resnum, end_resnum=None):
"""Retrieve letter annotations for a residue or a range of residues
Args:
start_resnum (int): Residue number
end_resnum (int): Optional residue number, specify if a range is desired
Returns:
d... | [
"def",
"get_residue_annotations",
"(",
"self",
",",
"start_resnum",
",",
"end_resnum",
"=",
"None",
")",
":",
"if",
"not",
"end_resnum",
":",
"end_resnum",
"=",
"start_resnum",
"# Create a new SeqFeature",
"f",
"=",
"SeqFeature",
"(",
"FeatureLocation",
"(",
"star... | Retrieve letter annotations for a residue or a range of residues
Args:
start_resnum (int): Residue number
end_resnum (int): Optional residue number, specify if a range is desired
Returns:
dict: Letter annotations for this residue or residues | [
"Retrieve",
"letter",
"annotations",
"for",
"a",
"residue",
"or",
"a",
"range",
"of",
"residues"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/seqprop.py#L749-L767 | train | 28,940 |
SBRG/ssbio | ssbio/protein/sequence/seqprop.py | SeqProp.get_aggregation_propensity | def get_aggregation_propensity(self, email, password, cutoff_v=5, cutoff_n=5, run_amylmuts=False, outdir=None):
"""Run the AMYLPRED2 web server to calculate the aggregation propensity of this protein sequence, which is
the number of aggregation-prone segments on the unfolded protein sequence.
S... | python | def get_aggregation_propensity(self, email, password, cutoff_v=5, cutoff_n=5, run_amylmuts=False, outdir=None):
"""Run the AMYLPRED2 web server to calculate the aggregation propensity of this protein sequence, which is
the number of aggregation-prone segments on the unfolded protein sequence.
S... | [
"def",
"get_aggregation_propensity",
"(",
"self",
",",
"email",
",",
"password",
",",
"cutoff_v",
"=",
"5",
",",
"cutoff_n",
"=",
"5",
",",
"run_amylmuts",
"=",
"False",
",",
"outdir",
"=",
"None",
")",
":",
"if",
"not",
"outdir",
":",
"outdir",
"=",
"... | Run the AMYLPRED2 web server to calculate the aggregation propensity of this protein sequence, which is
the number of aggregation-prone segments on the unfolded protein sequence.
Stores statistics in the ``annotations`` attribute, under the key `aggprop-amylpred`.
See :mod:`ssbio.protein.seque... | [
"Run",
"the",
"AMYLPRED2",
"web",
"server",
"to",
"calculate",
"the",
"aggregation",
"propensity",
"of",
"this",
"protein",
"sequence",
"which",
"is",
"the",
"number",
"of",
"aggregation",
"-",
"prone",
"segments",
"on",
"the",
"unfolded",
"protein",
"sequence",... | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/seqprop.py#L769-L789 | train | 28,941 |
SBRG/ssbio | ssbio/protein/sequence/seqprop.py | SeqProp.get_thermostability | def get_thermostability(self, at_temp):
"""Run the thermostability calculator using either the Dill or Oobatake methods.
Stores calculated (dG, Keq) tuple in the ``annotations`` attribute, under the key
`thermostability_<TEMP>-<METHOD_USED>`.
See :func:`ssbio.protein.sequence.propertie... | python | def get_thermostability(self, at_temp):
"""Run the thermostability calculator using either the Dill or Oobatake methods.
Stores calculated (dG, Keq) tuple in the ``annotations`` attribute, under the key
`thermostability_<TEMP>-<METHOD_USED>`.
See :func:`ssbio.protein.sequence.propertie... | [
"def",
"get_thermostability",
"(",
"self",
",",
"at_temp",
")",
":",
"import",
"ssbio",
".",
"protein",
".",
"sequence",
".",
"properties",
".",
"thermostability",
"as",
"ts",
"dG",
"=",
"ts",
".",
"get_dG_at_T",
"(",
"seq",
"=",
"self",
",",
"temp",
"="... | Run the thermostability calculator using either the Dill or Oobatake methods.
Stores calculated (dG, Keq) tuple in the ``annotations`` attribute, under the key
`thermostability_<TEMP>-<METHOD_USED>`.
See :func:`ssbio.protein.sequence.properties.thermostability.get_dG_at_T` for instructions and... | [
"Run",
"the",
"thermostability",
"calculator",
"using",
"either",
"the",
"Dill",
"or",
"Oobatake",
"methods",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/seqprop.py#L810-L823 | train | 28,942 |
SBRG/ssbio | ssbio/protein/sequence/seqprop.py | SeqProp.store_iupred_disorder_predictions | def store_iupred_disorder_predictions(seqprop, iupred_path,
iupred_exec, prediction_type, force_rerun=False):
"""Scores above 0.5 indicate disorder"""
os.environ['IUPred_PATH'] = iupred_path
stored_key = 'disorder-{}-iupred'.format(prediction_type)
... | python | def store_iupred_disorder_predictions(seqprop, iupred_path,
iupred_exec, prediction_type, force_rerun=False):
"""Scores above 0.5 indicate disorder"""
os.environ['IUPred_PATH'] = iupred_path
stored_key = 'disorder-{}-iupred'.format(prediction_type)
... | [
"def",
"store_iupred_disorder_predictions",
"(",
"seqprop",
",",
"iupred_path",
",",
"iupred_exec",
",",
"prediction_type",
",",
"force_rerun",
"=",
"False",
")",
":",
"os",
".",
"environ",
"[",
"'IUPred_PATH'",
"]",
"=",
"iupred_path",
"stored_key",
"=",
"'disord... | Scores above 0.5 indicate disorder | [
"Scores",
"above",
"0",
".",
"5",
"indicate",
"disorder"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/seqprop.py#L836-L857 | train | 28,943 |
SBRG/ssbio | ssbio/protein/sequence/properties/scratch.py | SCRATCH.run_scratch | def run_scratch(self, path_to_scratch, num_cores=1, outname=None, outdir=None, force_rerun=False):
"""Run SCRATCH on the sequence_file that was loaded into the class.
Args:
path_to_scratch: Path to the SCRATCH executable, run_SCRATCH-1D_predictors.sh
outname: Prefix to name the ... | python | def run_scratch(self, path_to_scratch, num_cores=1, outname=None, outdir=None, force_rerun=False):
"""Run SCRATCH on the sequence_file that was loaded into the class.
Args:
path_to_scratch: Path to the SCRATCH executable, run_SCRATCH-1D_predictors.sh
outname: Prefix to name the ... | [
"def",
"run_scratch",
"(",
"self",
",",
"path_to_scratch",
",",
"num_cores",
"=",
"1",
",",
"outname",
"=",
"None",
",",
"outdir",
"=",
"None",
",",
"force_rerun",
"=",
"False",
")",
":",
"if",
"not",
"outname",
":",
"outname",
"=",
"self",
".",
"proje... | Run SCRATCH on the sequence_file that was loaded into the class.
Args:
path_to_scratch: Path to the SCRATCH executable, run_SCRATCH-1D_predictors.sh
outname: Prefix to name the output files
outdir: Directory to store the output files
force_rerun: Flag to force re... | [
"Run",
"SCRATCH",
"on",
"the",
"sequence_file",
"that",
"was",
"loaded",
"into",
"the",
"class",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/properties/scratch.py#L39-L66 | train | 28,944 |
SBRG/ssbio | ssbio/protein/sequence/properties/scratch.py | SCRATCH.sspro_results | def sspro_results(self):
"""Parse the SSpro output file and return a dict of secondary structure compositions.
Returns:
dict: Keys are sequence IDs, values are the lists of secondary structure predictions.
H: helix
E: strand
C: the rest
... | python | def sspro_results(self):
"""Parse the SSpro output file and return a dict of secondary structure compositions.
Returns:
dict: Keys are sequence IDs, values are the lists of secondary structure predictions.
H: helix
E: strand
C: the rest
... | [
"def",
"sspro_results",
"(",
"self",
")",
":",
"return",
"ssbio",
".",
"protein",
".",
"sequence",
".",
"utils",
".",
"fasta",
".",
"load_fasta_file_as_dict_of_seqs",
"(",
"self",
".",
"out_sspro",
")"
] | Parse the SSpro output file and return a dict of secondary structure compositions.
Returns:
dict: Keys are sequence IDs, values are the lists of secondary structure predictions.
H: helix
E: strand
C: the rest | [
"Parse",
"the",
"SSpro",
"output",
"file",
"and",
"return",
"a",
"dict",
"of",
"secondary",
"structure",
"compositions",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/properties/scratch.py#L68-L78 | train | 28,945 |
SBRG/ssbio | ssbio/protein/sequence/properties/scratch.py | SCRATCH.sspro_summary | def sspro_summary(self):
"""Parse the SSpro output file and return a summary of secondary structure composition.
The output file is just a FASTA formatted file, so you can get residue level
information by parsing it like a normal sequence file.
Returns:
dict: Percentage... | python | def sspro_summary(self):
"""Parse the SSpro output file and return a summary of secondary structure composition.
The output file is just a FASTA formatted file, so you can get residue level
information by parsing it like a normal sequence file.
Returns:
dict: Percentage... | [
"def",
"sspro_summary",
"(",
"self",
")",
":",
"summary",
"=",
"{",
"}",
"records",
"=",
"ssbio",
".",
"protein",
".",
"sequence",
".",
"utils",
".",
"fasta",
".",
"load_fasta_file",
"(",
"self",
".",
"out_sspro",
")",
"for",
"r",
"in",
"records",
":",... | Parse the SSpro output file and return a summary of secondary structure composition.
The output file is just a FASTA formatted file, so you can get residue level
information by parsing it like a normal sequence file.
Returns:
dict: Percentage of:
H: helix
... | [
"Parse",
"the",
"SSpro",
"output",
"file",
"and",
"return",
"a",
"summary",
"of",
"secondary",
"structure",
"composition",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/properties/scratch.py#L80-L104 | train | 28,946 |
SBRG/ssbio | ssbio/protein/sequence/properties/scratch.py | SCRATCH.sspro8_results | def sspro8_results(self):
"""Parse the SSpro8 output file and return a dict of secondary structure compositions.
"""
return ssbio.protein.sequence.utils.fasta.load_fasta_file_as_dict_of_seqs(self.out_sspro8) | python | def sspro8_results(self):
"""Parse the SSpro8 output file and return a dict of secondary structure compositions.
"""
return ssbio.protein.sequence.utils.fasta.load_fasta_file_as_dict_of_seqs(self.out_sspro8) | [
"def",
"sspro8_results",
"(",
"self",
")",
":",
"return",
"ssbio",
".",
"protein",
".",
"sequence",
".",
"utils",
".",
"fasta",
".",
"load_fasta_file_as_dict_of_seqs",
"(",
"self",
".",
"out_sspro8",
")"
] | Parse the SSpro8 output file and return a dict of secondary structure compositions. | [
"Parse",
"the",
"SSpro8",
"output",
"file",
"and",
"return",
"a",
"dict",
"of",
"secondary",
"structure",
"compositions",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/properties/scratch.py#L106-L109 | train | 28,947 |
SBRG/ssbio | ssbio/protein/sequence/properties/scratch.py | SCRATCH.sspro8_summary | def sspro8_summary(self):
"""Parse the SSpro8 output file and return a summary of secondary structure composition.
The output file is just a FASTA formatted file, so you can get residue level
information by parsing it like a normal sequence file.
Returns:
dict: Percenta... | python | def sspro8_summary(self):
"""Parse the SSpro8 output file and return a summary of secondary structure composition.
The output file is just a FASTA formatted file, so you can get residue level
information by parsing it like a normal sequence file.
Returns:
dict: Percenta... | [
"def",
"sspro8_summary",
"(",
"self",
")",
":",
"summary",
"=",
"{",
"}",
"records",
"=",
"ssbio",
".",
"protein",
".",
"sequence",
".",
"utils",
".",
"fasta",
".",
"load_fasta_file",
"(",
"self",
".",
"out_sspro8",
")",
"for",
"r",
"in",
"records",
":... | Parse the SSpro8 output file and return a summary of secondary structure composition.
The output file is just a FASTA formatted file, so you can get residue level
information by parsing it like a normal sequence file.
Returns:
dict: Percentage of:
H: alpha-helix... | [
"Parse",
"the",
"SSpro8",
"output",
"file",
"and",
"return",
"a",
"summary",
"of",
"secondary",
"structure",
"composition",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/properties/scratch.py#L111-L145 | train | 28,948 |
SBRG/ssbio | ssbio/protein/sequence/properties/scratch.py | SCRATCH.accpro_results | def accpro_results(self):
"""Parse the ACCpro output file and return a dict of secondary structure compositions.
"""
return ssbio.protein.sequence.utils.fasta.load_fasta_file_as_dict_of_seqs(self.out_accpro) | python | def accpro_results(self):
"""Parse the ACCpro output file and return a dict of secondary structure compositions.
"""
return ssbio.protein.sequence.utils.fasta.load_fasta_file_as_dict_of_seqs(self.out_accpro) | [
"def",
"accpro_results",
"(",
"self",
")",
":",
"return",
"ssbio",
".",
"protein",
".",
"sequence",
".",
"utils",
".",
"fasta",
".",
"load_fasta_file_as_dict_of_seqs",
"(",
"self",
".",
"out_accpro",
")"
] | Parse the ACCpro output file and return a dict of secondary structure compositions. | [
"Parse",
"the",
"ACCpro",
"output",
"file",
"and",
"return",
"a",
"dict",
"of",
"secondary",
"structure",
"compositions",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/properties/scratch.py#L147-L150 | train | 28,949 |
SBRG/ssbio | ssbio/core/modelpro.py | model_loader | def model_loader(gem_file_path, gem_file_type):
"""Consolidated function to load a GEM using COBRApy. Specify the file type being loaded.
Args:
gem_file_path (str): Path to model file
gem_file_type (str): GEM model type - ``sbml`` (or ``xml``), ``mat``, or ``json`` format
Returns:
... | python | def model_loader(gem_file_path, gem_file_type):
"""Consolidated function to load a GEM using COBRApy. Specify the file type being loaded.
Args:
gem_file_path (str): Path to model file
gem_file_type (str): GEM model type - ``sbml`` (or ``xml``), ``mat``, or ``json`` format
Returns:
... | [
"def",
"model_loader",
"(",
"gem_file_path",
",",
"gem_file_type",
")",
":",
"if",
"gem_file_type",
".",
"lower",
"(",
")",
"==",
"'xml'",
"or",
"gem_file_type",
".",
"lower",
"(",
")",
"==",
"'sbml'",
":",
"model",
"=",
"read_sbml_model",
"(",
"gem_file_pat... | Consolidated function to load a GEM using COBRApy. Specify the file type being loaded.
Args:
gem_file_path (str): Path to model file
gem_file_type (str): GEM model type - ``sbml`` (or ``xml``), ``mat``, or ``json`` format
Returns:
COBRApy Model object. | [
"Consolidated",
"function",
"to",
"load",
"a",
"GEM",
"using",
"COBRApy",
".",
"Specify",
"the",
"file",
"type",
"being",
"loaded",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/core/modelpro.py#L140-L161 | train | 28,950 |
SBRG/ssbio | ssbio/core/modelpro.py | filter_out_spontaneous_genes | def filter_out_spontaneous_genes(genes, custom_spont_id=None):
"""Return the DictList of genes that are not spontaneous in a model.
Args:
genes (DictList): Genes DictList
custom_spont_id (str): Optional custom spontaneous ID if it does not match the regular expression ``[Ss](_|)0001``
Retu... | python | def filter_out_spontaneous_genes(genes, custom_spont_id=None):
"""Return the DictList of genes that are not spontaneous in a model.
Args:
genes (DictList): Genes DictList
custom_spont_id (str): Optional custom spontaneous ID if it does not match the regular expression ``[Ss](_|)0001``
Retu... | [
"def",
"filter_out_spontaneous_genes",
"(",
"genes",
",",
"custom_spont_id",
"=",
"None",
")",
":",
"new_genes",
"=",
"DictList",
"(",
")",
"for",
"gene",
"in",
"genes",
":",
"if",
"not",
"is_spontaneous",
"(",
"gene",
",",
"custom_id",
"=",
"custom_spont_id",... | Return the DictList of genes that are not spontaneous in a model.
Args:
genes (DictList): Genes DictList
custom_spont_id (str): Optional custom spontaneous ID if it does not match the regular expression ``[Ss](_|)0001``
Returns:
DictList: genes excluding ones that are spontaneous | [
"Return",
"the",
"DictList",
"of",
"genes",
"that",
"are",
"not",
"spontaneous",
"in",
"a",
"model",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/core/modelpro.py#L185-L201 | train | 28,951 |
SBRG/ssbio | ssbio/core/modelpro.py | true_num_genes | def true_num_genes(model, custom_spont_id=None):
"""Return the number of genes in a model ignoring spontaneously labeled genes.
Args:
model (Model):
custom_spont_id (str): Optional custom spontaneous ID if it does not match the regular expression ``[Ss](_|)0001``
Returns:
int: Numb... | python | def true_num_genes(model, custom_spont_id=None):
"""Return the number of genes in a model ignoring spontaneously labeled genes.
Args:
model (Model):
custom_spont_id (str): Optional custom spontaneous ID if it does not match the regular expression ``[Ss](_|)0001``
Returns:
int: Numb... | [
"def",
"true_num_genes",
"(",
"model",
",",
"custom_spont_id",
"=",
"None",
")",
":",
"true_num",
"=",
"0",
"for",
"gene",
"in",
"model",
".",
"genes",
":",
"if",
"not",
"is_spontaneous",
"(",
"gene",
",",
"custom_id",
"=",
"custom_spont_id",
")",
":",
"... | Return the number of genes in a model ignoring spontaneously labeled genes.
Args:
model (Model):
custom_spont_id (str): Optional custom spontaneous ID if it does not match the regular expression ``[Ss](_|)0001``
Returns:
int: Number of genes excluding spontaneous genes | [
"Return",
"the",
"number",
"of",
"genes",
"in",
"a",
"model",
"ignoring",
"spontaneously",
"labeled",
"genes",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/core/modelpro.py#L204-L219 | train | 28,952 |
SBRG/ssbio | ssbio/core/modelpro.py | true_num_reactions | def true_num_reactions(model, custom_spont_id=None):
"""Return the number of reactions associated with a gene.
Args:
model (Model):
custom_spont_id (str): Optional custom spontaneous ID if it does not match the regular expression ``[Ss](_|)0001``
Returns:
int: Number of reactions a... | python | def true_num_reactions(model, custom_spont_id=None):
"""Return the number of reactions associated with a gene.
Args:
model (Model):
custom_spont_id (str): Optional custom spontaneous ID if it does not match the regular expression ``[Ss](_|)0001``
Returns:
int: Number of reactions a... | [
"def",
"true_num_reactions",
"(",
"model",
",",
"custom_spont_id",
"=",
"None",
")",
":",
"true_num",
"=",
"0",
"for",
"rxn",
"in",
"model",
".",
"reactions",
":",
"if",
"len",
"(",
"rxn",
".",
"genes",
")",
"==",
"0",
":",
"continue",
"if",
"len",
"... | Return the number of reactions associated with a gene.
Args:
model (Model):
custom_spont_id (str): Optional custom spontaneous ID if it does not match the regular expression ``[Ss](_|)0001``
Returns:
int: Number of reactions associated with a gene | [
"Return",
"the",
"number",
"of",
"reactions",
"associated",
"with",
"a",
"gene",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/core/modelpro.py#L222-L241 | train | 28,953 |
SBRG/ssbio | ssbio/biopython/Bio/Struct/WWW/WHATIF.py | WHATIF._smcra_to_str | def _smcra_to_str(self, smcra, temp_dir='/tmp/'):
"""
WHATIF's input are PDB format files.
Converts a SMCRA object to a PDB formatted string.
"""
temp_path = tempfile.mktemp( '.pdb', dir=temp_dir )
io = PDBIO()
io.set_structure(smcra)
io.... | python | def _smcra_to_str(self, smcra, temp_dir='/tmp/'):
"""
WHATIF's input are PDB format files.
Converts a SMCRA object to a PDB formatted string.
"""
temp_path = tempfile.mktemp( '.pdb', dir=temp_dir )
io = PDBIO()
io.set_structure(smcra)
io.... | [
"def",
"_smcra_to_str",
"(",
"self",
",",
"smcra",
",",
"temp_dir",
"=",
"'/tmp/'",
")",
":",
"temp_path",
"=",
"tempfile",
".",
"mktemp",
"(",
"'.pdb'",
",",
"dir",
"=",
"temp_dir",
")",
"io",
"=",
"PDBIO",
"(",
")",
"io",
".",
"set_structure",
"(",
... | WHATIF's input are PDB format files.
Converts a SMCRA object to a PDB formatted string. | [
"WHATIF",
"s",
"input",
"are",
"PDB",
"format",
"files",
".",
"Converts",
"a",
"SMCRA",
"object",
"to",
"a",
"PDB",
"formatted",
"string",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/biopython/Bio/Struct/WWW/WHATIF.py#L58-L76 | train | 28,954 |
SBRG/ssbio | ssbio/biopython/Bio/Struct/WWW/WHATIF.py | WHATIF.is_alive | def is_alive(self):
"""
Test Function to check WHAT IF servers are up and running.
"""
u = urllib.urlopen("http://wiws.cmbi.ru.nl/rest/TestEmpty/id/1crn/")
x = xml.dom.minidom.parse(u)
self.alive = len(x.getElementsByTagName("TestEmptyResponse"))
return ... | python | def is_alive(self):
"""
Test Function to check WHAT IF servers are up and running.
"""
u = urllib.urlopen("http://wiws.cmbi.ru.nl/rest/TestEmpty/id/1crn/")
x = xml.dom.minidom.parse(u)
self.alive = len(x.getElementsByTagName("TestEmptyResponse"))
return ... | [
"def",
"is_alive",
"(",
"self",
")",
":",
"u",
"=",
"urllib",
".",
"urlopen",
"(",
"\"http://wiws.cmbi.ru.nl/rest/TestEmpty/id/1crn/\"",
")",
"x",
"=",
"xml",
".",
"dom",
".",
"minidom",
".",
"parse",
"(",
"u",
")",
"self",
".",
"alive",
"=",
"len",
"(",... | Test Function to check WHAT IF servers are up and running. | [
"Test",
"Function",
"to",
"check",
"WHAT",
"IF",
"servers",
"are",
"up",
"and",
"running",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/biopython/Bio/Struct/WWW/WHATIF.py#L94-L103 | train | 28,955 |
SBRG/ssbio | ssbio/biopython/Bio/Struct/WWW/WHATIF.py | WHATIF.PDBasXMLwithSymwithPolarH | def PDBasXMLwithSymwithPolarH(self, id):
"""
Adds Hydrogen Atoms to a Structure.
"""
print _WARNING
# Protonated Structure in XML Format
h_s_xml = urllib.urlopen("http://www.cmbi.ru.nl/wiwsd/rest/PDBasXMLwithSymwithPolarH/id/" + id)
self.raw = h_s_xml
... | python | def PDBasXMLwithSymwithPolarH(self, id):
"""
Adds Hydrogen Atoms to a Structure.
"""
print _WARNING
# Protonated Structure in XML Format
h_s_xml = urllib.urlopen("http://www.cmbi.ru.nl/wiwsd/rest/PDBasXMLwithSymwithPolarH/id/" + id)
self.raw = h_s_xml
... | [
"def",
"PDBasXMLwithSymwithPolarH",
"(",
"self",
",",
"id",
")",
":",
"print",
"_WARNING",
"# Protonated Structure in XML Format",
"h_s_xml",
"=",
"urllib",
".",
"urlopen",
"(",
"\"http://www.cmbi.ru.nl/wiwsd/rest/PDBasXMLwithSymwithPolarH/id/\"",
"+",
"id",
")",
"self",
... | Adds Hydrogen Atoms to a Structure. | [
"Adds",
"Hydrogen",
"Atoms",
"to",
"a",
"Structure",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/biopython/Bio/Struct/WWW/WHATIF.py#L130-L142 | train | 28,956 |
SBRG/ssbio | ssbio/databases/bigg.py | get_pdbs_for_gene | def get_pdbs_for_gene(bigg_model, bigg_gene, cache_dir=tempfile.gettempdir(), force_rerun=False):
"""Attempt to get a rank-ordered list of available PDB structures for a BiGG Model and its gene.
Args:
bigg_model: BiGG Model ID
bigg_gene: BiGG Gene ID
Returns:
list: rank-ordered lis... | python | def get_pdbs_for_gene(bigg_model, bigg_gene, cache_dir=tempfile.gettempdir(), force_rerun=False):
"""Attempt to get a rank-ordered list of available PDB structures for a BiGG Model and its gene.
Args:
bigg_model: BiGG Model ID
bigg_gene: BiGG Gene ID
Returns:
list: rank-ordered lis... | [
"def",
"get_pdbs_for_gene",
"(",
"bigg_model",
",",
"bigg_gene",
",",
"cache_dir",
"=",
"tempfile",
".",
"gettempdir",
"(",
")",
",",
"force_rerun",
"=",
"False",
")",
":",
"my_structures",
"=",
"[",
"]",
"# Download gene info",
"gene",
"=",
"ssbio",
".",
"u... | Attempt to get a rank-ordered list of available PDB structures for a BiGG Model and its gene.
Args:
bigg_model: BiGG Model ID
bigg_gene: BiGG Gene ID
Returns:
list: rank-ordered list of tuples of (pdb_id, chain_id) | [
"Attempt",
"to",
"get",
"a",
"rank",
"-",
"ordered",
"list",
"of",
"available",
"PDB",
"structures",
"for",
"a",
"BiGG",
"Model",
"and",
"its",
"gene",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/databases/bigg.py#L12-L50 | train | 28,957 |
SBRG/ssbio | ssbio/protein/structure/properties/dssp.py | get_dssp_df_on_file | def get_dssp_df_on_file(pdb_file, outfile=None, outdir=None, outext='_dssp.df', force_rerun=False):
"""Run DSSP directly on a structure file with the Biopython method Bio.PDB.DSSP.dssp_dict_from_pdb_file
Avoids errors like: PDBException: Structure/DSSP mismatch at <Residue MSE het= resseq=19 icode= >
by n... | python | def get_dssp_df_on_file(pdb_file, outfile=None, outdir=None, outext='_dssp.df', force_rerun=False):
"""Run DSSP directly on a structure file with the Biopython method Bio.PDB.DSSP.dssp_dict_from_pdb_file
Avoids errors like: PDBException: Structure/DSSP mismatch at <Residue MSE het= resseq=19 icode= >
by n... | [
"def",
"get_dssp_df_on_file",
"(",
"pdb_file",
",",
"outfile",
"=",
"None",
",",
"outdir",
"=",
"None",
",",
"outext",
"=",
"'_dssp.df'",
",",
"force_rerun",
"=",
"False",
")",
":",
"# TODO: function unfinished",
"# Create the output file name",
"outfile",
"=",
"s... | Run DSSP directly on a structure file with the Biopython method Bio.PDB.DSSP.dssp_dict_from_pdb_file
Avoids errors like: PDBException: Structure/DSSP mismatch at <Residue MSE het= resseq=19 icode= >
by not matching information to the structure file (DSSP fills in the ID "X" for unknown residues)
Args:
... | [
"Run",
"DSSP",
"directly",
"on",
"a",
"structure",
"file",
"with",
"the",
"Biopython",
"method",
"Bio",
".",
"PDB",
".",
"DSSP",
".",
"dssp_dict_from_pdb_file"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/structure/properties/dssp.py#L66-L128 | train | 28,958 |
SBRG/ssbio | ssbio/protein/structure/properties/dssp.py | secondary_structure_summary | def secondary_structure_summary(dssp_df):
"""Summarize the secondary structure content of the DSSP dataframe for each chain.
Args:
dssp_df: Pandas DataFrame of parsed DSSP results
Returns:
dict: Chain to secondary structure summary dictionary
"""
chains = dssp_df.chain.unique()
... | python | def secondary_structure_summary(dssp_df):
"""Summarize the secondary structure content of the DSSP dataframe for each chain.
Args:
dssp_df: Pandas DataFrame of parsed DSSP results
Returns:
dict: Chain to secondary structure summary dictionary
"""
chains = dssp_df.chain.unique()
... | [
"def",
"secondary_structure_summary",
"(",
"dssp_df",
")",
":",
"chains",
"=",
"dssp_df",
".",
"chain",
".",
"unique",
"(",
")",
"infodict",
"=",
"{",
"}",
"for",
"chain",
"in",
"chains",
":",
"expoinfo",
"=",
"defaultdict",
"(",
"int",
")",
"chain_df",
... | Summarize the secondary structure content of the DSSP dataframe for each chain.
Args:
dssp_df: Pandas DataFrame of parsed DSSP results
Returns:
dict: Chain to secondary structure summary dictionary | [
"Summarize",
"the",
"secondary",
"structure",
"content",
"of",
"the",
"DSSP",
"dataframe",
"for",
"each",
"chain",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/structure/properties/dssp.py#L131-L176 | train | 28,959 |
SBRG/ssbio | ssbio/protein/structure/properties/dssp.py | calc_surface_buried | def calc_surface_buried(dssp_df):
'''Calculates the percent of residues that are in the surface or buried,
as well as if they are polar or nonpolar. Returns a dictionary of this.
'''
SN = 0
BN = 0
SP = 0
SNP = 0
SPo = 0
SNe = 0
BNP = 0
BP = 0
BPo = 0
BNe = 0
Total... | python | def calc_surface_buried(dssp_df):
'''Calculates the percent of residues that are in the surface or buried,
as well as if they are polar or nonpolar. Returns a dictionary of this.
'''
SN = 0
BN = 0
SP = 0
SNP = 0
SPo = 0
SNe = 0
BNP = 0
BP = 0
BPo = 0
BNe = 0
Total... | [
"def",
"calc_surface_buried",
"(",
"dssp_df",
")",
":",
"SN",
"=",
"0",
"BN",
"=",
"0",
"SP",
"=",
"0",
"SNP",
"=",
"0",
"SPo",
"=",
"0",
"SNe",
"=",
"0",
"BNP",
"=",
"0",
"BP",
"=",
"0",
"BPo",
"=",
"0",
"BNe",
"=",
"0",
"Total",
"=",
"0",... | Calculates the percent of residues that are in the surface or buried,
as well as if they are polar or nonpolar. Returns a dictionary of this. | [
"Calculates",
"the",
"percent",
"of",
"residues",
"that",
"are",
"in",
"the",
"surface",
"or",
"buried",
"as",
"well",
"as",
"if",
"they",
"are",
"polar",
"or",
"nonpolar",
".",
"Returns",
"a",
"dictionary",
"of",
"this",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/structure/properties/dssp.py#L180-L253 | train | 28,960 |
SBRG/ssbio | ssbio/protein/structure/properties/dssp.py | calc_sasa | def calc_sasa(dssp_df):
"""
Calculation of SASA utilizing the DSSP program.
DSSP must be installed for biopython to properly call it.
Install using apt-get on Ubuntu
or from: http://swift.cmbi.ru.nl/gv/dssp/
Input: PDB or CIF structure file
Output: SASA (integer) of structure
"""
... | python | def calc_sasa(dssp_df):
"""
Calculation of SASA utilizing the DSSP program.
DSSP must be installed for biopython to properly call it.
Install using apt-get on Ubuntu
or from: http://swift.cmbi.ru.nl/gv/dssp/
Input: PDB or CIF structure file
Output: SASA (integer) of structure
"""
... | [
"def",
"calc_sasa",
"(",
"dssp_df",
")",
":",
"infodict",
"=",
"{",
"'ssb_sasa'",
":",
"dssp_df",
".",
"exposure_asa",
".",
"sum",
"(",
")",
",",
"'ssb_mean_rel_exposed'",
":",
"dssp_df",
".",
"exposure_rsa",
".",
"mean",
"(",
")",
",",
"'ssb_size'",
":",
... | Calculation of SASA utilizing the DSSP program.
DSSP must be installed for biopython to properly call it.
Install using apt-get on Ubuntu
or from: http://swift.cmbi.ru.nl/gv/dssp/
Input: PDB or CIF structure file
Output: SASA (integer) of structure | [
"Calculation",
"of",
"SASA",
"utilizing",
"the",
"DSSP",
"program",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/structure/properties/dssp.py#L256-L272 | train | 28,961 |
SBRG/ssbio | ssbio/protein/structure/properties/dssp.py | get_ss_class | def get_ss_class(pdb_file, dssp_file, chain):
"""Define the secondary structure class of a PDB file at the specific chain
Args:
pdb_file:
dssp_file:
chain:
Returns:
"""
prag = pr.parsePDB(pdb_file)
pr.parseDSSP(dssp_file, prag)
alpha, threeTen, beta = get_dssp_ss_c... | python | def get_ss_class(pdb_file, dssp_file, chain):
"""Define the secondary structure class of a PDB file at the specific chain
Args:
pdb_file:
dssp_file:
chain:
Returns:
"""
prag = pr.parsePDB(pdb_file)
pr.parseDSSP(dssp_file, prag)
alpha, threeTen, beta = get_dssp_ss_c... | [
"def",
"get_ss_class",
"(",
"pdb_file",
",",
"dssp_file",
",",
"chain",
")",
":",
"prag",
"=",
"pr",
".",
"parsePDB",
"(",
"pdb_file",
")",
"pr",
".",
"parseDSSP",
"(",
"dssp_file",
",",
"prag",
")",
"alpha",
",",
"threeTen",
",",
"beta",
"=",
"get_dss... | Define the secondary structure class of a PDB file at the specific chain
Args:
pdb_file:
dssp_file:
chain:
Returns: | [
"Define",
"the",
"secondary",
"structure",
"class",
"of",
"a",
"PDB",
"file",
"at",
"the",
"specific",
"chain"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/structure/properties/dssp.py#L293-L319 | train | 28,962 |
SBRG/ssbio | ssbio/databases/uniprot.py | parse_uniprot_xml_metadata | def parse_uniprot_xml_metadata(sr):
"""Load relevant attributes and dbxrefs from a parsed UniProt XML file in a SeqRecord.
Returns:
dict: All parsed information
"""
# TODO: What about "reviewed" status? and EC number
xref_dbs_to_keep = ['GO', 'KEGG', 'PDB', 'PROSITE', 'Pfam', 'RefSeq']
... | python | def parse_uniprot_xml_metadata(sr):
"""Load relevant attributes and dbxrefs from a parsed UniProt XML file in a SeqRecord.
Returns:
dict: All parsed information
"""
# TODO: What about "reviewed" status? and EC number
xref_dbs_to_keep = ['GO', 'KEGG', 'PDB', 'PROSITE', 'Pfam', 'RefSeq']
... | [
"def",
"parse_uniprot_xml_metadata",
"(",
"sr",
")",
":",
"# TODO: What about \"reviewed\" status? and EC number",
"xref_dbs_to_keep",
"=",
"[",
"'GO'",
",",
"'KEGG'",
",",
"'PDB'",
",",
"'PROSITE'",
",",
"'Pfam'",
",",
"'RefSeq'",
"]",
"infodict",
"=",
"{",
"}",
... | Load relevant attributes and dbxrefs from a parsed UniProt XML file in a SeqRecord.
Returns:
dict: All parsed information | [
"Load",
"relevant",
"attributes",
"and",
"dbxrefs",
"from",
"a",
"parsed",
"UniProt",
"XML",
"file",
"in",
"a",
"SeqRecord",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/databases/uniprot.py#L238-L276 | train | 28,963 |
SBRG/ssbio | ssbio/databases/uniprot.py | is_valid_uniprot_id | def is_valid_uniprot_id(instring):
"""Check if a string is a valid UniProt ID.
See regex from: http://www.uniprot.org/help/accession_numbers
Args:
instring: any string identifier
Returns: True if the string is a valid UniProt ID
"""
valid_id = re.compile("[OPQ][0-9][A-Z0-9]{3}[0-9]|[... | python | def is_valid_uniprot_id(instring):
"""Check if a string is a valid UniProt ID.
See regex from: http://www.uniprot.org/help/accession_numbers
Args:
instring: any string identifier
Returns: True if the string is a valid UniProt ID
"""
valid_id = re.compile("[OPQ][0-9][A-Z0-9]{3}[0-9]|[... | [
"def",
"is_valid_uniprot_id",
"(",
"instring",
")",
":",
"valid_id",
"=",
"re",
".",
"compile",
"(",
"\"[OPQ][0-9][A-Z0-9]{3}[0-9]|[A-NR-Z][0-9]([A-Z][A-Z0-9]{2}[0-9]){1,2}\"",
")",
"if",
"valid_id",
".",
"match",
"(",
"str",
"(",
"instring",
")",
")",
":",
"return"... | Check if a string is a valid UniProt ID.
See regex from: http://www.uniprot.org/help/accession_numbers
Args:
instring: any string identifier
Returns: True if the string is a valid UniProt ID | [
"Check",
"if",
"a",
"string",
"is",
"a",
"valid",
"UniProt",
"ID",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/databases/uniprot.py#L279-L294 | train | 28,964 |
SBRG/ssbio | ssbio/databases/uniprot.py | uniprot_reviewed_checker | def uniprot_reviewed_checker(uniprot_id):
"""Check if a single UniProt ID is reviewed or not.
Args:
uniprot_id:
Returns:
bool: If the entry is reviewed
"""
query_string = 'id:' + uniprot_id
uni_rev_raw = StringIO(bsup.search(query_string, columns='id,reviewed', frmt='tab'))
... | python | def uniprot_reviewed_checker(uniprot_id):
"""Check if a single UniProt ID is reviewed or not.
Args:
uniprot_id:
Returns:
bool: If the entry is reviewed
"""
query_string = 'id:' + uniprot_id
uni_rev_raw = StringIO(bsup.search(query_string, columns='id,reviewed', frmt='tab'))
... | [
"def",
"uniprot_reviewed_checker",
"(",
"uniprot_id",
")",
":",
"query_string",
"=",
"'id:'",
"+",
"uniprot_id",
"uni_rev_raw",
"=",
"StringIO",
"(",
"bsup",
".",
"search",
"(",
"query_string",
",",
"columns",
"=",
"'id,reviewed'",
",",
"frmt",
"=",
"'tab'",
"... | Check if a single UniProt ID is reviewed or not.
Args:
uniprot_id:
Returns:
bool: If the entry is reviewed | [
"Check",
"if",
"a",
"single",
"UniProt",
"ID",
"is",
"reviewed",
"or",
"not",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/databases/uniprot.py#L328-L350 | train | 28,965 |
SBRG/ssbio | ssbio/databases/uniprot.py | uniprot_reviewed_checker_batch | def uniprot_reviewed_checker_batch(uniprot_ids):
"""Batch check if uniprot IDs are reviewed or not
Args:
uniprot_ids: UniProt ID or list of UniProt IDs
Returns:
A dictionary of {UniProtID: Boolean}
"""
uniprot_ids = ssbio.utils.force_list(uniprot_ids)
invalid_ids = [i for i i... | python | def uniprot_reviewed_checker_batch(uniprot_ids):
"""Batch check if uniprot IDs are reviewed or not
Args:
uniprot_ids: UniProt ID or list of UniProt IDs
Returns:
A dictionary of {UniProtID: Boolean}
"""
uniprot_ids = ssbio.utils.force_list(uniprot_ids)
invalid_ids = [i for i i... | [
"def",
"uniprot_reviewed_checker_batch",
"(",
"uniprot_ids",
")",
":",
"uniprot_ids",
"=",
"ssbio",
".",
"utils",
".",
"force_list",
"(",
"uniprot_ids",
")",
"invalid_ids",
"=",
"[",
"i",
"for",
"i",
"in",
"uniprot_ids",
"if",
"not",
"is_valid_uniprot_id",
"(",
... | Batch check if uniprot IDs are reviewed or not
Args:
uniprot_ids: UniProt ID or list of UniProt IDs
Returns:
A dictionary of {UniProtID: Boolean} | [
"Batch",
"check",
"if",
"uniprot",
"IDs",
"are",
"reviewed",
"or",
"not"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/databases/uniprot.py#L353-L406 | train | 28,966 |
SBRG/ssbio | ssbio/databases/uniprot.py | uniprot_ec | def uniprot_ec(uniprot_id):
"""Retrieve the EC number annotation for a UniProt ID.
Args:
uniprot_id: Valid UniProt ID
Returns:
"""
r = requests.post('http://www.uniprot.org/uniprot/?query=%s&columns=ec&format=tab' % uniprot_id)
ec = r.content.decode('utf-8').splitlines()[1]
if le... | python | def uniprot_ec(uniprot_id):
"""Retrieve the EC number annotation for a UniProt ID.
Args:
uniprot_id: Valid UniProt ID
Returns:
"""
r = requests.post('http://www.uniprot.org/uniprot/?query=%s&columns=ec&format=tab' % uniprot_id)
ec = r.content.decode('utf-8').splitlines()[1]
if le... | [
"def",
"uniprot_ec",
"(",
"uniprot_id",
")",
":",
"r",
"=",
"requests",
".",
"post",
"(",
"'http://www.uniprot.org/uniprot/?query=%s&columns=ec&format=tab'",
"%",
"uniprot_id",
")",
"ec",
"=",
"r",
".",
"content",
".",
"decode",
"(",
"'utf-8'",
")",
".",
"splitl... | Retrieve the EC number annotation for a UniProt ID.
Args:
uniprot_id: Valid UniProt ID
Returns: | [
"Retrieve",
"the",
"EC",
"number",
"annotation",
"for",
"a",
"UniProt",
"ID",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/databases/uniprot.py#L409-L424 | train | 28,967 |
SBRG/ssbio | ssbio/databases/uniprot.py | uniprot_sites | def uniprot_sites(uniprot_id):
"""Retrieve a list of UniProt sites parsed from the feature file
Sites are defined here: http://www.uniprot.org/help/site and here: http://www.uniprot.org/help/function_section
Args:
uniprot_id: Valid UniProt ID
Returns:
"""
r = requests.post('http://w... | python | def uniprot_sites(uniprot_id):
"""Retrieve a list of UniProt sites parsed from the feature file
Sites are defined here: http://www.uniprot.org/help/site and here: http://www.uniprot.org/help/function_section
Args:
uniprot_id: Valid UniProt ID
Returns:
"""
r = requests.post('http://w... | [
"def",
"uniprot_sites",
"(",
"uniprot_id",
")",
":",
"r",
"=",
"requests",
".",
"post",
"(",
"'http://www.uniprot.org/uniprot/%s.gff'",
"%",
"uniprot_id",
")",
"gff",
"=",
"StringIO",
"(",
"r",
".",
"content",
".",
"decode",
"(",
"'utf-8'",
")",
")",
"feats"... | Retrieve a list of UniProt sites parsed from the feature file
Sites are defined here: http://www.uniprot.org/help/site and here: http://www.uniprot.org/help/function_section
Args:
uniprot_id: Valid UniProt ID
Returns: | [
"Retrieve",
"a",
"list",
"of",
"UniProt",
"sites",
"parsed",
"from",
"the",
"feature",
"file"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/databases/uniprot.py#L427-L446 | train | 28,968 |
SBRG/ssbio | ssbio/databases/uniprot.py | parse_uniprot_txt_file | def parse_uniprot_txt_file(infile):
"""Parse a raw UniProt metadata file and return a dictionary.
Args:
infile: Path to metadata file
Returns:
dict: Metadata dictionary
"""
uniprot_metadata_dict = {}
metadata = old_parse_uniprot_txt_file(infile)
metadata_keys = list(metad... | python | def parse_uniprot_txt_file(infile):
"""Parse a raw UniProt metadata file and return a dictionary.
Args:
infile: Path to metadata file
Returns:
dict: Metadata dictionary
"""
uniprot_metadata_dict = {}
metadata = old_parse_uniprot_txt_file(infile)
metadata_keys = list(metad... | [
"def",
"parse_uniprot_txt_file",
"(",
"infile",
")",
":",
"uniprot_metadata_dict",
"=",
"{",
"}",
"metadata",
"=",
"old_parse_uniprot_txt_file",
"(",
"infile",
")",
"metadata_keys",
"=",
"list",
"(",
"metadata",
".",
"keys",
"(",
")",
")",
"if",
"metadata_keys",... | Parse a raw UniProt metadata file and return a dictionary.
Args:
infile: Path to metadata file
Returns:
dict: Metadata dictionary | [
"Parse",
"a",
"raw",
"UniProt",
"metadata",
"file",
"and",
"return",
"a",
"dictionary",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/databases/uniprot.py#L484-L522 | train | 28,969 |
SBRG/ssbio | ssbio/databases/uniprot.py | UniProtProp.metadata_path_unset | def metadata_path_unset(self):
"""Copy features to memory and remove the association of the metadata file."""
if not self.metadata_file:
raise IOError('No metadata file to unset')
log.debug('{}: reading from metadata file {}'.format(self.id, self.metadata_path))
tmp_sr = Seq... | python | def metadata_path_unset(self):
"""Copy features to memory and remove the association of the metadata file."""
if not self.metadata_file:
raise IOError('No metadata file to unset')
log.debug('{}: reading from metadata file {}'.format(self.id, self.metadata_path))
tmp_sr = Seq... | [
"def",
"metadata_path_unset",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"metadata_file",
":",
"raise",
"IOError",
"(",
"'No metadata file to unset'",
")",
"log",
".",
"debug",
"(",
"'{}: reading from metadata file {}'",
".",
"format",
"(",
"self",
".",
"i... | Copy features to memory and remove the association of the metadata file. | [
"Copy",
"features",
"to",
"memory",
"and",
"remove",
"the",
"association",
"of",
"the",
"metadata",
"file",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/databases/uniprot.py#L177-L195 | train | 28,970 |
SBRG/ssbio | ssbio/databases/uniprot.py | UniProtProp.download_seq_file | def download_seq_file(self, outdir, force_rerun=False):
"""Download and load the UniProt FASTA file"""
uniprot_fasta_file = download_uniprot_file(uniprot_id=self.id,
filetype='fasta',
outdir=outdir,
... | python | def download_seq_file(self, outdir, force_rerun=False):
"""Download and load the UniProt FASTA file"""
uniprot_fasta_file = download_uniprot_file(uniprot_id=self.id,
filetype='fasta',
outdir=outdir,
... | [
"def",
"download_seq_file",
"(",
"self",
",",
"outdir",
",",
"force_rerun",
"=",
"False",
")",
":",
"uniprot_fasta_file",
"=",
"download_uniprot_file",
"(",
"uniprot_id",
"=",
"self",
".",
"id",
",",
"filetype",
"=",
"'fasta'",
",",
"outdir",
"=",
"outdir",
... | Download and load the UniProt FASTA file | [
"Download",
"and",
"load",
"the",
"UniProt",
"FASTA",
"file"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/databases/uniprot.py#L197-L205 | train | 28,971 |
SBRG/ssbio | ssbio/databases/uniprot.py | UniProtProp.download_metadata_file | def download_metadata_file(self, outdir, force_rerun=False):
"""Download and load the UniProt XML file"""
uniprot_xml_file = download_uniprot_file(uniprot_id=self.id,
outdir=outdir,
filetype='xml',
... | python | def download_metadata_file(self, outdir, force_rerun=False):
"""Download and load the UniProt XML file"""
uniprot_xml_file = download_uniprot_file(uniprot_id=self.id,
outdir=outdir,
filetype='xml',
... | [
"def",
"download_metadata_file",
"(",
"self",
",",
"outdir",
",",
"force_rerun",
"=",
"False",
")",
":",
"uniprot_xml_file",
"=",
"download_uniprot_file",
"(",
"uniprot_id",
"=",
"self",
".",
"id",
",",
"outdir",
"=",
"outdir",
",",
"filetype",
"=",
"'xml'",
... | Download and load the UniProt XML file | [
"Download",
"and",
"load",
"the",
"UniProt",
"XML",
"file"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/databases/uniprot.py#L207-L214 | train | 28,972 |
SBRG/ssbio | ssbio/core/object.py | Object.save_dataframes | def save_dataframes(self, outdir, prefix='df_'):
"""Save all attributes that start with "df" into a specified directory.
Args:
outdir (str): Path to output directory
prefix (str): Prefix that dataframe attributes start with
"""
# Get list of attributes that star... | python | def save_dataframes(self, outdir, prefix='df_'):
"""Save all attributes that start with "df" into a specified directory.
Args:
outdir (str): Path to output directory
prefix (str): Prefix that dataframe attributes start with
"""
# Get list of attributes that star... | [
"def",
"save_dataframes",
"(",
"self",
",",
"outdir",
",",
"prefix",
"=",
"'df_'",
")",
":",
"# Get list of attributes that start with \"df_\"",
"dfs",
"=",
"list",
"(",
"filter",
"(",
"lambda",
"x",
":",
"x",
".",
"startswith",
"(",
"prefix",
")",
",",
"dir... | Save all attributes that start with "df" into a specified directory.
Args:
outdir (str): Path to output directory
prefix (str): Prefix that dataframe attributes start with | [
"Save",
"all",
"attributes",
"that",
"start",
"with",
"df",
"into",
"a",
"specified",
"directory",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/core/object.py#L138-L163 | train | 28,973 |
SBRG/ssbio | ssbio/biopython/Bio/Struct/Hydrogenate.py | Hydrogenate_Protein._build_bonding_network | def _build_bonding_network(self):
"""
Evaluates atoms per residue for missing and known bonded partners.
Based on bond_amber.
A better alternative would be to iterate over the entire list of residues and
use NeighborSearch to probe neighbors for atom X in residue i, i-1 and i+1... | python | def _build_bonding_network(self):
"""
Evaluates atoms per residue for missing and known bonded partners.
Based on bond_amber.
A better alternative would be to iterate over the entire list of residues and
use NeighborSearch to probe neighbors for atom X in residue i, i-1 and i+1... | [
"def",
"_build_bonding_network",
"(",
"self",
")",
":",
"self",
".",
"bonds",
"=",
"{",
"}",
"# [Residue][Atom]: [ [missing], [bonded] ]",
"self",
".",
"selection",
"=",
"{",
"}",
"# [Residue]: 'nrml'/'nter'/'cter'",
"missing",
"=",
"0",
"for",
"residue",
"in",
"... | Evaluates atoms per residue for missing and known bonded partners.
Based on bond_amber.
A better alternative would be to iterate over the entire list of residues and
use NeighborSearch to probe neighbors for atom X in residue i, i-1 and i+1 | [
"Evaluates",
"atoms",
"per",
"residue",
"for",
"missing",
"and",
"known",
"bonded",
"partners",
".",
"Based",
"on",
"bond_amber",
".",
"A",
"better",
"alternative",
"would",
"be",
"to",
"iterate",
"over",
"the",
"entire",
"list",
"of",
"residues",
"and",
"us... | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/biopython/Bio/Struct/Hydrogenate.py#L76-L133 | train | 28,974 |
SBRG/ssbio | ssbio/biopython/Bio/Struct/Hydrogenate.py | Hydrogenate_Protein._exclude_ss_bonded_cysteines | def _exclude_ss_bonded_cysteines(self):
"""
Pre-compute ss bonds to discard cystines for H-adding.
"""
ss_bonds = self.nh_structure.search_ss_bonds()
for cys_pair in ss_bonds:
cys1, cys2 = cys_pair
cys1.resname = 'CYX'
c... | python | def _exclude_ss_bonded_cysteines(self):
"""
Pre-compute ss bonds to discard cystines for H-adding.
"""
ss_bonds = self.nh_structure.search_ss_bonds()
for cys_pair in ss_bonds:
cys1, cys2 = cys_pair
cys1.resname = 'CYX'
c... | [
"def",
"_exclude_ss_bonded_cysteines",
"(",
"self",
")",
":",
"ss_bonds",
"=",
"self",
".",
"nh_structure",
".",
"search_ss_bonds",
"(",
")",
"for",
"cys_pair",
"in",
"ss_bonds",
":",
"cys1",
",",
"cys2",
"=",
"cys_pair",
"cys1",
".",
"resname",
"=",
"'CYX'"... | Pre-compute ss bonds to discard cystines for H-adding. | [
"Pre",
"-",
"compute",
"ss",
"bonds",
"to",
"discard",
"cystines",
"for",
"H",
"-",
"adding",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/biopython/Bio/Struct/Hydrogenate.py#L135-L145 | train | 28,975 |
SBRG/ssbio | ssbio/biopython/Bio/Struct/Hydrogenate.py | Hydrogenate_Protein._find_secondary_anchors | def _find_secondary_anchors(self, residue, heavy_atom, anchor):
"""
Searches through the bond network for atoms bound to the anchor.
Returns a secondary and tertiary anchors.
Example, for CA, returns C and O.
"""
for secondary in self.bonds[residue][anchor.n... | python | def _find_secondary_anchors(self, residue, heavy_atom, anchor):
"""
Searches through the bond network for atoms bound to the anchor.
Returns a secondary and tertiary anchors.
Example, for CA, returns C and O.
"""
for secondary in self.bonds[residue][anchor.n... | [
"def",
"_find_secondary_anchors",
"(",
"self",
",",
"residue",
",",
"heavy_atom",
",",
"anchor",
")",
":",
"for",
"secondary",
"in",
"self",
".",
"bonds",
"[",
"residue",
"]",
"[",
"anchor",
".",
"name",
"]",
"[",
"1",
"]",
":",
"for",
"tertiary",
"in"... | Searches through the bond network for atoms bound to the anchor.
Returns a secondary and tertiary anchors.
Example, for CA, returns C and O. | [
"Searches",
"through",
"the",
"bond",
"network",
"for",
"atoms",
"bound",
"to",
"the",
"anchor",
".",
"Returns",
"a",
"secondary",
"and",
"tertiary",
"anchors",
".",
"Example",
"for",
"CA",
"returns",
"C",
"and",
"O",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/biopython/Bio/Struct/Hydrogenate.py#L147-L161 | train | 28,976 |
SBRG/ssbio | ssbio/protein/structure/utils/dock.py | parse_results_mol2 | def parse_results_mol2(mol2_outpath):
"""Parse a DOCK6 mol2 output file, return a Pandas DataFrame of the results.
Args:
mol2_outpath (str): Path to mol2 output file
Returns:
DataFrame: Pandas DataFrame of the results
"""
docked_ligands = pd.DataFrame()
lines = [line.strip() ... | python | def parse_results_mol2(mol2_outpath):
"""Parse a DOCK6 mol2 output file, return a Pandas DataFrame of the results.
Args:
mol2_outpath (str): Path to mol2 output file
Returns:
DataFrame: Pandas DataFrame of the results
"""
docked_ligands = pd.DataFrame()
lines = [line.strip() ... | [
"def",
"parse_results_mol2",
"(",
"mol2_outpath",
")",
":",
"docked_ligands",
"=",
"pd",
".",
"DataFrame",
"(",
")",
"lines",
"=",
"[",
"line",
".",
"strip",
"(",
")",
"for",
"line",
"in",
"open",
"(",
"mol2_outpath",
",",
"'r'",
")",
"]",
"props",
"="... | Parse a DOCK6 mol2 output file, return a Pandas DataFrame of the results.
Args:
mol2_outpath (str): Path to mol2 output file
Returns:
DataFrame: Pandas DataFrame of the results | [
"Parse",
"a",
"DOCK6",
"mol2",
"output",
"file",
"return",
"a",
"Pandas",
"DataFrame",
"of",
"the",
"results",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/structure/utils/dock.py#L592-L620 | train | 28,977 |
SBRG/ssbio | ssbio/protein/structure/utils/dock.py | DOCK.structure_path | def structure_path(self, path):
"""Provide pointers to the paths of the structure file
Args:
path: Path to structure file
"""
if not path:
self.structure_dir = None
self.structure_file = None
else:
if not op.exists(path):
... | python | def structure_path(self, path):
"""Provide pointers to the paths of the structure file
Args:
path: Path to structure file
"""
if not path:
self.structure_dir = None
self.structure_file = None
else:
if not op.exists(path):
... | [
"def",
"structure_path",
"(",
"self",
",",
"path",
")",
":",
"if",
"not",
"path",
":",
"self",
".",
"structure_dir",
"=",
"None",
"self",
".",
"structure_file",
"=",
"None",
"else",
":",
"if",
"not",
"op",
".",
"exists",
"(",
"path",
")",
":",
"raise... | Provide pointers to the paths of the structure file
Args:
path: Path to structure file | [
"Provide",
"pointers",
"to",
"the",
"paths",
"of",
"the",
"structure",
"file"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/structure/utils/dock.py#L117-L136 | train | 28,978 |
SBRG/ssbio | ssbio/protein/structure/utils/dock.py | DOCK.dockprep | def dockprep(self, force_rerun=False):
"""Prepare a PDB file for docking by first converting it to mol2 format.
Args:
force_rerun (bool): If method should be rerun even if output file exists
"""
log.debug('{}: running dock preparation...'.format(self.id))
prep_mol2... | python | def dockprep(self, force_rerun=False):
"""Prepare a PDB file for docking by first converting it to mol2 format.
Args:
force_rerun (bool): If method should be rerun even if output file exists
"""
log.debug('{}: running dock preparation...'.format(self.id))
prep_mol2... | [
"def",
"dockprep",
"(",
"self",
",",
"force_rerun",
"=",
"False",
")",
":",
"log",
".",
"debug",
"(",
"'{}: running dock preparation...'",
".",
"format",
"(",
"self",
".",
"id",
")",
")",
"prep_mol2",
"=",
"op",
".",
"join",
"(",
"self",
".",
"dock_dir",... | Prepare a PDB file for docking by first converting it to mol2 format.
Args:
force_rerun (bool): If method should be rerun even if output file exists | [
"Prepare",
"a",
"PDB",
"file",
"for",
"docking",
"by",
"first",
"converting",
"it",
"to",
"mol2",
"format",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/structure/utils/dock.py#L138-L168 | train | 28,979 |
SBRG/ssbio | ssbio/protein/structure/utils/dock.py | DOCK.protein_only_and_noH | def protein_only_and_noH(self, keep_ligands=None, force_rerun=False):
"""Isolate the receptor by stripping everything except protein and specified ligands.
Args:
keep_ligands (str, list): Ligand(s) to keep in PDB file
force_rerun (bool): If method should be rerun even if output ... | python | def protein_only_and_noH(self, keep_ligands=None, force_rerun=False):
"""Isolate the receptor by stripping everything except protein and specified ligands.
Args:
keep_ligands (str, list): Ligand(s) to keep in PDB file
force_rerun (bool): If method should be rerun even if output ... | [
"def",
"protein_only_and_noH",
"(",
"self",
",",
"keep_ligands",
"=",
"None",
",",
"force_rerun",
"=",
"False",
")",
":",
"log",
".",
"debug",
"(",
"'{}: running protein receptor isolation...'",
".",
"format",
"(",
"self",
".",
"id",
")",
")",
"if",
"not",
"... | Isolate the receptor by stripping everything except protein and specified ligands.
Args:
keep_ligands (str, list): Ligand(s) to keep in PDB file
force_rerun (bool): If method should be rerun even if output file exists | [
"Isolate",
"the",
"receptor",
"by",
"stripping",
"everything",
"except",
"protein",
"and",
"specified",
"ligands",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/structure/utils/dock.py#L170-L214 | train | 28,980 |
SBRG/ssbio | ssbio/protein/structure/utils/dock.py | DOCK.binding_site_mol2 | def binding_site_mol2(self, residues, force_rerun=False):
"""Create mol2 of only binding site residues from the receptor
This function will take in a .pdb file (preferably the _receptor_noH.pdb file)
and a string of residues (eg: '144,170,199') and delete all other residues in the
.pdb ... | python | def binding_site_mol2(self, residues, force_rerun=False):
"""Create mol2 of only binding site residues from the receptor
This function will take in a .pdb file (preferably the _receptor_noH.pdb file)
and a string of residues (eg: '144,170,199') and delete all other residues in the
.pdb ... | [
"def",
"binding_site_mol2",
"(",
"self",
",",
"residues",
",",
"force_rerun",
"=",
"False",
")",
":",
"log",
".",
"debug",
"(",
"'{}: running binding site isolation...'",
".",
"format",
"(",
"self",
".",
"id",
")",
")",
"if",
"not",
"self",
".",
"receptorpdb... | Create mol2 of only binding site residues from the receptor
This function will take in a .pdb file (preferably the _receptor_noH.pdb file)
and a string of residues (eg: '144,170,199') and delete all other residues in the
.pdb file. It then saves the coordinates of the selected residues as a .mo... | [
"Create",
"mol2",
"of",
"only",
"binding",
"site",
"residues",
"from",
"the",
"receptor"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/structure/utils/dock.py#L278-L319 | train | 28,981 |
SBRG/ssbio | ssbio/protein/structure/utils/dock.py | DOCK.sphere_selector_using_residues | def sphere_selector_using_residues(self, radius, force_rerun=False):
"""Select spheres based on binding site residues
Args:
radius (int, float): Radius around binding residues to dock to
force_rerun (bool): If method should be rerun even if output file exists
"""
... | python | def sphere_selector_using_residues(self, radius, force_rerun=False):
"""Select spheres based on binding site residues
Args:
radius (int, float): Radius around binding residues to dock to
force_rerun (bool): If method should be rerun even if output file exists
"""
... | [
"def",
"sphere_selector_using_residues",
"(",
"self",
",",
"radius",
",",
"force_rerun",
"=",
"False",
")",
":",
"log",
".",
"debug",
"(",
"'{}: running sphere selector...'",
".",
"format",
"(",
"self",
".",
"id",
")",
")",
"if",
"not",
"self",
".",
"sphgen_... | Select spheres based on binding site residues
Args:
radius (int, float): Radius around binding residues to dock to
force_rerun (bool): If method should be rerun even if output file exists | [
"Select",
"spheres",
"based",
"on",
"binding",
"site",
"residues"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/structure/utils/dock.py#L321-L347 | train | 28,982 |
SBRG/ssbio | ssbio/protein/structure/utils/dock.py | DOCK.showbox | def showbox(self, force_rerun=False):
"""Create the dummy PDB box around the selected spheres.
Args:
force_rerun (bool): If method should be rerun even if output file exists
"""
log.debug('{}: running box maker...'.format(self.id))
if not self.sphsel_path:
... | python | def showbox(self, force_rerun=False):
"""Create the dummy PDB box around the selected spheres.
Args:
force_rerun (bool): If method should be rerun even if output file exists
"""
log.debug('{}: running box maker...'.format(self.id))
if not self.sphsel_path:
... | [
"def",
"showbox",
"(",
"self",
",",
"force_rerun",
"=",
"False",
")",
":",
"log",
".",
"debug",
"(",
"'{}: running box maker...'",
".",
"format",
"(",
"self",
".",
"id",
")",
")",
"if",
"not",
"self",
".",
"sphsel_path",
":",
"return",
"ValueError",
"(",... | Create the dummy PDB box around the selected spheres.
Args:
force_rerun (bool): If method should be rerun even if output file exists | [
"Create",
"the",
"dummy",
"PDB",
"box",
"around",
"the",
"selected",
"spheres",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/structure/utils/dock.py#L367-L398 | train | 28,983 |
SBRG/ssbio | ssbio/protein/structure/utils/dock.py | DOCK.auto_flexdock | def auto_flexdock(self, binding_residues, radius, ligand_path=None, force_rerun=False):
"""Run DOCK6 on a PDB file, given its binding residues and a radius around them.
Provide a path to a ligand to dock a ligand to it. If no ligand is provided, DOCK6 preparations will be run on
that structure ... | python | def auto_flexdock(self, binding_residues, radius, ligand_path=None, force_rerun=False):
"""Run DOCK6 on a PDB file, given its binding residues and a radius around them.
Provide a path to a ligand to dock a ligand to it. If no ligand is provided, DOCK6 preparations will be run on
that structure ... | [
"def",
"auto_flexdock",
"(",
"self",
",",
"binding_residues",
",",
"radius",
",",
"ligand_path",
"=",
"None",
",",
"force_rerun",
"=",
"False",
")",
":",
"log",
".",
"debug",
"(",
"'\\n{}: running DOCK6...\\n'",
"'\\tBinding residues: {}\\n'",
"'\\tBinding residues ra... | Run DOCK6 on a PDB file, given its binding residues and a radius around them.
Provide a path to a ligand to dock a ligand to it. If no ligand is provided, DOCK6 preparations will be run on
that structure file.
Args:
binding_residues (str): Comma separated string of residues (eg: '1... | [
"Run",
"DOCK6",
"on",
"a",
"PDB",
"file",
"given",
"its",
"binding",
"residues",
"and",
"a",
"radius",
"around",
"them",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/structure/utils/dock.py#L562-L590 | train | 28,984 |
SBRG/ssbio | ssbio/databases/metalpdb.py | get_metalpdb_info | def get_metalpdb_info(metalpdb_lig_file):
"""Parse a MetalPDB .lig file and return a tuple of the chain ID it represents, along with metal binding information.
Args:
metalpdb_lig_file (str): Path to .lig file
Returns:
tuple: (str, dict) of the chain ID and the parsed metal binding site inf... | python | def get_metalpdb_info(metalpdb_lig_file):
"""Parse a MetalPDB .lig file and return a tuple of the chain ID it represents, along with metal binding information.
Args:
metalpdb_lig_file (str): Path to .lig file
Returns:
tuple: (str, dict) of the chain ID and the parsed metal binding site inf... | [
"def",
"get_metalpdb_info",
"(",
"metalpdb_lig_file",
")",
":",
"pdb_metals",
"=",
"[",
"'CU'",
",",
"'ZN'",
",",
"'MN'",
",",
"'FE'",
",",
"'MG'",
",",
"'CO'",
",",
"'SE'",
",",
"'YB'",
",",
"'SF4'",
",",
"'FES'",
",",
"'F3S'",
",",
"'NI'",
",",
"'F... | Parse a MetalPDB .lig file and return a tuple of the chain ID it represents, along with metal binding information.
Args:
metalpdb_lig_file (str): Path to .lig file
Returns:
tuple: (str, dict) of the chain ID and the parsed metal binding site information | [
"Parse",
"a",
"MetalPDB",
".",
"lig",
"file",
"and",
"return",
"a",
"tuple",
"of",
"the",
"chain",
"ID",
"it",
"represents",
"along",
"with",
"metal",
"binding",
"information",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/databases/metalpdb.py#L6-L52 | train | 28,985 |
SBRG/ssbio | ssbio/protein/sequence/utils/alignment.py | pairwise_sequence_alignment | def pairwise_sequence_alignment(a_seq, b_seq, engine, a_seq_id=None, b_seq_id=None,
gapopen=10, gapextend=0.5,
outfile=None, outdir=None, force_rerun=False):
"""Run a global pairwise sequence alignment between two sequence strings.
Args:
a... | python | def pairwise_sequence_alignment(a_seq, b_seq, engine, a_seq_id=None, b_seq_id=None,
gapopen=10, gapextend=0.5,
outfile=None, outdir=None, force_rerun=False):
"""Run a global pairwise sequence alignment between two sequence strings.
Args:
a... | [
"def",
"pairwise_sequence_alignment",
"(",
"a_seq",
",",
"b_seq",
",",
"engine",
",",
"a_seq_id",
"=",
"None",
",",
"b_seq_id",
"=",
"None",
",",
"gapopen",
"=",
"10",
",",
"gapextend",
"=",
"0.5",
",",
"outfile",
"=",
"None",
",",
"outdir",
"=",
"None",... | Run a global pairwise sequence alignment between two sequence strings.
Args:
a_seq (str, Seq, SeqRecord, SeqProp): Reference sequence
b_seq (str, Seq, SeqRecord, SeqProp): Sequence to be aligned to reference
engine (str): `biopython` or `needle` - which pairwise alignment program to use
... | [
"Run",
"a",
"global",
"pairwise",
"sequence",
"alignment",
"between",
"two",
"sequence",
"strings",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/utils/alignment.py#L27-L110 | train | 28,986 |
SBRG/ssbio | ssbio/protein/sequence/utils/alignment.py | run_needle_alignment | def run_needle_alignment(seq_a, seq_b, gapopen=10, gapextend=0.5, write_outfile=True,
outdir=None, outfile=None, force_rerun=False):
"""Run the needle alignment program for two strings and return the raw alignment result.
More info:
EMBOSS needle: http://www.bioinformatics.nl/cgi-b... | python | def run_needle_alignment(seq_a, seq_b, gapopen=10, gapextend=0.5, write_outfile=True,
outdir=None, outfile=None, force_rerun=False):
"""Run the needle alignment program for two strings and return the raw alignment result.
More info:
EMBOSS needle: http://www.bioinformatics.nl/cgi-b... | [
"def",
"run_needle_alignment",
"(",
"seq_a",
",",
"seq_b",
",",
"gapopen",
"=",
"10",
",",
"gapextend",
"=",
"0.5",
",",
"write_outfile",
"=",
"True",
",",
"outdir",
"=",
"None",
",",
"outfile",
"=",
"None",
",",
"force_rerun",
"=",
"False",
")",
":",
... | Run the needle alignment program for two strings and return the raw alignment result.
More info:
EMBOSS needle: http://www.bioinformatics.nl/cgi-bin/emboss/help/needle
Biopython wrapper: http://biopython.org/DIST/docs/tutorial/Tutorial.html#htoc84
Using strings as input: https://www.biostars.org/p/9112... | [
"Run",
"the",
"needle",
"alignment",
"program",
"for",
"two",
"strings",
"and",
"return",
"the",
"raw",
"alignment",
"result",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/utils/alignment.py#L113-L171 | train | 28,987 |
SBRG/ssbio | ssbio/protein/sequence/utils/alignment.py | run_needle_alignment_on_files | def run_needle_alignment_on_files(id_a, faa_a, id_b, faa_b, gapopen=10, gapextend=0.5,
outdir='', outfile='', force_rerun=False):
"""Run the needle alignment program for two fasta files and return the raw alignment result.
More info:
EMBOSS needle: http://www.bioinformatic... | python | def run_needle_alignment_on_files(id_a, faa_a, id_b, faa_b, gapopen=10, gapextend=0.5,
outdir='', outfile='', force_rerun=False):
"""Run the needle alignment program for two fasta files and return the raw alignment result.
More info:
EMBOSS needle: http://www.bioinformatic... | [
"def",
"run_needle_alignment_on_files",
"(",
"id_a",
",",
"faa_a",
",",
"id_b",
",",
"faa_b",
",",
"gapopen",
"=",
"10",
",",
"gapextend",
"=",
"0.5",
",",
"outdir",
"=",
"''",
",",
"outfile",
"=",
"''",
",",
"force_rerun",
"=",
"False",
")",
":",
"# T... | Run the needle alignment program for two fasta files and return the raw alignment result.
More info:
EMBOSS needle: http://www.bioinformatics.nl/cgi-bin/emboss/help/needle
Biopython wrapper: http://biopython.org/DIST/docs/tutorial/Tutorial.html#htoc84
Args:
id_a: ID of reference sequence
... | [
"Run",
"the",
"needle",
"alignment",
"program",
"for",
"two",
"fasta",
"files",
"and",
"return",
"the",
"raw",
"alignment",
"result",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/utils/alignment.py#L174-L229 | train | 28,988 |
SBRG/ssbio | ssbio/protein/sequence/utils/alignment.py | get_percent_identity | def get_percent_identity(a_aln_seq, b_aln_seq):
"""Get the percent identity between two alignment strings"""
if len(a_aln_seq) != len(b_aln_seq):
raise ValueError('Sequence lengths not equal - was an alignment run?')
count = 0
gaps = 0
for n in range(0, len(a_aln_seq)):
if a_aln_se... | python | def get_percent_identity(a_aln_seq, b_aln_seq):
"""Get the percent identity between two alignment strings"""
if len(a_aln_seq) != len(b_aln_seq):
raise ValueError('Sequence lengths not equal - was an alignment run?')
count = 0
gaps = 0
for n in range(0, len(a_aln_seq)):
if a_aln_se... | [
"def",
"get_percent_identity",
"(",
"a_aln_seq",
",",
"b_aln_seq",
")",
":",
"if",
"len",
"(",
"a_aln_seq",
")",
"!=",
"len",
"(",
"b_aln_seq",
")",
":",
"raise",
"ValueError",
"(",
"'Sequence lengths not equal - was an alignment run?'",
")",
"count",
"=",
"0",
... | Get the percent identity between two alignment strings | [
"Get",
"the",
"percent",
"identity",
"between",
"two",
"alignment",
"strings"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/utils/alignment.py#L232-L247 | train | 28,989 |
SBRG/ssbio | ssbio/protein/sequence/utils/alignment.py | get_alignment_df | def get_alignment_df(a_aln_seq, b_aln_seq, a_seq_id=None, b_seq_id=None):
"""Summarize two alignment strings in a dataframe.
Args:
a_aln_seq (str): Aligned sequence string
b_aln_seq (str): Aligned sequence string
a_seq_id (str): Optional ID of a_seq
b_seq_id (str): Optional ID o... | python | def get_alignment_df(a_aln_seq, b_aln_seq, a_seq_id=None, b_seq_id=None):
"""Summarize two alignment strings in a dataframe.
Args:
a_aln_seq (str): Aligned sequence string
b_aln_seq (str): Aligned sequence string
a_seq_id (str): Optional ID of a_seq
b_seq_id (str): Optional ID o... | [
"def",
"get_alignment_df",
"(",
"a_aln_seq",
",",
"b_aln_seq",
",",
"a_seq_id",
"=",
"None",
",",
"b_seq_id",
"=",
"None",
")",
":",
"if",
"len",
"(",
"a_aln_seq",
")",
"!=",
"len",
"(",
"b_aln_seq",
")",
":",
"raise",
"ValueError",
"(",
"'Sequence lengths... | Summarize two alignment strings in a dataframe.
Args:
a_aln_seq (str): Aligned sequence string
b_aln_seq (str): Aligned sequence string
a_seq_id (str): Optional ID of a_seq
b_seq_id (str): Optional ID of b_aln_seq
Returns:
DataFrame: a per-residue level annotation of th... | [
"Summarize",
"two",
"alignment",
"strings",
"in",
"a",
"dataframe",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/utils/alignment.py#L250-L323 | train | 28,990 |
SBRG/ssbio | ssbio/protein/sequence/utils/alignment.py | get_alignment_df_from_file | def get_alignment_df_from_file(alignment_file, a_seq_id=None, b_seq_id=None):
"""Get a Pandas DataFrame of the Needle alignment results. Contains all positions of the sequences.
Args:
alignment_file:
a_seq_id: Optional specification of the ID of the reference sequence
b_seq_id: Optional... | python | def get_alignment_df_from_file(alignment_file, a_seq_id=None, b_seq_id=None):
"""Get a Pandas DataFrame of the Needle alignment results. Contains all positions of the sequences.
Args:
alignment_file:
a_seq_id: Optional specification of the ID of the reference sequence
b_seq_id: Optional... | [
"def",
"get_alignment_df_from_file",
"(",
"alignment_file",
",",
"a_seq_id",
"=",
"None",
",",
"b_seq_id",
"=",
"None",
")",
":",
"alignments",
"=",
"list",
"(",
"AlignIO",
".",
"parse",
"(",
"alignment_file",
",",
"\"emboss\"",
")",
")",
"alignment_df",
"=",
... | Get a Pandas DataFrame of the Needle alignment results. Contains all positions of the sequences.
Args:
alignment_file:
a_seq_id: Optional specification of the ID of the reference sequence
b_seq_id: Optional specification of the ID of the aligned sequence
Returns:
Pandas DataFra... | [
"Get",
"a",
"Pandas",
"DataFrame",
"of",
"the",
"Needle",
"alignment",
"results",
".",
"Contains",
"all",
"positions",
"of",
"the",
"sequences",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/utils/alignment.py#L326-L352 | train | 28,991 |
SBRG/ssbio | ssbio/protein/sequence/utils/alignment.py | get_deletions | def get_deletions(aln_df):
"""Get a list of tuples indicating the first and last residues of a deletion region, as well as the length of the deletion.
Examples:
# Deletion of residues 1 to 4, length 4
>>> test = {'id_a': {0: 'a', 1: 'a', 2: 'a', 3: 'a'}, 'id_a_aa': {0: 'M', 1: 'G', 2: 'I', 3: '... | python | def get_deletions(aln_df):
"""Get a list of tuples indicating the first and last residues of a deletion region, as well as the length of the deletion.
Examples:
# Deletion of residues 1 to 4, length 4
>>> test = {'id_a': {0: 'a', 1: 'a', 2: 'a', 3: 'a'}, 'id_a_aa': {0: 'M', 1: 'G', 2: 'I', 3: '... | [
"def",
"get_deletions",
"(",
"aln_df",
")",
":",
"deletion_df",
"=",
"aln_df",
"[",
"aln_df",
"[",
"'type'",
"]",
"==",
"'deletion'",
"]",
"if",
"not",
"deletion_df",
".",
"empty",
":",
"deletion_df",
"[",
"'id_a_pos'",
"]",
"=",
"deletion_df",
"[",
"'id_a... | Get a list of tuples indicating the first and last residues of a deletion region, as well as the length of the deletion.
Examples:
# Deletion of residues 1 to 4, length 4
>>> test = {'id_a': {0: 'a', 1: 'a', 2: 'a', 3: 'a'}, 'id_a_aa': {0: 'M', 1: 'G', 2: 'I', 3: 'T'}, 'id_a_pos': {0: 1.0, 1: 2.0, ... | [
"Get",
"a",
"list",
"of",
"tuples",
"indicating",
"the",
"first",
"and",
"last",
"residues",
"of",
"a",
"deletion",
"region",
"as",
"well",
"as",
"the",
"length",
"of",
"the",
"deletion",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/utils/alignment.py#L394-L437 | train | 28,992 |
SBRG/ssbio | ssbio/protein/sequence/utils/alignment.py | get_insertions | def get_insertions(aln_df):
"""Get a list of tuples indicating the first and last residues of a insertion region, as well as the length of the insertion.
If the first tuple is:
(-1, 1) that means the insertion is at the beginning of the original protein
(X, Inf) where X is the length of the ori... | python | def get_insertions(aln_df):
"""Get a list of tuples indicating the first and last residues of a insertion region, as well as the length of the insertion.
If the first tuple is:
(-1, 1) that means the insertion is at the beginning of the original protein
(X, Inf) where X is the length of the ori... | [
"def",
"get_insertions",
"(",
"aln_df",
")",
":",
"insertion_df",
"=",
"aln_df",
"[",
"aln_df",
"[",
"'type'",
"]",
"==",
"'insertion'",
"]",
"# if not insertion_df.empty: # don't need to do this for insertions",
"# insertion_df['id_a_pos'] = insertion_df['id_a_pos'].astype(i... | Get a list of tuples indicating the first and last residues of a insertion region, as well as the length of the insertion.
If the first tuple is:
(-1, 1) that means the insertion is at the beginning of the original protein
(X, Inf) where X is the length of the original protein, that means the inser... | [
"Get",
"a",
"list",
"of",
"tuples",
"indicating",
"the",
"first",
"and",
"last",
"residues",
"of",
"a",
"insertion",
"region",
"as",
"well",
"as",
"the",
"length",
"of",
"the",
"insertion",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/utils/alignment.py#L440-L507 | train | 28,993 |
SBRG/ssbio | ssbio/protein/sequence/utils/alignment.py | map_resnum_a_to_resnum_b | def map_resnum_a_to_resnum_b(resnums, a_aln, b_aln):
"""Map a residue number in a sequence to the corresponding residue number in an aligned sequence.
Examples:
>>> map_resnum_a_to_resnum_b([1,2,3], '--ABCDEF', 'XXABCDEF')
{1: 3, 2: 4, 3: 5}
>>> map_resnum_a_to_resnum_b(5, '--ABCDEF', 'XXABCDEF')
... | python | def map_resnum_a_to_resnum_b(resnums, a_aln, b_aln):
"""Map a residue number in a sequence to the corresponding residue number in an aligned sequence.
Examples:
>>> map_resnum_a_to_resnum_b([1,2,3], '--ABCDEF', 'XXABCDEF')
{1: 3, 2: 4, 3: 5}
>>> map_resnum_a_to_resnum_b(5, '--ABCDEF', 'XXABCDEF')
... | [
"def",
"map_resnum_a_to_resnum_b",
"(",
"resnums",
",",
"a_aln",
",",
"b_aln",
")",
":",
"resnums",
"=",
"ssbio",
".",
"utils",
".",
"force_list",
"(",
"resnums",
")",
"aln_df",
"=",
"get_alignment_df",
"(",
"a_aln",
",",
"b_aln",
")",
"maps",
"=",
"aln_df... | Map a residue number in a sequence to the corresponding residue number in an aligned sequence.
Examples:
>>> map_resnum_a_to_resnum_b([1,2,3], '--ABCDEF', 'XXABCDEF')
{1: 3, 2: 4, 3: 5}
>>> map_resnum_a_to_resnum_b(5, '--ABCDEF', 'XXABCDEF')
{5: 7}
>>> map_resnum_a_to_resnum_b(5, 'ABCDEF', 'ABC... | [
"Map",
"a",
"residue",
"number",
"in",
"a",
"sequence",
"to",
"the",
"corresponding",
"residue",
"number",
"in",
"an",
"aligned",
"sequence",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/utils/alignment.py#L510-L548 | train | 28,994 |
SBRG/ssbio | ssbio/protein/sequence/utils/alignment.py | pairwise_alignment_stats | def pairwise_alignment_stats(reference_seq_aln, other_seq_aln):
"""Get a report of a pairwise alignment.
Args:
reference_seq_aln (str, Seq, SeqRecord): Reference sequence, alignment form
other_seq_aln (str, Seq, SeqRecord): Other sequence, alignment form
Returns:
dict: Dictionary o... | python | def pairwise_alignment_stats(reference_seq_aln, other_seq_aln):
"""Get a report of a pairwise alignment.
Args:
reference_seq_aln (str, Seq, SeqRecord): Reference sequence, alignment form
other_seq_aln (str, Seq, SeqRecord): Other sequence, alignment form
Returns:
dict: Dictionary o... | [
"def",
"pairwise_alignment_stats",
"(",
"reference_seq_aln",
",",
"other_seq_aln",
")",
":",
"if",
"len",
"(",
"reference_seq_aln",
")",
"!=",
"len",
"(",
"other_seq_aln",
")",
":",
"raise",
"ValueError",
"(",
"'Sequence lengths not equal - was an alignment run?'",
")",... | Get a report of a pairwise alignment.
Args:
reference_seq_aln (str, Seq, SeqRecord): Reference sequence, alignment form
other_seq_aln (str, Seq, SeqRecord): Other sequence, alignment form
Returns:
dict: Dictionary of information on mutations, insertions, sequence identity, etc. | [
"Get",
"a",
"report",
"of",
"a",
"pairwise",
"alignment",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/utils/alignment.py#L551-L581 | train | 28,995 |
SBRG/ssbio | ssbio/protein/sequence/utils/alignment.py | needle_statistics | def needle_statistics(infile):
"""Reads in a needle alignment file and spits out statistics of the alignment.
Args:
infile (str): Alignment file name
Returns:
dict: alignment_properties - a dictionary telling you the number of gaps, identity, etc.
"""
alignments = list(AlignIO.pa... | python | def needle_statistics(infile):
"""Reads in a needle alignment file and spits out statistics of the alignment.
Args:
infile (str): Alignment file name
Returns:
dict: alignment_properties - a dictionary telling you the number of gaps, identity, etc.
"""
alignments = list(AlignIO.pa... | [
"def",
"needle_statistics",
"(",
"infile",
")",
":",
"alignments",
"=",
"list",
"(",
"AlignIO",
".",
"parse",
"(",
"infile",
",",
"\"emboss\"",
")",
")",
"alignment_properties",
"=",
"defaultdict",
"(",
"dict",
")",
"with",
"open",
"(",
"infile",
")",
"as"... | Reads in a needle alignment file and spits out statistics of the alignment.
Args:
infile (str): Alignment file name
Returns:
dict: alignment_properties - a dictionary telling you the number of gaps, identity, etc. | [
"Reads",
"in",
"a",
"needle",
"alignment",
"file",
"and",
"spits",
"out",
"statistics",
"of",
"the",
"alignment",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/utils/alignment.py#L584-L641 | train | 28,996 |
SBRG/ssbio | ssbio/protein/sequence/utils/alignment.py | needle_statistics_alignio | def needle_statistics_alignio(infile):
"""Reads in a needle alignment file and returns an AlignIO object with annotations
Args:
infile (str): Alignment file name
Returns:
AlignIO: annotated AlignIO object
"""
alignments = list(AlignIO.parse(infile, "emboss"))
if len(alignmen... | python | def needle_statistics_alignio(infile):
"""Reads in a needle alignment file and returns an AlignIO object with annotations
Args:
infile (str): Alignment file name
Returns:
AlignIO: annotated AlignIO object
"""
alignments = list(AlignIO.parse(infile, "emboss"))
if len(alignmen... | [
"def",
"needle_statistics_alignio",
"(",
"infile",
")",
":",
"alignments",
"=",
"list",
"(",
"AlignIO",
".",
"parse",
"(",
"infile",
",",
"\"emboss\"",
")",
")",
"if",
"len",
"(",
"alignments",
")",
">",
"1",
":",
"raise",
"ValueError",
"(",
"'Alignment fi... | Reads in a needle alignment file and returns an AlignIO object with annotations
Args:
infile (str): Alignment file name
Returns:
AlignIO: annotated AlignIO object | [
"Reads",
"in",
"a",
"needle",
"alignment",
"file",
"and",
"returns",
"an",
"AlignIO",
"object",
"with",
"annotations"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/utils/alignment.py#L644-L701 | train | 28,997 |
SBRG/ssbio | ssbio/protein/structure/utils/foldx.py | FoldX.run_repair_pdb | def run_repair_pdb(self, silent=False, force_rerun=False):
"""Run FoldX RepairPDB on this PDB file.
Original command::
foldx --command=RepairPDB --pdb=4bxi.pdb
Args:
silent (bool): If FoldX output should be silenced from printing to the shell.
force_rerun (... | python | def run_repair_pdb(self, silent=False, force_rerun=False):
"""Run FoldX RepairPDB on this PDB file.
Original command::
foldx --command=RepairPDB --pdb=4bxi.pdb
Args:
silent (bool): If FoldX output should be silenced from printing to the shell.
force_rerun (... | [
"def",
"run_repair_pdb",
"(",
"self",
",",
"silent",
"=",
"False",
",",
"force_rerun",
"=",
"False",
")",
":",
"# Create RepairPDB command",
"foldx_repair_pdb",
"=",
"'foldx --command=RepairPDB --pdb={}'",
".",
"format",
"(",
"self",
".",
"pdb_file",
")",
"# Repaire... | Run FoldX RepairPDB on this PDB file.
Original command::
foldx --command=RepairPDB --pdb=4bxi.pdb
Args:
silent (bool): If FoldX output should be silenced from printing to the shell.
force_rerun (bool): If FoldX RepairPDB should be rerun even if a repaired file exis... | [
"Run",
"FoldX",
"RepairPDB",
"on",
"this",
"PDB",
"file",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/structure/utils/foldx.py#L107-L131 | train | 28,998 |
SBRG/ssbio | ssbio/protein/structure/utils/foldx.py | FoldX.create_mutation_file | def create_mutation_file(self, list_of_tuples):
"""Create the FoldX file 'individual_list.txt' to run BuildModel upon.
Args:
list_of_tuples (list): A list of tuples indicating mutation groups to carry out BuildModel upon. Example::
[
(('N', 'A', 308, 'S'... | python | def create_mutation_file(self, list_of_tuples):
"""Create the FoldX file 'individual_list.txt' to run BuildModel upon.
Args:
list_of_tuples (list): A list of tuples indicating mutation groups to carry out BuildModel upon. Example::
[
(('N', 'A', 308, 'S'... | [
"def",
"create_mutation_file",
"(",
"self",
",",
"list_of_tuples",
")",
":",
"self",
".",
"mutation_infile",
"=",
"op",
".",
"join",
"(",
"self",
".",
"foldx_dir",
",",
"'individual_list.txt'",
")",
"idx",
"=",
"1",
"with",
"open",
"(",
"self",
".",
"mutat... | Create the FoldX file 'individual_list.txt' to run BuildModel upon.
Args:
list_of_tuples (list): A list of tuples indicating mutation groups to carry out BuildModel upon. Example::
[
(('N', 'A', 308, 'S'), ('S', 'A', 320, 'T'), ('S', 'A', 321, 'H')), # Mutation... | [
"Create",
"the",
"FoldX",
"file",
"individual_list",
".",
"txt",
"to",
"run",
"BuildModel",
"upon",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/structure/utils/foldx.py#L133-L158 | train | 28,999 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.