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/utils/foldx.py | FoldX.create_random_mutation_file | def create_random_mutation_file(self, list_of_tuples, original_sequence,
randomize_resnums=False, randomize_resids=False,
skip_resnums=None):
"""Create the FoldX file 'individual_list.txt', but randomize the mutation numbers or residues tha... | python | def create_random_mutation_file(self, list_of_tuples, original_sequence,
randomize_resnums=False, randomize_resids=False,
skip_resnums=None):
"""Create the FoldX file 'individual_list.txt', but randomize the mutation numbers or residues tha... | [
"def",
"create_random_mutation_file",
"(",
"self",
",",
"list_of_tuples",
",",
"original_sequence",
",",
"randomize_resnums",
"=",
"False",
",",
"randomize_resids",
"=",
"False",
",",
"skip_resnums",
"=",
"None",
")",
":",
"import",
"random",
"def",
"find",
"(",
... | Create the FoldX file 'individual_list.txt', but randomize the mutation numbers or residues that were input.
The randomize combinations can be a little confusing - this is what can happen:
- randomize_resnums=False, randomize_resids=False: no change, original mutations are carried out
... | [
"Create",
"the",
"FoldX",
"file",
"individual_list",
".",
"txt",
"but",
"randomize",
"the",
"mutation",
"numbers",
"or",
"residues",
"that",
"were",
"input",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/structure/utils/foldx.py#L160-L187 | train | 29,000 |
SBRG/ssbio | ssbio/protein/structure/utils/foldx.py | FoldX.run_build_model | def run_build_model(self, num_runs=5, silent=False, force_rerun=False):
"""Run FoldX BuildModel command with a mutant file input.
Original command::
foldx --command=BuildModel --pdb=4bxi_Repair.pdb --mutant-file=individual_list.txt --numberOfRuns=5
Args:
num_runs (int)... | python | def run_build_model(self, num_runs=5, silent=False, force_rerun=False):
"""Run FoldX BuildModel command with a mutant file input.
Original command::
foldx --command=BuildModel --pdb=4bxi_Repair.pdb --mutant-file=individual_list.txt --numberOfRuns=5
Args:
num_runs (int)... | [
"def",
"run_build_model",
"(",
"self",
",",
"num_runs",
"=",
"5",
",",
"silent",
"=",
"False",
",",
"force_rerun",
"=",
"False",
")",
":",
"# BuildModel output files",
"self",
".",
"mutation_ddG_avg_outfile",
"=",
"'Average_{}.fxout'",
".",
"format",
"(",
"op",
... | Run FoldX BuildModel command with a mutant file input.
Original command::
foldx --command=BuildModel --pdb=4bxi_Repair.pdb --mutant-file=individual_list.txt --numberOfRuns=5
Args:
num_runs (int):
silent (bool): If FoldX output should be silenced from printing to th... | [
"Run",
"FoldX",
"BuildModel",
"command",
"with",
"a",
"mutant",
"file",
"input",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/structure/utils/foldx.py#L191-L214 | train | 29,001 |
SBRG/ssbio | ssbio/protein/structure/utils/foldx.py | FoldX.get_ddG_results | def get_ddG_results(self):
"""Parse the results from BuildModel and get the delta delta G's.
A positive ddG means that the mutation(s) is destabilzing, negative means stabilizing.
- highly stabilising (ΔΔG < −1.84 kcal/mol);
- stabilising (−1.84 kcal/mol ≤ ΔΔG < −0.92 kcal/mol)... | python | def get_ddG_results(self):
"""Parse the results from BuildModel and get the delta delta G's.
A positive ddG means that the mutation(s) is destabilzing, negative means stabilizing.
- highly stabilising (ΔΔG < −1.84 kcal/mol);
- stabilising (−1.84 kcal/mol ≤ ΔΔG < −0.92 kcal/mol)... | [
"def",
"get_ddG_results",
"(",
"self",
")",
":",
"foldx_avg_df",
"=",
"self",
".",
"df_mutation_ddG_avg",
"foldx_avg_ddG",
"=",
"{",
"}",
"results",
"=",
"foldx_avg_df",
"[",
"[",
"'Pdb'",
",",
"'total energy'",
",",
"'SD'",
"]",
"]",
".",
"T",
".",
"to_di... | Parse the results from BuildModel and get the delta delta G's.
A positive ddG means that the mutation(s) is destabilzing, negative means stabilizing.
- highly stabilising (ΔΔG < −1.84 kcal/mol);
- stabilising (−1.84 kcal/mol ≤ ΔΔG < −0.92 kcal/mol);
- slightly stabilising (... | [
"Parse",
"the",
"results",
"from",
"BuildModel",
"and",
"get",
"the",
"delta",
"delta",
"G",
"s",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/structure/utils/foldx.py#L216-L244 | train | 29,002 |
SBRG/ssbio | ssbio/protein/structure/utils/cleanpdb.py | clean_pdb | def clean_pdb(pdb_file, out_suffix='_clean', outdir=None, force_rerun=False,
remove_atom_alt=True, keep_atom_alt_id='A', remove_atom_hydrogen=True, add_atom_occ=True,
remove_res_hetero=True, keep_chemicals=None, keep_res_only=None,
add_chain_id_if_empty='X', keep_chains=None):
... | python | def clean_pdb(pdb_file, out_suffix='_clean', outdir=None, force_rerun=False,
remove_atom_alt=True, keep_atom_alt_id='A', remove_atom_hydrogen=True, add_atom_occ=True,
remove_res_hetero=True, keep_chemicals=None, keep_res_only=None,
add_chain_id_if_empty='X', keep_chains=None):
... | [
"def",
"clean_pdb",
"(",
"pdb_file",
",",
"out_suffix",
"=",
"'_clean'",
",",
"outdir",
"=",
"None",
",",
"force_rerun",
"=",
"False",
",",
"remove_atom_alt",
"=",
"True",
",",
"keep_atom_alt_id",
"=",
"'A'",
",",
"remove_atom_hydrogen",
"=",
"True",
",",
"a... | Clean a PDB file.
Args:
pdb_file (str): Path to input PDB file
out_suffix (str): Suffix to append to original filename
outdir (str): Path to output directory
force_rerun (bool): If structure should be re-cleaned if a clean file exists already
remove_atom_alt (bool): Remove a... | [
"Clean",
"a",
"PDB",
"file",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/structure/utils/cleanpdb.py#L116-L165 | train | 29,003 |
SBRG/ssbio | ssbio/databases/pdb.py | parse_mmtf_header | def parse_mmtf_header(infile):
"""Parse an MMTF file and return basic header-like information.
Args:
infile (str): Path to MMTF file
Returns:
dict: Dictionary of parsed header
Todo:
- Can this be sped up by not parsing the 3D coordinate info somehow?
- OR just store th... | python | def parse_mmtf_header(infile):
"""Parse an MMTF file and return basic header-like information.
Args:
infile (str): Path to MMTF file
Returns:
dict: Dictionary of parsed header
Todo:
- Can this be sped up by not parsing the 3D coordinate info somehow?
- OR just store th... | [
"def",
"parse_mmtf_header",
"(",
"infile",
")",
":",
"infodict",
"=",
"{",
"}",
"mmtf_decoder",
"=",
"mmtf",
".",
"parse",
"(",
"infile",
")",
"infodict",
"[",
"'date'",
"]",
"=",
"mmtf_decoder",
".",
"deposition_date",
"infodict",
"[",
"'release_date'",
"]"... | Parse an MMTF file and return basic header-like information.
Args:
infile (str): Path to MMTF file
Returns:
dict: Dictionary of parsed header
Todo:
- Can this be sped up by not parsing the 3D coordinate info somehow?
- OR just store the sequences when this happens since it... | [
"Parse",
"an",
"MMTF",
"file",
"and",
"return",
"basic",
"header",
"-",
"like",
"information",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/databases/pdb.py#L121-L151 | train | 29,004 |
SBRG/ssbio | ssbio/databases/pdb.py | download_mmcif_header | def download_mmcif_header(pdb_id, outdir='', force_rerun=False):
"""Download a mmCIF header file from the RCSB PDB by ID.
Args:
pdb_id: PDB ID
outdir: Optional output directory, default is current working directory
force_rerun: If the file should be downloaded again even if it exists
... | python | def download_mmcif_header(pdb_id, outdir='', force_rerun=False):
"""Download a mmCIF header file from the RCSB PDB by ID.
Args:
pdb_id: PDB ID
outdir: Optional output directory, default is current working directory
force_rerun: If the file should be downloaded again even if it exists
... | [
"def",
"download_mmcif_header",
"(",
"pdb_id",
",",
"outdir",
"=",
"''",
",",
"force_rerun",
"=",
"False",
")",
":",
"# TODO: keep an eye on https://github.com/biopython/biopython/pull/943 Biopython PR#493 for functionality of this",
"# method in biopython. extra file types have not be... | Download a mmCIF header file from the RCSB PDB by ID.
Args:
pdb_id: PDB ID
outdir: Optional output directory, default is current working directory
force_rerun: If the file should be downloaded again even if it exists
Returns:
str: Path to outfile | [
"Download",
"a",
"mmCIF",
"header",
"file",
"from",
"the",
"RCSB",
"PDB",
"by",
"ID",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/databases/pdb.py#L153-L180 | train | 29,005 |
SBRG/ssbio | ssbio/databases/pdb.py | parse_mmcif_header | def parse_mmcif_header(infile):
"""Parse a couple important fields from the mmCIF file format with some manual curation of ligands.
If you want full access to the mmCIF file just use the MMCIF2Dict class in Biopython.
Args:
infile: Path to mmCIF file
Returns:
dict: Dictionary of parse... | python | def parse_mmcif_header(infile):
"""Parse a couple important fields from the mmCIF file format with some manual curation of ligands.
If you want full access to the mmCIF file just use the MMCIF2Dict class in Biopython.
Args:
infile: Path to mmCIF file
Returns:
dict: Dictionary of parse... | [
"def",
"parse_mmcif_header",
"(",
"infile",
")",
":",
"from",
"Bio",
".",
"PDB",
".",
"MMCIF2Dict",
"import",
"MMCIF2Dict",
"newdict",
"=",
"{",
"}",
"try",
":",
"mmdict",
"=",
"MMCIF2Dict",
"(",
"infile",
")",
"except",
"ValueError",
"as",
"e",
":",
"lo... | Parse a couple important fields from the mmCIF file format with some manual curation of ligands.
If you want full access to the mmCIF file just use the MMCIF2Dict class in Biopython.
Args:
infile: Path to mmCIF file
Returns:
dict: Dictionary of parsed header | [
"Parse",
"a",
"couple",
"important",
"fields",
"from",
"the",
"mmCIF",
"file",
"format",
"with",
"some",
"manual",
"curation",
"of",
"ligands",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/databases/pdb.py#L183-L259 | train | 29,006 |
SBRG/ssbio | ssbio/databases/pdb.py | download_sifts_xml | def download_sifts_xml(pdb_id, outdir='', force_rerun=False):
"""Download the SIFTS file for a PDB ID.
Args:
pdb_id (str): PDB ID
outdir (str): Output directory, current working directory if not specified.
force_rerun (bool): If the file should be downloaded again even if it exists
... | python | def download_sifts_xml(pdb_id, outdir='', force_rerun=False):
"""Download the SIFTS file for a PDB ID.
Args:
pdb_id (str): PDB ID
outdir (str): Output directory, current working directory if not specified.
force_rerun (bool): If the file should be downloaded again even if it exists
... | [
"def",
"download_sifts_xml",
"(",
"pdb_id",
",",
"outdir",
"=",
"''",
",",
"force_rerun",
"=",
"False",
")",
":",
"baseURL",
"=",
"'ftp://ftp.ebi.ac.uk/pub/databases/msd/sifts/xml/'",
"filename",
"=",
"'{}.xml.gz'",
".",
"format",
"(",
"pdb_id",
".",
"lower",
"(",... | Download the SIFTS file for a PDB ID.
Args:
pdb_id (str): PDB ID
outdir (str): Output directory, current working directory if not specified.
force_rerun (bool): If the file should be downloaded again even if it exists
Returns:
str: Path to downloaded file | [
"Download",
"the",
"SIFTS",
"file",
"for",
"a",
"PDB",
"ID",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/databases/pdb.py#L262-L284 | train | 29,007 |
SBRG/ssbio | ssbio/databases/pdb.py | map_uniprot_resnum_to_pdb | def map_uniprot_resnum_to_pdb(uniprot_resnum, chain_id, sifts_file):
"""Map a UniProt residue number to its corresponding PDB residue number.
This function requires that the SIFTS file be downloaded,
and also a chain ID (as different chains may have different mappings).
Args:
uniprot_resnum (i... | python | def map_uniprot_resnum_to_pdb(uniprot_resnum, chain_id, sifts_file):
"""Map a UniProt residue number to its corresponding PDB residue number.
This function requires that the SIFTS file be downloaded,
and also a chain ID (as different chains may have different mappings).
Args:
uniprot_resnum (i... | [
"def",
"map_uniprot_resnum_to_pdb",
"(",
"uniprot_resnum",
",",
"chain_id",
",",
"sifts_file",
")",
":",
"# Load the xml with lxml",
"parser",
"=",
"etree",
".",
"XMLParser",
"(",
"ns_clean",
"=",
"True",
")",
"tree",
"=",
"etree",
".",
"parse",
"(",
"sifts_file... | Map a UniProt residue number to its corresponding PDB residue number.
This function requires that the SIFTS file be downloaded,
and also a chain ID (as different chains may have different mappings).
Args:
uniprot_resnum (int): integer of the residue number you'd like to map
chain_id (str):... | [
"Map",
"a",
"UniProt",
"residue",
"number",
"to",
"its",
"corresponding",
"PDB",
"residue",
"number",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/databases/pdb.py#L287-L346 | train | 29,008 |
SBRG/ssbio | ssbio/databases/pdb.py | best_structures | def best_structures(uniprot_id, outname=None, outdir=None, seq_ident_cutoff=0.0, force_rerun=False):
"""Use the PDBe REST service to query for the best PDB structures for a UniProt ID.
More information found here: https://www.ebi.ac.uk/pdbe/api/doc/sifts.html
Link used to retrieve results: https://www.ebi.... | python | def best_structures(uniprot_id, outname=None, outdir=None, seq_ident_cutoff=0.0, force_rerun=False):
"""Use the PDBe REST service to query for the best PDB structures for a UniProt ID.
More information found here: https://www.ebi.ac.uk/pdbe/api/doc/sifts.html
Link used to retrieve results: https://www.ebi.... | [
"def",
"best_structures",
"(",
"uniprot_id",
",",
"outname",
"=",
"None",
",",
"outdir",
"=",
"None",
",",
"seq_ident_cutoff",
"=",
"0.0",
",",
"force_rerun",
"=",
"False",
")",
":",
"outfile",
"=",
"''",
"if",
"not",
"outdir",
":",
"outdir",
"=",
"''",
... | Use the PDBe REST service to query for the best PDB structures for a UniProt ID.
More information found here: https://www.ebi.ac.uk/pdbe/api/doc/sifts.html
Link used to retrieve results: https://www.ebi.ac.uk/pdbe/api/mappings/best_structures/:accession
The list of PDB structures mapping to a UniProt acces... | [
"Use",
"the",
"PDBe",
"REST",
"service",
"to",
"query",
"for",
"the",
"best",
"PDB",
"structures",
"for",
"a",
"UniProt",
"ID",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/databases/pdb.py#L349-L433 | train | 29,009 |
SBRG/ssbio | ssbio/databases/pdb.py | _property_table | def _property_table():
"""Download the PDB -> resolution table directly from the RCSB PDB REST service.
See the other fields that you can get here: http://www.rcsb.org/pdb/results/reportField.do
Returns:
Pandas DataFrame: table of structureId as the index, resolution and experimentalTechnique as t... | python | def _property_table():
"""Download the PDB -> resolution table directly from the RCSB PDB REST service.
See the other fields that you can get here: http://www.rcsb.org/pdb/results/reportField.do
Returns:
Pandas DataFrame: table of structureId as the index, resolution and experimentalTechnique as t... | [
"def",
"_property_table",
"(",
")",
":",
"url",
"=",
"'http://www.rcsb.org/pdb/rest/customReport.csv?pdbids=*&customReportColumns=structureId,resolution,experimentalTechnique,releaseDate&service=wsfile&format=csv'",
"r",
"=",
"requests",
".",
"get",
"(",
"url",
")",
"p",
"=",
"pd... | Download the PDB -> resolution table directly from the RCSB PDB REST service.
See the other fields that you can get here: http://www.rcsb.org/pdb/results/reportField.do
Returns:
Pandas DataFrame: table of structureId as the index, resolution and experimentalTechnique as the columns | [
"Download",
"the",
"PDB",
"-",
">",
"resolution",
"table",
"directly",
"from",
"the",
"RCSB",
"PDB",
"REST",
"service",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/databases/pdb.py#L443-L455 | train | 29,010 |
SBRG/ssbio | ssbio/databases/pdb.py | get_resolution | def get_resolution(pdb_id):
"""Quick way to get the resolution of a PDB ID using the table of results from the REST service
Returns infinity if the resolution is not available.
Returns:
float: resolution of a PDB ID in Angstroms
TODO:
- Unit test
"""
pdb_id = pdb_id.upper()
... | python | def get_resolution(pdb_id):
"""Quick way to get the resolution of a PDB ID using the table of results from the REST service
Returns infinity if the resolution is not available.
Returns:
float: resolution of a PDB ID in Angstroms
TODO:
- Unit test
"""
pdb_id = pdb_id.upper()
... | [
"def",
"get_resolution",
"(",
"pdb_id",
")",
":",
"pdb_id",
"=",
"pdb_id",
".",
"upper",
"(",
")",
"if",
"pdb_id",
"not",
"in",
"_property_table",
"(",
")",
".",
"index",
":",
"raise",
"ValueError",
"(",
"'PDB ID not in property table'",
")",
"else",
":",
... | Quick way to get the resolution of a PDB ID using the table of results from the REST service
Returns infinity if the resolution is not available.
Returns:
float: resolution of a PDB ID in Angstroms
TODO:
- Unit test | [
"Quick",
"way",
"to",
"get",
"the",
"resolution",
"of",
"a",
"PDB",
"ID",
"using",
"the",
"table",
"of",
"results",
"from",
"the",
"REST",
"service"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/databases/pdb.py#L458-L480 | train | 29,011 |
SBRG/ssbio | ssbio/databases/pdb.py | get_release_date | def get_release_date(pdb_id):
"""Quick way to get the release date of a PDB ID using the table of results from the REST service
Returns None if the release date is not available.
Returns:
str: Organism of a PDB ID
"""
pdb_id = pdb_id.upper()
if pdb_id not in _property_table().index:
... | python | def get_release_date(pdb_id):
"""Quick way to get the release date of a PDB ID using the table of results from the REST service
Returns None if the release date is not available.
Returns:
str: Organism of a PDB ID
"""
pdb_id = pdb_id.upper()
if pdb_id not in _property_table().index:
... | [
"def",
"get_release_date",
"(",
"pdb_id",
")",
":",
"pdb_id",
"=",
"pdb_id",
".",
"upper",
"(",
")",
"if",
"pdb_id",
"not",
"in",
"_property_table",
"(",
")",
".",
"index",
":",
"raise",
"ValueError",
"(",
"'PDB ID not in property table'",
")",
"else",
":",
... | Quick way to get the release date of a PDB ID using the table of results from the REST service
Returns None if the release date is not available.
Returns:
str: Organism of a PDB ID | [
"Quick",
"way",
"to",
"get",
"the",
"release",
"date",
"of",
"a",
"PDB",
"ID",
"using",
"the",
"table",
"of",
"results",
"from",
"the",
"REST",
"service"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/databases/pdb.py#L483-L502 | train | 29,012 |
SBRG/ssbio | ssbio/databases/pdb.py | get_num_bioassemblies | def get_num_bioassemblies(pdb_id, cache=False, outdir=None, force_rerun=False):
"""Check if there are bioassemblies using the PDB REST API, and if there are, get the number of bioassemblies
available.
See: https://www.rcsb.org/pages/webservices/rest, section 'List biological assemblies'
Not all PDB en... | python | def get_num_bioassemblies(pdb_id, cache=False, outdir=None, force_rerun=False):
"""Check if there are bioassemblies using the PDB REST API, and if there are, get the number of bioassemblies
available.
See: https://www.rcsb.org/pages/webservices/rest, section 'List biological assemblies'
Not all PDB en... | [
"def",
"get_num_bioassemblies",
"(",
"pdb_id",
",",
"cache",
"=",
"False",
",",
"outdir",
"=",
"None",
",",
"force_rerun",
"=",
"False",
")",
":",
"parser",
"=",
"etree",
".",
"XMLParser",
"(",
"ns_clean",
"=",
"True",
")",
"if",
"not",
"outdir",
":",
... | Check if there are bioassemblies using the PDB REST API, and if there are, get the number of bioassemblies
available.
See: https://www.rcsb.org/pages/webservices/rest, section 'List biological assemblies'
Not all PDB entries have biological assemblies available and some have multiple. Details that are nec... | [
"Check",
"if",
"there",
"are",
"bioassemblies",
"using",
"the",
"PDB",
"REST",
"API",
"and",
"if",
"there",
"are",
"get",
"the",
"number",
"of",
"bioassemblies",
"available",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/databases/pdb.py#L505-L570 | train | 29,013 |
SBRG/ssbio | ssbio/databases/pdb.py | get_bioassembly_info | def get_bioassembly_info(pdb_id, biomol_num, cache=False, outdir=None, force_rerun=False):
"""Get metadata about a bioassembly from the RCSB PDB's REST API.
See: https://www.rcsb.org/pdb/rest/bioassembly/bioassembly?structureId=1hv4&nr=1
The API returns an XML file containing the information on a biologica... | python | def get_bioassembly_info(pdb_id, biomol_num, cache=False, outdir=None, force_rerun=False):
"""Get metadata about a bioassembly from the RCSB PDB's REST API.
See: https://www.rcsb.org/pdb/rest/bioassembly/bioassembly?structureId=1hv4&nr=1
The API returns an XML file containing the information on a biologica... | [
"def",
"get_bioassembly_info",
"(",
"pdb_id",
",",
"biomol_num",
",",
"cache",
"=",
"False",
",",
"outdir",
"=",
"None",
",",
"force_rerun",
"=",
"False",
")",
":",
"parser",
"=",
"etree",
".",
"XMLParser",
"(",
"ns_clean",
"=",
"True",
")"
] | Get metadata about a bioassembly from the RCSB PDB's REST API.
See: https://www.rcsb.org/pdb/rest/bioassembly/bioassembly?structureId=1hv4&nr=1
The API returns an XML file containing the information on a biological assembly that looks like this::
<bioassembly structureId="1HV4" assemblyNr="1" method="... | [
"Get",
"metadata",
"about",
"a",
"bioassembly",
"from",
"the",
"RCSB",
"PDB",
"s",
"REST",
"API",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/databases/pdb.py#L573-L596 | train | 29,014 |
SBRG/ssbio | ssbio/databases/pdb.py | download_structure | def download_structure(pdb_id, file_type, outdir='', only_header=False, force_rerun=False):
"""Download a structure from the RCSB PDB by ID. Specify the file type desired.
Args:
pdb_id: PDB ID
file_type: pdb, pdb.gz, mmcif, cif, cif.gz, xml.gz, mmtf, mmtf.gz
outdir: Optional output dire... | python | def download_structure(pdb_id, file_type, outdir='', only_header=False, force_rerun=False):
"""Download a structure from the RCSB PDB by ID. Specify the file type desired.
Args:
pdb_id: PDB ID
file_type: pdb, pdb.gz, mmcif, cif, cif.gz, xml.gz, mmtf, mmtf.gz
outdir: Optional output dire... | [
"def",
"download_structure",
"(",
"pdb_id",
",",
"file_type",
",",
"outdir",
"=",
"''",
",",
"only_header",
"=",
"False",
",",
"force_rerun",
"=",
"False",
")",
":",
"# method in biopython. extra file types have not been added to biopython download yet",
"pdb_id",
"=",
... | Download a structure from the RCSB PDB by ID. Specify the file type desired.
Args:
pdb_id: PDB ID
file_type: pdb, pdb.gz, mmcif, cif, cif.gz, xml.gz, mmtf, mmtf.gz
outdir: Optional output directory
only_header: If only the header file should be downloaded
force_rerun: If the... | [
"Download",
"a",
"structure",
"from",
"the",
"RCSB",
"PDB",
"by",
"ID",
".",
"Specify",
"the",
"file",
"type",
"desired",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/databases/pdb.py#L681-L743 | train | 29,015 |
SBRG/ssbio | ssbio/databases/pdb.py | PDBProp.download_structure_file | def download_structure_file(self, outdir, file_type=None, load_header_metadata=True, force_rerun=False):
"""Download a structure file from the PDB, specifying an output directory and a file type. Optionally download
the mmCIF header file and parse data from it to store within this object.
Args:... | python | def download_structure_file(self, outdir, file_type=None, load_header_metadata=True, force_rerun=False):
"""Download a structure file from the PDB, specifying an output directory and a file type. Optionally download
the mmCIF header file and parse data from it to store within this object.
Args:... | [
"def",
"download_structure_file",
"(",
"self",
",",
"outdir",
",",
"file_type",
"=",
"None",
",",
"load_header_metadata",
"=",
"True",
",",
"force_rerun",
"=",
"False",
")",
":",
"ssbio",
".",
"utils",
".",
"double_check_attribute",
"(",
"object",
"=",
"self",... | Download a structure file from the PDB, specifying an output directory and a file type. Optionally download
the mmCIF header file and parse data from it to store within this object.
Args:
outdir (str): Path to output directory
file_type (str): ``pdb``, ``mmCif``, ``xml``, ``mmtf... | [
"Download",
"a",
"structure",
"file",
"from",
"the",
"PDB",
"specifying",
"an",
"output",
"directory",
"and",
"a",
"file",
"type",
".",
"Optionally",
"download",
"the",
"mmCIF",
"header",
"file",
"and",
"parse",
"data",
"from",
"it",
"to",
"store",
"within",... | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/databases/pdb.py#L60-L97 | train | 29,016 |
SBRG/ssbio | ssbio/protein/structure/properties/quality.py | parse_procheck | def parse_procheck(quality_directory):
"""Parses all PROCHECK files in a directory and returns a Pandas DataFrame of the results
Args:
quality_directory: path to directory with PROCHECK output (.sum files)
Returns:
Pandas DataFrame: Summary of PROCHECK results
"""
# TODO: save as... | python | def parse_procheck(quality_directory):
"""Parses all PROCHECK files in a directory and returns a Pandas DataFrame of the results
Args:
quality_directory: path to directory with PROCHECK output (.sum files)
Returns:
Pandas DataFrame: Summary of PROCHECK results
"""
# TODO: save as... | [
"def",
"parse_procheck",
"(",
"quality_directory",
")",
":",
"# TODO: save as dict instead, offer df as option",
"# TODO: parse for one file instead",
"procheck_summaries",
"=",
"glob",
".",
"glob",
"(",
"os",
".",
"path",
".",
"join",
"(",
"quality_directory",
",",
"'*.s... | Parses all PROCHECK files in a directory and returns a Pandas DataFrame of the results
Args:
quality_directory: path to directory with PROCHECK output (.sum files)
Returns:
Pandas DataFrame: Summary of PROCHECK results | [
"Parses",
"all",
"PROCHECK",
"files",
"in",
"a",
"directory",
"and",
"returns",
"a",
"Pandas",
"DataFrame",
"of",
"the",
"results"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/structure/properties/quality.py#L159-L200 | train | 29,017 |
SBRG/ssbio | ssbio/protein/structure/properties/quality.py | parse_psqs | def parse_psqs(psqs_results_file):
"""Parse a PSQS result file and returns a Pandas DataFrame of the results
Args:
psqs_results_file: Path to psqs results file
Returns:
Pandas DataFrame: Summary of PSQS results
"""
# TODO: generalize column names for all results, save as dict ins... | python | def parse_psqs(psqs_results_file):
"""Parse a PSQS result file and returns a Pandas DataFrame of the results
Args:
psqs_results_file: Path to psqs results file
Returns:
Pandas DataFrame: Summary of PSQS results
"""
# TODO: generalize column names for all results, save as dict ins... | [
"def",
"parse_psqs",
"(",
"psqs_results_file",
")",
":",
"# TODO: generalize column names for all results, save as dict instead",
"psqs_results",
"=",
"pd",
".",
"read_csv",
"(",
"psqs_results_file",
",",
"sep",
"=",
"'\\t'",
",",
"header",
"=",
"None",
")",
"psqs_resul... | Parse a PSQS result file and returns a Pandas DataFrame of the results
Args:
psqs_results_file: Path to psqs results file
Returns:
Pandas DataFrame: Summary of PSQS results | [
"Parse",
"a",
"PSQS",
"result",
"file",
"and",
"returns",
"a",
"Pandas",
"DataFrame",
"of",
"the",
"results"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/structure/properties/quality.py#L203-L223 | train | 29,018 |
SBRG/ssbio | ssbio/core/protein.py | Protein.protein_statistics | def protein_statistics(self):
"""Get a dictionary of basic statistics describing this protein"""
# TODO: can i use get_dict here instead
d = {}
d['id'] = self.id
d['sequences'] = [x.id for x in self.sequences]
d['num_sequences'] = self.num_sequences
if self.repr... | python | def protein_statistics(self):
"""Get a dictionary of basic statistics describing this protein"""
# TODO: can i use get_dict here instead
d = {}
d['id'] = self.id
d['sequences'] = [x.id for x in self.sequences]
d['num_sequences'] = self.num_sequences
if self.repr... | [
"def",
"protein_statistics",
"(",
"self",
")",
":",
"# TODO: can i use get_dict here instead",
"d",
"=",
"{",
"}",
"d",
"[",
"'id'",
"]",
"=",
"self",
".",
"id",
"d",
"[",
"'sequences'",
"]",
"=",
"[",
"x",
".",
"id",
"for",
"x",
"in",
"self",
".",
"... | Get a dictionary of basic statistics describing this protein | [
"Get",
"a",
"dictionary",
"of",
"basic",
"statistics",
"describing",
"this",
"protein"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/core/protein.py#L192-L221 | train | 29,019 |
SBRG/ssbio | ssbio/core/protein.py | Protein.filter_sequences | def filter_sequences(self, seq_type):
"""Return a DictList of only specified types in the sequences attribute.
Args:
seq_type (SeqProp): Object type
Returns:
DictList: A filtered DictList of specified object type only
"""
return DictList(x for x in self... | python | def filter_sequences(self, seq_type):
"""Return a DictList of only specified types in the sequences attribute.
Args:
seq_type (SeqProp): Object type
Returns:
DictList: A filtered DictList of specified object type only
"""
return DictList(x for x in self... | [
"def",
"filter_sequences",
"(",
"self",
",",
"seq_type",
")",
":",
"return",
"DictList",
"(",
"x",
"for",
"x",
"in",
"self",
".",
"sequences",
"if",
"isinstance",
"(",
"x",
",",
"seq_type",
")",
")"
] | Return a DictList of only specified types in the sequences attribute.
Args:
seq_type (SeqProp): Object type
Returns:
DictList: A filtered DictList of specified object type only | [
"Return",
"a",
"DictList",
"of",
"only",
"specified",
"types",
"in",
"the",
"sequences",
"attribute",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/core/protein.py#L264-L274 | train | 29,020 |
SBRG/ssbio | ssbio/core/protein.py | Protein.load_kegg | def load_kegg(self, kegg_id, kegg_organism_code=None, kegg_seq_file=None, kegg_metadata_file=None,
set_as_representative=False, download=False, outdir=None, force_rerun=False):
"""Load a KEGG ID, sequence, and metadata files into the sequences attribute.
Args:
kegg_id (str... | python | def load_kegg(self, kegg_id, kegg_organism_code=None, kegg_seq_file=None, kegg_metadata_file=None,
set_as_representative=False, download=False, outdir=None, force_rerun=False):
"""Load a KEGG ID, sequence, and metadata files into the sequences attribute.
Args:
kegg_id (str... | [
"def",
"load_kegg",
"(",
"self",
",",
"kegg_id",
",",
"kegg_organism_code",
"=",
"None",
",",
"kegg_seq_file",
"=",
"None",
",",
"kegg_metadata_file",
"=",
"None",
",",
"set_as_representative",
"=",
"False",
",",
"download",
"=",
"False",
",",
"outdir",
"=",
... | Load a KEGG ID, sequence, and metadata files into the sequences attribute.
Args:
kegg_id (str): KEGG ID
kegg_organism_code (str): KEGG organism code to prepend to the kegg_id if not part of it already.
Example: ``eco:b1244``, ``eco`` is the organism code
kegg... | [
"Load",
"a",
"KEGG",
"ID",
"sequence",
"and",
"metadata",
"files",
"into",
"the",
"sequences",
"attribute",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/core/protein.py#L276-L348 | train | 29,021 |
SBRG/ssbio | ssbio/core/protein.py | Protein.load_manual_sequence_file | def load_manual_sequence_file(self, ident, seq_file, copy_file=False, outdir=None, set_as_representative=False):
"""Load a manual sequence, given as a FASTA file and optionally set it as the representative sequence.
Also store it in the sequences attribute.
Args:
ident (str): Sequen... | python | def load_manual_sequence_file(self, ident, seq_file, copy_file=False, outdir=None, set_as_representative=False):
"""Load a manual sequence, given as a FASTA file and optionally set it as the representative sequence.
Also store it in the sequences attribute.
Args:
ident (str): Sequen... | [
"def",
"load_manual_sequence_file",
"(",
"self",
",",
"ident",
",",
"seq_file",
",",
"copy_file",
"=",
"False",
",",
"outdir",
"=",
"None",
",",
"set_as_representative",
"=",
"False",
")",
":",
"if",
"copy_file",
":",
"if",
"not",
"outdir",
":",
"outdir",
... | Load a manual sequence, given as a FASTA file and optionally set it as the representative sequence.
Also store it in the sequences attribute.
Args:
ident (str): Sequence ID
seq_file (str): Path to sequence FASTA file
copy_file (bool): If the FASTA file should be copi... | [
"Load",
"a",
"manual",
"sequence",
"given",
"as",
"a",
"FASTA",
"file",
"and",
"optionally",
"set",
"it",
"as",
"the",
"representative",
"sequence",
".",
"Also",
"store",
"it",
"in",
"the",
"sequences",
"attribute",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/core/protein.py#L422-L452 | train | 29,022 |
SBRG/ssbio | ssbio/core/protein.py | Protein.load_manual_sequence | def load_manual_sequence(self, seq, ident=None, write_fasta_file=False, outdir=None,
set_as_representative=False, force_rewrite=False):
"""Load a manual sequence given as a string and optionally set it as the representative sequence.
Also store it in the sequences attribute.... | python | def load_manual_sequence(self, seq, ident=None, write_fasta_file=False, outdir=None,
set_as_representative=False, force_rewrite=False):
"""Load a manual sequence given as a string and optionally set it as the representative sequence.
Also store it in the sequences attribute.... | [
"def",
"load_manual_sequence",
"(",
"self",
",",
"seq",
",",
"ident",
"=",
"None",
",",
"write_fasta_file",
"=",
"False",
",",
"outdir",
"=",
"None",
",",
"set_as_representative",
"=",
"False",
",",
"force_rewrite",
"=",
"False",
")",
":",
"if",
"write_fasta... | Load a manual sequence given as a string and optionally set it as the representative sequence.
Also store it in the sequences attribute.
Args:
seq (str, Seq, SeqRecord): Sequence string, Biopython Seq or SeqRecord object
ident (str): Optional identifier for the sequence, require... | [
"Load",
"a",
"manual",
"sequence",
"given",
"as",
"a",
"string",
"and",
"optionally",
"set",
"it",
"as",
"the",
"representative",
"sequence",
".",
"Also",
"store",
"it",
"in",
"the",
"sequences",
"attribute",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/core/protein.py#L454-L501 | train | 29,023 |
SBRG/ssbio | ssbio/core/protein.py | Protein.write_all_sequences_file | def write_all_sequences_file(self, outname, outdir=None):
"""Write all the stored sequences as a single FASTA file. By default, sets IDs to model gene IDs.
Args:
outname (str): Name of the output FASTA file without the extension
outdir (str): Path to output directory for the fil... | python | def write_all_sequences_file(self, outname, outdir=None):
"""Write all the stored sequences as a single FASTA file. By default, sets IDs to model gene IDs.
Args:
outname (str): Name of the output FASTA file without the extension
outdir (str): Path to output directory for the fil... | [
"def",
"write_all_sequences_file",
"(",
"self",
",",
"outname",
",",
"outdir",
"=",
"None",
")",
":",
"if",
"not",
"outdir",
":",
"outdir",
"=",
"self",
".",
"sequence_dir",
"if",
"not",
"outdir",
":",
"raise",
"ValueError",
"(",
"'Output directory must be spe... | Write all the stored sequences as a single FASTA file. By default, sets IDs to model gene IDs.
Args:
outname (str): Name of the output FASTA file without the extension
outdir (str): Path to output directory for the file, default is the sequences directory | [
"Write",
"all",
"the",
"stored",
"sequences",
"as",
"a",
"single",
"FASTA",
"file",
".",
"By",
"default",
"sets",
"IDs",
"to",
"model",
"gene",
"IDs",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/core/protein.py#L706-L724 | train | 29,024 |
SBRG/ssbio | ssbio/core/protein.py | Protein.get_sequence_sliding_window_properties | def get_sequence_sliding_window_properties(self, scale, window, representative_only=True):
"""Run Biopython ProteinAnalysis with a sliding window to calculate a given property.
Results are stored in the protein's respective SeqProp objects at ``.letter_annotations``
Args:
scale (str... | python | def get_sequence_sliding_window_properties(self, scale, window, representative_only=True):
"""Run Biopython ProteinAnalysis with a sliding window to calculate a given property.
Results are stored in the protein's respective SeqProp objects at ``.letter_annotations``
Args:
scale (str... | [
"def",
"get_sequence_sliding_window_properties",
"(",
"self",
",",
"scale",
",",
"window",
",",
"representative_only",
"=",
"True",
")",
":",
"if",
"representative_only",
":",
"# Check if a representative sequence was set",
"if",
"not",
"self",
".",
"representative_sequen... | Run Biopython ProteinAnalysis with a sliding window to calculate a given property.
Results are stored in the protein's respective SeqProp objects at ``.letter_annotations``
Args:
scale (str): Scale name
window (int): Sliding window size
representative_only (bool): If... | [
"Run",
"Biopython",
"ProteinAnalysis",
"with",
"a",
"sliding",
"window",
"to",
"calculate",
"a",
"given",
"property",
".",
"Results",
"are",
"stored",
"in",
"the",
"protein",
"s",
"respective",
"SeqProp",
"objects",
"at",
".",
"letter_annotations"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/core/protein.py#L761-L794 | train | 29,025 |
SBRG/ssbio | ssbio/core/protein.py | Protein.prep_itasser_modeling | def prep_itasser_modeling(self, itasser_installation, itlib_folder, runtype, create_in_dir=None,
execute_from_dir=None, print_exec=False, **kwargs):
"""Prepare to run I-TASSER homology modeling for the representative sequence.
Args:
itasser_installation (str): ... | python | def prep_itasser_modeling(self, itasser_installation, itlib_folder, runtype, create_in_dir=None,
execute_from_dir=None, print_exec=False, **kwargs):
"""Prepare to run I-TASSER homology modeling for the representative sequence.
Args:
itasser_installation (str): ... | [
"def",
"prep_itasser_modeling",
"(",
"self",
",",
"itasser_installation",
",",
"itlib_folder",
",",
"runtype",
",",
"create_in_dir",
"=",
"None",
",",
"execute_from_dir",
"=",
"None",
",",
"print_exec",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
... | Prepare to run I-TASSER homology modeling for the representative sequence.
Args:
itasser_installation (str): Path to I-TASSER folder, i.e. ``~/software/I-TASSER4.4``
itlib_folder (str): Path to ITLIB folder, i.e. ``~/software/ITLIB``
runtype: How you will be running I-TASSER... | [
"Prepare",
"to",
"run",
"I",
"-",
"TASSER",
"homology",
"modeling",
"for",
"the",
"representative",
"sequence",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/core/protein.py#L796-L852 | train | 29,026 |
SBRG/ssbio | ssbio/core/protein.py | Protein.map_uniprot_to_pdb | def map_uniprot_to_pdb(self, seq_ident_cutoff=0.0, outdir=None, force_rerun=False):
"""Map the representative sequence's UniProt ID to PDB IDs using the PDBe "Best Structures" API.
Will save a JSON file of the results to the protein sequences folder.
The "Best structures" API is available at ht... | python | def map_uniprot_to_pdb(self, seq_ident_cutoff=0.0, outdir=None, force_rerun=False):
"""Map the representative sequence's UniProt ID to PDB IDs using the PDBe "Best Structures" API.
Will save a JSON file of the results to the protein sequences folder.
The "Best structures" API is available at ht... | [
"def",
"map_uniprot_to_pdb",
"(",
"self",
",",
"seq_ident_cutoff",
"=",
"0.0",
",",
"outdir",
"=",
"None",
",",
"force_rerun",
"=",
"False",
")",
":",
"if",
"not",
"self",
".",
"representative_sequence",
":",
"log",
".",
"error",
"(",
"'{}: no representative s... | Map the representative sequence's UniProt ID to PDB IDs using the PDBe "Best Structures" API.
Will save a JSON file of the results to the protein sequences folder.
The "Best structures" API is available at https://www.ebi.ac.uk/pdbe/api/doc/sifts.html
The list of PDB structures mapping to a Uni... | [
"Map",
"the",
"representative",
"sequence",
"s",
"UniProt",
"ID",
"to",
"PDB",
"IDs",
"using",
"the",
"PDBe",
"Best",
"Structures",
"API",
".",
"Will",
"save",
"a",
"JSON",
"file",
"of",
"the",
"results",
"to",
"the",
"protein",
"sequences",
"folder",
"."
... | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/core/protein.py#L937-L1008 | train | 29,027 |
SBRG/ssbio | ssbio/core/protein.py | Protein.load_pdb | def load_pdb(self, pdb_id, mapped_chains=None, pdb_file=None, file_type=None, is_experimental=True,
set_as_representative=False, representative_chain=None, force_rerun=False):
"""Load a structure ID and optional structure file into the structures attribute.
Args:
pdb_id (st... | python | def load_pdb(self, pdb_id, mapped_chains=None, pdb_file=None, file_type=None, is_experimental=True,
set_as_representative=False, representative_chain=None, force_rerun=False):
"""Load a structure ID and optional structure file into the structures attribute.
Args:
pdb_id (st... | [
"def",
"load_pdb",
"(",
"self",
",",
"pdb_id",
",",
"mapped_chains",
"=",
"None",
",",
"pdb_file",
"=",
"None",
",",
"file_type",
"=",
"None",
",",
"is_experimental",
"=",
"True",
",",
"set_as_representative",
"=",
"False",
",",
"representative_chain",
"=",
... | Load a structure ID and optional structure file into the structures attribute.
Args:
pdb_id (str): PDB ID
mapped_chains (str, list): Chain ID or list of IDs which you are interested in
pdb_file (str): Path to PDB file
file_type (str): Type of PDB file
... | [
"Load",
"a",
"structure",
"ID",
"and",
"optional",
"structure",
"file",
"into",
"the",
"structures",
"attribute",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/core/protein.py#L1033-L1079 | train | 29,028 |
SBRG/ssbio | ssbio/core/protein.py | Protein.pdb_downloader_and_metadata | def pdb_downloader_and_metadata(self, outdir=None, pdb_file_type=None, force_rerun=False):
"""Download ALL mapped experimental structures to the protein structures directory.
Args:
outdir (str): Path to output directory, if protein structures directory not set or other output directory is
... | python | def pdb_downloader_and_metadata(self, outdir=None, pdb_file_type=None, force_rerun=False):
"""Download ALL mapped experimental structures to the protein structures directory.
Args:
outdir (str): Path to output directory, if protein structures directory not set or other output directory is
... | [
"def",
"pdb_downloader_and_metadata",
"(",
"self",
",",
"outdir",
"=",
"None",
",",
"pdb_file_type",
"=",
"None",
",",
"force_rerun",
"=",
"False",
")",
":",
"if",
"not",
"outdir",
":",
"outdir",
"=",
"self",
".",
"structure_dir",
"if",
"not",
"outdir",
":... | Download ALL mapped experimental structures to the protein structures directory.
Args:
outdir (str): Path to output directory, if protein structures directory not set or other output directory is
desired
pdb_file_type (str): Type of PDB file to download, if not already s... | [
"Download",
"ALL",
"mapped",
"experimental",
"structures",
"to",
"the",
"protein",
"structures",
"directory",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/core/protein.py#L1204-L1240 | train | 29,029 |
SBRG/ssbio | ssbio/core/protein.py | Protein._get_seqprop_to_seqprop_alignment | def _get_seqprop_to_seqprop_alignment(self, seqprop1, seqprop2):
"""Return the alignment stored in self.sequence_alignments given a seqprop + another seqprop"""
if isinstance(seqprop1, str):
seqprop1_id = seqprop1
else:
seqprop1_id = seqprop1.id
if isinstance(seqp... | python | def _get_seqprop_to_seqprop_alignment(self, seqprop1, seqprop2):
"""Return the alignment stored in self.sequence_alignments given a seqprop + another seqprop"""
if isinstance(seqprop1, str):
seqprop1_id = seqprop1
else:
seqprop1_id = seqprop1.id
if isinstance(seqp... | [
"def",
"_get_seqprop_to_seqprop_alignment",
"(",
"self",
",",
"seqprop1",
",",
"seqprop2",
")",
":",
"if",
"isinstance",
"(",
"seqprop1",
",",
"str",
")",
":",
"seqprop1_id",
"=",
"seqprop1",
"else",
":",
"seqprop1_id",
"=",
"seqprop1",
".",
"id",
"if",
"isi... | Return the alignment stored in self.sequence_alignments given a seqprop + another seqprop | [
"Return",
"the",
"alignment",
"stored",
"in",
"self",
".",
"sequence_alignments",
"given",
"a",
"seqprop",
"+",
"another",
"seqprop"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/core/protein.py#L1438-L1455 | train | 29,030 |
SBRG/ssbio | ssbio/core/protein.py | Protein.map_seqprop_resnums_to_seqprop_resnums | def map_seqprop_resnums_to_seqprop_resnums(self, resnums, seqprop1, seqprop2):
"""Map a residue number in any SeqProp to another SeqProp using the pairwise alignment information.
Args:
resnums (int, list): Residue numbers in seqprop1
seqprop1 (SeqProp): SeqProp object the resnum... | python | def map_seqprop_resnums_to_seqprop_resnums(self, resnums, seqprop1, seqprop2):
"""Map a residue number in any SeqProp to another SeqProp using the pairwise alignment information.
Args:
resnums (int, list): Residue numbers in seqprop1
seqprop1 (SeqProp): SeqProp object the resnum... | [
"def",
"map_seqprop_resnums_to_seqprop_resnums",
"(",
"self",
",",
"resnums",
",",
"seqprop1",
",",
"seqprop2",
")",
":",
"resnums",
"=",
"ssbio",
".",
"utils",
".",
"force_list",
"(",
"resnums",
")",
"alignment",
"=",
"self",
".",
"_get_seqprop_to_seqprop_alignme... | Map a residue number in any SeqProp to another SeqProp using the pairwise alignment information.
Args:
resnums (int, list): Residue numbers in seqprop1
seqprop1 (SeqProp): SeqProp object the resnums match to
seqprop2 (SeqProp): SeqProp object you want to map the resnums to
... | [
"Map",
"a",
"residue",
"number",
"in",
"any",
"SeqProp",
"to",
"another",
"SeqProp",
"using",
"the",
"pairwise",
"alignment",
"information",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/core/protein.py#L1463-L1484 | train | 29,031 |
SBRG/ssbio | ssbio/core/protein.py | Protein._get_seqprop_to_structprop_alignment | def _get_seqprop_to_structprop_alignment(self, seqprop, structprop, chain_id):
"""Return the alignment stored in self.sequence_alignments given a seqprop, structuprop, and chain_id"""
full_structure_id = '{}-{}'.format(structprop.id, chain_id)
aln_id = '{}_{}'.format(seqprop.id, full_structure_i... | python | def _get_seqprop_to_structprop_alignment(self, seqprop, structprop, chain_id):
"""Return the alignment stored in self.sequence_alignments given a seqprop, structuprop, and chain_id"""
full_structure_id = '{}-{}'.format(structprop.id, chain_id)
aln_id = '{}_{}'.format(seqprop.id, full_structure_i... | [
"def",
"_get_seqprop_to_structprop_alignment",
"(",
"self",
",",
"seqprop",
",",
"structprop",
",",
"chain_id",
")",
":",
"full_structure_id",
"=",
"'{}-{}'",
".",
"format",
"(",
"structprop",
".",
"id",
",",
"chain_id",
")",
"aln_id",
"=",
"'{}_{}'",
".",
"fo... | Return the alignment stored in self.sequence_alignments given a seqprop, structuprop, and chain_id | [
"Return",
"the",
"alignment",
"stored",
"in",
"self",
".",
"sequence_alignments",
"given",
"a",
"seqprop",
"structuprop",
"and",
"chain_id"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/core/protein.py#L1486-L1495 | train | 29,032 |
SBRG/ssbio | ssbio/core/protein.py | Protein.check_structure_chain_quality | def check_structure_chain_quality(self, seqprop, structprop, chain_id,
seq_ident_cutoff=0.5, allow_missing_on_termini=0.2,
allow_mutants=True, allow_deletions=False,
allow_insertions=False, allow_unresolved... | python | def check_structure_chain_quality(self, seqprop, structprop, chain_id,
seq_ident_cutoff=0.5, allow_missing_on_termini=0.2,
allow_mutants=True, allow_deletions=False,
allow_insertions=False, allow_unresolved... | [
"def",
"check_structure_chain_quality",
"(",
"self",
",",
"seqprop",
",",
"structprop",
",",
"chain_id",
",",
"seq_ident_cutoff",
"=",
"0.5",
",",
"allow_missing_on_termini",
"=",
"0.2",
",",
"allow_mutants",
"=",
"True",
",",
"allow_deletions",
"=",
"False",
",",... | Report if a structure's chain meets the defined cutoffs for sequence quality. | [
"Report",
"if",
"a",
"structure",
"s",
"chain",
"meets",
"the",
"defined",
"cutoffs",
"for",
"sequence",
"quality",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/core/protein.py#L1503-L1519 | train | 29,033 |
SBRG/ssbio | ssbio/core/protein.py | Protein.find_representative_chain | def find_representative_chain(self, seqprop, structprop, chains_to_check=None,
seq_ident_cutoff=0.5, allow_missing_on_termini=0.2,
allow_mutants=True, allow_deletions=False,
allow_insertions=False, allow_unresolved=Tru... | python | def find_representative_chain(self, seqprop, structprop, chains_to_check=None,
seq_ident_cutoff=0.5, allow_missing_on_termini=0.2,
allow_mutants=True, allow_deletions=False,
allow_insertions=False, allow_unresolved=Tru... | [
"def",
"find_representative_chain",
"(",
"self",
",",
"seqprop",
",",
"structprop",
",",
"chains_to_check",
"=",
"None",
",",
"seq_ident_cutoff",
"=",
"0.5",
",",
"allow_missing_on_termini",
"=",
"0.2",
",",
"allow_mutants",
"=",
"True",
",",
"allow_deletions",
"=... | Set and return the representative chain based on sequence quality checks to a reference sequence.
Args:
seqprop (SeqProp): SeqProp object to compare to chain sequences
structprop (StructProp): StructProp object with chains to compare to in the ``mapped_chains`` attribute. If
... | [
"Set",
"and",
"return",
"the",
"representative",
"chain",
"based",
"on",
"sequence",
"quality",
"checks",
"to",
"a",
"reference",
"sequence",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/core/protein.py#L1521-L1577 | train | 29,034 |
SBRG/ssbio | ssbio/core/protein.py | Protein._map_seqprop_resnums_to_structprop_chain_index | def _map_seqprop_resnums_to_structprop_chain_index(self, resnums, seqprop=None, structprop=None, chain_id=None,
use_representatives=False):
"""Map a residue number in any SeqProp to the mapping index in the StructProp + chain ID. This does not provide
... | python | def _map_seqprop_resnums_to_structprop_chain_index(self, resnums, seqprop=None, structprop=None, chain_id=None,
use_representatives=False):
"""Map a residue number in any SeqProp to the mapping index in the StructProp + chain ID. This does not provide
... | [
"def",
"_map_seqprop_resnums_to_structprop_chain_index",
"(",
"self",
",",
"resnums",
",",
"seqprop",
"=",
"None",
",",
"structprop",
"=",
"None",
",",
"chain_id",
"=",
"None",
",",
"use_representatives",
"=",
"False",
")",
":",
"resnums",
"=",
"ssbio",
".",
"... | Map a residue number in any SeqProp to the mapping index in the StructProp + chain ID. This does not provide
a mapping to residue number, only a mapping to the index which then can be mapped to the structure resnum!
Args:
resnums (int, list): Residue numbers in the sequence
seqp... | [
"Map",
"a",
"residue",
"number",
"in",
"any",
"SeqProp",
"to",
"the",
"mapping",
"index",
"in",
"the",
"StructProp",
"+",
"chain",
"ID",
".",
"This",
"does",
"not",
"provide",
"a",
"mapping",
"to",
"residue",
"number",
"only",
"a",
"mapping",
"to",
"the"... | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/core/protein.py#L1579-L1633 | train | 29,035 |
SBRG/ssbio | ssbio/core/protein.py | Protein.map_seqprop_resnums_to_structprop_resnums | def map_seqprop_resnums_to_structprop_resnums(self, resnums, seqprop=None, structprop=None, chain_id=None,
use_representatives=False):
"""Map a residue number in any SeqProp to the structure's residue number for a specified chain.
Args:
resn... | python | def map_seqprop_resnums_to_structprop_resnums(self, resnums, seqprop=None, structprop=None, chain_id=None,
use_representatives=False):
"""Map a residue number in any SeqProp to the structure's residue number for a specified chain.
Args:
resn... | [
"def",
"map_seqprop_resnums_to_structprop_resnums",
"(",
"self",
",",
"resnums",
",",
"seqprop",
"=",
"None",
",",
"structprop",
"=",
"None",
",",
"chain_id",
"=",
"None",
",",
"use_representatives",
"=",
"False",
")",
":",
"resnums",
"=",
"ssbio",
".",
"utils... | Map a residue number in any SeqProp to the structure's residue number for a specified chain.
Args:
resnums (int, list): Residue numbers in the sequence
seqprop (SeqProp): SeqProp object
structprop (StructProp): StructProp object
chain_id (str): Chain ID to map to... | [
"Map",
"a",
"residue",
"number",
"in",
"any",
"SeqProp",
"to",
"the",
"structure",
"s",
"residue",
"number",
"for",
"a",
"specified",
"chain",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/core/protein.py#L1635-L1705 | train | 29,036 |
SBRG/ssbio | ssbio/core/protein.py | Protein.map_structprop_resnums_to_seqprop_resnums | def map_structprop_resnums_to_seqprop_resnums(self, resnums, structprop=None, chain_id=None, seqprop=None,
use_representatives=False):
"""Map a residue number in any StructProp + chain ID to any SeqProp's residue number.
Args:
resnums (int, ... | python | def map_structprop_resnums_to_seqprop_resnums(self, resnums, structprop=None, chain_id=None, seqprop=None,
use_representatives=False):
"""Map a residue number in any StructProp + chain ID to any SeqProp's residue number.
Args:
resnums (int, ... | [
"def",
"map_structprop_resnums_to_seqprop_resnums",
"(",
"self",
",",
"resnums",
",",
"structprop",
"=",
"None",
",",
"chain_id",
"=",
"None",
",",
"seqprop",
"=",
"None",
",",
"use_representatives",
"=",
"False",
")",
":",
"resnums",
"=",
"ssbio",
".",
"utils... | Map a residue number in any StructProp + chain ID to any SeqProp's residue number.
Args:
resnums (int, list): Residue numbers in the structure
structprop (StructProp): StructProp object
chain_id (str): Chain ID to map from
seqprop (SeqProp): SeqProp object
... | [
"Map",
"a",
"residue",
"number",
"in",
"any",
"StructProp",
"+",
"chain",
"ID",
"to",
"any",
"SeqProp",
"s",
"residue",
"number",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/core/protein.py#L1707-L1787 | train | 29,037 |
SBRG/ssbio | ssbio/core/protein.py | Protein.get_seqprop_subsequence_from_structchain_property | def get_seqprop_subsequence_from_structchain_property(self,
property_key, property_value, condition,
seqprop=None, structprop=None, chain_id=None,
... | python | def get_seqprop_subsequence_from_structchain_property(self,
property_key, property_value, condition,
seqprop=None, structprop=None, chain_id=None,
... | [
"def",
"get_seqprop_subsequence_from_structchain_property",
"(",
"self",
",",
"property_key",
",",
"property_value",
",",
"condition",
",",
"seqprop",
"=",
"None",
",",
"structprop",
"=",
"None",
",",
"chain_id",
"=",
"None",
",",
"use_representatives",
"=",
"False"... | Get a subsequence as a new SeqProp object given a certain property you want to find in the
given StructProp's chain's letter_annotation
This is similar to the :func:`ssbio.protein.sequence.seqprop.SeqProp.get_subsequence_from_property` method but instead of
filtering by the SeqProp's letter_ann... | [
"Get",
"a",
"subsequence",
"as",
"a",
"new",
"SeqProp",
"object",
"given",
"a",
"certain",
"property",
"you",
"want",
"to",
"find",
"in",
"the",
"given",
"StructProp",
"s",
"chain",
"s",
"letter_annotation"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/core/protein.py#L1789-L1855 | train | 29,038 |
SBRG/ssbio | ssbio/core/protein.py | Protein._representative_structure_setter | def _representative_structure_setter(self, structprop, keep_chain, clean=True, keep_chemicals=None,
out_suffix='_clean', outdir=None, force_rerun=False):
"""Set the representative structure by 1) cleaning it and 2) copying over attributes of the original structure.
... | python | def _representative_structure_setter(self, structprop, keep_chain, clean=True, keep_chemicals=None,
out_suffix='_clean', outdir=None, force_rerun=False):
"""Set the representative structure by 1) cleaning it and 2) copying over attributes of the original structure.
... | [
"def",
"_representative_structure_setter",
"(",
"self",
",",
"structprop",
",",
"keep_chain",
",",
"clean",
"=",
"True",
",",
"keep_chemicals",
"=",
"None",
",",
"out_suffix",
"=",
"'_clean'",
",",
"outdir",
"=",
"None",
",",
"force_rerun",
"=",
"False",
")",
... | Set the representative structure by 1) cleaning it and 2) copying over attributes of the original structure.
The structure is copied because the chains stored may change, and cleaning it makes a new PDB file.
Args:
structprop (StructProp): StructProp object to set as representative
... | [
"Set",
"the",
"representative",
"structure",
"by",
"1",
")",
"cleaning",
"it",
"and",
"2",
")",
"copying",
"over",
"attributes",
"of",
"the",
"original",
"structure",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/core/protein.py#L1857-L1915 | train | 29,039 |
SBRG/ssbio | ssbio/core/protein.py | Protein.get_residue_annotations | def get_residue_annotations(self, seq_resnum, seqprop=None, structprop=None, chain_id=None,
use_representatives=False):
"""Get all residue-level annotations stored in the SeqProp ``letter_annotations`` field for a given residue number.
Uses the representative sequence, s... | python | def get_residue_annotations(self, seq_resnum, seqprop=None, structprop=None, chain_id=None,
use_representatives=False):
"""Get all residue-level annotations stored in the SeqProp ``letter_annotations`` field for a given residue number.
Uses the representative sequence, s... | [
"def",
"get_residue_annotations",
"(",
"self",
",",
"seq_resnum",
",",
"seqprop",
"=",
"None",
",",
"structprop",
"=",
"None",
",",
"chain_id",
"=",
"None",
",",
"use_representatives",
"=",
"False",
")",
":",
"if",
"use_representatives",
":",
"if",
"seqprop",
... | Get all residue-level annotations stored in the SeqProp ``letter_annotations`` field for a given residue number.
Uses the representative sequence, structure, and chain ID stored by default. If other properties from other
structures are desired, input the proper IDs. An alignment for the given sequence ... | [
"Get",
"all",
"residue",
"-",
"level",
"annotations",
"stored",
"in",
"the",
"SeqProp",
"letter_annotations",
"field",
"for",
"a",
"given",
"residue",
"number",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/core/protein.py#L2310-L2390 | train | 29,040 |
SBRG/ssbio | ssbio/core/protein.py | Protein.sequence_mutation_summary | def sequence_mutation_summary(self, alignment_ids=None, alignment_type=None):
"""Summarize all mutations found in the sequence_alignments attribute.
Returns 2 dictionaries, single_counter and fingerprint_counter.
single_counter:
Dictionary of ``{point mutation: list of genes/strain... | python | def sequence_mutation_summary(self, alignment_ids=None, alignment_type=None):
"""Summarize all mutations found in the sequence_alignments attribute.
Returns 2 dictionaries, single_counter and fingerprint_counter.
single_counter:
Dictionary of ``{point mutation: list of genes/strain... | [
"def",
"sequence_mutation_summary",
"(",
"self",
",",
"alignment_ids",
"=",
"None",
",",
"alignment_type",
"=",
"None",
")",
":",
"if",
"alignment_ids",
":",
"ssbio",
".",
"utils",
".",
"force_list",
"(",
"alignment_ids",
")",
"if",
"len",
"(",
"self",
".",
... | Summarize all mutations found in the sequence_alignments attribute.
Returns 2 dictionaries, single_counter and fingerprint_counter.
single_counter:
Dictionary of ``{point mutation: list of genes/strains}``
Example::
{
('A', 24, 'V'): ['Strai... | [
"Summarize",
"all",
"mutations",
"found",
"in",
"the",
"sequence_alignments",
"attribute",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/core/protein.py#L2392-L2459 | train | 29,041 |
SBRG/ssbio | ssbio/core/protein.py | Protein.get_all_pdbflex_info | def get_all_pdbflex_info(self):
"""Gets ALL PDBFlex entries for all mapped structures, then stores the ones that match the repseq length
Ideas:
- maybe first check for quality of structure and then retrieve the pdbflex entry
- not sure which sequence is used in pdbflex
... | python | def get_all_pdbflex_info(self):
"""Gets ALL PDBFlex entries for all mapped structures, then stores the ones that match the repseq length
Ideas:
- maybe first check for quality of structure and then retrieve the pdbflex entry
- not sure which sequence is used in pdbflex
... | [
"def",
"get_all_pdbflex_info",
"(",
"self",
")",
":",
"# XTODO: documentation",
"log",
".",
"debug",
"(",
"'{}: representative sequence length'",
".",
"format",
"(",
"self",
".",
"representative_sequence",
".",
"seq_len",
")",
")",
"for",
"s",
"in",
"self",
".",
... | Gets ALL PDBFlex entries for all mapped structures, then stores the ones that match the repseq length
Ideas:
- maybe first check for quality of structure and then retrieve the pdbflex entry
- not sure which sequence is used in pdbflex | [
"Gets",
"ALL",
"PDBFlex",
"entries",
"for",
"all",
"mapped",
"structures",
"then",
"stores",
"the",
"ones",
"that",
"match",
"the",
"repseq",
"length"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/core/protein.py#L2872-L2930 | train | 29,042 |
SBRG/ssbio | ssbio/core/protein.py | Protein.get_generic_subseq_2D | def get_generic_subseq_2D(protein, cutoff, prop, condition):
"""Get a subsequence from REPSEQ based on a property stored in REPSEQ.letter_annotations"""
subseq, subseq_resnums = protein.representative_sequence.get_subsequence_from_property(property_key=prop,
... | python | def get_generic_subseq_2D(protein, cutoff, prop, condition):
"""Get a subsequence from REPSEQ based on a property stored in REPSEQ.letter_annotations"""
subseq, subseq_resnums = protein.representative_sequence.get_subsequence_from_property(property_key=prop,
... | [
"def",
"get_generic_subseq_2D",
"(",
"protein",
",",
"cutoff",
",",
"prop",
",",
"condition",
")",
":",
"subseq",
",",
"subseq_resnums",
"=",
"protein",
".",
"representative_sequence",
".",
"get_subsequence_from_property",
"(",
"property_key",
"=",
"prop",
",",
"p... | Get a subsequence from REPSEQ based on a property stored in REPSEQ.letter_annotations | [
"Get",
"a",
"subsequence",
"from",
"REPSEQ",
"based",
"on",
"a",
"property",
"stored",
"in",
"REPSEQ",
".",
"letter_annotations"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/core/protein.py#L2987-L2995 | train | 29,043 |
SBRG/ssbio | ssbio/core/protein.py | Protein.get_generic_subseq_3D | def get_generic_subseq_3D(protein, cutoff, prop, condition):
"""Get a subsequence from REPSEQ based on a property stored in REPSTRUCT.REPCHAIN.letter_annotations"""
if not protein.representative_structure:
log.error('{}: no representative structure, cannot search for subseq'.format(protein.i... | python | def get_generic_subseq_3D(protein, cutoff, prop, condition):
"""Get a subsequence from REPSEQ based on a property stored in REPSTRUCT.REPCHAIN.letter_annotations"""
if not protein.representative_structure:
log.error('{}: no representative structure, cannot search for subseq'.format(protein.i... | [
"def",
"get_generic_subseq_3D",
"(",
"protein",
",",
"cutoff",
",",
"prop",
",",
"condition",
")",
":",
"if",
"not",
"protein",
".",
"representative_structure",
":",
"log",
".",
"error",
"(",
"'{}: no representative structure, cannot search for subseq'",
".",
"format"... | Get a subsequence from REPSEQ based on a property stored in REPSTRUCT.REPCHAIN.letter_annotations | [
"Get",
"a",
"subsequence",
"from",
"REPSEQ",
"based",
"on",
"a",
"property",
"stored",
"in",
"REPSTRUCT",
".",
"REPCHAIN",
".",
"letter_annotations"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/core/protein.py#L2997-L3010 | train | 29,044 |
SBRG/ssbio | ssbio/core/protein.py | Protein.get_combo_subseq_within_2_5D | def get_combo_subseq_within_2_5D(protein, props, within, filter_resnums=None):
"""Get a subsequence from REPSEQ based on multiple features stored in REPSEQ and within the set distance in REPSTRUCT.REPCHAIN"""
if not protein.representative_structure:
log.error('{}: no representative structure... | python | def get_combo_subseq_within_2_5D(protein, props, within, filter_resnums=None):
"""Get a subsequence from REPSEQ based on multiple features stored in REPSEQ and within the set distance in REPSTRUCT.REPCHAIN"""
if not protein.representative_structure:
log.error('{}: no representative structure... | [
"def",
"get_combo_subseq_within_2_5D",
"(",
"protein",
",",
"props",
",",
"within",
",",
"filter_resnums",
"=",
"None",
")",
":",
"if",
"not",
"protein",
".",
"representative_structure",
":",
"log",
".",
"error",
"(",
"'{}: no representative structure, cannot search f... | Get a subsequence from REPSEQ based on multiple features stored in REPSEQ and within the set distance in REPSTRUCT.REPCHAIN | [
"Get",
"a",
"subsequence",
"from",
"REPSEQ",
"based",
"on",
"multiple",
"features",
"stored",
"in",
"REPSEQ",
"and",
"within",
"the",
"set",
"distance",
"in",
"REPSTRUCT",
".",
"REPCHAIN"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/core/protein.py#L3093-L3111 | train | 29,045 |
SBRG/ssbio | ssbio/core/protein.py | Protein.get_surface_subseq_3D | def get_surface_subseq_3D(protein,
depth_prop='RES_DEPTH-msms', depth_cutoff=2.5, depth_condition='<',
acc_prop='RSA_ALL-freesasa_het', acc_cutoff=25, acc_condition='>'):
"""SURFACE 3D = NOTDEEP + ACC"""
empty = {'surface_3D': {'subseq_len' ... | python | def get_surface_subseq_3D(protein,
depth_prop='RES_DEPTH-msms', depth_cutoff=2.5, depth_condition='<',
acc_prop='RSA_ALL-freesasa_het', acc_cutoff=25, acc_condition='>'):
"""SURFACE 3D = NOTDEEP + ACC"""
empty = {'surface_3D': {'subseq_len' ... | [
"def",
"get_surface_subseq_3D",
"(",
"protein",
",",
"depth_prop",
"=",
"'RES_DEPTH-msms'",
",",
"depth_cutoff",
"=",
"2.5",
",",
"depth_condition",
"=",
"'<'",
",",
"acc_prop",
"=",
"'RSA_ALL-freesasa_het'",
",",
"acc_cutoff",
"=",
"25",
",",
"acc_condition",
"="... | SURFACE 3D = NOTDEEP + ACC | [
"SURFACE",
"3D",
"=",
"NOTDEEP",
"+",
"ACC"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/core/protein.py#L3113-L3150 | train | 29,046 |
SBRG/ssbio | ssbio/core/protein.py | Protein.get_disorder_subseq_3D | def get_disorder_subseq_3D(protein,
pdbflex_keys_file,
disorder_cutoff=2,
disorder_condition='>'):
"""DISORDERED REGION 3D"""
with open(pdbflex_keys_file, 'r') as f:
pdbflex_keys = json.load(f)
... | python | def get_disorder_subseq_3D(protein,
pdbflex_keys_file,
disorder_cutoff=2,
disorder_condition='>'):
"""DISORDERED REGION 3D"""
with open(pdbflex_keys_file, 'r') as f:
pdbflex_keys = json.load(f)
... | [
"def",
"get_disorder_subseq_3D",
"(",
"protein",
",",
"pdbflex_keys_file",
",",
"disorder_cutoff",
"=",
"2",
",",
"disorder_condition",
"=",
"'>'",
")",
":",
"with",
"open",
"(",
"pdbflex_keys_file",
",",
"'r'",
")",
"as",
"f",
":",
"pdbflex_keys",
"=",
"json"... | DISORDERED REGION 3D | [
"DISORDERED",
"REGION",
"3D"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/core/protein.py#L3165-L3193 | train | 29,047 |
SBRG/ssbio | ssbio/protein/structure/homology/itasser/itasserprop.py | parse_init_dat | def parse_init_dat(infile):
"""Parse the main init.dat file which contains the modeling results
The first line of the file init.dat contains stuff like::
"120 easy 40 8"
The other lines look like this::
" 161 11.051 1 1guqA MUSTER"
and getting the first 1... | python | def parse_init_dat(infile):
"""Parse the main init.dat file which contains the modeling results
The first line of the file init.dat contains stuff like::
"120 easy 40 8"
The other lines look like this::
" 161 11.051 1 1guqA MUSTER"
and getting the first 1... | [
"def",
"parse_init_dat",
"(",
"infile",
")",
":",
"# TODO: would be nice to get top 10 templates instead of just the top",
"init_dict",
"=",
"{",
"}",
"log",
".",
"debug",
"(",
"'{}: reading file...'",
".",
"format",
"(",
"infile",
")",
")",
"with",
"open",
"(",
"in... | Parse the main init.dat file which contains the modeling results
The first line of the file init.dat contains stuff like::
"120 easy 40 8"
The other lines look like this::
" 161 11.051 1 1guqA MUSTER"
and getting the first 10 gives you the top 10 templates us... | [
"Parse",
"the",
"main",
"init",
".",
"dat",
"file",
"which",
"contains",
"the",
"modeling",
"results"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/structure/homology/itasser/itasserprop.py#L289-L330 | train | 29,048 |
SBRG/ssbio | ssbio/protein/structure/homology/itasser/itasserprop.py | parse_cscore | def parse_cscore(infile):
"""Parse the cscore file to return a dictionary of scores.
Args:
infile (str): Path to cscore
Returns:
dict: Dictionary of scores
"""
cscore_dict = {}
with open(infile, 'r') as f:
for ll in f.readlines():
# Look for the first lin... | python | def parse_cscore(infile):
"""Parse the cscore file to return a dictionary of scores.
Args:
infile (str): Path to cscore
Returns:
dict: Dictionary of scores
"""
cscore_dict = {}
with open(infile, 'r') as f:
for ll in f.readlines():
# Look for the first lin... | [
"def",
"parse_cscore",
"(",
"infile",
")",
":",
"cscore_dict",
"=",
"{",
"}",
"with",
"open",
"(",
"infile",
",",
"'r'",
")",
"as",
"f",
":",
"for",
"ll",
"in",
"f",
".",
"readlines",
"(",
")",
":",
"# Look for the first line that starts with model1",
"if"... | Parse the cscore file to return a dictionary of scores.
Args:
infile (str): Path to cscore
Returns:
dict: Dictionary of scores | [
"Parse",
"the",
"cscore",
"file",
"to",
"return",
"a",
"dictionary",
"of",
"scores",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/structure/homology/itasser/itasserprop.py#L381-L414 | train | 29,049 |
SBRG/ssbio | ssbio/protein/structure/homology/itasser/itasserprop.py | parse_coach_bsites_inf | def parse_coach_bsites_inf(infile):
"""Parse the Bsites.inf output file of COACH and return a list of rank-ordered binding site predictions
Bsites.inf contains the summary of COACH clustering results after all other prediction algorithms have finished
For each site (cluster), there are three lines:
... | python | def parse_coach_bsites_inf(infile):
"""Parse the Bsites.inf output file of COACH and return a list of rank-ordered binding site predictions
Bsites.inf contains the summary of COACH clustering results after all other prediction algorithms have finished
For each site (cluster), there are three lines:
... | [
"def",
"parse_coach_bsites_inf",
"(",
"infile",
")",
":",
"bsites_results",
"=",
"[",
"]",
"with",
"open",
"(",
"infile",
")",
"as",
"pp",
":",
"lines",
"=",
"list",
"(",
"filter",
"(",
"None",
",",
"(",
"line",
".",
"rstrip",
"(",
")",
"for",
"line"... | Parse the Bsites.inf output file of COACH and return a list of rank-ordered binding site predictions
Bsites.inf contains the summary of COACH clustering results after all other prediction algorithms have finished
For each site (cluster), there are three lines:
- Line 1: site number, c-score of coa... | [
"Parse",
"the",
"Bsites",
".",
"inf",
"output",
"file",
"of",
"COACH",
"and",
"return",
"a",
"list",
"of",
"rank",
"-",
"ordered",
"binding",
"site",
"predictions"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/structure/homology/itasser/itasserprop.py#L417-L487 | train | 29,050 |
SBRG/ssbio | ssbio/protein/structure/homology/itasser/itasserprop.py | parse_coach_ec_df | def parse_coach_ec_df(infile):
"""Parse the EC.dat output file of COACH and return a dataframe of results
EC.dat contains the predicted EC number and active residues.
The columns are: PDB_ID, TM-score, RMSD, Sequence identity,
Coverage, Confidence score, EC number, and Active site residues
Args:
... | python | def parse_coach_ec_df(infile):
"""Parse the EC.dat output file of COACH and return a dataframe of results
EC.dat contains the predicted EC number and active residues.
The columns are: PDB_ID, TM-score, RMSD, Sequence identity,
Coverage, Confidence score, EC number, and Active site residues
Args:
... | [
"def",
"parse_coach_ec_df",
"(",
"infile",
")",
":",
"ec_df",
"=",
"pd",
".",
"read_table",
"(",
"infile",
",",
"delim_whitespace",
"=",
"True",
",",
"names",
"=",
"[",
"'pdb_template'",
",",
"'tm_score'",
",",
"'rmsd'",
",",
"'seq_ident'",
",",
"'seq_covera... | Parse the EC.dat output file of COACH and return a dataframe of results
EC.dat contains the predicted EC number and active residues.
The columns are: PDB_ID, TM-score, RMSD, Sequence identity,
Coverage, Confidence score, EC number, and Active site residues
Args:
infile (str): Path to EC.dat
... | [
"Parse",
"the",
"EC",
".",
"dat",
"output",
"file",
"of",
"COACH",
"and",
"return",
"a",
"dataframe",
"of",
"results"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/structure/homology/itasser/itasserprop.py#L490-L516 | train | 29,051 |
SBRG/ssbio | ssbio/protein/structure/homology/itasser/itasserprop.py | parse_coach_go | def parse_coach_go(infile):
"""Parse a GO output file from COACH and return a rank-ordered list of GO term predictions
The columns in all files are: GO terms, Confidence score, Name of GO terms. The files are:
- GO_MF.dat - GO terms in 'molecular function'
- GO_BP.dat - GO terms in 'bi... | python | def parse_coach_go(infile):
"""Parse a GO output file from COACH and return a rank-ordered list of GO term predictions
The columns in all files are: GO terms, Confidence score, Name of GO terms. The files are:
- GO_MF.dat - GO terms in 'molecular function'
- GO_BP.dat - GO terms in 'bi... | [
"def",
"parse_coach_go",
"(",
"infile",
")",
":",
"go_list",
"=",
"[",
"]",
"with",
"open",
"(",
"infile",
")",
"as",
"go_file",
":",
"for",
"line",
"in",
"go_file",
".",
"readlines",
"(",
")",
":",
"go_dict",
"=",
"{",
"}",
"go_split",
"=",
"line",
... | Parse a GO output file from COACH and return a rank-ordered list of GO term predictions
The columns in all files are: GO terms, Confidence score, Name of GO terms. The files are:
- GO_MF.dat - GO terms in 'molecular function'
- GO_BP.dat - GO terms in 'biological process'
- GO_CC.d... | [
"Parse",
"a",
"GO",
"output",
"file",
"from",
"COACH",
"and",
"return",
"a",
"rank",
"-",
"ordered",
"list",
"of",
"GO",
"term",
"predictions"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/structure/homology/itasser/itasserprop.py#L546-L579 | train | 29,052 |
SBRG/ssbio | ssbio/protein/structure/homology/itasser/itasserprop.py | ITASSERProp.copy_results | def copy_results(self, copy_to_dir, rename_model_to=None, force_rerun=False):
"""Copy the raw information from I-TASSER modeling to a new folder.
Copies all files in the list _attrs_to_copy.
Args:
copy_to_dir (str): Directory to copy the minimal set of results per sequence.
... | python | def copy_results(self, copy_to_dir, rename_model_to=None, force_rerun=False):
"""Copy the raw information from I-TASSER modeling to a new folder.
Copies all files in the list _attrs_to_copy.
Args:
copy_to_dir (str): Directory to copy the minimal set of results per sequence.
... | [
"def",
"copy_results",
"(",
"self",
",",
"copy_to_dir",
",",
"rename_model_to",
"=",
"None",
",",
"force_rerun",
"=",
"False",
")",
":",
"# Save path to the structure and copy it if specified",
"if",
"not",
"rename_model_to",
":",
"rename_model_to",
"=",
"self",
".",
... | Copy the raw information from I-TASSER modeling to a new folder.
Copies all files in the list _attrs_to_copy.
Args:
copy_to_dir (str): Directory to copy the minimal set of results per sequence.
rename_model_to (str): New file name (without extension)
force_rerun (bo... | [
"Copy",
"the",
"raw",
"information",
"from",
"I",
"-",
"TASSER",
"modeling",
"to",
"a",
"new",
"folder",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/structure/homology/itasser/itasserprop.py#L153-L196 | train | 29,053 |
SBRG/ssbio | ssbio/protein/structure/homology/itasser/itasserprop.py | ITASSERProp.get_dict | def get_dict(self, only_attributes=None, exclude_attributes=None, df_format=False):
"""Summarize the I-TASSER run in a dictionary containing modeling results and top predictions from COACH
Args:
only_attributes (str, list): Attributes that should be returned. If not provided, all are return... | python | def get_dict(self, only_attributes=None, exclude_attributes=None, df_format=False):
"""Summarize the I-TASSER run in a dictionary containing modeling results and top predictions from COACH
Args:
only_attributes (str, list): Attributes that should be returned. If not provided, all are return... | [
"def",
"get_dict",
"(",
"self",
",",
"only_attributes",
"=",
"None",
",",
"exclude_attributes",
"=",
"None",
",",
"df_format",
"=",
"False",
")",
":",
"to_exclude",
"=",
"[",
"'coach_bsites'",
",",
"'coach_ec'",
",",
"'coach_go_mf'",
",",
"'coach_go_bp'",
",",... | Summarize the I-TASSER run in a dictionary containing modeling results and top predictions from COACH
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.
... | [
"Summarize",
"the",
"I",
"-",
"TASSER",
"run",
"in",
"a",
"dictionary",
"containing",
"modeling",
"results",
"and",
"top",
"predictions",
"from",
"COACH"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/structure/homology/itasser/itasserprop.py#L240-L286 | train | 29,054 |
SBRG/ssbio | ssbio/pipeline/gempro.py | GEMPRO.load_cobra_model | def load_cobra_model(self, model):
"""Load a COBRApy Model object into the GEM-PRO project.
Args:
model (Model): COBRApy ``Model`` object
"""
self.model = ModelPro(model)
for g in self.model.genes:
if self.genes_dir:
g.root_dir = self.gen... | python | def load_cobra_model(self, model):
"""Load a COBRApy Model object into the GEM-PRO project.
Args:
model (Model): COBRApy ``Model`` object
"""
self.model = ModelPro(model)
for g in self.model.genes:
if self.genes_dir:
g.root_dir = self.gen... | [
"def",
"load_cobra_model",
"(",
"self",
",",
"model",
")",
":",
"self",
".",
"model",
"=",
"ModelPro",
"(",
"model",
")",
"for",
"g",
"in",
"self",
".",
"model",
".",
"genes",
":",
"if",
"self",
".",
"genes_dir",
":",
"g",
".",
"root_dir",
"=",
"se... | Load a COBRApy Model object into the GEM-PRO project.
Args:
model (Model): COBRApy ``Model`` object | [
"Load",
"a",
"COBRApy",
"Model",
"object",
"into",
"the",
"GEM",
"-",
"PRO",
"project",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/pipeline/gempro.py#L239-L260 | train | 29,055 |
SBRG/ssbio | ssbio/pipeline/gempro.py | GEMPRO.add_gene_ids | def add_gene_ids(self, genes_list):
"""Add gene IDs manually into the GEM-PRO project.
Args:
genes_list (list): List of gene IDs as strings.
"""
orig_num_genes = len(self.genes)
for g in list(set(genes_list)):
if not self.genes.has_id(g):
... | python | def add_gene_ids(self, genes_list):
"""Add gene IDs manually into the GEM-PRO project.
Args:
genes_list (list): List of gene IDs as strings.
"""
orig_num_genes = len(self.genes)
for g in list(set(genes_list)):
if not self.genes.has_id(g):
... | [
"def",
"add_gene_ids",
"(",
"self",
",",
"genes_list",
")",
":",
"orig_num_genes",
"=",
"len",
"(",
"self",
".",
"genes",
")",
"for",
"g",
"in",
"list",
"(",
"set",
"(",
"genes_list",
")",
")",
":",
"if",
"not",
"self",
".",
"genes",
".",
"has_id",
... | Add gene IDs manually into the GEM-PRO project.
Args:
genes_list (list): List of gene IDs as strings. | [
"Add",
"gene",
"IDs",
"manually",
"into",
"the",
"GEM",
"-",
"PRO",
"project",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/pipeline/gempro.py#L320-L337 | train | 29,056 |
SBRG/ssbio | ssbio/pipeline/gempro.py | GEMPRO.uniprot_mapping_and_metadata | def uniprot_mapping_and_metadata(self, model_gene_source, custom_gene_mapping=None, outdir=None,
set_as_representative=False, force_rerun=False):
"""Map all genes in the model to UniProt IDs using the UniProt mapping service.
Also download all metadata and sequences.... | python | def uniprot_mapping_and_metadata(self, model_gene_source, custom_gene_mapping=None, outdir=None,
set_as_representative=False, force_rerun=False):
"""Map all genes in the model to UniProt IDs using the UniProt mapping service.
Also download all metadata and sequences.... | [
"def",
"uniprot_mapping_and_metadata",
"(",
"self",
",",
"model_gene_source",
",",
"custom_gene_mapping",
"=",
"None",
",",
"outdir",
"=",
"None",
",",
"set_as_representative",
"=",
"False",
",",
"force_rerun",
"=",
"False",
")",
":",
"# Allow model gene --> custom ID... | Map all genes in the model to UniProt IDs using the UniProt mapping service.
Also download all metadata and sequences.
Args:
model_gene_source (str): the database source of your model gene IDs.
See: http://www.uniprot.org/help/api_idmapping
Common model gene ... | [
"Map",
"all",
"genes",
"in",
"the",
"model",
"to",
"UniProt",
"IDs",
"using",
"the",
"UniProt",
"mapping",
"service",
".",
"Also",
"download",
"all",
"metadata",
"and",
"sequences",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/pipeline/gempro.py#L505-L563 | train | 29,057 |
SBRG/ssbio | ssbio/pipeline/gempro.py | GEMPRO.write_representative_sequences_file | def write_representative_sequences_file(self, outname, outdir=None, set_ids_from_model=True):
"""Write all the model's sequences as a single FASTA file. By default, sets IDs to model gene IDs.
Args:
outname (str): Name of the output FASTA file without the extension
outdir (str):... | python | def write_representative_sequences_file(self, outname, outdir=None, set_ids_from_model=True):
"""Write all the model's sequences as a single FASTA file. By default, sets IDs to model gene IDs.
Args:
outname (str): Name of the output FASTA file without the extension
outdir (str):... | [
"def",
"write_representative_sequences_file",
"(",
"self",
",",
"outname",
",",
"outdir",
"=",
"None",
",",
"set_ids_from_model",
"=",
"True",
")",
":",
"if",
"not",
"outdir",
":",
"outdir",
"=",
"self",
".",
"data_dir",
"if",
"not",
"outdir",
":",
"raise",
... | Write all the model's sequences as a single FASTA file. By default, sets IDs to model gene IDs.
Args:
outname (str): Name of the output FASTA file without the extension
outdir (str): Path to output directory of downloaded files, must be set if GEM-PRO directories
were no... | [
"Write",
"all",
"the",
"model",
"s",
"sequences",
"as",
"a",
"single",
"FASTA",
"file",
".",
"By",
"default",
"sets",
"IDs",
"to",
"model",
"gene",
"IDs",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/pipeline/gempro.py#L720-L750 | train | 29,058 |
SBRG/ssbio | ssbio/pipeline/gempro.py | GEMPRO.get_tmhmm_predictions | def get_tmhmm_predictions(self, tmhmm_results, custom_gene_mapping=None):
"""Parse TMHMM results and store in the representative sequences.
This is a basic function to parse pre-run TMHMM results. Run TMHMM from the
web service (http://www.cbs.dtu.dk/services/TMHMM/) by doing the following:
... | python | def get_tmhmm_predictions(self, tmhmm_results, custom_gene_mapping=None):
"""Parse TMHMM results and store in the representative sequences.
This is a basic function to parse pre-run TMHMM results. Run TMHMM from the
web service (http://www.cbs.dtu.dk/services/TMHMM/) by doing the following:
... | [
"def",
"get_tmhmm_predictions",
"(",
"self",
",",
"tmhmm_results",
",",
"custom_gene_mapping",
"=",
"None",
")",
":",
"# TODO: refactor to Protein class?",
"tmhmm_dict",
"=",
"ssbio",
".",
"protein",
".",
"sequence",
".",
"properties",
".",
"tmhmm",
".",
"parse_tmhm... | Parse TMHMM results and store in the representative sequences.
This is a basic function to parse pre-run TMHMM results. Run TMHMM from the
web service (http://www.cbs.dtu.dk/services/TMHMM/) by doing the following:
1. Write all representative sequences in the GEM-PRO using the function ``w... | [
"Parse",
"TMHMM",
"results",
"and",
"store",
"in",
"the",
"representative",
"sequences",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/pipeline/gempro.py#L846-L888 | train | 29,059 |
SBRG/ssbio | ssbio/pipeline/gempro.py | GEMPRO.map_uniprot_to_pdb | def map_uniprot_to_pdb(self, seq_ident_cutoff=0.0, outdir=None, force_rerun=False):
"""Map all representative sequences' UniProt ID to PDB IDs using the PDBe "Best Structures" API.
Will save a JSON file of the results to each protein's ``sequences`` folder.
The "Best structures" API is availabl... | python | def map_uniprot_to_pdb(self, seq_ident_cutoff=0.0, outdir=None, force_rerun=False):
"""Map all representative sequences' UniProt ID to PDB IDs using the PDBe "Best Structures" API.
Will save a JSON file of the results to each protein's ``sequences`` folder.
The "Best structures" API is availabl... | [
"def",
"map_uniprot_to_pdb",
"(",
"self",
",",
"seq_ident_cutoff",
"=",
"0.0",
",",
"outdir",
"=",
"None",
",",
"force_rerun",
"=",
"False",
")",
":",
"# First get all UniProt IDs and check if they have PDBs",
"all_representative_uniprots",
"=",
"[",
"]",
"for",
"g",
... | Map all representative sequences' UniProt ID to PDB IDs using the PDBe "Best Structures" API.
Will save a JSON file of the results to each protein's ``sequences`` folder.
The "Best structures" API is available at https://www.ebi.ac.uk/pdbe/api/doc/sifts.html
The list of PDB structures mapping t... | [
"Map",
"all",
"representative",
"sequences",
"UniProt",
"ID",
"to",
"PDB",
"IDs",
"using",
"the",
"PDBe",
"Best",
"Structures",
"API",
".",
"Will",
"save",
"a",
"JSON",
"file",
"of",
"the",
"results",
"to",
"each",
"protein",
"s",
"sequences",
"folder",
".... | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/pipeline/gempro.py#L952-L999 | train | 29,060 |
SBRG/ssbio | ssbio/pipeline/gempro.py | GEMPRO.get_manual_homology_models | def get_manual_homology_models(self, input_dict, outdir=None, clean=True, force_rerun=False):
"""Copy homology models to the GEM-PRO project.
Requires an input of a dictionary formatted like so::
{
model_gene: {
homology_model_id1: {
... | python | def get_manual_homology_models(self, input_dict, outdir=None, clean=True, force_rerun=False):
"""Copy homology models to the GEM-PRO project.
Requires an input of a dictionary formatted like so::
{
model_gene: {
homology_model_id1: {
... | [
"def",
"get_manual_homology_models",
"(",
"self",
",",
"input_dict",
",",
"outdir",
"=",
"None",
",",
"clean",
"=",
"True",
",",
"force_rerun",
"=",
"False",
")",
":",
"if",
"outdir",
":",
"outdir_set",
"=",
"True",
"else",
":",
"outdir_set",
"=",
"False",... | Copy homology models to the GEM-PRO project.
Requires an input of a dictionary formatted like so::
{
model_gene: {
homology_model_id1: {
'model_file': '/path/to/homology/model.pdb',
... | [
"Copy",
"homology",
"models",
"to",
"the",
"GEM",
"-",
"PRO",
"project",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/pipeline/gempro.py#L1021-L1090 | train | 29,061 |
SBRG/ssbio | ssbio/pipeline/gempro.py | GEMPRO.get_itasser_models | def get_itasser_models(self, homology_raw_dir, custom_itasser_name_mapping=None, outdir=None, force_rerun=False):
"""Copy generated I-TASSER models from a directory to the GEM-PRO directory.
Args:
homology_raw_dir (str): Root directory of I-TASSER folders.
custom_itasser_name_ma... | python | def get_itasser_models(self, homology_raw_dir, custom_itasser_name_mapping=None, outdir=None, force_rerun=False):
"""Copy generated I-TASSER models from a directory to the GEM-PRO directory.
Args:
homology_raw_dir (str): Root directory of I-TASSER folders.
custom_itasser_name_ma... | [
"def",
"get_itasser_models",
"(",
"self",
",",
"homology_raw_dir",
",",
"custom_itasser_name_mapping",
"=",
"None",
",",
"outdir",
"=",
"None",
",",
"force_rerun",
"=",
"False",
")",
":",
"counter",
"=",
"0",
"for",
"g",
"in",
"tqdm",
"(",
"self",
".",
"ge... | Copy generated I-TASSER models from a directory to the GEM-PRO directory.
Args:
homology_raw_dir (str): Root directory of I-TASSER folders.
custom_itasser_name_mapping (dict): Use this if your I-TASSER folder names differ from your model gene names.
Input a dict of {mode... | [
"Copy",
"generated",
"I",
"-",
"TASSER",
"models",
"from",
"a",
"directory",
"to",
"the",
"GEM",
"-",
"PRO",
"directory",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/pipeline/gempro.py#L1092-L1135 | train | 29,062 |
SBRG/ssbio | ssbio/pipeline/gempro.py | GEMPRO.set_representative_structure | def set_representative_structure(self, seq_outdir=None, struct_outdir=None, pdb_file_type=None,
engine='needle', always_use_homology=False, rez_cutoff=0.0,
seq_ident_cutoff=0.5, allow_missing_on_termini=0.2,
a... | python | def set_representative_structure(self, seq_outdir=None, struct_outdir=None, pdb_file_type=None,
engine='needle', always_use_homology=False, rez_cutoff=0.0,
seq_ident_cutoff=0.5, allow_missing_on_termini=0.2,
a... | [
"def",
"set_representative_structure",
"(",
"self",
",",
"seq_outdir",
"=",
"None",
",",
"struct_outdir",
"=",
"None",
",",
"pdb_file_type",
"=",
"None",
",",
"engine",
"=",
"'needle'",
",",
"always_use_homology",
"=",
"False",
",",
"rez_cutoff",
"=",
"0.0",
"... | Set all representative structure for proteins from a structure in the structures attribute.
Each gene can have a combination of the following, which will be analyzed to set a representative structure.
* Homology model(s)
* Ranked PDBs
* BLASTed PDBs
If the ``always... | [
"Set",
"all",
"representative",
"structure",
"for",
"proteins",
"from",
"a",
"structure",
"in",
"the",
"structures",
"attribute",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/pipeline/gempro.py#L1157-L1223 | train | 29,063 |
SBRG/ssbio | ssbio/pipeline/gempro.py | GEMPRO.prep_itasser_modeling | def prep_itasser_modeling(self, itasser_installation, itlib_folder, runtype, create_in_dir=None,
execute_from_dir=None, all_genes=False, print_exec=False, **kwargs):
"""Prepare to run I-TASSER homology modeling for genes without structures, or all genes.
Args:
it... | python | def prep_itasser_modeling(self, itasser_installation, itlib_folder, runtype, create_in_dir=None,
execute_from_dir=None, all_genes=False, print_exec=False, **kwargs):
"""Prepare to run I-TASSER homology modeling for genes without structures, or all genes.
Args:
it... | [
"def",
"prep_itasser_modeling",
"(",
"self",
",",
"itasser_installation",
",",
"itlib_folder",
",",
"runtype",
",",
"create_in_dir",
"=",
"None",
",",
"execute_from_dir",
"=",
"None",
",",
"all_genes",
"=",
"False",
",",
"print_exec",
"=",
"False",
",",
"*",
"... | Prepare to run I-TASSER homology modeling for genes without structures, or all genes.
Args:
itasser_installation (str): Path to I-TASSER folder, i.e. ``~/software/I-TASSER4.4``
itlib_folder (str): Path to ITLIB folder, i.e. ``~/software/ITLIB``
runtype: How you will be runni... | [
"Prepare",
"to",
"run",
"I",
"-",
"TASSER",
"homology",
"modeling",
"for",
"genes",
"without",
"structures",
"or",
"all",
"genes",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/pipeline/gempro.py#L1287-L1334 | train | 29,064 |
SBRG/ssbio | ssbio/pipeline/gempro.py | GEMPRO.pdb_downloader_and_metadata | def pdb_downloader_and_metadata(self, outdir=None, pdb_file_type=None, force_rerun=False):
"""Download ALL mapped experimental structures to each protein's structures directory.
Args:
outdir (str): Path to output directory, if GEM-PRO directories were not set or other output directory is
... | python | def pdb_downloader_and_metadata(self, outdir=None, pdb_file_type=None, force_rerun=False):
"""Download ALL mapped experimental structures to each protein's structures directory.
Args:
outdir (str): Path to output directory, if GEM-PRO directories were not set or other output directory is
... | [
"def",
"pdb_downloader_and_metadata",
"(",
"self",
",",
"outdir",
"=",
"None",
",",
"pdb_file_type",
"=",
"None",
",",
"force_rerun",
"=",
"False",
")",
":",
"if",
"not",
"pdb_file_type",
":",
"pdb_file_type",
"=",
"self",
".",
"pdb_file_type",
"counter",
"=",... | Download ALL mapped experimental structures to each protein's structures directory.
Args:
outdir (str): Path to output directory, if GEM-PRO directories were not set or other output directory is
desired
pdb_file_type (str): Type of PDB file to download, if not already se... | [
"Download",
"ALL",
"mapped",
"experimental",
"structures",
"to",
"each",
"protein",
"s",
"structures",
"directory",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/pipeline/gempro.py#L1336-L1358 | train | 29,065 |
SBRG/ssbio | ssbio/databases/swissmodel.py | get_oligomeric_state | def get_oligomeric_state(swiss_model_path):
"""Parse the oligomeric prediction in a SWISS-MODEL repository file
As of 2018-02-26, works on all E. coli models. Untested on other pre-made organism models.
Args:
swiss_model_path (str): Path to SWISS-MODEL PDB file
Returns:
dict: Informat... | python | def get_oligomeric_state(swiss_model_path):
"""Parse the oligomeric prediction in a SWISS-MODEL repository file
As of 2018-02-26, works on all E. coli models. Untested on other pre-made organism models.
Args:
swiss_model_path (str): Path to SWISS-MODEL PDB file
Returns:
dict: Informat... | [
"def",
"get_oligomeric_state",
"(",
"swiss_model_path",
")",
":",
"oligo_info",
"=",
"{",
"}",
"with",
"open",
"(",
"swiss_model_path",
",",
"'r'",
")",
"as",
"f",
":",
"for",
"line",
"in",
"f",
":",
"if",
"line",
".",
"startswith",
"(",
"'REMARK 3 MODEL... | Parse the oligomeric prediction in a SWISS-MODEL repository file
As of 2018-02-26, works on all E. coli models. Untested on other pre-made organism models.
Args:
swiss_model_path (str): Path to SWISS-MODEL PDB file
Returns:
dict: Information parsed about the oligomeric state | [
"Parse",
"the",
"oligomeric",
"prediction",
"in",
"a",
"SWISS",
"-",
"MODEL",
"repository",
"file"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/databases/swissmodel.py#L168-L201 | train | 29,066 |
SBRG/ssbio | ssbio/databases/swissmodel.py | translate_ostat | def translate_ostat(ostat):
"""Translate the OSTAT field to an integer.
As of 2018-02-26, works on all E. coli models. Untested on other pre-made organism models.
Args:
ostat (str): Predicted oligomeric state of the PDB file
Returns:
int: Translated string to integer
"""
osta... | python | def translate_ostat(ostat):
"""Translate the OSTAT field to an integer.
As of 2018-02-26, works on all E. coli models. Untested on other pre-made organism models.
Args:
ostat (str): Predicted oligomeric state of the PDB file
Returns:
int: Translated string to integer
"""
osta... | [
"def",
"translate_ostat",
"(",
"ostat",
")",
":",
"ostat_lower",
"=",
"ostat",
".",
"strip",
"(",
")",
".",
"lower",
"(",
")",
"if",
"ostat_lower",
"==",
"'monomer'",
":",
"return",
"1",
"elif",
"ostat_lower",
"==",
"'homo-dimer'",
":",
"return",
"2",
"e... | Translate the OSTAT field to an integer.
As of 2018-02-26, works on all E. coli models. Untested on other pre-made organism models.
Args:
ostat (str): Predicted oligomeric state of the PDB file
Returns:
int: Translated string to integer | [
"Translate",
"the",
"OSTAT",
"field",
"to",
"an",
"integer",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/databases/swissmodel.py#L204-L235 | train | 29,067 |
SBRG/ssbio | ssbio/databases/swissmodel.py | SWISSMODEL.parse_metadata | def parse_metadata(self):
"""Parse the INDEX_JSON file and reorganize it as a dictionary of lists."""
all_models = defaultdict(list)
with open(self.metadata_index_json) as f:
loaded = json.load(f)
for m in loaded['index']:
all_models[m['uniprot_ac']].append(m)
... | python | def parse_metadata(self):
"""Parse the INDEX_JSON file and reorganize it as a dictionary of lists."""
all_models = defaultdict(list)
with open(self.metadata_index_json) as f:
loaded = json.load(f)
for m in loaded['index']:
all_models[m['uniprot_ac']].append(m)
... | [
"def",
"parse_metadata",
"(",
"self",
")",
":",
"all_models",
"=",
"defaultdict",
"(",
"list",
")",
"with",
"open",
"(",
"self",
".",
"metadata_index_json",
")",
"as",
"f",
":",
"loaded",
"=",
"json",
".",
"load",
"(",
"f",
")",
"for",
"m",
"in",
"lo... | Parse the INDEX_JSON file and reorganize it as a dictionary of lists. | [
"Parse",
"the",
"INDEX_JSON",
"file",
"and",
"reorganize",
"it",
"as",
"a",
"dictionary",
"of",
"lists",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/databases/swissmodel.py#L50-L61 | train | 29,068 |
SBRG/ssbio | ssbio/databases/swissmodel.py | SWISSMODEL.get_models | def get_models(self, uniprot_acc):
"""Return all available models for a UniProt accession number.
Args:
uniprot_acc (str): UniProt ACC/ID
Returns:
dict: All available models in SWISS-MODEL for this UniProt entry
"""
if uniprot_acc in self.all_models:
... | python | def get_models(self, uniprot_acc):
"""Return all available models for a UniProt accession number.
Args:
uniprot_acc (str): UniProt ACC/ID
Returns:
dict: All available models in SWISS-MODEL for this UniProt entry
"""
if uniprot_acc in self.all_models:
... | [
"def",
"get_models",
"(",
"self",
",",
"uniprot_acc",
")",
":",
"if",
"uniprot_acc",
"in",
"self",
".",
"all_models",
":",
"return",
"self",
".",
"all_models",
"[",
"uniprot_acc",
"]",
"else",
":",
"log",
".",
"error",
"(",
"'{}: no SWISS-MODELs available'",
... | Return all available models for a UniProt accession number.
Args:
uniprot_acc (str): UniProt ACC/ID
Returns:
dict: All available models in SWISS-MODEL for this UniProt entry | [
"Return",
"all",
"available",
"models",
"for",
"a",
"UniProt",
"accession",
"number",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/databases/swissmodel.py#L63-L77 | train | 29,069 |
SBRG/ssbio | ssbio/databases/swissmodel.py | SWISSMODEL.get_model_filepath | def get_model_filepath(self, infodict):
"""Get the path to the homology model using information from the index dictionary for a single model.
Example: use self.get_models(UNIPROT_ID) to get all the models, which returns a list of dictionaries.
Use one of those dictionaries as input to this ... | python | def get_model_filepath(self, infodict):
"""Get the path to the homology model using information from the index dictionary for a single model.
Example: use self.get_models(UNIPROT_ID) to get all the models, which returns a list of dictionaries.
Use one of those dictionaries as input to this ... | [
"def",
"get_model_filepath",
"(",
"self",
",",
"infodict",
")",
":",
"u",
"=",
"infodict",
"[",
"'uniprot_ac'",
"]",
"original_filename",
"=",
"'{}_{}_{}_{}'",
".",
"format",
"(",
"infodict",
"[",
"'from'",
"]",
",",
"infodict",
"[",
"'to'",
"]",
",",
"inf... | Get the path to the homology model using information from the index dictionary for a single model.
Example: use self.get_models(UNIPROT_ID) to get all the models, which returns a list of dictionaries.
Use one of those dictionaries as input to this function to get the filepath to the model itself.
... | [
"Get",
"the",
"path",
"to",
"the",
"homology",
"model",
"using",
"information",
"from",
"the",
"index",
"dictionary",
"for",
"a",
"single",
"model",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/databases/swissmodel.py#L79-L103 | train | 29,070 |
SBRG/ssbio | ssbio/databases/swissmodel.py | SWISSMODEL.download_models | def download_models(self, uniprot_acc, outdir='', force_rerun=False):
"""Download all models available for a UniProt accession number.
Args:
uniprot_acc (str): UniProt ACC/ID
outdir (str): Path to output directory, uses working directory if not set
force_rerun (bool)... | python | def download_models(self, uniprot_acc, outdir='', force_rerun=False):
"""Download all models available for a UniProt accession number.
Args:
uniprot_acc (str): UniProt ACC/ID
outdir (str): Path to output directory, uses working directory if not set
force_rerun (bool)... | [
"def",
"download_models",
"(",
"self",
",",
"uniprot_acc",
",",
"outdir",
"=",
"''",
",",
"force_rerun",
"=",
"False",
")",
":",
"downloaded",
"=",
"[",
"]",
"subset",
"=",
"self",
".",
"get_models",
"(",
"uniprot_acc",
")",
"for",
"entry",
"in",
"subset... | Download all models available for a UniProt accession number.
Args:
uniprot_acc (str): UniProt ACC/ID
outdir (str): Path to output directory, uses working directory if not set
force_rerun (bool): Force a redownload the models if they already exist
Returns:
... | [
"Download",
"all",
"models",
"available",
"for",
"a",
"UniProt",
"accession",
"number",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/databases/swissmodel.py#L105-L139 | train | 29,071 |
SBRG/ssbio | ssbio/databases/swissmodel.py | SWISSMODEL.organize_models | def organize_models(self, outdir, force_rerun=False):
"""Organize and rename SWISS-MODEL models to a single folder with a name containing template information.
Args:
outdir (str): New directory to copy renamed models to
force_rerun (bool): If models should be copied again even i... | python | def organize_models(self, outdir, force_rerun=False):
"""Organize and rename SWISS-MODEL models to a single folder with a name containing template information.
Args:
outdir (str): New directory to copy renamed models to
force_rerun (bool): If models should be copied again even i... | [
"def",
"organize_models",
"(",
"self",
",",
"outdir",
",",
"force_rerun",
"=",
"False",
")",
":",
"uniprot_to_swissmodel",
"=",
"defaultdict",
"(",
"list",
")",
"for",
"u",
",",
"models",
"in",
"self",
".",
"all_models",
".",
"items",
"(",
")",
":",
"for... | Organize and rename SWISS-MODEL models to a single folder with a name containing template information.
Args:
outdir (str): New directory to copy renamed models to
force_rerun (bool): If models should be copied again even if they already exist
Returns:
dict: Dictiona... | [
"Organize",
"and",
"rename",
"SWISS",
"-",
"MODEL",
"models",
"to",
"a",
"single",
"folder",
"with",
"a",
"name",
"containing",
"template",
"information",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/databases/swissmodel.py#L141-L166 | train | 29,072 |
SBRG/ssbio | ssbio/protein/sequence/properties/thermostability.py | get_dG_at_T | def get_dG_at_T(seq, temp):
"""Predict dG at temperature T, using best predictions from Dill or Oobatake methods.
Args:
seq (str, Seq, SeqRecord): Amino acid sequence
temp (float): Temperature in degrees C
Returns:
(tuple): tuple containing:
dG (float) Free energy of u... | python | def get_dG_at_T(seq, temp):
"""Predict dG at temperature T, using best predictions from Dill or Oobatake methods.
Args:
seq (str, Seq, SeqRecord): Amino acid sequence
temp (float): Temperature in degrees C
Returns:
(tuple): tuple containing:
dG (float) Free energy of u... | [
"def",
"get_dG_at_T",
"(",
"seq",
",",
"temp",
")",
":",
"# R (molar gas constant) in calories",
"r_cal",
"=",
"scipy",
".",
"constants",
".",
"R",
"/",
"scipy",
".",
"constants",
".",
"calorie",
"seq",
"=",
"ssbio",
".",
"protein",
".",
"sequence",
".",
"... | Predict dG at temperature T, using best predictions from Dill or Oobatake methods.
Args:
seq (str, Seq, SeqRecord): Amino acid sequence
temp (float): Temperature in degrees C
Returns:
(tuple): tuple containing:
dG (float) Free energy of unfolding dG (cal/mol)
k... | [
"Predict",
"dG",
"at",
"temperature",
"T",
"using",
"best",
"predictions",
"from",
"Dill",
"or",
"Oobatake",
"methods",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/properties/thermostability.py#L156-L193 | train | 29,073 |
SBRG/ssbio | ssbio/protein/structure/properties/opm.py | run_ppm_server | def run_ppm_server(pdb_file, outfile, force_rerun=False):
"""Run the PPM server from OPM to predict transmembrane residues.
Args:
pdb_file (str): Path to PDB file
outfile (str): Path to output HTML results file
force_rerun (bool): Flag to rerun PPM if HTML results file already exists
... | python | def run_ppm_server(pdb_file, outfile, force_rerun=False):
"""Run the PPM server from OPM to predict transmembrane residues.
Args:
pdb_file (str): Path to PDB file
outfile (str): Path to output HTML results file
force_rerun (bool): Flag to rerun PPM if HTML results file already exists
... | [
"def",
"run_ppm_server",
"(",
"pdb_file",
",",
"outfile",
",",
"force_rerun",
"=",
"False",
")",
":",
"if",
"ssbio",
".",
"utils",
".",
"force_rerun",
"(",
"outfile",
"=",
"outfile",
",",
"flag",
"=",
"force_rerun",
")",
":",
"url",
"=",
"'http://sunshine.... | Run the PPM server from OPM to predict transmembrane residues.
Args:
pdb_file (str): Path to PDB file
outfile (str): Path to output HTML results file
force_rerun (bool): Flag to rerun PPM if HTML results file already exists
Returns:
dict: Dictionary of information from the PPM ... | [
"Run",
"the",
"PPM",
"server",
"from",
"OPM",
"to",
"predict",
"transmembrane",
"residues",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/structure/properties/opm.py#L44-L116 | train | 29,074 |
SBRG/ssbio | ssbio/protein/sequence/properties/cctop.py | cctop_submit | def cctop_submit(seq_str):
"""Submit a protein sequence string to CCTOP and return the job ID.
Args:
seq_str (str): Protein sequence as a string
Returns:
dict: Job ID on the CCTOP server
"""
url = 'http://cctop.enzim.ttk.mta.hu/php/submit.php?sequence={}&tmFilter&signalPred'.forma... | python | def cctop_submit(seq_str):
"""Submit a protein sequence string to CCTOP and return the job ID.
Args:
seq_str (str): Protein sequence as a string
Returns:
dict: Job ID on the CCTOP server
"""
url = 'http://cctop.enzim.ttk.mta.hu/php/submit.php?sequence={}&tmFilter&signalPred'.forma... | [
"def",
"cctop_submit",
"(",
"seq_str",
")",
":",
"url",
"=",
"'http://cctop.enzim.ttk.mta.hu/php/submit.php?sequence={}&tmFilter&signalPred'",
".",
"format",
"(",
"seq_str",
")",
"r",
"=",
"requests",
".",
"post",
"(",
"url",
")",
"jobid",
"=",
"r",
".",
"text",
... | Submit a protein sequence string to CCTOP and return the job ID.
Args:
seq_str (str): Protein sequence as a string
Returns:
dict: Job ID on the CCTOP server | [
"Submit",
"a",
"protein",
"sequence",
"string",
"to",
"CCTOP",
"and",
"return",
"the",
"job",
"ID",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/properties/cctop.py#L6-L20 | train | 29,075 |
SBRG/ssbio | ssbio/protein/sequence/properties/cctop.py | cctop_check_status | def cctop_check_status(jobid):
"""Check the status of a CCTOP job ID.
Args:
jobid (str): Job ID obtained when job was submitted
Returns:
str: 'Finished' if the job is finished and results ready to be downloaded, 'Running' if still in progress,
'Invalid' for any errors.
"""
... | python | def cctop_check_status(jobid):
"""Check the status of a CCTOP job ID.
Args:
jobid (str): Job ID obtained when job was submitted
Returns:
str: 'Finished' if the job is finished and results ready to be downloaded, 'Running' if still in progress,
'Invalid' for any errors.
"""
... | [
"def",
"cctop_check_status",
"(",
"jobid",
")",
":",
"status",
"=",
"'http://cctop.enzim.ttk.mta.hu/php/poll.php?jobId={}'",
".",
"format",
"(",
"jobid",
")",
"status_text",
"=",
"requests",
".",
"post",
"(",
"status",
")",
"return",
"status_text",
".",
"text"
] | Check the status of a CCTOP job ID.
Args:
jobid (str): Job ID obtained when job was submitted
Returns:
str: 'Finished' if the job is finished and results ready to be downloaded, 'Running' if still in progress,
'Invalid' for any errors. | [
"Check",
"the",
"status",
"of",
"a",
"CCTOP",
"job",
"ID",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/properties/cctop.py#L23-L36 | train | 29,076 |
SBRG/ssbio | ssbio/protein/sequence/properties/cctop.py | cctop_save_xml | def cctop_save_xml(jobid, outpath):
"""Save the CCTOP results file in XML format.
Args:
jobid (str): Job ID obtained when job was submitted
outpath (str): Path to output filename
Returns:
str: Path to output filename
"""
status = cctop_check_status(jobid=jobid)
if stat... | python | def cctop_save_xml(jobid, outpath):
"""Save the CCTOP results file in XML format.
Args:
jobid (str): Job ID obtained when job was submitted
outpath (str): Path to output filename
Returns:
str: Path to output filename
"""
status = cctop_check_status(jobid=jobid)
if stat... | [
"def",
"cctop_save_xml",
"(",
"jobid",
",",
"outpath",
")",
":",
"status",
"=",
"cctop_check_status",
"(",
"jobid",
"=",
"jobid",
")",
"if",
"status",
"==",
"'Finished'",
":",
"result",
"=",
"'http://cctop.enzim.ttk.mta.hu/php/result.php?jobId={}'",
".",
"format",
... | Save the CCTOP results file in XML format.
Args:
jobid (str): Job ID obtained when job was submitted
outpath (str): Path to output filename
Returns:
str: Path to output filename | [
"Save",
"the",
"CCTOP",
"results",
"file",
"in",
"XML",
"format",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/sequence/properties/cctop.py#L39-L58 | train | 29,077 |
SBRG/ssbio | ssbio/pipeline/atlas3.py | load_feather | def load_feather(protein_feather, length_filter_pid=None, copynum_scale=False, copynum_df=None):
"""Load a feather of amino acid counts for a protein.
Args:
protein_feather (str): path to feather file
copynum_scale (bool): if counts should be multiplied by protein copy number
copynum_df... | python | def load_feather(protein_feather, length_filter_pid=None, copynum_scale=False, copynum_df=None):
"""Load a feather of amino acid counts for a protein.
Args:
protein_feather (str): path to feather file
copynum_scale (bool): if counts should be multiplied by protein copy number
copynum_df... | [
"def",
"load_feather",
"(",
"protein_feather",
",",
"length_filter_pid",
"=",
"None",
",",
"copynum_scale",
"=",
"False",
",",
"copynum_df",
"=",
"None",
")",
":",
"protein_df",
"=",
"pd",
".",
"read_feather",
"(",
"protein_feather",
")",
".",
"set_index",
"("... | Load a feather of amino acid counts for a protein.
Args:
protein_feather (str): path to feather file
copynum_scale (bool): if counts should be multiplied by protein copy number
copynum_df (DataFrame): DataFrame of copy numbers
Returns:
DataFrame: of counts with some aggregated ... | [
"Load",
"a",
"feather",
"of",
"amino",
"acid",
"counts",
"for",
"a",
"protein",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/pipeline/atlas3.py#L128-L195 | train | 29,078 |
SBRG/ssbio | ssbio/pipeline/atlas3.py | get_proteome_counts_impute_missing | def get_proteome_counts_impute_missing(prots_filtered_feathers, outpath, length_filter_pid=None,
copynum_scale=False, copynum_df=None,
force_rerun=False):
"""Get counts, uses the mean feature vector to fill in missing proteins for a strai... | python | def get_proteome_counts_impute_missing(prots_filtered_feathers, outpath, length_filter_pid=None,
copynum_scale=False, copynum_df=None,
force_rerun=False):
"""Get counts, uses the mean feature vector to fill in missing proteins for a strai... | [
"def",
"get_proteome_counts_impute_missing",
"(",
"prots_filtered_feathers",
",",
"outpath",
",",
"length_filter_pid",
"=",
"None",
",",
"copynum_scale",
"=",
"False",
",",
"copynum_df",
"=",
"None",
",",
"force_rerun",
"=",
"False",
")",
":",
"if",
"ssbio",
".",
... | Get counts, uses the mean feature vector to fill in missing proteins for a strain | [
"Get",
"counts",
"uses",
"the",
"mean",
"feature",
"vector",
"to",
"fill",
"in",
"missing",
"proteins",
"for",
"a",
"strain"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/pipeline/atlas3.py#L235-L266 | train | 29,079 |
SBRG/ssbio | ssbio/pipeline/atlas3.py | get_proteome_correct_percentages | def get_proteome_correct_percentages(prots_filtered_feathers, outpath, length_filter_pid=None,
copynum_scale=False, copynum_df=None,
force_rerun=False):
"""Get counts and normalize by number of proteins, providing percentages"""
if ssbio.... | python | def get_proteome_correct_percentages(prots_filtered_feathers, outpath, length_filter_pid=None,
copynum_scale=False, copynum_df=None,
force_rerun=False):
"""Get counts and normalize by number of proteins, providing percentages"""
if ssbio.... | [
"def",
"get_proteome_correct_percentages",
"(",
"prots_filtered_feathers",
",",
"outpath",
",",
"length_filter_pid",
"=",
"None",
",",
"copynum_scale",
"=",
"False",
",",
"copynum_df",
"=",
"None",
",",
"force_rerun",
"=",
"False",
")",
":",
"if",
"ssbio",
".",
... | Get counts and normalize by number of proteins, providing percentages | [
"Get",
"counts",
"and",
"normalize",
"by",
"number",
"of",
"proteins",
"providing",
"percentages"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/pipeline/atlas3.py#L288-L324 | train | 29,080 |
SBRG/ssbio | ssbio/pipeline/atlas3.py | run_all2 | def run_all2(protgroup, memornot, subsequences, base_outdir,
protgroup_dict, protein_feathers_dir, date, errfile, impute_counts=True,
cutoff_num_proteins=0, core_only_genes=None,
length_filter_pid=.8, remove_correlated_feats=True,
force_rerun_counts=False, force_rerun_per... | python | def run_all2(protgroup, memornot, subsequences, base_outdir,
protgroup_dict, protein_feathers_dir, date, errfile, impute_counts=True,
cutoff_num_proteins=0, core_only_genes=None,
length_filter_pid=.8, remove_correlated_feats=True,
force_rerun_counts=False, force_rerun_per... | [
"def",
"run_all2",
"(",
"protgroup",
",",
"memornot",
",",
"subsequences",
",",
"base_outdir",
",",
"protgroup_dict",
",",
"protein_feathers_dir",
",",
"date",
",",
"errfile",
",",
"impute_counts",
"=",
"True",
",",
"cutoff_num_proteins",
"=",
"0",
",",
"core_on... | run_all but ignoring observations before pca | [
"run_all",
"but",
"ignoring",
"observations",
"before",
"pca"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/pipeline/atlas3.py#L1000-L1093 | train | 29,081 |
SBRG/ssbio | ssbio/pipeline/atlas3.py | PCAMultiROS.make_contribplot | def make_contribplot(self, pc_to_look_at=1, sigadder=0.01, outpath=None, dpi=150, return_top_contribs=False):
"""Make a plot showing contributions of properties to a PC"""
cont = pd.DataFrame(self.pca.components_, columns=self.features_df.index, index=self.pc_names_list)
tmp_df = pd.DataFrame(co... | python | def make_contribplot(self, pc_to_look_at=1, sigadder=0.01, outpath=None, dpi=150, return_top_contribs=False):
"""Make a plot showing contributions of properties to a PC"""
cont = pd.DataFrame(self.pca.components_, columns=self.features_df.index, index=self.pc_names_list)
tmp_df = pd.DataFrame(co... | [
"def",
"make_contribplot",
"(",
"self",
",",
"pc_to_look_at",
"=",
"1",
",",
"sigadder",
"=",
"0.01",
",",
"outpath",
"=",
"None",
",",
"dpi",
"=",
"150",
",",
"return_top_contribs",
"=",
"False",
")",
":",
"cont",
"=",
"pd",
".",
"DataFrame",
"(",
"se... | Make a plot showing contributions of properties to a PC | [
"Make",
"a",
"plot",
"showing",
"contributions",
"of",
"properties",
"to",
"a",
"PC"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/pipeline/atlas3.py#L605-L632 | train | 29,082 |
SBRG/ssbio | ssbio/pipeline/atlas3.py | PCAMultiROS._change_height | def _change_height(self, ax, new_value):
"""Make bars in horizontal bar chart thinner"""
for patch in ax.patches:
current_height = patch.get_height()
diff = current_height - new_value
# we change the bar height
patch.set_height(new_value)
# w... | python | def _change_height(self, ax, new_value):
"""Make bars in horizontal bar chart thinner"""
for patch in ax.patches:
current_height = patch.get_height()
diff = current_height - new_value
# we change the bar height
patch.set_height(new_value)
# w... | [
"def",
"_change_height",
"(",
"self",
",",
"ax",
",",
"new_value",
")",
":",
"for",
"patch",
"in",
"ax",
".",
"patches",
":",
"current_height",
"=",
"patch",
".",
"get_height",
"(",
")",
"diff",
"=",
"current_height",
"-",
"new_value",
"# we change the bar h... | Make bars in horizontal bar chart thinner | [
"Make",
"bars",
"in",
"horizontal",
"bar",
"chart",
"thinner"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/pipeline/atlas3.py#L634-L644 | train | 29,083 |
SBRG/ssbio | ssbio/complex/oligomer.py | write_merged_bioassembly | def write_merged_bioassembly(inpath, outdir, outname, force_rerun=False):
"""Utility to take as input a bioassembly file and merge all its models into multiple chains in a single model.
Args:
infile (str): Path to input PDB file with multiple models that represent an oligomeric form of a structure.
... | python | def write_merged_bioassembly(inpath, outdir, outname, force_rerun=False):
"""Utility to take as input a bioassembly file and merge all its models into multiple chains in a single model.
Args:
infile (str): Path to input PDB file with multiple models that represent an oligomeric form of a structure.
... | [
"def",
"write_merged_bioassembly",
"(",
"inpath",
",",
"outdir",
",",
"outname",
",",
"force_rerun",
"=",
"False",
")",
":",
"outpath",
"=",
"outfile",
"=",
"op",
".",
"join",
"(",
"outdir",
",",
"outname",
"+",
"'.pdb'",
")",
"if",
"ssbio",
".",
"utils"... | Utility to take as input a bioassembly file and merge all its models into multiple chains in a single model.
Args:
infile (str): Path to input PDB file with multiple models that represent an oligomeric form of a structure.
outdir (str): Path to output directory
outname (str): New filename o... | [
"Utility",
"to",
"take",
"as",
"input",
"a",
"bioassembly",
"file",
"and",
"merge",
"all",
"its",
"models",
"into",
"multiple",
"chains",
"in",
"a",
"single",
"model",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/complex/oligomer.py#L96-L117 | train | 29,084 |
SBRG/ssbio | ssbio/io/__init__.py | save_json | def save_json(obj, outfile, allow_nan=True, compression=False):
"""Save an ssbio object as a JSON file using json_tricks"""
if compression:
with open(outfile, 'wb') as f:
dump(obj, f, allow_nan=allow_nan, compression=compression)
else:
with open(outfile, 'w') as f:
du... | python | def save_json(obj, outfile, allow_nan=True, compression=False):
"""Save an ssbio object as a JSON file using json_tricks"""
if compression:
with open(outfile, 'wb') as f:
dump(obj, f, allow_nan=allow_nan, compression=compression)
else:
with open(outfile, 'w') as f:
du... | [
"def",
"save_json",
"(",
"obj",
",",
"outfile",
",",
"allow_nan",
"=",
"True",
",",
"compression",
"=",
"False",
")",
":",
"if",
"compression",
":",
"with",
"open",
"(",
"outfile",
",",
"'wb'",
")",
"as",
"f",
":",
"dump",
"(",
"obj",
",",
"f",
","... | Save an ssbio object as a JSON file using json_tricks | [
"Save",
"an",
"ssbio",
"object",
"as",
"a",
"JSON",
"file",
"using",
"json_tricks"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/io/__init__.py#L9-L17 | train | 29,085 |
SBRG/ssbio | ssbio/io/__init__.py | load_json | def load_json(file, new_root_dir=None, decompression=False):
"""Load a JSON file using json_tricks"""
if decompression:
with open(file, 'rb') as f:
my_object = load(f, decompression=decompression)
else:
with open(file, 'r') as f:
my_object = load(f, decompression=deco... | python | def load_json(file, new_root_dir=None, decompression=False):
"""Load a JSON file using json_tricks"""
if decompression:
with open(file, 'rb') as f:
my_object = load(f, decompression=decompression)
else:
with open(file, 'r') as f:
my_object = load(f, decompression=deco... | [
"def",
"load_json",
"(",
"file",
",",
"new_root_dir",
"=",
"None",
",",
"decompression",
"=",
"False",
")",
":",
"if",
"decompression",
":",
"with",
"open",
"(",
"file",
",",
"'rb'",
")",
"as",
"f",
":",
"my_object",
"=",
"load",
"(",
"f",
",",
"deco... | Load a JSON file using json_tricks | [
"Load",
"a",
"JSON",
"file",
"using",
"json_tricks"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/io/__init__.py#L20-L31 | train | 29,086 |
SBRG/ssbio | ssbio/io/__init__.py | save_pickle | def save_pickle(obj, outfile, protocol=2):
"""Save the object as a pickle file
Args:
outfile (str): Filename
protocol (int): Pickle protocol to use. Default is 2 to remain compatible with Python 2
Returns:
str: Path to pickle file
"""
with open(outfile, 'wb') as f:
... | python | def save_pickle(obj, outfile, protocol=2):
"""Save the object as a pickle file
Args:
outfile (str): Filename
protocol (int): Pickle protocol to use. Default is 2 to remain compatible with Python 2
Returns:
str: Path to pickle file
"""
with open(outfile, 'wb') as f:
... | [
"def",
"save_pickle",
"(",
"obj",
",",
"outfile",
",",
"protocol",
"=",
"2",
")",
":",
"with",
"open",
"(",
"outfile",
",",
"'wb'",
")",
"as",
"f",
":",
"pickle",
".",
"dump",
"(",
"obj",
",",
"f",
",",
"protocol",
"=",
"protocol",
")",
"return",
... | Save the object as a pickle file
Args:
outfile (str): Filename
protocol (int): Pickle protocol to use. Default is 2 to remain compatible with Python 2
Returns:
str: Path to pickle file | [
"Save",
"the",
"object",
"as",
"a",
"pickle",
"file"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/io/__init__.py#L34-L48 | train | 29,087 |
SBRG/ssbio | ssbio/io/__init__.py | load_pickle | def load_pickle(file, encoding=None):
"""Load a pickle file.
Args:
file (str): Path to pickle file
Returns:
object: Loaded object from pickle file
"""
# TODO: test set encoding='latin1' for 2/3 incompatibility
if encoding:
with open(file, 'rb') as f:
return... | python | def load_pickle(file, encoding=None):
"""Load a pickle file.
Args:
file (str): Path to pickle file
Returns:
object: Loaded object from pickle file
"""
# TODO: test set encoding='latin1' for 2/3 incompatibility
if encoding:
with open(file, 'rb') as f:
return... | [
"def",
"load_pickle",
"(",
"file",
",",
"encoding",
"=",
"None",
")",
":",
"# TODO: test set encoding='latin1' for 2/3 incompatibility",
"if",
"encoding",
":",
"with",
"open",
"(",
"file",
",",
"'rb'",
")",
"as",
"f",
":",
"return",
"pickle",
".",
"load",
"(",... | Load a pickle file.
Args:
file (str): Path to pickle file
Returns:
object: Loaded object from pickle file | [
"Load",
"a",
"pickle",
"file",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/io/__init__.py#L51-L67 | train | 29,088 |
SBRG/ssbio | ssbio/biopython/Bio/Struct/__init__.py | read | def read( handle, id=None ):
"""
Reads a structure via PDBParser.
Simplifies life..
"""
from Bio.PDB import PDBParser
if not id:
id = os.path.basename(handle).split('.')[0] # Get from filename
p = PDBParser()
s = p.get_structure(id, handle)
return s | python | def read( handle, id=None ):
"""
Reads a structure via PDBParser.
Simplifies life..
"""
from Bio.PDB import PDBParser
if not id:
id = os.path.basename(handle).split('.')[0] # Get from filename
p = PDBParser()
s = p.get_structure(id, handle)
return s | [
"def",
"read",
"(",
"handle",
",",
"id",
"=",
"None",
")",
":",
"from",
"Bio",
".",
"PDB",
"import",
"PDBParser",
"if",
"not",
"id",
":",
"id",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"handle",
")",
".",
"split",
"(",
"'.'",
")",
"[",
"0"... | Reads a structure via PDBParser.
Simplifies life.. | [
"Reads",
"a",
"structure",
"via",
"PDBParser",
".",
"Simplifies",
"life",
".."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/biopython/Bio/Struct/__init__.py#L11-L25 | train | 29,089 |
SBRG/ssbio | ssbio/biopython/Bio/Struct/__init__.py | write | def write( structure, name=None ):
"""
Writes a Structure in PDB format through PDBIO.
Simplifies life..
"""
from Bio.PDB import PDBIO
io = PDBIO()
io.set_structure(structure)
if not name:
s_name = structure.id
else:
s_name = name
name = "%s.p... | python | def write( structure, name=None ):
"""
Writes a Structure in PDB format through PDBIO.
Simplifies life..
"""
from Bio.PDB import PDBIO
io = PDBIO()
io.set_structure(structure)
if not name:
s_name = structure.id
else:
s_name = name
name = "%s.p... | [
"def",
"write",
"(",
"structure",
",",
"name",
"=",
"None",
")",
":",
"from",
"Bio",
".",
"PDB",
"import",
"PDBIO",
"io",
"=",
"PDBIO",
"(",
")",
"io",
".",
"set_structure",
"(",
"structure",
")",
"if",
"not",
"name",
":",
"s_name",
"=",
"structure",... | Writes a Structure in PDB format through PDBIO.
Simplifies life.. | [
"Writes",
"a",
"Structure",
"in",
"PDB",
"format",
"through",
"PDBIO",
".",
"Simplifies",
"life",
".."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/biopython/Bio/Struct/__init__.py#L27-L56 | train | 29,090 |
SBRG/ssbio | ssbio/databases/pisa.py | download_pisa_multimers_xml | def download_pisa_multimers_xml(pdb_ids, save_single_xml_files=True, outdir=None, force_rerun=False):
"""Download the PISA XML file for multimers.
See: http://www.ebi.ac.uk/pdbe/pisa/pi_download.html for more info
XML description of macromolecular assemblies:
http://www.ebi.ac.uk/pdbe/pisa/cgi-bin... | python | def download_pisa_multimers_xml(pdb_ids, save_single_xml_files=True, outdir=None, force_rerun=False):
"""Download the PISA XML file for multimers.
See: http://www.ebi.ac.uk/pdbe/pisa/pi_download.html for more info
XML description of macromolecular assemblies:
http://www.ebi.ac.uk/pdbe/pisa/cgi-bin... | [
"def",
"download_pisa_multimers_xml",
"(",
"pdb_ids",
",",
"save_single_xml_files",
"=",
"True",
",",
"outdir",
"=",
"None",
",",
"force_rerun",
"=",
"False",
")",
":",
"if",
"not",
"outdir",
":",
"outdir",
"=",
"os",
".",
"getcwd",
"(",
")",
"files",
"=",... | Download the PISA XML file for multimers.
See: http://www.ebi.ac.uk/pdbe/pisa/pi_download.html for more info
XML description of macromolecular assemblies:
http://www.ebi.ac.uk/pdbe/pisa/cgi-bin/multimers.pisa?pdbcodelist
where "pdbcodelist" is a comma-separated (strictly no spaces) list of PDB... | [
"Download",
"the",
"PISA",
"XML",
"file",
"for",
"multimers",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/databases/pisa.py#L19-L105 | train | 29,091 |
SBRG/ssbio | ssbio/core/genepro.py | GenePro.copy_modified_gene | def copy_modified_gene(self, modified_gene, ignore_model_attributes=True):
"""Copy attributes of a Gene object over to this Gene, given that the modified gene has the same ID.
Args:
modified_gene (Gene, GenePro): Gene with modified attributes that you want to copy over.
ignore_m... | python | def copy_modified_gene(self, modified_gene, ignore_model_attributes=True):
"""Copy attributes of a Gene object over to this Gene, given that the modified gene has the same ID.
Args:
modified_gene (Gene, GenePro): Gene with modified attributes that you want to copy over.
ignore_m... | [
"def",
"copy_modified_gene",
"(",
"self",
",",
"modified_gene",
",",
"ignore_model_attributes",
"=",
"True",
")",
":",
"ignore",
"=",
"[",
"'_model'",
",",
"'_reaction'",
",",
"'_functional'",
",",
"'model'",
",",
"'reaction'",
",",
"'functional'",
"]",
"for",
... | Copy attributes of a Gene object over to this Gene, given that the modified gene has the same ID.
Args:
modified_gene (Gene, GenePro): Gene with modified attributes that you want to copy over.
ignore_model_attributes (bool): If you want to ignore copying over attributes related to metab... | [
"Copy",
"attributes",
"of",
"a",
"Gene",
"object",
"over",
"to",
"this",
"Gene",
"given",
"that",
"the",
"modified",
"gene",
"has",
"the",
"same",
"ID",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/core/genepro.py#L71-L83 | train | 29,092 |
SBRG/ssbio | ssbio/protein/structure/structprop.py | StructProp.load_structure_path | def load_structure_path(self, structure_path, file_type):
"""Load a structure file and provide pointers to its location
Args:
structure_path (str): Path to structure file
file_type (str): Type of structure file
"""
if not file_type:
raise ValueError... | python | def load_structure_path(self, structure_path, file_type):
"""Load a structure file and provide pointers to its location
Args:
structure_path (str): Path to structure file
file_type (str): Type of structure file
"""
if not file_type:
raise ValueError... | [
"def",
"load_structure_path",
"(",
"self",
",",
"structure_path",
",",
"file_type",
")",
":",
"if",
"not",
"file_type",
":",
"raise",
"ValueError",
"(",
"'File type must be specified'",
")",
"self",
".",
"file_type",
"=",
"file_type",
"self",
".",
"structure_dir",... | Load a structure file and provide pointers to its location
Args:
structure_path (str): Path to structure file
file_type (str): Type of structure file | [
"Load",
"a",
"structure",
"file",
"and",
"provide",
"pointers",
"to",
"its",
"location"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/structure/structprop.py#L114-L128 | train | 29,093 |
SBRG/ssbio | ssbio/protein/structure/structprop.py | StructProp.parse_structure | def parse_structure(self, store_in_memory=False):
"""Read the 3D coordinates of a structure file and return it as a Biopython Structure object.
Also create ChainProp objects in the chains attribute for each chain in the first model.
Args:
store_in_memory (bool): If the Biopython Str... | python | def parse_structure(self, store_in_memory=False):
"""Read the 3D coordinates of a structure file and return it as a Biopython Structure object.
Also create ChainProp objects in the chains attribute for each chain in the first model.
Args:
store_in_memory (bool): If the Biopython Str... | [
"def",
"parse_structure",
"(",
"self",
",",
"store_in_memory",
"=",
"False",
")",
":",
"# TODO: perhaps add option to parse into ProDy object?",
"if",
"not",
"self",
".",
"structure_file",
":",
"log",
".",
"error",
"(",
"'{}: no structure file, unable to parse'",
".",
"... | Read the 3D coordinates of a structure file and return it as a Biopython Structure object.
Also create ChainProp objects in the chains attribute for each chain in the first model.
Args:
store_in_memory (bool): If the Biopython Structure object should be stored in the attribute ``structure``... | [
"Read",
"the",
"3D",
"coordinates",
"of",
"a",
"structure",
"file",
"and",
"return",
"it",
"as",
"a",
"Biopython",
"Structure",
"object",
".",
"Also",
"create",
"ChainProp",
"objects",
"in",
"the",
"chains",
"attribute",
"for",
"each",
"chain",
"in",
"the",
... | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/structure/structprop.py#L130-L162 | train | 29,094 |
SBRG/ssbio | ssbio/protein/structure/structprop.py | StructProp.clean_structure | def clean_structure(self, out_suffix='_clean', outdir=None, force_rerun=False,
remove_atom_alt=True, keep_atom_alt_id='A',remove_atom_hydrogen=True, add_atom_occ=True,
remove_res_hetero=True, keep_chemicals=None, keep_res_only=None,
add_chain_id_i... | python | def clean_structure(self, out_suffix='_clean', outdir=None, force_rerun=False,
remove_atom_alt=True, keep_atom_alt_id='A',remove_atom_hydrogen=True, add_atom_occ=True,
remove_res_hetero=True, keep_chemicals=None, keep_res_only=None,
add_chain_id_i... | [
"def",
"clean_structure",
"(",
"self",
",",
"out_suffix",
"=",
"'_clean'",
",",
"outdir",
"=",
"None",
",",
"force_rerun",
"=",
"False",
",",
"remove_atom_alt",
"=",
"True",
",",
"keep_atom_alt_id",
"=",
"'A'",
",",
"remove_atom_hydrogen",
"=",
"True",
",",
... | Clean the structure file associated with this structure, and save it as a new file. Returns the file path.
Args:
out_suffix (str): Suffix to append to original filename
outdir (str): Path to output directory
force_rerun (bool): If structure should be re-cleaned if a clean fi... | [
"Clean",
"the",
"structure",
"file",
"associated",
"with",
"this",
"structure",
"and",
"save",
"it",
"as",
"a",
"new",
"file",
".",
"Returns",
"the",
"file",
"path",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/structure/structprop.py#L164-L205 | train | 29,095 |
SBRG/ssbio | ssbio/protein/structure/structprop.py | StructProp.add_mapped_chain_ids | def add_mapped_chain_ids(self, mapped_chains):
"""Add chains by ID into the mapped_chains attribute
Args:
mapped_chains (str, list): Chain ID or list of IDs
"""
mapped_chains = ssbio.utils.force_list(mapped_chains)
for c in mapped_chains:
if c not in se... | python | def add_mapped_chain_ids(self, mapped_chains):
"""Add chains by ID into the mapped_chains attribute
Args:
mapped_chains (str, list): Chain ID or list of IDs
"""
mapped_chains = ssbio.utils.force_list(mapped_chains)
for c in mapped_chains:
if c not in se... | [
"def",
"add_mapped_chain_ids",
"(",
"self",
",",
"mapped_chains",
")",
":",
"mapped_chains",
"=",
"ssbio",
".",
"utils",
".",
"force_list",
"(",
"mapped_chains",
")",
"for",
"c",
"in",
"mapped_chains",
":",
"if",
"c",
"not",
"in",
"self",
".",
"mapped_chains... | Add chains by ID into the mapped_chains attribute
Args:
mapped_chains (str, list): Chain ID or list of IDs | [
"Add",
"chains",
"by",
"ID",
"into",
"the",
"mapped_chains",
"attribute"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/structure/structprop.py#L207-L221 | train | 29,096 |
SBRG/ssbio | ssbio/protein/structure/structprop.py | StructProp.add_chain_ids | def add_chain_ids(self, chains):
"""Add chains by ID into the chains attribute
Args:
chains (str, list): Chain ID or list of IDs
"""
chains = ssbio.utils.force_list(chains)
for c in chains:
if self.chains.has_id(c):
log.debug('{}: chain ... | python | def add_chain_ids(self, chains):
"""Add chains by ID into the chains attribute
Args:
chains (str, list): Chain ID or list of IDs
"""
chains = ssbio.utils.force_list(chains)
for c in chains:
if self.chains.has_id(c):
log.debug('{}: chain ... | [
"def",
"add_chain_ids",
"(",
"self",
",",
"chains",
")",
":",
"chains",
"=",
"ssbio",
".",
"utils",
".",
"force_list",
"(",
"chains",
")",
"for",
"c",
"in",
"chains",
":",
"if",
"self",
".",
"chains",
".",
"has_id",
"(",
"c",
")",
":",
"log",
".",
... | Add chains by ID into the chains attribute
Args:
chains (str, list): Chain ID or list of IDs | [
"Add",
"chains",
"by",
"ID",
"into",
"the",
"chains",
"attribute"
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/structure/structprop.py#L223-L238 | train | 29,097 |
SBRG/ssbio | ssbio/protein/structure/structprop.py | StructProp.get_structure_seqs | def get_structure_seqs(self, model):
"""Gather chain sequences and store in their corresponding ``ChainProp`` objects in the ``chains`` attribute.
Args:
model (Model): Biopython Model object of the structure you would like to parse
"""
# Don't overwrite existing ChainProp ... | python | def get_structure_seqs(self, model):
"""Gather chain sequences and store in their corresponding ``ChainProp`` objects in the ``chains`` attribute.
Args:
model (Model): Biopython Model object of the structure you would like to parse
"""
# Don't overwrite existing ChainProp ... | [
"def",
"get_structure_seqs",
"(",
"self",
",",
"model",
")",
":",
"# Don't overwrite existing ChainProp objects",
"dont_overwrite",
"=",
"[",
"]",
"chains",
"=",
"list",
"(",
"model",
".",
"get_chains",
"(",
")",
")",
"for",
"x",
"in",
"chains",
":",
"if",
"... | Gather chain sequences and store in their corresponding ``ChainProp`` objects in the ``chains`` attribute.
Args:
model (Model): Biopython Model object of the structure you would like to parse | [
"Gather",
"chain",
"sequences",
"and",
"store",
"in",
"their",
"corresponding",
"ChainProp",
"objects",
"in",
"the",
"chains",
"attribute",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/structure/structprop.py#L240-L267 | train | 29,098 |
SBRG/ssbio | ssbio/protein/structure/structprop.py | StructProp.get_dict_with_chain | def get_dict_with_chain(self, chain, only_keys=None, chain_keys=None, exclude_attributes=None, df_format=False):
"""get_dict method which incorporates attributes found in a specific chain. Does not overwrite any attributes
in the original StructProp.
Args:
chain:
only_ke... | python | def get_dict_with_chain(self, chain, only_keys=None, chain_keys=None, exclude_attributes=None, df_format=False):
"""get_dict method which incorporates attributes found in a specific chain. Does not overwrite any attributes
in the original StructProp.
Args:
chain:
only_ke... | [
"def",
"get_dict_with_chain",
"(",
"self",
",",
"chain",
",",
"only_keys",
"=",
"None",
",",
"chain_keys",
"=",
"None",
",",
"exclude_attributes",
"=",
"None",
",",
"df_format",
"=",
"False",
")",
":",
"# Choose attributes to return, return everything in the object if... | get_dict method which incorporates attributes found in a specific chain. Does not overwrite any attributes
in the original StructProp.
Args:
chain:
only_keys:
chain_keys:
exclude_attributes:
df_format:
Returns:
dict: attri... | [
"get_dict",
"method",
"which",
"incorporates",
"attributes",
"found",
"in",
"a",
"specific",
"chain",
".",
"Does",
"not",
"overwrite",
"any",
"attributes",
"in",
"the",
"original",
"StructProp",
"."
] | e9449e64ffc1a1f5ad07e5849aa12a650095f8a2 | https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/protein/structure/structprop.py#L273-L317 | train | 29,099 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.