_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 31 13.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q245600 | Protein.get_residue_annotations | train | 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 | {
"resource": ""
} |
q245601 | Protein.sequence_mutation_summary | train | 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 | {
"resource": ""
} |
q245602 | Protein.get_all_pdbflex_info | train | 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 | {
"resource": ""
} |
q245603 | Protein.get_generic_subseq_2D | train | 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 | {
"resource": ""
} |
q245604 | Protein.get_generic_subseq_3D | train | 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 | {
"resource": ""
} |
q245605 | Protein.get_combo_subseq_within_2_5D | train | 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 | {
"resource": ""
} |
q245606 | Protein.get_surface_subseq_3D | train | 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 | {
"resource": ""
} |
q245607 | Protein.get_disorder_subseq_3D | train | 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 | {
"resource": ""
} |
q245608 | parse_init_dat | train | 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 | {
"resource": ""
} |
q245609 | parse_cscore | train | 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 | {
"resource": ""
} |
q245610 | parse_coach_bsites_inf | train | 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 | {
"resource": ""
} |
q245611 | parse_coach_ec_df | train | 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 | {
"resource": ""
} |
q245612 | parse_coach_go | train | 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 | {
"resource": ""
} |
q245613 | ITASSERProp.copy_results | train | 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 | {
"resource": ""
} |
q245614 | ITASSERProp.get_dict | train | 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 | {
"resource": ""
} |
q245615 | GEMPRO.load_cobra_model | train | 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 | {
"resource": ""
} |
q245616 | GEMPRO.add_gene_ids | train | 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 | {
"resource": ""
} |
q245617 | GEMPRO.uniprot_mapping_and_metadata | train | 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 | {
"resource": ""
} |
q245618 | GEMPRO.write_representative_sequences_file | train | 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 | {
"resource": ""
} |
q245619 | GEMPRO.get_tmhmm_predictions | train | 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 | {
"resource": ""
} |
q245620 | GEMPRO.map_uniprot_to_pdb | train | 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 | {
"resource": ""
} |
q245621 | GEMPRO.get_manual_homology_models | train | 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 | {
"resource": ""
} |
q245622 | GEMPRO.get_itasser_models | train | 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 | {
"resource": ""
} |
q245623 | GEMPRO.set_representative_structure | train | 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 | {
"resource": ""
} |
q245624 | GEMPRO.prep_itasser_modeling | train | 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 | {
"resource": ""
} |
q245625 | GEMPRO.pdb_downloader_and_metadata | train | 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 | {
"resource": ""
} |
q245626 | get_oligomeric_state | train | 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 | {
"resource": ""
} |
q245627 | translate_ostat | train | 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 | {
"resource": ""
} |
q245628 | SWISSMODEL.parse_metadata | train | 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)
| python | {
"resource": ""
} |
q245629 | SWISSMODEL.get_models | train | 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 | python | {
"resource": ""
} |
q245630 | SWISSMODEL.get_model_filepath | train | 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 | {
"resource": ""
} |
q245631 | SWISSMODEL.download_models | train | 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 | {
"resource": ""
} |
q245632 | SWISSMODEL.organize_models | train | 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 | {
"resource": ""
} |
q245633 | get_dG_at_T | train | 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 | {
"resource": ""
} |
q245634 | run_ppm_server | train | 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 | {
"resource": ""
} |
q245635 | cctop_submit | train | 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 | python | {
"resource": ""
} |
q245636 | cctop_check_status | train | 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 | {
"resource": ""
} |
q245637 | cctop_save_xml | train | 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 = | python | {
"resource": ""
} |
q245638 | load_feather | train | 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 | {
"resource": ""
} |
q245639 | get_proteome_counts_impute_missing | train | 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 | {
"resource": ""
} |
q245640 | get_proteome_correct_percentages | train | 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 | {
"resource": ""
} |
q245641 | run_all2 | train | 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 | {
"resource": ""
} |
q245642 | PCAMultiROS.make_contribplot | train | 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 | {
"resource": ""
} |
q245643 | PCAMultiROS._change_height | train | 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 | python | {
"resource": ""
} |
q245644 | write_merged_bioassembly | train | 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 | {
"resource": ""
} |
q245645 | save_json | train | 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: | python | {
"resource": ""
} |
q245646 | load_json | train | 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:
| python | {
"resource": ""
} |
q245647 | save_pickle | train | 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: | python | {
"resource": ""
} |
q245648 | load_pickle | train | def load_pickle(file, encoding=None):
"""Load a pickle file.
Args:
file (str): Path to pickle file
Returns:
object: Loaded object from pickle file
| python | {
"resource": ""
} |
q245649 | read | train | def read( handle, id=None ):
"""
Reads a structure via PDBParser.
Simplifies life..
"""
from Bio.PDB import PDBParser
if not id:
| python | {
"resource": ""
} |
q245650 | write | train | 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 | {
"resource": ""
} |
q245651 | download_pisa_multimers_xml | train | 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 | {
"resource": ""
} |
q245652 | GenePro.copy_modified_gene | train | 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 | {
"resource": ""
} |
q245653 | StructProp.load_structure_path | train | 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
"""
| python | {
"resource": ""
} |
q245654 | StructProp.parse_structure | train | 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 | {
"resource": ""
} |
q245655 | StructProp.clean_structure | train | 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 | {
"resource": ""
} |
q245656 | StructProp.add_mapped_chain_ids | train | 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 | {
"resource": ""
} |
q245657 | StructProp.add_chain_ids | train | 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 | {
"resource": ""
} |
q245658 | StructProp.get_structure_seqs | train | 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 | {
"resource": ""
} |
q245659 | StructProp.get_dict_with_chain | train | 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 | {
"resource": ""
} |
q245660 | StructProp.find_disulfide_bridges | train | def find_disulfide_bridges(self, threshold=3.0):
"""Run Biopython's search_ss_bonds to find potential disulfide bridges for each chain and store in ChainProp.
Will add a list of tuple pairs into the annotations field, looks like this::
[ ((' ', 79, ' '), (' ', 110, ' ')),
(('... | python | {
"resource": ""
} |
q245661 | StructProp.get_polypeptide_within | train | def get_polypeptide_within(self, chain_id, resnum, angstroms, only_protein=True,
use_ca=False, custom_coord=None, return_resnums=False):
"""Get a Polypeptide object of the amino acids within X angstroms of the specified chain + residue number.
Args:
resnum (in... | python | {
"resource": ""
} |
q245662 | StructProp.get_seqprop_within | train | def get_seqprop_within(self, chain_id, resnum, angstroms, only_protein=True,
use_ca=False, custom_coord=None, return_resnums=False):
"""Get a SeqProp object of the amino acids within X angstroms of the specified chain + residue number.
Args:
resnum (int): Residue ... | python | {
"resource": ""
} |
q245663 | StructProp.get_dssp_annotations | train | def get_dssp_annotations(self, outdir, force_rerun=False):
"""Run DSSP on this structure and store the DSSP annotations in the corresponding ChainProp SeqRecords
Calculations are stored in the ChainProp's ``letter_annotations`` at the following keys:
* ``SS-dssp``
* ``RSA-dssp`... | python | {
"resource": ""
} |
q245664 | StructProp.get_freesasa_annotations | train | def get_freesasa_annotations(self, outdir, include_hetatms=False, force_rerun=False):
"""Run ``freesasa`` on this structure and store the calculated properties in the corresponding ChainProps
"""
if self.file_type != 'pdb':
log.error('{}: unable to run freesasa with "{}" file type. P... | python | {
"resource": ""
} |
q245665 | StructProp.view_structure | train | def view_structure(self, only_chains=None, opacity=1.0, recolor=False, gui=False):
"""Use NGLviewer to display a structure in a Jupyter notebook
Args:
only_chains (str, list): Chain ID or IDs to display
opacity (float): Opacity of the structure
recolor (bool): If str... | python | {
"resource": ""
} |
q245666 | label_TM_tmhmm_residue_numbers_and_leaflets | train | def label_TM_tmhmm_residue_numbers_and_leaflets(tmhmm_seq):
"""Determine the residue numbers of the TM-helix residues that cross the membrane and label them by leaflet.
Args:
tmhmm_seq: g.protein.representative_sequence.seq_record.letter_annotations['TM-tmhmm']
Returns:
leaflet_dict: a dic... | python | {
"resource": ""
} |
q245667 | biopython_protein_scale | train | def biopython_protein_scale(inseq, scale, custom_scale_dict=None, window=7):
"""Use Biopython to calculate properties using a sliding window over a sequence given a specific scale to use."""
if scale == 'kd_hydrophobicity':
scale_dict = kd_hydrophobicity_one
elif scale == 'bulkiness':
scale... | python | {
"resource": ""
} |
q245668 | biopython_protein_analysis | train | def biopython_protein_analysis(inseq):
"""Utiize Biopython's ProteinAnalysis module to return general sequence properties of an amino acid string.
For full definitions see: http://biopython.org/DIST/docs/api/Bio.SeqUtils.ProtParam.ProteinAnalysis-class.html
Args:
inseq: Amino acid sequence
Re... | python | {
"resource": ""
} |
q245669 | emboss_pepstats_on_fasta | train | def emboss_pepstats_on_fasta(infile, outfile='', outdir='', outext='.pepstats', force_rerun=False):
"""Run EMBOSS pepstats on a FASTA file.
Args:
infile: Path to FASTA file
outfile: Name of output file without extension
outdir: Path to output directory
outext: Extension of resul... | python | {
"resource": ""
} |
q245670 | emboss_pepstats_parser | train | def emboss_pepstats_parser(infile):
"""Get dictionary of pepstats results.
Args:
infile: Path to pepstats outfile
Returns:
dict: Parsed information from pepstats
TODO:
Only currently parsing the bottom of the file for percentages of properties.
| python | {
"resource": ""
} |
q245671 | ATLAS.load_strain | train | def load_strain(self, strain_id, strain_genome_file):
"""Load a strain as a new GEM-PRO by its ID and associated genome file. Stored in the ``strains`` attribute.
Args:
strain_id (str): Strain ID
strain_genome_file (str): Path to strain genome file
"""
# logging... | python | {
"resource": ""
} |
q245672 | ATLAS.download_patric_genomes | train | def download_patric_genomes(self, ids, force_rerun=False):
"""Download genome files from PATRIC given a list of PATRIC genome IDs and load them as strains.
Args:
ids (str, list): PATRIC ID or list of PATRIC IDs
force_rerun (bool): If genome files should be downloaded again even ... | python | {
"resource": ""
} |
q245673 | ATLAS._pare_down_model | train | def _pare_down_model(self, strain_gempro, genes_to_remove):
"""Mark genes as non-functional in a GEM-PRO. If there is a COBRApy model associated with it, the
COBRApy method delete_model_genes is utilized to delete genes.
Args:
strain_gempro (GEMPRO): GEMPRO object
ge... | python | {
"resource": ""
} |
q245674 | ATLAS._load_strain_sequences | train | def _load_strain_sequences(self, strain_gempro):
"""Load strain sequences from the orthology matrix into the base model for comparisons, and into the
strain-specific model itself.
"""
if self._orthology_matrix_has_sequences: # Load directly from the orthology matrix if it contains sequ... | python | {
"resource": ""
} |
q245675 | ATLAS.build_strain_specific_models | train | def build_strain_specific_models(self, save_models=False):
"""Using the orthologous genes matrix, create and modify the strain specific models based on if orthologous
genes exist.
Also store the sequences directly in the reference GEM-PRO protein sequence attribute for the strains.
... | python | {
"resource": ""
} |
q245676 | ATLAS.align_orthologous_genes_pairwise | train | def align_orthologous_genes_pairwise(self, gapopen=10, gapextend=0.5):
"""For each gene in the base strain, run a pairwise alignment for all orthologous gene sequences to it."""
for ref_gene in tqdm(self.reference_gempro.genes):
if len(ref_gene.protein.sequences) > 1:
alignme... | python | {
"resource": ""
} |
q245677 | ATLAS.get_atlas_per_gene_mutation_df | train | def get_atlas_per_gene_mutation_df(self, gene_id):
"""Create a single data frame which summarizes a gene and its mutations.
Args:
gene_id (str): Gene ID in the base model
Returns:
DataFrame: Pandas DataFrame of the results
"""
# TODO: also count: number... | python | {
"resource": ""
} |
q245678 | add_residues_highlight_to_nglview | train | def add_residues_highlight_to_nglview(view, structure_resnums, chain, res_color='red'):
"""Add a residue number or numbers to an NGLWidget view object.
Args:
view (NGLWidget): NGLWidget view object
structure_resnums (int, list): Residue number(s) to highlight, structure numbering
chain ... | python | {
"resource": ""
} |
q245679 | download_kegg_gene_metadata | train | def download_kegg_gene_metadata(gene_id, outdir=None, force_rerun=False):
"""Download the KEGG flatfile for a KEGG ID and return the path.
Args:
gene_id: KEGG gene ID (with organism code), i.e. "eco:1244"
outdir: optional output directory of metadata
Returns:
Path to metadata file
... | python | {
"resource": ""
} |
q245680 | parse_kegg_gene_metadata | train | def parse_kegg_gene_metadata(infile):
"""Parse the KEGG flatfile and return a dictionary of metadata.
Dictionary keys are:
refseq
uniprot
pdbs
taxonomy
Args:
infile: Path to KEGG flatfile
Returns:
dict: Dictionary of metadata
"""
metadata = def... | python | {
"resource": ""
} |
q245681 | map_kegg_all_genes | train | def map_kegg_all_genes(organism_code, target_db):
"""Map all of an organism's gene IDs to the target database.
This is faster than supplying a specific list of genes to map,
plus there seems to be a limit on the number you can map with a manual REST query anyway.
Args:
organism_code: the three... | python | {
"resource": ""
} |
q245682 | ITASSERPrep.prep_folder | train | def prep_folder(self, seq):
"""Take in a sequence string and prepares the folder for the I-TASSER run."""
itasser_dir = op.join(self.root_dir, self.id)
if not op.exists(itasser_dir):
| python | {
"resource": ""
} |
q245683 | run_makeblastdb | train | def run_makeblastdb(infile, dbtype, outdir=''):
"""Make the BLAST database for a genome file.
Args:
infile (str): path to genome FASTA file
dbtype (str): "nucl" or "prot" - what format your genome files are in
outdir (str): path to directory to output database files (default is original... | python | {
"resource": ""
} |
q245684 | run_bidirectional_blast | train | def run_bidirectional_blast(reference, other_genome, dbtype, outdir=''):
"""BLAST a genome against another, and vice versa.
This function requires BLAST to be installed, do so by running:
sudo apt install ncbi-blast+
Args:
reference (str): path to "reference" genome, aka your "base strain"
... | python | {
"resource": ""
} |
q245685 | print_run_bidirectional_blast | train | def print_run_bidirectional_blast(reference, other_genome, dbtype, outdir):
"""Write torque submission files for running bidirectional blast on a server and print execution command.
Args:
reference (str): Path to "reference" genome, aka your "base strain"
other_genome (str): Path to other genom... | python | {
"resource": ""
} |
q245686 | StructureIO.write_pdb | train | def write_pdb(self, custom_name='', out_suffix='', out_dir=None, custom_selection=None, force_rerun=False):
"""Write a new PDB file for the Structure's FIRST MODEL.
Set custom_selection to a PDB.Select class for custom SMCRA selections.
Args:
custom_name: Filename of the new file (... | python | {
"resource": ""
} |
q245687 | XMLParser._handle_builder_exception | train | def _handle_builder_exception(self, message, residue):
"""
Makes a PDB Construction Error a bit more verbose and informative
| python | {
"resource": ""
} |
q245688 | XMLParser._parse | train | def _parse(self):
"""
Parse atomic data of the XML file.
"""
atom_counter = 0
structure_build = self.structure_builder
residues = self._extract_residues()
cur_model = None
cur_chain = None
structure_build.init_se... | python | {
"resource": ""
} |
q245689 | XMLParser._extract_residues | train | def _extract_residues(self):
"""
WHAT IF puts terminal atoms in new residues at the end for some reason..
"""
r_list = self.handle.getElementsByTagName("response")
r_data = {}
for r in r_list:
data = self._parse_residue(r)
... | python | {
"resource": ""
} |
q245690 | calculate_residue_counts_perstrain | train | def calculate_residue_counts_perstrain(protein_pickle_path, outdir, pdbflex_keys_file, wt_pid_cutoff=None, force_rerun=False):
"""Writes out a feather file for a PROTEIN counting amino acid occurences for ALL STRAINS along with SUBSEQUENCES"""
from collections import defaultdict
from ssbio.protein.sequence.... | python | {
"resource": ""
} |
q245691 | ATLAS2.filter_genes_and_strains | train | def filter_genes_and_strains(self, remove_genes_not_in_reference_model=True,
remove_strains_with_no_orthology=True, remove_strains_with_no_differences=False,
custom_keep_strains=None, custom_keep_genes=None):
"""Filters the analysis by keeping a ... | python | {
"resource": ""
} |
q245692 | ATLAS2._write_strain_functional_genes | train | def _write_strain_functional_genes(self, strain_id, ref_functional_genes, orth_matrix, force_rerun=False):
"""Create strain functional genes json file"""
func_genes_path = op.join(self.model_dir, '{}_funcgenes.json'.format(strain_id))
if ssbio.utils.force_rerun(flag=force_rerun, outfile=func_ge... | python | {
"resource": ""
} |
q245693 | ATLAS2.write_strain_functional_genes | train | def write_strain_functional_genes(self, force_rerun=False):
"""Wrapper function for _write_strain_functional_genes"""
if len(self.df_orthology_matrix) == 0:
raise RuntimeError('Empty orthology matrix, please calculate first!')
ref_functional_genes = [g.id for g in self.reference_gemp... | python | {
"resource": ""
} |
q245694 | ATLAS2._build_strain_specific_model | train | def _build_strain_specific_model(self, strain_id, ref_functional_genes, orth_matrix, force_rerun=False):
"""Create strain GEMPRO, set functional genes"""
gp_noseqs_path = op.join(self.model_dir, '{}_gp.pckl'.format(strain_id))
if ssbio.utils.force_rerun(flag=force_rerun, outfile=gp_noseqs_path)... | python | {
"resource": ""
} |
q245695 | ATLAS2.build_strain_specific_models | train | def build_strain_specific_models(self, joblib=False, cores=1, force_rerun=False):
"""Wrapper function for _build_strain_specific_model"""
if len(self.df_orthology_matrix) == 0:
raise RuntimeError('Empty orthology matrix, please calculate first!')
ref_functional_genes = [g.id for g in... | python | {
"resource": ""
} |
q245696 | ATLAS2._load_sequences_to_strain | train | def _load_sequences_to_strain(self, strain_id, force_rerun=False):
"""Load strain GEMPRO with functional genes defined, load sequences to it, save as new GEMPRO"""
gp_seqs_path = op.join(self.model_dir, '{}_gp_withseqs.pckl'.format(strain_id))
if ssbio.utils.force_rerun(flag=force_rerun, outfil... | python | {
"resource": ""
} |
q245697 | ATLAS2.load_sequences_to_strains | train | def load_sequences_to_strains(self, joblib=False, cores=1, force_rerun=False):
"""Wrapper function for _load_sequences_to_strain"""
log.info('Loading sequences to strain GEM-PROs...')
if joblib:
result = DictList(Parallel(n_jobs=cores)(delayed(self._load_sequences_to_strain)(s, force... | python | {
"resource": ""
} |
q245698 | ATLAS2._load_sequences_to_reference_gene | train | def _load_sequences_to_reference_gene(self, g_id, force_rerun=False):
"""Load orthologous strain sequences to reference Protein object, save as new pickle"""
protein_seqs_pickle_path = op.join(self.sequences_by_gene_dir, '{}_protein_withseqs.pckl'.format(g_id))
if ssbio.utils.force_rerun(flag=f... | python | {
"resource": ""
} |
q245699 | ATLAS2.load_sequences_to_reference | train | def load_sequences_to_reference(self, sc=None, force_rerun=False):
"""Wrapper for _load_sequences_to_reference_gene"""
log.info('Loading sequences to reference GEM-PRO...')
from random import shuffle
g_ids = [g.id for g in self.reference_gempro.functional_genes]
shuffle(g_ids)
... | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.