repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
tanghaibao/goatools
goatools/base.py
ftp_get
def ftp_get(fin_src, fout): """Download a file from an ftp server""" assert fin_src[:6] == 'ftp://', fin_src dir_full, fin_ftp = os.path.split(fin_src[6:]) pt0 = dir_full.find('/') assert pt0 != -1, pt0 ftphost = dir_full[:pt0] chg_dir = dir_full[pt0+1:] print('FTP RETR {HOST} {DIR} {SRC...
python
def ftp_get(fin_src, fout): """Download a file from an ftp server""" assert fin_src[:6] == 'ftp://', fin_src dir_full, fin_ftp = os.path.split(fin_src[6:]) pt0 = dir_full.find('/') assert pt0 != -1, pt0 ftphost = dir_full[:pt0] chg_dir = dir_full[pt0+1:] print('FTP RETR {HOST} {DIR} {SRC...
[ "def", "ftp_get", "(", "fin_src", ",", "fout", ")", ":", "assert", "fin_src", "[", ":", "6", "]", "==", "'ftp://'", ",", "fin_src", "dir_full", ",", "fin_ftp", "=", "os", ".", "path", ".", "split", "(", "fin_src", "[", "6", ":", "]", ")", "pt0", ...
Download a file from an ftp server
[ "Download", "a", "file", "from", "an", "ftp", "server" ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/base.py#L189-L204
train
tanghaibao/goatools
goatools/base.py
dnld_file
def dnld_file(src_ftp, dst_file, prt=sys.stdout, loading_bar=True): """Download specified file if necessary.""" if os.path.isfile(dst_file): return do_gunzip = src_ftp[-3:] == '.gz' and dst_file[-3:] != '.gz' dst_wget = "{DST}.gz".format(DST=dst_file) if do_gunzip else dst_file # Write to st...
python
def dnld_file(src_ftp, dst_file, prt=sys.stdout, loading_bar=True): """Download specified file if necessary.""" if os.path.isfile(dst_file): return do_gunzip = src_ftp[-3:] == '.gz' and dst_file[-3:] != '.gz' dst_wget = "{DST}.gz".format(DST=dst_file) if do_gunzip else dst_file # Write to st...
[ "def", "dnld_file", "(", "src_ftp", ",", "dst_file", ",", "prt", "=", "sys", ".", "stdout", ",", "loading_bar", "=", "True", ")", ":", "if", "os", ".", "path", ".", "isfile", "(", "dst_file", ")", ":", "return", "do_gunzip", "=", "src_ftp", "[", "-",...
Download specified file if necessary.
[ "Download", "specified", "file", "if", "necessary", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/base.py#L207-L230
train
tanghaibao/goatools
goatools/godag/obo_optional_attributes.py
OboOptionalAttrs.init_datamembers
def init_datamembers(self, rec): """Initialize current GOTerm with data members for storing optional attributes.""" # pylint: disable=multiple-statements if 'synonym' in self.optional_attrs: rec.synonym = [] if 'xref' in self.optional_attrs: rec.xref = set() if 'subs...
python
def init_datamembers(self, rec): """Initialize current GOTerm with data members for storing optional attributes.""" # pylint: disable=multiple-statements if 'synonym' in self.optional_attrs: rec.synonym = [] if 'xref' in self.optional_attrs: rec.xref = set() if 'subs...
[ "def", "init_datamembers", "(", "self", ",", "rec", ")", ":", "if", "'synonym'", "in", "self", ".", "optional_attrs", ":", "rec", ".", "synonym", "=", "[", "]", "if", "'xref'", "in", "self", ".", "optional_attrs", ":", "rec", ".", "xref", "=", "set", ...
Initialize current GOTerm with data members for storing optional attributes.
[ "Initialize", "current", "GOTerm", "with", "data", "members", "for", "storing", "optional", "attributes", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/godag/obo_optional_attributes.py#L51-L60
train
tanghaibao/goatools
goatools/godag/obo_optional_attributes.py
OboOptionalAttrs._get_synonym
def _get_synonym(self, line): """Given line, return optional attribute synonym value in a namedtuple. Example synonym and its storage in a namedtuple: synonym: "The other white meat" EXACT MARKETING_SLOGAN [MEAT:00324, BACONBASE:03021] text: "The other white meat" scope:...
python
def _get_synonym(self, line): """Given line, return optional attribute synonym value in a namedtuple. Example synonym and its storage in a namedtuple: synonym: "The other white meat" EXACT MARKETING_SLOGAN [MEAT:00324, BACONBASE:03021] text: "The other white meat" scope:...
[ "def", "_get_synonym", "(", "self", ",", "line", ")", ":", "mtch", "=", "self", ".", "attr2cmp", "[", "'synonym'", "]", ".", "match", "(", "line", ")", "text", ",", "scope", ",", "typename", ",", "dbxrefs", ",", "_", "=", "mtch", ".", "groups", "("...
Given line, return optional attribute synonym value in a namedtuple. Example synonym and its storage in a namedtuple: synonym: "The other white meat" EXACT MARKETING_SLOGAN [MEAT:00324, BACONBASE:03021] text: "The other white meat" scope: EXACT typename: MARKETING_S...
[ "Given", "line", "return", "optional", "attribute", "synonym", "value", "in", "a", "namedtuple", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/godag/obo_optional_attributes.py#L62-L81
train
tanghaibao/goatools
goatools/godag/obo_optional_attributes.py
OboOptionalAttrs._get_xref
def _get_xref(self, line): """Given line, return optional attribute xref value in a dict of sets.""" # Ex: Wikipedia:Zygotene # Ex: Reactome:REACT_22295 "Addition of a third mannose to ..." mtch = self.attr2cmp['xref'].match(line) return mtch.group(1).replace(' ', '')
python
def _get_xref(self, line): """Given line, return optional attribute xref value in a dict of sets.""" # Ex: Wikipedia:Zygotene # Ex: Reactome:REACT_22295 "Addition of a third mannose to ..." mtch = self.attr2cmp['xref'].match(line) return mtch.group(1).replace(' ', '')
[ "def", "_get_xref", "(", "self", ",", "line", ")", ":", "mtch", "=", "self", ".", "attr2cmp", "[", "'xref'", "]", ".", "match", "(", "line", ")", "return", "mtch", ".", "group", "(", "1", ")", ".", "replace", "(", "' '", ",", "''", ")" ]
Given line, return optional attribute xref value in a dict of sets.
[ "Given", "line", "return", "optional", "attribute", "xref", "value", "in", "a", "dict", "of", "sets", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/godag/obo_optional_attributes.py#L83-L88
train
tanghaibao/goatools
goatools/godag/obo_optional_attributes.py
OboOptionalAttrs._init_compile_patterns
def _init_compile_patterns(optional_attrs): """Compile search patterns for optional attributes if needed.""" attr2cmp = {} if optional_attrs is None: return attr2cmp # "peptidase inhibitor complex" EXACT [GOC:bf, GOC:pr] # "blood vessel formation from pre-existing blo...
python
def _init_compile_patterns(optional_attrs): """Compile search patterns for optional attributes if needed.""" attr2cmp = {} if optional_attrs is None: return attr2cmp # "peptidase inhibitor complex" EXACT [GOC:bf, GOC:pr] # "blood vessel formation from pre-existing blo...
[ "def", "_init_compile_patterns", "(", "optional_attrs", ")", ":", "attr2cmp", "=", "{", "}", "if", "optional_attrs", "is", "None", ":", "return", "attr2cmp", "if", "'synonym'", "in", "optional_attrs", ":", "attr2cmp", "[", "'synonym'", "]", "=", "re", ".", "...
Compile search patterns for optional attributes if needed.
[ "Compile", "search", "patterns", "for", "optional", "attributes", "if", "needed", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/godag/obo_optional_attributes.py#L91-L107
train
tanghaibao/goatools
goatools/cli/wr_hierarchy.py
cli
def cli(): """Command-line script to print a GO term's lower-level hierarchy.""" objcli = WrHierCli(sys.argv[1:]) fouts_txt = objcli.get_fouts() if fouts_txt: for fout_txt in fouts_txt: objcli.wrtxt_hier(fout_txt) else: objcli.prt_hier(sys.stdout)
python
def cli(): """Command-line script to print a GO term's lower-level hierarchy.""" objcli = WrHierCli(sys.argv[1:]) fouts_txt = objcli.get_fouts() if fouts_txt: for fout_txt in fouts_txt: objcli.wrtxt_hier(fout_txt) else: objcli.prt_hier(sys.stdout)
[ "def", "cli", "(", ")", ":", "objcli", "=", "WrHierCli", "(", "sys", ".", "argv", "[", "1", ":", "]", ")", "fouts_txt", "=", "objcli", ".", "get_fouts", "(", ")", "if", "fouts_txt", ":", "for", "fout_txt", "in", "fouts_txt", ":", "objcli", ".", "wr...
Command-line script to print a GO term's lower-level hierarchy.
[ "Command", "-", "line", "script", "to", "print", "a", "GO", "term", "s", "lower", "-", "level", "hierarchy", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/cli/wr_hierarchy.py#L50-L58
train
tanghaibao/goatools
goatools/cli/wr_hierarchy.py
WrHierCli.get_fouts
def get_fouts(self): """Get output filename.""" fouts_txt = [] if 'o' in self.kws: fouts_txt.append(self.kws['o']) if 'f' in self.kws: fouts_txt.append(self._get_fout_go()) return fouts_txt
python
def get_fouts(self): """Get output filename.""" fouts_txt = [] if 'o' in self.kws: fouts_txt.append(self.kws['o']) if 'f' in self.kws: fouts_txt.append(self._get_fout_go()) return fouts_txt
[ "def", "get_fouts", "(", "self", ")", ":", "fouts_txt", "=", "[", "]", "if", "'o'", "in", "self", ".", "kws", ":", "fouts_txt", ".", "append", "(", "self", ".", "kws", "[", "'o'", "]", ")", "if", "'f'", "in", "self", ".", "kws", ":", "fouts_txt",...
Get output filename.
[ "Get", "output", "filename", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/cli/wr_hierarchy.py#L107-L114
train
tanghaibao/goatools
goatools/cli/wr_hierarchy.py
WrHierCli._get_fout_go
def _get_fout_go(self): """Get the name of an output file based on the top GO term.""" assert self.goids, "NO VALID GO IDs WERE PROVIDED AS STARTING POINTS FOR HIERARCHY REPORT" base = next(iter(self.goids)).replace(':', '') upstr = '_up' if 'up' in self.kws else '' return "hier_...
python
def _get_fout_go(self): """Get the name of an output file based on the top GO term.""" assert self.goids, "NO VALID GO IDs WERE PROVIDED AS STARTING POINTS FOR HIERARCHY REPORT" base = next(iter(self.goids)).replace(':', '') upstr = '_up' if 'up' in self.kws else '' return "hier_...
[ "def", "_get_fout_go", "(", "self", ")", ":", "assert", "self", ".", "goids", ",", "\"NO VALID GO IDs WERE PROVIDED AS STARTING POINTS FOR HIERARCHY REPORT\"", "base", "=", "next", "(", "iter", "(", "self", ".", "goids", ")", ")", ".", "replace", "(", "':'", ","...
Get the name of an output file based on the top GO term.
[ "Get", "the", "name", "of", "an", "output", "file", "based", "on", "the", "top", "GO", "term", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/cli/wr_hierarchy.py#L116-L121
train
tanghaibao/goatools
goatools/cli/wr_hierarchy.py
WrHierCli.wrtxt_hier
def wrtxt_hier(self, fout_txt): """Write hierarchy below specfied GO IDs to an ASCII file.""" with open(fout_txt, 'wb') as prt: self.prt_hier(prt) print(" WROTE: {TXT}".format(TXT=fout_txt))
python
def wrtxt_hier(self, fout_txt): """Write hierarchy below specfied GO IDs to an ASCII file.""" with open(fout_txt, 'wb') as prt: self.prt_hier(prt) print(" WROTE: {TXT}".format(TXT=fout_txt))
[ "def", "wrtxt_hier", "(", "self", ",", "fout_txt", ")", ":", "with", "open", "(", "fout_txt", ",", "'wb'", ")", "as", "prt", ":", "self", ".", "prt_hier", "(", "prt", ")", "print", "(", "\" WROTE: {TXT}\"", ".", "format", "(", "TXT", "=", "fout_txt", ...
Write hierarchy below specfied GO IDs to an ASCII file.
[ "Write", "hierarchy", "below", "specfied", "GO", "IDs", "to", "an", "ASCII", "file", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/cli/wr_hierarchy.py#L123-L127
train
tanghaibao/goatools
goatools/cli/wr_hierarchy.py
WrHierCli.prt_hier
def prt_hier(self, prt=sys.stdout): """Write hierarchy below specfied GO IDs.""" objwr = WrHierGO(self.gosubdag, **self.kws) assert self.goids, "NO VALID GO IDs WERE PROVIDED" if 'up' not in objwr.usrset: for goid in self.goids: objwr.prt_hier_down(goid, prt) ...
python
def prt_hier(self, prt=sys.stdout): """Write hierarchy below specfied GO IDs.""" objwr = WrHierGO(self.gosubdag, **self.kws) assert self.goids, "NO VALID GO IDs WERE PROVIDED" if 'up' not in objwr.usrset: for goid in self.goids: objwr.prt_hier_down(goid, prt) ...
[ "def", "prt_hier", "(", "self", ",", "prt", "=", "sys", ".", "stdout", ")", ":", "objwr", "=", "WrHierGO", "(", "self", ".", "gosubdag", ",", "**", "self", ".", "kws", ")", "assert", "self", ".", "goids", ",", "\"NO VALID GO IDs WERE PROVIDED\"", "if", ...
Write hierarchy below specfied GO IDs.
[ "Write", "hierarchy", "below", "specfied", "GO", "IDs", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/cli/wr_hierarchy.py#L129-L137
train
tanghaibao/goatools
goatools/cli/wr_hierarchy.py
WrHierCli._adj_for_assc
def _adj_for_assc(self): """Print only GO IDs from associations and their ancestors.""" if self.gene2gos: gos_assoc = set(get_b2aset(self.gene2gos).keys()) if 'item_marks' not in self.kws: self.kws['item_marks'] = {go:'>' for go in gos_assoc} if 'inclu...
python
def _adj_for_assc(self): """Print only GO IDs from associations and their ancestors.""" if self.gene2gos: gos_assoc = set(get_b2aset(self.gene2gos).keys()) if 'item_marks' not in self.kws: self.kws['item_marks'] = {go:'>' for go in gos_assoc} if 'inclu...
[ "def", "_adj_for_assc", "(", "self", ")", ":", "if", "self", ".", "gene2gos", ":", "gos_assoc", "=", "set", "(", "get_b2aset", "(", "self", ".", "gene2gos", ")", ".", "keys", "(", ")", ")", "if", "'item_marks'", "not", "in", "self", ".", "kws", ":", ...
Print only GO IDs from associations and their ancestors.
[ "Print", "only", "GO", "IDs", "from", "associations", "and", "their", "ancestors", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/cli/wr_hierarchy.py#L165-L174
train
tanghaibao/goatools
goatools/pvalcalc.py
PvalCalcBase.calc_pvalue
def calc_pvalue(self, study_count, study_n, pop_count, pop_n): """pvalues are calculated in derived classes.""" fnc_call = "calc_pvalue({SCNT}, {STOT}, {PCNT} {PTOT})".format( SCNT=study_count, STOT=study_n, PCNT=pop_count, PTOT=pop_n) raise Exception("NOT IMPLEMENTED: {FNC_CALL} usi...
python
def calc_pvalue(self, study_count, study_n, pop_count, pop_n): """pvalues are calculated in derived classes.""" fnc_call = "calc_pvalue({SCNT}, {STOT}, {PCNT} {PTOT})".format( SCNT=study_count, STOT=study_n, PCNT=pop_count, PTOT=pop_n) raise Exception("NOT IMPLEMENTED: {FNC_CALL} usi...
[ "def", "calc_pvalue", "(", "self", ",", "study_count", ",", "study_n", ",", "pop_count", ",", "pop_n", ")", ":", "fnc_call", "=", "\"calc_pvalue({SCNT}, {STOT}, {PCNT} {PTOT})\"", ".", "format", "(", "SCNT", "=", "study_count", ",", "STOT", "=", "study_n", ",", ...
pvalues are calculated in derived classes.
[ "pvalues", "are", "calculated", "in", "derived", "classes", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/pvalcalc.py#L19-L24
train
tanghaibao/goatools
goatools/pvalcalc.py
FisherFactory._init_pval_obj
def _init_pval_obj(self): """Returns a Fisher object based on user-input.""" if self.pval_fnc_name in self.options.keys(): try: fisher_obj = self.options[self.pval_fnc_name](self.pval_fnc_name, self.log) except ImportError: print("fisher module not...
python
def _init_pval_obj(self): """Returns a Fisher object based on user-input.""" if self.pval_fnc_name in self.options.keys(): try: fisher_obj = self.options[self.pval_fnc_name](self.pval_fnc_name, self.log) except ImportError: print("fisher module not...
[ "def", "_init_pval_obj", "(", "self", ")", ":", "if", "self", ".", "pval_fnc_name", "in", "self", ".", "options", ".", "keys", "(", ")", ":", "try", ":", "fisher_obj", "=", "self", ".", "options", "[", "self", ".", "pval_fnc_name", "]", "(", "self", ...
Returns a Fisher object based on user-input.
[ "Returns", "a", "Fisher", "object", "based", "on", "user", "-", "input", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/pvalcalc.py#L90-L101
train
tanghaibao/goatools
setup_helper.py
SetupHelper.check_version
def check_version(self, name, majorv=2, minorv=7): """ Make sure the package runs on the supported Python version """ if sys.version_info.major == majorv and sys.version_info.minor != minorv: sys.stderr.write("ERROR: %s is only for >= Python %d.%d but you are running %d.%d\n" %\ ...
python
def check_version(self, name, majorv=2, minorv=7): """ Make sure the package runs on the supported Python version """ if sys.version_info.major == majorv and sys.version_info.minor != minorv: sys.stderr.write("ERROR: %s is only for >= Python %d.%d but you are running %d.%d\n" %\ ...
[ "def", "check_version", "(", "self", ",", "name", ",", "majorv", "=", "2", ",", "minorv", "=", "7", ")", ":", "if", "sys", ".", "version_info", ".", "major", "==", "majorv", "and", "sys", ".", "version_info", ".", "minor", "!=", "minorv", ":", "sys",...
Make sure the package runs on the supported Python version
[ "Make", "sure", "the", "package", "runs", "on", "the", "supported", "Python", "version" ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/setup_helper.py#L21-L27
train
tanghaibao/goatools
setup_helper.py
SetupHelper.get_init
def get_init(self, filename="__init__.py"): """ Get various info from the package without importing them """ import ast with open(filename) as init_file: module = ast.parse(init_file.read()) itr = lambda x: (ast.literal_eval(node.value) for node in ast.walk(module) ...
python
def get_init(self, filename="__init__.py"): """ Get various info from the package without importing them """ import ast with open(filename) as init_file: module = ast.parse(init_file.read()) itr = lambda x: (ast.literal_eval(node.value) for node in ast.walk(module) ...
[ "def", "get_init", "(", "self", ",", "filename", "=", "\"__init__.py\"", ")", ":", "import", "ast", "with", "open", "(", "filename", ")", "as", "init_file", ":", "module", "=", "ast", ".", "parse", "(", "init_file", ".", "read", "(", ")", ")", "itr", ...
Get various info from the package without importing them
[ "Get", "various", "info", "from", "the", "package", "without", "importing", "them" ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/setup_helper.py#L29-L47
train
tanghaibao/goatools
setup_helper.py
SetupHelper.missing_requirements
def missing_requirements(self, specifiers): """ Find what's missing """ for specifier in specifiers: try: pkg_resources.require(specifier) except pkg_resources.DistributionNotFound: yield specifier
python
def missing_requirements(self, specifiers): """ Find what's missing """ for specifier in specifiers: try: pkg_resources.require(specifier) except pkg_resources.DistributionNotFound: yield specifier
[ "def", "missing_requirements", "(", "self", ",", "specifiers", ")", ":", "for", "specifier", "in", "specifiers", ":", "try", ":", "pkg_resources", ".", "require", "(", "specifier", ")", "except", "pkg_resources", ".", "DistributionNotFound", ":", "yield", "speci...
Find what's missing
[ "Find", "what", "s", "missing" ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/setup_helper.py#L49-L56
train
tanghaibao/goatools
setup_helper.py
SetupHelper.install_requirements
def install_requirements(self, requires): """ Install the listed requirements """ # Temporarily install dependencies required by setup.py before trying to import them. sys.path[0:0] = ['setup-requires'] pkg_resources.working_set.add_entry('setup-requires') to_install = l...
python
def install_requirements(self, requires): """ Install the listed requirements """ # Temporarily install dependencies required by setup.py before trying to import them. sys.path[0:0] = ['setup-requires'] pkg_resources.working_set.add_entry('setup-requires') to_install = l...
[ "def", "install_requirements", "(", "self", ",", "requires", ")", ":", "sys", ".", "path", "[", "0", ":", "0", "]", "=", "[", "'setup-requires'", "]", "pkg_resources", ".", "working_set", ".", "add_entry", "(", "'setup-requires'", ")", "to_install", "=", "...
Install the listed requirements
[ "Install", "the", "listed", "requirements" ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/setup_helper.py#L58-L69
train
tanghaibao/goatools
setup_helper.py
SetupHelper.get_long_description
def get_long_description(self, filename='README.md'): """ I really prefer Markdown to reStructuredText. PyPi does not. """ try: import pypandoc description = pypandoc.convert_file('README.md', 'rst', 'md') except (IOError, ImportError): description = o...
python
def get_long_description(self, filename='README.md'): """ I really prefer Markdown to reStructuredText. PyPi does not. """ try: import pypandoc description = pypandoc.convert_file('README.md', 'rst', 'md') except (IOError, ImportError): description = o...
[ "def", "get_long_description", "(", "self", ",", "filename", "=", "'README.md'", ")", ":", "try", ":", "import", "pypandoc", "description", "=", "pypandoc", ".", "convert_file", "(", "'README.md'", ",", "'rst'", ",", "'md'", ")", "except", "(", "IOError", ",...
I really prefer Markdown to reStructuredText. PyPi does not.
[ "I", "really", "prefer", "Markdown", "to", "reStructuredText", ".", "PyPi", "does", "not", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/setup_helper.py#L71-L79
train
tanghaibao/goatools
goatools/grouper/sorter.py
Sorter.prt_gos
def prt_gos(self, prt=sys.stdout, **kws_usr): """Sort user GO ids, grouped under broader GO terms or sections. Print to screen.""" # deprecated # Keyword arguments (control content): hdrgo_prt section_prt use_sections # desc2nts contains: (sections hdrgo_prt sortobj) or (flat hdrgo_prt s...
python
def prt_gos(self, prt=sys.stdout, **kws_usr): """Sort user GO ids, grouped under broader GO terms or sections. Print to screen.""" # deprecated # Keyword arguments (control content): hdrgo_prt section_prt use_sections # desc2nts contains: (sections hdrgo_prt sortobj) or (flat hdrgo_prt s...
[ "def", "prt_gos", "(", "self", ",", "prt", "=", "sys", ".", "stdout", ",", "**", "kws_usr", ")", ":", "desc2nts", "=", "self", ".", "get_desc2nts", "(", "**", "kws_usr", ")", "self", ".", "prt_nts", "(", "desc2nts", ",", "prt", ",", "kws_usr", ".", ...
Sort user GO ids, grouped under broader GO terms or sections. Print to screen.
[ "Sort", "user", "GO", "ids", "grouped", "under", "broader", "GO", "terms", "or", "sections", ".", "Print", "to", "screen", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/grouper/sorter.py#L64-L72
train
tanghaibao/goatools
goatools/grouper/sorter.py
Sorter.get_nts_flat
def get_nts_flat(self, hdrgo_prt=True, use_sections=True): """Return a flat list of sorted nts.""" # Either there are no sections OR we are not using them if self.sectobj is None or not use_sections: return self.sortgos.get_nts_sorted( hdrgo_prt, hdrgo...
python
def get_nts_flat(self, hdrgo_prt=True, use_sections=True): """Return a flat list of sorted nts.""" # Either there are no sections OR we are not using them if self.sectobj is None or not use_sections: return self.sortgos.get_nts_sorted( hdrgo_prt, hdrgo...
[ "def", "get_nts_flat", "(", "self", ",", "hdrgo_prt", "=", "True", ",", "use_sections", "=", "True", ")", ":", "if", "self", ".", "sectobj", "is", "None", "or", "not", "use_sections", ":", "return", "self", ".", "sortgos", ".", "get_nts_sorted", "(", "hd...
Return a flat list of sorted nts.
[ "Return", "a", "flat", "list", "of", "sorted", "nts", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/grouper/sorter.py#L165-L175
train
tanghaibao/goatools
goatools/grouper/grprobj.py
Grouper.get_sections_2d
def get_sections_2d(self): """Get 2-D list of sections and hdrgos sets actually used in grouping.""" sections_hdrgos_act = [] hdrgos_act_all = self.get_hdrgos() # Header GOs actually used to group hdrgos_act_secs = set() if self.hdrobj.sections: for section_name, hdr...
python
def get_sections_2d(self): """Get 2-D list of sections and hdrgos sets actually used in grouping.""" sections_hdrgos_act = [] hdrgos_act_all = self.get_hdrgos() # Header GOs actually used to group hdrgos_act_secs = set() if self.hdrobj.sections: for section_name, hdr...
[ "def", "get_sections_2d", "(", "self", ")", ":", "sections_hdrgos_act", "=", "[", "]", "hdrgos_act_all", "=", "self", ".", "get_hdrgos", "(", ")", "hdrgos_act_secs", "=", "set", "(", ")", "if", "self", ".", "hdrobj", ".", "sections", ":", "for", "section_n...
Get 2-D list of sections and hdrgos sets actually used in grouping.
[ "Get", "2", "-", "D", "list", "of", "sections", "and", "hdrgos", "sets", "actually", "used", "in", "grouping", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/grouper/grprobj.py#L60-L88
train
tanghaibao/goatools
goatools/grouper/grprobj.py
Grouper.get_usrgos_g_section
def get_usrgos_g_section(self, section=None): """Get usrgos in a requested section.""" if section is None: section = self.hdrobj.secdflt if section is True: return self.usrgos # Get dict of sections and hdrgos actually used in grouping section2hdrgos = cx....
python
def get_usrgos_g_section(self, section=None): """Get usrgos in a requested section.""" if section is None: section = self.hdrobj.secdflt if section is True: return self.usrgos # Get dict of sections and hdrgos actually used in grouping section2hdrgos = cx....
[ "def", "get_usrgos_g_section", "(", "self", ",", "section", "=", "None", ")", ":", "if", "section", "is", "None", ":", "section", "=", "self", ".", "hdrobj", ".", "secdflt", "if", "section", "is", "True", ":", "return", "self", ".", "usrgos", "section2hd...
Get usrgos in a requested section.
[ "Get", "usrgos", "in", "a", "requested", "section", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/grouper/grprobj.py#L90-L106
train
tanghaibao/goatools
goatools/grouper/grprobj.py
Grouper.get_section2usrnts
def get_section2usrnts(self): """Get dict section2usrnts.""" sec_nts = [] for section_name, _ in self.get_sections_2d(): usrgos = self.get_usrgos_g_section(section_name) sec_nts.append((section_name, [self.go2nt.get(u) for u in usrgos])) return cx.OrderedDict(sec_...
python
def get_section2usrnts(self): """Get dict section2usrnts.""" sec_nts = [] for section_name, _ in self.get_sections_2d(): usrgos = self.get_usrgos_g_section(section_name) sec_nts.append((section_name, [self.go2nt.get(u) for u in usrgos])) return cx.OrderedDict(sec_...
[ "def", "get_section2usrnts", "(", "self", ")", ":", "sec_nts", "=", "[", "]", "for", "section_name", ",", "_", "in", "self", ".", "get_sections_2d", "(", ")", ":", "usrgos", "=", "self", ".", "get_usrgos_g_section", "(", "section_name", ")", "sec_nts", "."...
Get dict section2usrnts.
[ "Get", "dict", "section2usrnts", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/grouper/grprobj.py#L108-L114
train
tanghaibao/goatools
goatools/grouper/grprobj.py
Grouper.get_section2items
def get_section2items(self, itemkey): """Collect all items into a single set per section.""" sec_items = [] section2usrnts = self.get_section2usrnts() for section, usrnts in section2usrnts.items(): items = set([e for nt in usrnts for e in getattr(nt, itemkey, set())]) ...
python
def get_section2items(self, itemkey): """Collect all items into a single set per section.""" sec_items = [] section2usrnts = self.get_section2usrnts() for section, usrnts in section2usrnts.items(): items = set([e for nt in usrnts for e in getattr(nt, itemkey, set())]) ...
[ "def", "get_section2items", "(", "self", ",", "itemkey", ")", ":", "sec_items", "=", "[", "]", "section2usrnts", "=", "self", ".", "get_section2usrnts", "(", ")", "for", "section", ",", "usrnts", "in", "section2usrnts", ".", "items", "(", ")", ":", "items"...
Collect all items into a single set per section.
[ "Collect", "all", "items", "into", "a", "single", "set", "per", "section", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/grouper/grprobj.py#L116-L123
train
tanghaibao/goatools
goatools/grouper/grprobj.py
Grouper.get_hdrgos_g_usrgos
def get_hdrgos_g_usrgos(self, usrgos): """Return hdrgos which contain the usrgos.""" hdrgos_for_usrgos = set() hdrgos_all = self.get_hdrgos() usrgo2hdrgo = self.get_usrgo2hdrgo() for usrgo in usrgos: if usrgo in hdrgos_all: hdrgos_for_usrgos.add(usrgo)...
python
def get_hdrgos_g_usrgos(self, usrgos): """Return hdrgos which contain the usrgos.""" hdrgos_for_usrgos = set() hdrgos_all = self.get_hdrgos() usrgo2hdrgo = self.get_usrgo2hdrgo() for usrgo in usrgos: if usrgo in hdrgos_all: hdrgos_for_usrgos.add(usrgo)...
[ "def", "get_hdrgos_g_usrgos", "(", "self", ",", "usrgos", ")", ":", "hdrgos_for_usrgos", "=", "set", "(", ")", "hdrgos_all", "=", "self", ".", "get_hdrgos", "(", ")", "usrgo2hdrgo", "=", "self", ".", "get_usrgo2hdrgo", "(", ")", "for", "usrgo", "in", "usrg...
Return hdrgos which contain the usrgos.
[ "Return", "hdrgos", "which", "contain", "the", "usrgos", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/grouper/grprobj.py#L125-L137
train
tanghaibao/goatools
goatools/grouper/grprobj.py
Grouper.get_section_hdrgos_nts
def get_section_hdrgos_nts(self, sortby=None): """Get a flat list of sections and hdrgos actually used in grouping.""" nts_all = [] section_hdrgos_actual = self.get_sections_2d() flds_all = ['Section'] + self.gosubdag.prt_attr['flds'] ntobj = cx.namedtuple("NtGoSec", " ".join(fld...
python
def get_section_hdrgos_nts(self, sortby=None): """Get a flat list of sections and hdrgos actually used in grouping.""" nts_all = [] section_hdrgos_actual = self.get_sections_2d() flds_all = ['Section'] + self.gosubdag.prt_attr['flds'] ntobj = cx.namedtuple("NtGoSec", " ".join(fld...
[ "def", "get_section_hdrgos_nts", "(", "self", ",", "sortby", "=", "None", ")", ":", "nts_all", "=", "[", "]", "section_hdrgos_actual", "=", "self", ".", "get_sections_2d", "(", ")", "flds_all", "=", "[", "'Section'", "]", "+", "self", ".", "gosubdag", ".",...
Get a flat list of sections and hdrgos actually used in grouping.
[ "Get", "a", "flat", "list", "of", "sections", "and", "hdrgos", "actually", "used", "in", "grouping", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/grouper/grprobj.py#L139-L157
train
tanghaibao/goatools
goatools/grouper/grprobj.py
Grouper.get_sections_2d_nts
def get_sections_2d_nts(self, sortby=None): """Get high GO IDs that are actually used to group current set of GO IDs.""" sections_2d_nts = [] for section_name, hdrgos_actual in self.get_sections_2d(): hdrgo_nts = self.gosubdag.get_nts(hdrgos_actual, sortby=sortby) section...
python
def get_sections_2d_nts(self, sortby=None): """Get high GO IDs that are actually used to group current set of GO IDs.""" sections_2d_nts = [] for section_name, hdrgos_actual in self.get_sections_2d(): hdrgo_nts = self.gosubdag.get_nts(hdrgos_actual, sortby=sortby) section...
[ "def", "get_sections_2d_nts", "(", "self", ",", "sortby", "=", "None", ")", ":", "sections_2d_nts", "=", "[", "]", "for", "section_name", ",", "hdrgos_actual", "in", "self", ".", "get_sections_2d", "(", ")", ":", "hdrgo_nts", "=", "self", ".", "gosubdag", ...
Get high GO IDs that are actually used to group current set of GO IDs.
[ "Get", "high", "GO", "IDs", "that", "are", "actually", "used", "to", "group", "current", "set", "of", "GO", "IDs", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/grouper/grprobj.py#L159-L165
train
tanghaibao/goatools
goatools/grouper/grprobj.py
Grouper.get_usrgos_g_hdrgos
def get_usrgos_g_hdrgos(self, hdrgos): """Return usrgos under provided hdrgos.""" usrgos_all = set() if isinstance(hdrgos, str): hdrgos = [hdrgos] for hdrgo in hdrgos: usrgos_cur = self.hdrgo2usrgos.get(hdrgo, None) if usrgos_cur is not None: ...
python
def get_usrgos_g_hdrgos(self, hdrgos): """Return usrgos under provided hdrgos.""" usrgos_all = set() if isinstance(hdrgos, str): hdrgos = [hdrgos] for hdrgo in hdrgos: usrgos_cur = self.hdrgo2usrgos.get(hdrgo, None) if usrgos_cur is not None: ...
[ "def", "get_usrgos_g_hdrgos", "(", "self", ",", "hdrgos", ")", ":", "usrgos_all", "=", "set", "(", ")", "if", "isinstance", "(", "hdrgos", ",", "str", ")", ":", "hdrgos", "=", "[", "hdrgos", "]", "for", "hdrgo", "in", "hdrgos", ":", "usrgos_cur", "=", ...
Return usrgos under provided hdrgos.
[ "Return", "usrgos", "under", "provided", "hdrgos", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/grouper/grprobj.py#L171-L182
train
tanghaibao/goatools
goatools/grouper/grprobj.py
Grouper.get_hdrgo2usrgos
def get_hdrgo2usrgos(self, hdrgos): """Return a subset of hdrgo2usrgos.""" get_usrgos = self.hdrgo2usrgos.get hdrgos_actual = self.get_hdrgos().intersection(hdrgos) return {h:get_usrgos(h) for h in hdrgos_actual}
python
def get_hdrgo2usrgos(self, hdrgos): """Return a subset of hdrgo2usrgos.""" get_usrgos = self.hdrgo2usrgos.get hdrgos_actual = self.get_hdrgos().intersection(hdrgos) return {h:get_usrgos(h) for h in hdrgos_actual}
[ "def", "get_hdrgo2usrgos", "(", "self", ",", "hdrgos", ")", ":", "get_usrgos", "=", "self", ".", "hdrgo2usrgos", ".", "get", "hdrgos_actual", "=", "self", ".", "get_hdrgos", "(", ")", ".", "intersection", "(", "hdrgos", ")", "return", "{", "h", ":", "get...
Return a subset of hdrgo2usrgos.
[ "Return", "a", "subset", "of", "hdrgo2usrgos", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/grouper/grprobj.py#L196-L200
train
tanghaibao/goatools
goatools/grouper/grprobj.py
Grouper.get_usrgo2hdrgo
def get_usrgo2hdrgo(self): """Return a dict with all user GO IDs as keys and their respective header GOs as values.""" usrgo2hdrgo = {} for hdrgo, usrgos in self.hdrgo2usrgos.items(): for usrgo in usrgos: assert usrgo not in usrgo2hdrgo usrgo2hdrgo[usr...
python
def get_usrgo2hdrgo(self): """Return a dict with all user GO IDs as keys and their respective header GOs as values.""" usrgo2hdrgo = {} for hdrgo, usrgos in self.hdrgo2usrgos.items(): for usrgo in usrgos: assert usrgo not in usrgo2hdrgo usrgo2hdrgo[usr...
[ "def", "get_usrgo2hdrgo", "(", "self", ")", ":", "usrgo2hdrgo", "=", "{", "}", "for", "hdrgo", ",", "usrgos", "in", "self", ".", "hdrgo2usrgos", ".", "items", "(", ")", ":", "for", "usrgo", "in", "usrgos", ":", "assert", "usrgo", "not", "in", "usrgo2hd...
Return a dict with all user GO IDs as keys and their respective header GOs as values.
[ "Return", "a", "dict", "with", "all", "user", "GO", "IDs", "as", "keys", "and", "their", "respective", "header", "GOs", "as", "values", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/grouper/grprobj.py#L202-L217
train
tanghaibao/goatools
goatools/grouper/grprobj.py
Grouper.get_go2sectiontxt
def get_go2sectiontxt(self): """Return a dict with actual header and user GO IDs as keys and their sections as values.""" go2txt = {} _get_secs = self.hdrobj.get_sections hdrgo2sectxt = {h:" ".join(_get_secs(h)) for h in self.get_hdrgos()} usrgo2hdrgo = self.get_usrgo2hdrgo() ...
python
def get_go2sectiontxt(self): """Return a dict with actual header and user GO IDs as keys and their sections as values.""" go2txt = {} _get_secs = self.hdrobj.get_sections hdrgo2sectxt = {h:" ".join(_get_secs(h)) for h in self.get_hdrgos()} usrgo2hdrgo = self.get_usrgo2hdrgo() ...
[ "def", "get_go2sectiontxt", "(", "self", ")", ":", "go2txt", "=", "{", "}", "_get_secs", "=", "self", ".", "hdrobj", ".", "get_sections", "hdrgo2sectxt", "=", "{", "h", ":", "\" \"", ".", "join", "(", "_get_secs", "(", "h", ")", ")", "for", "h", "in"...
Return a dict with actual header and user GO IDs as keys and their sections as values.
[ "Return", "a", "dict", "with", "actual", "header", "and", "user", "GO", "IDs", "as", "keys", "and", "their", "sections", "as", "values", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/grouper/grprobj.py#L219-L228
train
tanghaibao/goatools
goatools/grouper/grprobj.py
Grouper.get_usrgo2sections
def get_usrgo2sections(self): """Return a dict with all user GO IDs as keys and their sections as values.""" usrgo2sections = cx.defaultdict(set) usrgo2hdrgo = self.get_usrgo2hdrgo() get_sections = self.hdrobj.get_sections for usrgo, hdrgo in usrgo2hdrgo.items(): sect...
python
def get_usrgo2sections(self): """Return a dict with all user GO IDs as keys and their sections as values.""" usrgo2sections = cx.defaultdict(set) usrgo2hdrgo = self.get_usrgo2hdrgo() get_sections = self.hdrobj.get_sections for usrgo, hdrgo in usrgo2hdrgo.items(): sect...
[ "def", "get_usrgo2sections", "(", "self", ")", ":", "usrgo2sections", "=", "cx", ".", "defaultdict", "(", "set", ")", "usrgo2hdrgo", "=", "self", ".", "get_usrgo2hdrgo", "(", ")", "get_sections", "=", "self", ".", "hdrobj", ".", "get_sections", "for", "usrgo...
Return a dict with all user GO IDs as keys and their sections as values.
[ "Return", "a", "dict", "with", "all", "user", "GO", "IDs", "as", "keys", "and", "their", "sections", "as", "values", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/grouper/grprobj.py#L230-L243
train
tanghaibao/goatools
goatools/grouper/grprobj.py
Grouper.get_fout_base
def get_fout_base(self, goid, name=None, pre="gogrp"): """Get filename for a group of GO IDs under a single header GO ID.""" goobj = self.gosubdag.go2obj[goid] if name is None: name = self.grpname.replace(" ", "_") sections = "_".join(self.hdrobj.get_sections(goid)) r...
python
def get_fout_base(self, goid, name=None, pre="gogrp"): """Get filename for a group of GO IDs under a single header GO ID.""" goobj = self.gosubdag.go2obj[goid] if name is None: name = self.grpname.replace(" ", "_") sections = "_".join(self.hdrobj.get_sections(goid)) r...
[ "def", "get_fout_base", "(", "self", ",", "goid", ",", "name", "=", "None", ",", "pre", "=", "\"gogrp\"", ")", ":", "goobj", "=", "self", ".", "gosubdag", ".", "go2obj", "[", "goid", "]", "if", "name", "is", "None", ":", "name", "=", "self", ".", ...
Get filename for a group of GO IDs under a single header GO ID.
[ "Get", "filename", "for", "a", "group", "of", "GO", "IDs", "under", "a", "single", "header", "GO", "ID", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/grouper/grprobj.py#L245-L258
train
tanghaibao/goatools
goatools/grouper/grprobj.py
Grouper._get_depthsr
def _get_depthsr(self, goobj): """Return DNN or RNN depending on if relationships are loaded.""" if 'reldepth' in self.gosubdag.prt_attr['flds']: return "R{R:02}".format(R=goobj.reldepth) return "D{D:02}".format(D=goobj.depth)
python
def _get_depthsr(self, goobj): """Return DNN or RNN depending on if relationships are loaded.""" if 'reldepth' in self.gosubdag.prt_attr['flds']: return "R{R:02}".format(R=goobj.reldepth) return "D{D:02}".format(D=goobj.depth)
[ "def", "_get_depthsr", "(", "self", ",", "goobj", ")", ":", "if", "'reldepth'", "in", "self", ".", "gosubdag", ".", "prt_attr", "[", "'flds'", "]", ":", "return", "\"R{R:02}\"", ".", "format", "(", "R", "=", "goobj", ".", "reldepth", ")", "return", "\"...
Return DNN or RNN depending on if relationships are loaded.
[ "Return", "DNN", "or", "RNN", "depending", "on", "if", "relationships", "are", "loaded", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/grouper/grprobj.py#L260-L264
train
tanghaibao/goatools
goatools/grouper/grprobj.py
Grouper._str_replace
def _str_replace(txt): """Makes a small text amenable to being used in a filename.""" txt = txt.replace(",", "") txt = txt.replace(" ", "_") txt = txt.replace(":", "") txt = txt.replace(".", "") txt = txt.replace("/", "") txt = txt.replace("", "") return t...
python
def _str_replace(txt): """Makes a small text amenable to being used in a filename.""" txt = txt.replace(",", "") txt = txt.replace(" ", "_") txt = txt.replace(":", "") txt = txt.replace(".", "") txt = txt.replace("/", "") txt = txt.replace("", "") return t...
[ "def", "_str_replace", "(", "txt", ")", ":", "txt", "=", "txt", ".", "replace", "(", "\",\"", ",", "\"\"", ")", "txt", "=", "txt", ".", "replace", "(", "\" \"", ",", "\"_\"", ")", "txt", "=", "txt", ".", "replace", "(", "\":\"", ",", "\"\"", ")",...
Makes a small text amenable to being used in a filename.
[ "Makes", "a", "small", "text", "amenable", "to", "being", "used", "in", "a", "filename", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/grouper/grprobj.py#L267-L275
train
tanghaibao/goatools
goatools/rpt/prtfmt.py
PrtFmt.get_prtfmt_list
def get_prtfmt_list(self, flds, add_nl=True): """Get print format, given fields.""" fmts = [] for fld in flds: if fld[:2] == 'p_': fmts.append('{{{FLD}:8.2e}}'.format(FLD=fld)) elif fld in self.default_fld2fmt: fmts.append(self.default_fld2...
python
def get_prtfmt_list(self, flds, add_nl=True): """Get print format, given fields.""" fmts = [] for fld in flds: if fld[:2] == 'p_': fmts.append('{{{FLD}:8.2e}}'.format(FLD=fld)) elif fld in self.default_fld2fmt: fmts.append(self.default_fld2...
[ "def", "get_prtfmt_list", "(", "self", ",", "flds", ",", "add_nl", "=", "True", ")", ":", "fmts", "=", "[", "]", "for", "fld", "in", "flds", ":", "if", "fld", "[", ":", "2", "]", "==", "'p_'", ":", "fmts", ".", "append", "(", "'{{{FLD}:8.2e}}'", ...
Get print format, given fields.
[ "Get", "print", "format", "given", "fields", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/rpt/prtfmt.py#L55-L67
train
tanghaibao/goatools
scripts/fetch_associations.py
main
def main(): """Fetch simple gene-term assocaitions from Golr using bioentity document type, one line per gene.""" import argparse prs = argparse.ArgumentParser(__doc__, formatter_class=argparse.ArgumentDefaultsHelpFormatter) prs.add_argument('--taxon_id', type=str, ...
python
def main(): """Fetch simple gene-term assocaitions from Golr using bioentity document type, one line per gene.""" import argparse prs = argparse.ArgumentParser(__doc__, formatter_class=argparse.ArgumentDefaultsHelpFormatter) prs.add_argument('--taxon_id', type=str, ...
[ "def", "main", "(", ")", ":", "import", "argparse", "prs", "=", "argparse", ".", "ArgumentParser", "(", "__doc__", ",", "formatter_class", "=", "argparse", ".", "ArgumentDefaultsHelpFormatter", ")", "prs", ".", "add_argument", "(", "'--taxon_id'", ",", "type", ...
Fetch simple gene-term assocaitions from Golr using bioentity document type, one line per gene.
[ "Fetch", "simple", "gene", "-", "term", "assocaitions", "from", "Golr", "using", "bioentity", "document", "type", "one", "line", "per", "gene", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/scripts/fetch_associations.py#L34-L76
train
tanghaibao/goatools
goatools/gosubdag/plot/go_name_shorten.py
ShortenText.get_short_plot_name
def get_short_plot_name(self, goobj): """Shorten some GO names so plots are smaller.""" name = goobj.name if self._keep_this(name): return self.replace_greek(name) name = name.replace("cellular response to chemical stimulus", "cellular rsp. to chem...
python
def get_short_plot_name(self, goobj): """Shorten some GO names so plots are smaller.""" name = goobj.name if self._keep_this(name): return self.replace_greek(name) name = name.replace("cellular response to chemical stimulus", "cellular rsp. to chem...
[ "def", "get_short_plot_name", "(", "self", ",", "goobj", ")", ":", "name", "=", "goobj", ".", "name", "if", "self", ".", "_keep_this", "(", "name", ")", ":", "return", "self", ".", "replace_greek", "(", "name", ")", "name", "=", "name", ".", "replace",...
Shorten some GO names so plots are smaller.
[ "Shorten", "some", "GO", "names", "so", "plots", "are", "smaller", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/gosubdag/plot/go_name_shorten.py#L26-L60
train
tanghaibao/goatools
goatools/gosubdag/plot/go_name_shorten.py
ShortenText.shorten_go_name_ptbl1
def shorten_go_name_ptbl1(self, name): """Shorten GO name for tables in paper.""" if self._keep_this(name): return name name = name.replace("negative", "neg.") name = name.replace("positive", "pos.") name = name.replace("response", "rsp.") name = name.replace(...
python
def shorten_go_name_ptbl1(self, name): """Shorten GO name for tables in paper.""" if self._keep_this(name): return name name = name.replace("negative", "neg.") name = name.replace("positive", "pos.") name = name.replace("response", "rsp.") name = name.replace(...
[ "def", "shorten_go_name_ptbl1", "(", "self", ",", "name", ")", ":", "if", "self", ".", "_keep_this", "(", "name", ")", ":", "return", "name", "name", "=", "name", ".", "replace", "(", "\"negative\"", ",", "\"neg.\"", ")", "name", "=", "name", ".", "rep...
Shorten GO name for tables in paper.
[ "Shorten", "GO", "name", "for", "tables", "in", "paper", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/gosubdag/plot/go_name_shorten.py#L62-L71
train
tanghaibao/goatools
goatools/gosubdag/plot/go_name_shorten.py
ShortenText.shorten_go_name_ptbl3
def shorten_go_name_ptbl3(self, name, dcnt): """Shorten GO description for Table 3 in manuscript.""" if self._keep_this(name): return name name = name.replace("positive regulation of immune system process", "+ reg. of immune sys. process") name = n...
python
def shorten_go_name_ptbl3(self, name, dcnt): """Shorten GO description for Table 3 in manuscript.""" if self._keep_this(name): return name name = name.replace("positive regulation of immune system process", "+ reg. of immune sys. process") name = n...
[ "def", "shorten_go_name_ptbl3", "(", "self", ",", "name", ",", "dcnt", ")", ":", "if", "self", ".", "_keep_this", "(", "name", ")", ":", "return", "name", "name", "=", "name", ".", "replace", "(", "\"positive regulation of immune system process\"", ",", "\"+ r...
Shorten GO description for Table 3 in manuscript.
[ "Shorten", "GO", "description", "for", "Table", "3", "in", "manuscript", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/gosubdag/plot/go_name_shorten.py#L73-L97
train
tanghaibao/goatools
goatools/gosubdag/plot/go_name_shorten.py
ShortenText.shorten_go_name_all
def shorten_go_name_all(self, name): """Shorten GO name for tables in paper, supplemental materials, and plots.""" name = self.replace_greek(name) name = name.replace("MHC class I", "MHC-I") return name
python
def shorten_go_name_all(self, name): """Shorten GO name for tables in paper, supplemental materials, and plots.""" name = self.replace_greek(name) name = name.replace("MHC class I", "MHC-I") return name
[ "def", "shorten_go_name_all", "(", "self", ",", "name", ")", ":", "name", "=", "self", ".", "replace_greek", "(", "name", ")", "name", "=", "name", ".", "replace", "(", "\"MHC class I\"", ",", "\"MHC-I\"", ")", "return", "name" ]
Shorten GO name for tables in paper, supplemental materials, and plots.
[ "Shorten", "GO", "name", "for", "tables", "in", "paper", "supplemental", "materials", "and", "plots", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/gosubdag/plot/go_name_shorten.py#L125-L129
train
tanghaibao/goatools
goatools/gosubdag/plot/go_name_shorten.py
ShortenText._keep_this
def _keep_this(self, name): """Return True if there are to be no modifications to name.""" for keep_name in self.keep: if name == keep_name: return True return False
python
def _keep_this(self, name): """Return True if there are to be no modifications to name.""" for keep_name in self.keep: if name == keep_name: return True return False
[ "def", "_keep_this", "(", "self", ",", "name", ")", ":", "for", "keep_name", "in", "self", ".", "keep", ":", "if", "name", "==", "keep_name", ":", "return", "True", "return", "False" ]
Return True if there are to be no modifications to name.
[ "Return", "True", "if", "there", "are", "to", "be", "no", "modifications", "to", "name", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/gosubdag/plot/go_name_shorten.py#L131-L136
train
tanghaibao/goatools
goatools/gosubdag/rpt/wr_xlsx.py
read_d1_letter
def read_d1_letter(fin_txt): """Reads letter aliases from a text file created by GoDepth1LettersWr.""" go2letter = {} re_goid = re.compile(r"(GO:\d{7})") with open(fin_txt) as ifstrm: for line in ifstrm: mtch = re_goid.search(line) if mtch and line[:1] != ' ': ...
python
def read_d1_letter(fin_txt): """Reads letter aliases from a text file created by GoDepth1LettersWr.""" go2letter = {} re_goid = re.compile(r"(GO:\d{7})") with open(fin_txt) as ifstrm: for line in ifstrm: mtch = re_goid.search(line) if mtch and line[:1] != ' ': ...
[ "def", "read_d1_letter", "(", "fin_txt", ")", ":", "go2letter", "=", "{", "}", "re_goid", "=", "re", ".", "compile", "(", "r\"(GO:\\d{7})\"", ")", "with", "open", "(", "fin_txt", ")", "as", "ifstrm", ":", "for", "line", "in", "ifstrm", ":", "mtch", "="...
Reads letter aliases from a text file created by GoDepth1LettersWr.
[ "Reads", "letter", "aliases", "from", "a", "text", "file", "created", "by", "GoDepth1LettersWr", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/gosubdag/rpt/wr_xlsx.py#L66-L76
train
tanghaibao/goatools
goatools/gosubdag/rpt/wr_xlsx.py
GoSubDagWr.get_goids_sections
def get_goids_sections(sections): """Return all the GO IDs in a 2-D sections list.""" goids_all = set() for _, goids_sec in sections: goids_all |= set(goids_sec) return goids_all
python
def get_goids_sections(sections): """Return all the GO IDs in a 2-D sections list.""" goids_all = set() for _, goids_sec in sections: goids_all |= set(goids_sec) return goids_all
[ "def", "get_goids_sections", "(", "sections", ")", ":", "goids_all", "=", "set", "(", ")", "for", "_", ",", "goids_sec", "in", "sections", ":", "goids_all", "|=", "set", "(", "goids_sec", ")", "return", "goids_all" ]
Return all the GO IDs in a 2-D sections list.
[ "Return", "all", "the", "GO", "IDs", "in", "a", "2", "-", "D", "sections", "list", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/gosubdag/rpt/wr_xlsx.py#L58-L63
train
tanghaibao/goatools
goatools/gosubdag/rpt/wr_xlsx.py
GoDepth1LettersWr.prt_txt
def prt_txt(self, prt=sys.stdout, pre=''): """Print letters, descendant count, and GO information.""" data_nts = self.get_d1nts() for ntdata in data_nts: prt.write("{PRE}{L:1} {NS} {d:6,} D{D:02} {GO} {NAME}\n".format( PRE=pre, L=ntdata.D1, ...
python
def prt_txt(self, prt=sys.stdout, pre=''): """Print letters, descendant count, and GO information.""" data_nts = self.get_d1nts() for ntdata in data_nts: prt.write("{PRE}{L:1} {NS} {d:6,} D{D:02} {GO} {NAME}\n".format( PRE=pre, L=ntdata.D1, ...
[ "def", "prt_txt", "(", "self", ",", "prt", "=", "sys", ".", "stdout", ",", "pre", "=", "''", ")", ":", "data_nts", "=", "self", ".", "get_d1nts", "(", ")", "for", "ntdata", "in", "data_nts", ":", "prt", ".", "write", "(", "\"{PRE}{L:1} {NS} {d:6,} D{D:...
Print letters, descendant count, and GO information.
[ "Print", "letters", "descendant", "count", "and", "GO", "information", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/gosubdag/rpt/wr_xlsx.py#L88-L100
train
tanghaibao/goatools
goatools/gosubdag/rpt/wr_xlsx.py
GoDepth1LettersWr.wr_xlsx
def wr_xlsx(self, fout_xlsx="gos_depth01.xlsx", **kws): """Write xlsx table of depth-01 GO terms and their letter representation.""" data_nts = self.get_d1nts() if 'fld2col_widths' not in kws: kws['fld2col_widths'] = {'D1': 6, 'NS':3, 'depth': 5, 'GO': 12, 'name': 40} if 'hdr...
python
def wr_xlsx(self, fout_xlsx="gos_depth01.xlsx", **kws): """Write xlsx table of depth-01 GO terms and their letter representation.""" data_nts = self.get_d1nts() if 'fld2col_widths' not in kws: kws['fld2col_widths'] = {'D1': 6, 'NS':3, 'depth': 5, 'GO': 12, 'name': 40} if 'hdr...
[ "def", "wr_xlsx", "(", "self", ",", "fout_xlsx", "=", "\"gos_depth01.xlsx\"", ",", "**", "kws", ")", ":", "data_nts", "=", "self", ".", "get_d1nts", "(", ")", "if", "'fld2col_widths'", "not", "in", "kws", ":", "kws", "[", "'fld2col_widths'", "]", "=", "{...
Write xlsx table of depth-01 GO terms and their letter representation.
[ "Write", "xlsx", "table", "of", "depth", "-", "01", "GO", "terms", "and", "their", "letter", "representation", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/gosubdag/rpt/wr_xlsx.py#L102-L109
train
tanghaibao/goatools
goatools/gosubdag/rpt/wr_xlsx.py
GoDepth1LettersWr.get_d1nts
def get_d1nts(self): """Get letters for depth-01 GO terms, descendants count, and GO information.""" data = [] ntdata = cx.namedtuple("NtPrt", "D1 NS dcnt depth GO name") namespace = None for ntlet in sorted(self.goone2ntletter.values(), key=lambda nt:...
python
def get_d1nts(self): """Get letters for depth-01 GO terms, descendants count, and GO information.""" data = [] ntdata = cx.namedtuple("NtPrt", "D1 NS dcnt depth GO name") namespace = None for ntlet in sorted(self.goone2ntletter.values(), key=lambda nt:...
[ "def", "get_d1nts", "(", "self", ")", ":", "data", "=", "[", "]", "ntdata", "=", "cx", ".", "namedtuple", "(", "\"NtPrt\"", ",", "\"D1 NS dcnt depth GO name\"", ")", "namespace", "=", "None", "for", "ntlet", "in", "sorted", "(", "self", ".", "goone2ntlette...
Get letters for depth-01 GO terms, descendants count, and GO information.
[ "Get", "letters", "for", "depth", "-", "01", "GO", "terms", "descendants", "count", "and", "GO", "information", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/gosubdag/rpt/wr_xlsx.py#L172-L190
train
tanghaibao/goatools
goatools/gosubdag/rpt/wr_xlsx.py
GoDepth1LettersWr._init_ns2nt
def _init_ns2nt(rcntobj): """Save depth-00 GO terms ordered using descendants cnt.""" go2dcnt = rcntobj.go2dcnt ntobj = cx.namedtuple("NtD1", "D1 dcnt goobj") d0s = rcntobj.depth2goobjs[0] ns_nt = [(o.namespace, ntobj(D1="", dcnt=go2dcnt[o.id], goobj=o)) for o in d0s] ret...
python
def _init_ns2nt(rcntobj): """Save depth-00 GO terms ordered using descendants cnt.""" go2dcnt = rcntobj.go2dcnt ntobj = cx.namedtuple("NtD1", "D1 dcnt goobj") d0s = rcntobj.depth2goobjs[0] ns_nt = [(o.namespace, ntobj(D1="", dcnt=go2dcnt[o.id], goobj=o)) for o in d0s] ret...
[ "def", "_init_ns2nt", "(", "rcntobj", ")", ":", "go2dcnt", "=", "rcntobj", ".", "go2dcnt", "ntobj", "=", "cx", ".", "namedtuple", "(", "\"NtD1\"", ",", "\"D1 dcnt goobj\"", ")", "d0s", "=", "rcntobj", ".", "depth2goobjs", "[", "0", "]", "ns_nt", "=", "["...
Save depth-00 GO terms ordered using descendants cnt.
[ "Save", "depth", "-", "00", "GO", "terms", "ordered", "using", "descendants", "cnt", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/gosubdag/rpt/wr_xlsx.py#L193-L199
train
tanghaibao/goatools
goatools/grouper/wrxlsx.py
WrXlsxSortedGos._get_xlsx_kws
def _get_xlsx_kws(self, **kws_usr): """Return keyword arguments relevant to writing an xlsx.""" kws_xlsx = {'fld2col_widths':self._get_fld2col_widths(**kws_usr), 'items':'GO IDs'} remaining_keys = set(['title', 'hdrs', 'prt_flds', 'fld2fmt', 'ntval2wbfmtdict', 'ntfl...
python
def _get_xlsx_kws(self, **kws_usr): """Return keyword arguments relevant to writing an xlsx.""" kws_xlsx = {'fld2col_widths':self._get_fld2col_widths(**kws_usr), 'items':'GO IDs'} remaining_keys = set(['title', 'hdrs', 'prt_flds', 'fld2fmt', 'ntval2wbfmtdict', 'ntfl...
[ "def", "_get_xlsx_kws", "(", "self", ",", "**", "kws_usr", ")", ":", "kws_xlsx", "=", "{", "'fld2col_widths'", ":", "self", ".", "_get_fld2col_widths", "(", "**", "kws_usr", ")", ",", "'items'", ":", "'GO IDs'", "}", "remaining_keys", "=", "set", "(", "[",...
Return keyword arguments relevant to writing an xlsx.
[ "Return", "keyword", "arguments", "relevant", "to", "writing", "an", "xlsx", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/grouper/wrxlsx.py#L113-L121
train
tanghaibao/goatools
goatools/grouper/wrxlsx.py
WrXlsxSortedGos._adjust_prt_flds
def _adjust_prt_flds(self, kws_xlsx, desc2nts, shade_hdrgos): """Print user-requested fields or provided fields minus info fields.""" # Use xlsx prt_flds from the user, if provided if "prt_flds" in kws_xlsx: return kws_xlsx["prt_flds"] # If the user did not provide specific f...
python
def _adjust_prt_flds(self, kws_xlsx, desc2nts, shade_hdrgos): """Print user-requested fields or provided fields minus info fields.""" # Use xlsx prt_flds from the user, if provided if "prt_flds" in kws_xlsx: return kws_xlsx["prt_flds"] # If the user did not provide specific f...
[ "def", "_adjust_prt_flds", "(", "self", ",", "kws_xlsx", ",", "desc2nts", ",", "shade_hdrgos", ")", ":", "if", "\"prt_flds\"", "in", "kws_xlsx", ":", "return", "kws_xlsx", "[", "\"prt_flds\"", "]", "dont_print", "=", "set", "(", "[", "'hdr_idx'", ",", "'is_h...
Print user-requested fields or provided fields minus info fields.
[ "Print", "user", "-", "requested", "fields", "or", "provided", "fields", "minus", "info", "fields", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/grouper/wrxlsx.py#L123-L145
train
tanghaibao/goatools
goatools/grouper/wrxlsx.py
WrXlsxSortedGos._get_fld2col_widths
def _get_fld2col_widths(self, **kws): """Return xlsx column widths based on default and user-specified field-value pairs.""" fld2col_widths = self._init_fld2col_widths() if 'fld2col_widths' not in kws: return fld2col_widths for fld, val in kws['fld2col_widths'].items(): ...
python
def _get_fld2col_widths(self, **kws): """Return xlsx column widths based on default and user-specified field-value pairs.""" fld2col_widths = self._init_fld2col_widths() if 'fld2col_widths' not in kws: return fld2col_widths for fld, val in kws['fld2col_widths'].items(): ...
[ "def", "_get_fld2col_widths", "(", "self", ",", "**", "kws", ")", ":", "fld2col_widths", "=", "self", ".", "_init_fld2col_widths", "(", ")", "if", "'fld2col_widths'", "not", "in", "kws", ":", "return", "fld2col_widths", "for", "fld", ",", "val", "in", "kws",...
Return xlsx column widths based on default and user-specified field-value pairs.
[ "Return", "xlsx", "column", "widths", "based", "on", "default", "and", "user", "-", "specified", "field", "-", "value", "pairs", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/grouper/wrxlsx.py#L147-L154
train
tanghaibao/goatools
goatools/grouper/wrxlsx.py
WrXlsxSortedGos._init_fld2col_widths
def _init_fld2col_widths(self): """Return default column widths for writing an Excel Spreadsheet.""" # GO info namedtuple fields: NS dcnt level depth GO D1 name # GO header namedtuple fields: format_txt hdr_idx fld2col_widths = GoSubDagWr.fld2col_widths.copy() for fld, wid in sel...
python
def _init_fld2col_widths(self): """Return default column widths for writing an Excel Spreadsheet.""" # GO info namedtuple fields: NS dcnt level depth GO D1 name # GO header namedtuple fields: format_txt hdr_idx fld2col_widths = GoSubDagWr.fld2col_widths.copy() for fld, wid in sel...
[ "def", "_init_fld2col_widths", "(", "self", ")", ":", "fld2col_widths", "=", "GoSubDagWr", ".", "fld2col_widths", ".", "copy", "(", ")", "for", "fld", ",", "wid", "in", "self", ".", "oprtfmt", ".", "default_fld2col_widths", ".", "items", "(", ")", ":", "fl...
Return default column widths for writing an Excel Spreadsheet.
[ "Return", "default", "column", "widths", "for", "writing", "an", "Excel", "Spreadsheet", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/grouper/wrxlsx.py#L156-L165
train
tanghaibao/goatools
goatools/grouper/wrxlsx.py
WrXlsxSortedGos._get_shade_hdrgos
def _get_shade_hdrgos(**kws): """If no hdrgo_prt specified, and these conditions are present -> hdrgo_prt=F.""" # KWS: shade_hdrgos hdrgo_prt section_sortby top_n if 'shade_hdrgos' in kws: return kws['shade_hdrgos'] # Return user-sepcified hdrgo_prt, if provided if 'h...
python
def _get_shade_hdrgos(**kws): """If no hdrgo_prt specified, and these conditions are present -> hdrgo_prt=F.""" # KWS: shade_hdrgos hdrgo_prt section_sortby top_n if 'shade_hdrgos' in kws: return kws['shade_hdrgos'] # Return user-sepcified hdrgo_prt, if provided if 'h...
[ "def", "_get_shade_hdrgos", "(", "**", "kws", ")", ":", "if", "'shade_hdrgos'", "in", "kws", ":", "return", "kws", "[", "'shade_hdrgos'", "]", "if", "'hdrgo_prt'", "in", "kws", ":", "return", "kws", "[", "'hdrgo_prt'", "]", "if", "'section_sortby'", "in", ...
If no hdrgo_prt specified, and these conditions are present -> hdrgo_prt=F.
[ "If", "no", "hdrgo_prt", "specified", "and", "these", "conditions", "are", "present", "-", ">", "hdrgo_prt", "=", "F", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/grouper/wrxlsx.py#L174-L190
train
tanghaibao/goatools
goatools/rpt/goea_nt_xfrm.py
MgrNtGOEAs.dflt_sortby_objgoea
def dflt_sortby_objgoea(goea_res): """Default sorting of GOEA results.""" return [getattr(goea_res, 'enrichment'), getattr(goea_res, 'namespace'), getattr(goea_res, 'p_uncorrected'), getattr(goea_res, 'depth'), getattr(goea_res, 'GO')]
python
def dflt_sortby_objgoea(goea_res): """Default sorting of GOEA results.""" return [getattr(goea_res, 'enrichment'), getattr(goea_res, 'namespace'), getattr(goea_res, 'p_uncorrected'), getattr(goea_res, 'depth'), getattr(goea_res, 'GO')]
[ "def", "dflt_sortby_objgoea", "(", "goea_res", ")", ":", "return", "[", "getattr", "(", "goea_res", ",", "'enrichment'", ")", ",", "getattr", "(", "goea_res", ",", "'namespace'", ")", ",", "getattr", "(", "goea_res", ",", "'p_uncorrected'", ")", ",", "getatt...
Default sorting of GOEA results.
[ "Default", "sorting", "of", "GOEA", "results", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/rpt/goea_nt_xfrm.py#L44-L50
train
tanghaibao/goatools
goatools/rpt/goea_nt_xfrm.py
MgrNtGOEAs.dflt_sortby_ntgoea
def dflt_sortby_ntgoea(ntgoea): """Default sorting of GOEA results stored in namedtuples.""" return [ntgoea.enrichment, ntgoea.namespace, ntgoea.p_uncorrected, ntgoea.depth, ntgoea.GO]
python
def dflt_sortby_ntgoea(ntgoea): """Default sorting of GOEA results stored in namedtuples.""" return [ntgoea.enrichment, ntgoea.namespace, ntgoea.p_uncorrected, ntgoea.depth, ntgoea.GO]
[ "def", "dflt_sortby_ntgoea", "(", "ntgoea", ")", ":", "return", "[", "ntgoea", ".", "enrichment", ",", "ntgoea", ".", "namespace", ",", "ntgoea", ".", "p_uncorrected", ",", "ntgoea", ".", "depth", ",", "ntgoea", ".", "GO", "]" ]
Default sorting of GOEA results stored in namedtuples.
[ "Default", "sorting", "of", "GOEA", "results", "stored", "in", "namedtuples", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/rpt/goea_nt_xfrm.py#L53-L59
train
tanghaibao/goatools
goatools/rpt/goea_nt_xfrm.py
MgrNtGOEAs.get_goea_nts_prt
def get_goea_nts_prt(self, fldnames=None, **usr_kws): """Return list of namedtuples removing fields which are redundant or verbose.""" kws = usr_kws.copy() if 'not_fldnames' not in kws: kws['not_fldnames'] = ['goterm', 'parents', 'children', 'id'] if 'rpt_fmt' not in kws: ...
python
def get_goea_nts_prt(self, fldnames=None, **usr_kws): """Return list of namedtuples removing fields which are redundant or verbose.""" kws = usr_kws.copy() if 'not_fldnames' not in kws: kws['not_fldnames'] = ['goterm', 'parents', 'children', 'id'] if 'rpt_fmt' not in kws: ...
[ "def", "get_goea_nts_prt", "(", "self", ",", "fldnames", "=", "None", ",", "**", "usr_kws", ")", ":", "kws", "=", "usr_kws", ".", "copy", "(", ")", "if", "'not_fldnames'", "not", "in", "kws", ":", "kws", "[", "'not_fldnames'", "]", "=", "[", "'goterm'"...
Return list of namedtuples removing fields which are redundant or verbose.
[ "Return", "list", "of", "namedtuples", "removing", "fields", "which", "are", "redundant", "or", "verbose", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/rpt/goea_nt_xfrm.py#L61-L68
train
tanghaibao/goatools
goatools/rpt/goea_nt_xfrm.py
MgrNtGOEAs._get_field_values
def _get_field_values(item, fldnames, rpt_fmt=None, itemid2name=None): """Return fieldnames and values of either a namedtuple or GOEnrichmentRecord.""" if hasattr(item, "_fldsdefprt"): # Is a GOEnrichmentRecord return item.get_field_values(fldnames, rpt_fmt, itemid2name) if hasattr(i...
python
def _get_field_values(item, fldnames, rpt_fmt=None, itemid2name=None): """Return fieldnames and values of either a namedtuple or GOEnrichmentRecord.""" if hasattr(item, "_fldsdefprt"): # Is a GOEnrichmentRecord return item.get_field_values(fldnames, rpt_fmt, itemid2name) if hasattr(i...
[ "def", "_get_field_values", "(", "item", ",", "fldnames", ",", "rpt_fmt", "=", "None", ",", "itemid2name", "=", "None", ")", ":", "if", "hasattr", "(", "item", ",", "\"_fldsdefprt\"", ")", ":", "return", "item", ".", "get_field_values", "(", "fldnames", ",...
Return fieldnames and values of either a namedtuple or GOEnrichmentRecord.
[ "Return", "fieldnames", "and", "values", "of", "either", "a", "namedtuple", "or", "GOEnrichmentRecord", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/rpt/goea_nt_xfrm.py#L103-L108
train
tanghaibao/goatools
goatools/rpt/goea_nt_xfrm.py
MgrNtGOEAs._get_fieldnames
def _get_fieldnames(item): """Return fieldnames of either a namedtuple or GOEnrichmentRecord.""" if hasattr(item, "_fldsdefprt"): # Is a GOEnrichmentRecord return item.get_prtflds_all() if hasattr(item, "_fields"): # Is a namedtuple return item._fields
python
def _get_fieldnames(item): """Return fieldnames of either a namedtuple or GOEnrichmentRecord.""" if hasattr(item, "_fldsdefprt"): # Is a GOEnrichmentRecord return item.get_prtflds_all() if hasattr(item, "_fields"): # Is a namedtuple return item._fields
[ "def", "_get_fieldnames", "(", "item", ")", ":", "if", "hasattr", "(", "item", ",", "\"_fldsdefprt\"", ")", ":", "return", "item", ".", "get_prtflds_all", "(", ")", "if", "hasattr", "(", "item", ",", "\"_fields\"", ")", ":", "return", "item", ".", "_fiel...
Return fieldnames of either a namedtuple or GOEnrichmentRecord.
[ "Return", "fieldnames", "of", "either", "a", "namedtuple", "or", "GOEnrichmentRecord", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/rpt/goea_nt_xfrm.py#L111-L116
train
tanghaibao/goatools
goatools/grouper/colors.py
GrouperColors.get_bordercolor
def get_bordercolor(self): """Get bordercolor based on hdrgos and usergos.""" hdrgos_all = self.grprobj.hdrobj.get_hdrgos() hdrgos_unused = hdrgos_all.difference(self.hdrgos_actual) go2bordercolor = {} # hdrgos that went unused for hdrgo in hdrgos_unused: go2b...
python
def get_bordercolor(self): """Get bordercolor based on hdrgos and usergos.""" hdrgos_all = self.grprobj.hdrobj.get_hdrgos() hdrgos_unused = hdrgos_all.difference(self.hdrgos_actual) go2bordercolor = {} # hdrgos that went unused for hdrgo in hdrgos_unused: go2b...
[ "def", "get_bordercolor", "(", "self", ")", ":", "hdrgos_all", "=", "self", ".", "grprobj", ".", "hdrobj", ".", "get_hdrgos", "(", ")", "hdrgos_unused", "=", "hdrgos_all", ".", "difference", "(", "self", ".", "hdrgos_actual", ")", "go2bordercolor", "=", "{",...
Get bordercolor based on hdrgos and usergos.
[ "Get", "bordercolor", "based", "on", "hdrgos", "and", "usergos", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/grouper/colors.py#L18-L42
train
tanghaibao/goatools
goatools/grouper/colors.py
GrouperColors.get_go2color_users
def get_go2color_users(self, usrgo_color='#feffa3', # yellow hdrusrgo_color='#d4ffea', # green hdrgo_color='#eee6f6'): # purple """Get go2color for GO DAG plots.""" go2color = {} # Color user GO IDs for goid...
python
def get_go2color_users(self, usrgo_color='#feffa3', # yellow hdrusrgo_color='#d4ffea', # green hdrgo_color='#eee6f6'): # purple """Get go2color for GO DAG plots.""" go2color = {} # Color user GO IDs for goid...
[ "def", "get_go2color_users", "(", "self", ",", "usrgo_color", "=", "'#feffa3'", ",", "hdrusrgo_color", "=", "'#d4ffea'", ",", "hdrgo_color", "=", "'#eee6f6'", ")", ":", "go2color", "=", "{", "}", "for", "goid", "in", "self", ".", "usrgos", ":", "go2color", ...
Get go2color for GO DAG plots.
[ "Get", "go2color", "for", "GO", "DAG", "plots", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/grouper/colors.py#L44-L56
train
tanghaibao/goatools
goatools/grouper/aart_geneproducts_all.py
AArtGeneProductSetsAll.run
def run(self, name, goea_nts, log): """Run gene product ASCII art.""" objaart = AArtGeneProductSetsOne(name, goea_nts, self) if self.hdrobj.sections: return objaart.prt_report_grp1(log) else: return objaart.prt_report_grp0(log)
python
def run(self, name, goea_nts, log): """Run gene product ASCII art.""" objaart = AArtGeneProductSetsOne(name, goea_nts, self) if self.hdrobj.sections: return objaart.prt_report_grp1(log) else: return objaart.prt_report_grp0(log)
[ "def", "run", "(", "self", ",", "name", ",", "goea_nts", ",", "log", ")", ":", "objaart", "=", "AArtGeneProductSetsOne", "(", "name", ",", "goea_nts", ",", "self", ")", "if", "self", ".", "hdrobj", ".", "sections", ":", "return", "objaart", ".", "prt_r...
Run gene product ASCII art.
[ "Run", "gene", "product", "ASCII", "art", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/grouper/aart_geneproducts_all.py#L40-L46
train
tanghaibao/goatools
goatools/grouper/aart_geneproducts_all.py
AArtGeneProductSetsAll.get_chr2idx
def get_chr2idx(self): """Return a dict with the ASCII art character as key and its index as value.""" return {chr(ascii_int):idx for idx, ascii_int in enumerate(self.all_chrints)}
python
def get_chr2idx(self): """Return a dict with the ASCII art character as key and its index as value.""" return {chr(ascii_int):idx for idx, ascii_int in enumerate(self.all_chrints)}
[ "def", "get_chr2idx", "(", "self", ")", ":", "return", "{", "chr", "(", "ascii_int", ")", ":", "idx", "for", "idx", ",", "ascii_int", "in", "enumerate", "(", "self", ".", "all_chrints", ")", "}" ]
Return a dict with the ASCII art character as key and its index as value.
[ "Return", "a", "dict", "with", "the", "ASCII", "art", "character", "as", "key", "and", "its", "index", "as", "value", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/grouper/aart_geneproducts_all.py#L99-L101
train
tanghaibao/goatools
goatools/grouper/aart_geneproducts_all.py
AArtGeneProductSetsAll._init_kws
def _init_kws(self): """Fill default values for keyword args, if necessary.""" # Return user-specified GO formatting, if specfied: if 'fmtgo' not in self.kws: self.kws['fmtgo'] = self.grprdflt.gosubdag.prt_attr['fmt'] + "\n" if 'fmtgo2' not in self.kws: self.kws['...
python
def _init_kws(self): """Fill default values for keyword args, if necessary.""" # Return user-specified GO formatting, if specfied: if 'fmtgo' not in self.kws: self.kws['fmtgo'] = self.grprdflt.gosubdag.prt_attr['fmt'] + "\n" if 'fmtgo2' not in self.kws: self.kws['...
[ "def", "_init_kws", "(", "self", ")", ":", "if", "'fmtgo'", "not", "in", "self", ".", "kws", ":", "self", ".", "kws", "[", "'fmtgo'", "]", "=", "self", ".", "grprdflt", ".", "gosubdag", ".", "prt_attr", "[", "'fmt'", "]", "+", "\"\\n\"", "if", "'fm...
Fill default values for keyword args, if necessary.
[ "Fill", "default", "values", "for", "keyword", "args", "if", "necessary", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/grouper/aart_geneproducts_all.py#L103-L116
train
tanghaibao/goatools
goatools/gosubdag/gosubdag_init.py
InitGOs._init_relationships
def _init_relationships(self, relationships_arg): """Return a set of relationships found in all subset GO Terms.""" if relationships_arg: relationships_all = self._get_all_relationships() if relationships_arg is True: return relationships_all else: ...
python
def _init_relationships(self, relationships_arg): """Return a set of relationships found in all subset GO Terms.""" if relationships_arg: relationships_all = self._get_all_relationships() if relationships_arg is True: return relationships_all else: ...
[ "def", "_init_relationships", "(", "self", ",", "relationships_arg", ")", ":", "if", "relationships_arg", ":", "relationships_all", "=", "self", ".", "_get_all_relationships", "(", ")", "if", "relationships_arg", "is", "True", ":", "return", "relationships_all", "el...
Return a set of relationships found in all subset GO Terms.
[ "Return", "a", "set", "of", "relationships", "found", "in", "all", "subset", "GO", "Terms", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/gosubdag/gosubdag_init.py#L39-L47
train
tanghaibao/goatools
goatools/gosubdag/gosubdag_init.py
InitGOs._get_all_relationships
def _get_all_relationships(self): """Return all relationships seen in GO Dag subset.""" relationships_all = set() for goterm in self.go2obj.values(): if goterm.relationship: relationships_all.update(goterm.relationship) if goterm.relationship_rev: ...
python
def _get_all_relationships(self): """Return all relationships seen in GO Dag subset.""" relationships_all = set() for goterm in self.go2obj.values(): if goterm.relationship: relationships_all.update(goterm.relationship) if goterm.relationship_rev: ...
[ "def", "_get_all_relationships", "(", "self", ")", ":", "relationships_all", "=", "set", "(", ")", "for", "goterm", "in", "self", ".", "go2obj", ".", "values", "(", ")", ":", "if", "goterm", ".", "relationship", ":", "relationships_all", ".", "update", "("...
Return all relationships seen in GO Dag subset.
[ "Return", "all", "relationships", "seen", "in", "GO", "Dag", "subset", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/gosubdag/gosubdag_init.py#L49-L57
train
tanghaibao/goatools
goatools/gosubdag/gosubdag_init.py
InitGOs._init_gos
def _init_gos(self, go_sources_arg, relationships_arg): """Initialize GO sources.""" # No GO sources provided if not go_sources_arg: assert self.go2obj_orig, "go2obj MUST BE PRESENT IF go_sources IS NOT" self.go_sources = set(self.go2obj_orig) self.go2obj = se...
python
def _init_gos(self, go_sources_arg, relationships_arg): """Initialize GO sources.""" # No GO sources provided if not go_sources_arg: assert self.go2obj_orig, "go2obj MUST BE PRESENT IF go_sources IS NOT" self.go_sources = set(self.go2obj_orig) self.go2obj = se...
[ "def", "_init_gos", "(", "self", ",", "go_sources_arg", ",", "relationships_arg", ")", ":", "if", "not", "go_sources_arg", ":", "assert", "self", ".", "go2obj_orig", ",", "\"go2obj MUST BE PRESENT IF go_sources IS NOT\"", "self", ".", "go_sources", "=", "set", "(", ...
Initialize GO sources.
[ "Initialize", "GO", "sources", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/gosubdag/gosubdag_init.py#L59-L80
train
tanghaibao/goatools
goatools/gosubdag/gosubdag_init.py
InitGOs._add_goterms_kws
def _add_goterms_kws(self, go2obj_user, kws_gos): """Add more GOTerms to go2obj_user, if requested and relevant.""" if 'go2color' in kws_gos: for goid in kws_gos['go2color'].keys(): self._add_goterms(go2obj_user, goid)
python
def _add_goterms_kws(self, go2obj_user, kws_gos): """Add more GOTerms to go2obj_user, if requested and relevant.""" if 'go2color' in kws_gos: for goid in kws_gos['go2color'].keys(): self._add_goterms(go2obj_user, goid)
[ "def", "_add_goterms_kws", "(", "self", ",", "go2obj_user", ",", "kws_gos", ")", ":", "if", "'go2color'", "in", "kws_gos", ":", "for", "goid", "in", "kws_gos", "[", "'go2color'", "]", ".", "keys", "(", ")", ":", "self", ".", "_add_goterms", "(", "go2obj_...
Add more GOTerms to go2obj_user, if requested and relevant.
[ "Add", "more", "GOTerms", "to", "go2obj_user", "if", "requested", "and", "relevant", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/gosubdag/gosubdag_init.py#L82-L86
train
tanghaibao/goatools
goatools/gosubdag/gosubdag_init.py
InitGOs._add_goterms
def _add_goterms(self, go2obj_user, goid): """Add alt GO IDs to go2obj subset, if requested and relevant.""" goterm = self.go2obj_orig[goid] if goid != goterm.id and goterm.id in go2obj_user and goid not in go2obj_user: go2obj_user[goid] = goterm
python
def _add_goterms(self, go2obj_user, goid): """Add alt GO IDs to go2obj subset, if requested and relevant.""" goterm = self.go2obj_orig[goid] if goid != goterm.id and goterm.id in go2obj_user and goid not in go2obj_user: go2obj_user[goid] = goterm
[ "def", "_add_goterms", "(", "self", ",", "go2obj_user", ",", "goid", ")", ":", "goterm", "=", "self", ".", "go2obj_orig", "[", "goid", "]", "if", "goid", "!=", "goterm", ".", "id", "and", "goterm", ".", "id", "in", "go2obj_user", "and", "goid", "not", ...
Add alt GO IDs to go2obj subset, if requested and relevant.
[ "Add", "alt", "GO", "IDs", "to", "go2obj", "subset", "if", "requested", "and", "relevant", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/gosubdag/gosubdag_init.py#L88-L92
train
tanghaibao/goatools
goatools/gosubdag/gosubdag_init.py
InitGOs._init_go_sources
def _init_go_sources(self, go_sources_arg, go2obj_arg): """Return GO sources which are present in GODag.""" gos_user = set(go_sources_arg) if 'children' in self.kws and self.kws['children']: gos_user |= get_leaf_children(gos_user, go2obj_arg) gos_godag = set(go2obj_arg) ...
python
def _init_go_sources(self, go_sources_arg, go2obj_arg): """Return GO sources which are present in GODag.""" gos_user = set(go_sources_arg) if 'children' in self.kws and self.kws['children']: gos_user |= get_leaf_children(gos_user, go2obj_arg) gos_godag = set(go2obj_arg) ...
[ "def", "_init_go_sources", "(", "self", ",", "go_sources_arg", ",", "go2obj_arg", ")", ":", "gos_user", "=", "set", "(", "go_sources_arg", ")", "if", "'children'", "in", "self", ".", "kws", "and", "self", ".", "kws", "[", "'children'", "]", ":", "gos_user"...
Return GO sources which are present in GODag.
[ "Return", "GO", "sources", "which", "are", "present", "in", "GODag", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/gosubdag/gosubdag_init.py#L94-L106
train
tanghaibao/goatools
goatools/gosubdag/gosubdag_init.py
InitFields.get_rcntobj
def get_rcntobj(self): """Return None or user-provided CountRelatives object.""" # rcntobj value in kws can be: None, False, True, CountRelatives object if 'rcntobj' in self.kws: rcntobj = self.kws['rcntobj'] if isinstance(rcntobj, CountRelatives): return ...
python
def get_rcntobj(self): """Return None or user-provided CountRelatives object.""" # rcntobj value in kws can be: None, False, True, CountRelatives object if 'rcntobj' in self.kws: rcntobj = self.kws['rcntobj'] if isinstance(rcntobj, CountRelatives): return ...
[ "def", "get_rcntobj", "(", "self", ")", ":", "if", "'rcntobj'", "in", "self", ".", "kws", ":", "rcntobj", "=", "self", ".", "kws", "[", "'rcntobj'", "]", "if", "isinstance", "(", "rcntobj", ",", "CountRelatives", ")", ":", "return", "rcntobj", "return", ...
Return None or user-provided CountRelatives object.
[ "Return", "None", "or", "user", "-", "provided", "CountRelatives", "object", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/gosubdag/gosubdag_init.py#L123-L134
train
tanghaibao/goatools
goatools/gosubdag/gosubdag_init.py
InitFields.get_prt_fmt
def get_prt_fmt(self, alt=False): """Return the format for printing GO named tuples and their related information.""" # prt_fmt = [ # rcnt # '{GO} # {NS} L{level:02} D{depth:02} {GO_name}', # '{GO} # {NS} {dcnt:6,} L{level:0...
python
def get_prt_fmt(self, alt=False): """Return the format for printing GO named tuples and their related information.""" # prt_fmt = [ # rcnt # '{GO} # {NS} L{level:02} D{depth:02} {GO_name}', # '{GO} # {NS} {dcnt:6,} L{level:0...
[ "def", "get_prt_fmt", "(", "self", ",", "alt", "=", "False", ")", ":", "prt_fmt", "=", "[", "]", "if", "alt", ":", "prt_fmt", ".", "append", "(", "'{GO}{alt:1}'", ")", "else", ":", "prt_fmt", ".", "append", "(", "'{GO}'", ")", "prt_fmt", ".", "append...
Return the format for printing GO named tuples and their related information.
[ "Return", "the", "format", "for", "printing", "GO", "named", "tuples", "and", "their", "related", "information", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/gosubdag/gosubdag_init.py#L174-L204
train
tanghaibao/goatools
goatools/gosubdag/gosubdag_init.py
InitFields._init_kwelems
def _init_kwelems(self): """Init set elements.""" ret = set() if 'rcntobj' in self.kws: ret.add('dcnt') ret.add('D1') if 'tcntobj' in self.kws: ret.add('tcnt') ret.add('tfreq') ret.add('tinfo') return ret
python
def _init_kwelems(self): """Init set elements.""" ret = set() if 'rcntobj' in self.kws: ret.add('dcnt') ret.add('D1') if 'tcntobj' in self.kws: ret.add('tcnt') ret.add('tfreq') ret.add('tinfo') return ret
[ "def", "_init_kwelems", "(", "self", ")", ":", "ret", "=", "set", "(", ")", "if", "'rcntobj'", "in", "self", ".", "kws", ":", "ret", ".", "add", "(", "'dcnt'", ")", "ret", ".", "add", "(", "'D1'", ")", "if", "'tcntobj'", "in", "self", ".", "kws",...
Init set elements.
[ "Init", "set", "elements", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/gosubdag/gosubdag_init.py#L248-L258
train
tanghaibao/goatools
goatools/anno/extensions/extensions.py
AnnotationExtensions.get_relations_cnt
def get_relations_cnt(self): """Get the set of all relations.""" return cx.Counter([e.relation for es in self.exts for e in es])
python
def get_relations_cnt(self): """Get the set of all relations.""" return cx.Counter([e.relation for es in self.exts for e in es])
[ "def", "get_relations_cnt", "(", "self", ")", ":", "return", "cx", ".", "Counter", "(", "[", "e", ".", "relation", "for", "es", "in", "self", ".", "exts", "for", "e", "in", "es", "]", ")" ]
Get the set of all relations.
[ "Get", "the", "set", "of", "all", "relations", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/anno/extensions/extensions.py#L40-L42
train
tanghaibao/goatools
goatools/gosubdag/plot/go2color.py
Go2Color._init_equiv
def _init_equiv(self): """Add equivalent GO IDs to go2color, if necessary.""" gocolored_all = set(self.go2color) go2obj_usr = self.gosubdag.go2obj go2color_add = {} for gocolored_cur, color in self.go2color.items(): # Ignore GOs in go2color that are not in the user se...
python
def _init_equiv(self): """Add equivalent GO IDs to go2color, if necessary.""" gocolored_all = set(self.go2color) go2obj_usr = self.gosubdag.go2obj go2color_add = {} for gocolored_cur, color in self.go2color.items(): # Ignore GOs in go2color that are not in the user se...
[ "def", "_init_equiv", "(", "self", ")", ":", "gocolored_all", "=", "set", "(", "self", ".", "go2color", ")", "go2obj_usr", "=", "self", ".", "gosubdag", ".", "go2obj", "go2color_add", "=", "{", "}", "for", "gocolored_cur", ",", "color", "in", "self", "."...
Add equivalent GO IDs to go2color, if necessary.
[ "Add", "equivalent", "GO", "IDs", "to", "go2color", "if", "necessary", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/gosubdag/plot/go2color.py#L78-L98
train
tanghaibao/goatools
goatools/go_enrichment.py
GOEnrichmentRecord.get_pvalue
def get_pvalue(self): """Returns pval for 1st method, if it exists. Else returns uncorrected pval.""" if self.method_flds: return getattr(self, "p_{m}".format(m=self.get_method_name())) return getattr(self, "p_uncorrected")
python
def get_pvalue(self): """Returns pval for 1st method, if it exists. Else returns uncorrected pval.""" if self.method_flds: return getattr(self, "p_{m}".format(m=self.get_method_name())) return getattr(self, "p_uncorrected")
[ "def", "get_pvalue", "(", "self", ")", ":", "if", "self", ".", "method_flds", ":", "return", "getattr", "(", "self", ",", "\"p_{m}\"", ".", "format", "(", "m", "=", "self", ".", "get_method_name", "(", ")", ")", ")", "return", "getattr", "(", "self", ...
Returns pval for 1st method, if it exists. Else returns uncorrected pval.
[ "Returns", "pval", "for", "1st", "method", "if", "it", "exists", ".", "Else", "returns", "uncorrected", "pval", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/go_enrichment.py#L86-L90
train
tanghaibao/goatools
goatools/go_enrichment.py
GOEnrichmentRecord.set_corrected_pval
def set_corrected_pval(self, nt_method, pvalue): """Add object attribute based on method name.""" self.method_flds.append(nt_method) fieldname = "".join(["p_", nt_method.fieldname]) setattr(self, fieldname, pvalue)
python
def set_corrected_pval(self, nt_method, pvalue): """Add object attribute based on method name.""" self.method_flds.append(nt_method) fieldname = "".join(["p_", nt_method.fieldname]) setattr(self, fieldname, pvalue)
[ "def", "set_corrected_pval", "(", "self", ",", "nt_method", ",", "pvalue", ")", ":", "self", ".", "method_flds", ".", "append", "(", "nt_method", ")", "fieldname", "=", "\"\"", ".", "join", "(", "[", "\"p_\"", ",", "nt_method", ".", "fieldname", "]", ")"...
Add object attribute based on method name.
[ "Add", "object", "attribute", "based", "on", "method", "name", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/go_enrichment.py#L92-L96
train
tanghaibao/goatools
goatools/go_enrichment.py
GOEnrichmentRecord._chk_fields
def _chk_fields(field_data, field_formatter): """Check that expected fields are present.""" if len(field_data) == len(field_formatter): return len_dat = len(field_data) len_fmt = len(field_formatter) msg = [ "FIELD DATA({d}) != FORMATTER({f})".format(d=len...
python
def _chk_fields(field_data, field_formatter): """Check that expected fields are present.""" if len(field_data) == len(field_formatter): return len_dat = len(field_data) len_fmt = len(field_formatter) msg = [ "FIELD DATA({d}) != FORMATTER({f})".format(d=len...
[ "def", "_chk_fields", "(", "field_data", ",", "field_formatter", ")", ":", "if", "len", "(", "field_data", ")", "==", "len", "(", "field_formatter", ")", ":", "return", "len_dat", "=", "len", "(", "field_data", ")", "len_fmt", "=", "len", "(", "field_forma...
Check that expected fields are present.
[ "Check", "that", "expected", "fields", "are", "present", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/go_enrichment.py#L121-L131
train
tanghaibao/goatools
goatools/go_enrichment.py
GOEnrichmentRecord.set_goterm
def set_goterm(self, go2obj): """Set goterm and copy GOTerm's name and namespace.""" if self.GO in go2obj: goterm = go2obj[self.GO] self.goterm = goterm self.name = goterm.name self.depth = goterm.depth self.NS = self.namespace2NS[self.goterm.n...
python
def set_goterm(self, go2obj): """Set goterm and copy GOTerm's name and namespace.""" if self.GO in go2obj: goterm = go2obj[self.GO] self.goterm = goterm self.name = goterm.name self.depth = goterm.depth self.NS = self.namespace2NS[self.goterm.n...
[ "def", "set_goterm", "(", "self", ",", "go2obj", ")", ":", "if", "self", ".", "GO", "in", "go2obj", ":", "goterm", "=", "go2obj", "[", "self", ".", "GO", "]", "self", ".", "goterm", "=", "goterm", "self", ".", "name", "=", "goterm", ".", "name", ...
Set goterm and copy GOTerm's name and namespace.
[ "Set", "goterm", "and", "copy", "GOTerm", "s", "name", "and", "namespace", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/go_enrichment.py#L136-L143
train
tanghaibao/goatools
goatools/go_enrichment.py
GOEnrichmentRecord._init_enrichment
def _init_enrichment(self): """Mark as 'enriched' or 'purified'.""" if self.study_n: return 'e' if ((1.0 * self.study_count / self.study_n) > (1.0 * self.pop_count / self.pop_n)) else 'p' return 'p'
python
def _init_enrichment(self): """Mark as 'enriched' or 'purified'.""" if self.study_n: return 'e' if ((1.0 * self.study_count / self.study_n) > (1.0 * self.pop_count / self.pop_n)) else 'p' return 'p'
[ "def", "_init_enrichment", "(", "self", ")", ":", "if", "self", ".", "study_n", ":", "return", "'e'", "if", "(", "(", "1.0", "*", "self", ".", "study_count", "/", "self", ".", "study_n", ")", ">", "(", "1.0", "*", "self", ".", "pop_count", "/", "se...
Mark as 'enriched' or 'purified'.
[ "Mark", "as", "enriched", "or", "purified", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/go_enrichment.py#L145-L150
train
tanghaibao/goatools
goatools/go_enrichment.py
GOEnrichmentRecord.get_prtflds_default
def get_prtflds_default(self): """Get default fields.""" return self._fldsdefprt[:-1] + \ ["p_{M}".format(M=m.fieldname) for m in self.method_flds] + \ [self._fldsdefprt[-1]]
python
def get_prtflds_default(self): """Get default fields.""" return self._fldsdefprt[:-1] + \ ["p_{M}".format(M=m.fieldname) for m in self.method_flds] + \ [self._fldsdefprt[-1]]
[ "def", "get_prtflds_default", "(", "self", ")", ":", "return", "self", ".", "_fldsdefprt", "[", ":", "-", "1", "]", "+", "[", "\"p_{M}\"", ".", "format", "(", "M", "=", "m", ".", "fieldname", ")", "for", "m", "in", "self", ".", "method_flds", "]", ...
Get default fields.
[ "Get", "default", "fields", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/go_enrichment.py#L160-L164
train
tanghaibao/goatools
goatools/go_enrichment.py
GOEnrichmentRecord.get_prtflds_all
def get_prtflds_all(self): """When converting to a namedtuple, get all possible fields in their original order.""" flds = [] dont_add = set(['_parents', 'method_flds', 'relationship_rev', 'relationship']) # Fields: GO NS enrichment name ratio_in_study ratio_in_pop p_uncorrected #...
python
def get_prtflds_all(self): """When converting to a namedtuple, get all possible fields in their original order.""" flds = [] dont_add = set(['_parents', 'method_flds', 'relationship_rev', 'relationship']) # Fields: GO NS enrichment name ratio_in_study ratio_in_pop p_uncorrected #...
[ "def", "get_prtflds_all", "(", "self", ")", ":", "flds", "=", "[", "]", "dont_add", "=", "set", "(", "[", "'_parents'", ",", "'method_flds'", ",", "'relationship_rev'", ",", "'relationship'", "]", ")", "self", ".", "_flds_append", "(", "flds", ",", "self",...
When converting to a namedtuple, get all possible fields in their original order.
[ "When", "converting", "to", "a", "namedtuple", "get", "all", "possible", "fields", "in", "their", "original", "order", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/go_enrichment.py#L166-L180
train
tanghaibao/goatools
goatools/go_enrichment.py
GOEnrichmentRecord._flds_append
def _flds_append(flds, addthese, dont_add): """Retain order of fields as we add them once to the list.""" for fld in addthese: if fld not in flds and fld not in dont_add: flds.append(fld)
python
def _flds_append(flds, addthese, dont_add): """Retain order of fields as we add them once to the list.""" for fld in addthese: if fld not in flds and fld not in dont_add: flds.append(fld)
[ "def", "_flds_append", "(", "flds", ",", "addthese", ",", "dont_add", ")", ":", "for", "fld", "in", "addthese", ":", "if", "fld", "not", "in", "flds", "and", "fld", "not", "in", "dont_add", ":", "flds", ".", "append", "(", "fld", ")" ]
Retain order of fields as we add them once to the list.
[ "Retain", "order", "of", "fields", "as", "we", "add", "them", "once", "to", "the", "list", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/go_enrichment.py#L183-L187
train
tanghaibao/goatools
goatools/go_enrichment.py
GOEnrichmentRecord.get_field_values
def get_field_values(self, fldnames, rpt_fmt=True, itemid2name=None): """Get flat namedtuple fields for one GOEnrichmentRecord.""" row = [] # Loop through each user field desired for fld in fldnames: # 1. Check the GOEnrichmentRecord's attributes val = getattr(sel...
python
def get_field_values(self, fldnames, rpt_fmt=True, itemid2name=None): """Get flat namedtuple fields for one GOEnrichmentRecord.""" row = [] # Loop through each user field desired for fld in fldnames: # 1. Check the GOEnrichmentRecord's attributes val = getattr(sel...
[ "def", "get_field_values", "(", "self", ",", "fldnames", ",", "rpt_fmt", "=", "True", ",", "itemid2name", "=", "None", ")", ":", "row", "=", "[", "]", "for", "fld", "in", "fldnames", ":", "val", "=", "getattr", "(", "self", ",", "fld", ",", "None", ...
Get flat namedtuple fields for one GOEnrichmentRecord.
[ "Get", "flat", "namedtuple", "fields", "for", "one", "GOEnrichmentRecord", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/go_enrichment.py#L189-L214
train
tanghaibao/goatools
goatools/go_enrichment.py
GOEnrichmentRecord._get_rpt_fmt
def _get_rpt_fmt(fld, val, itemid2name=None): """Return values in a format amenable to printing in a table.""" if fld.startswith("ratio_"): return "{N}/{TOT}".format(N=val[0], TOT=val[1]) elif fld in set(['study_items', 'pop_items', 'alt_ids']): if itemid2name is not None...
python
def _get_rpt_fmt(fld, val, itemid2name=None): """Return values in a format amenable to printing in a table.""" if fld.startswith("ratio_"): return "{N}/{TOT}".format(N=val[0], TOT=val[1]) elif fld in set(['study_items', 'pop_items', 'alt_ids']): if itemid2name is not None...
[ "def", "_get_rpt_fmt", "(", "fld", ",", "val", ",", "itemid2name", "=", "None", ")", ":", "if", "fld", ".", "startswith", "(", "\"ratio_\"", ")", ":", "return", "\"{N}/{TOT}\"", ".", "format", "(", "N", "=", "val", "[", "0", "]", ",", "TOT", "=", "...
Return values in a format amenable to printing in a table.
[ "Return", "values", "in", "a", "format", "amenable", "to", "printing", "in", "a", "table", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/go_enrichment.py#L217-L225
train
tanghaibao/goatools
goatools/go_enrichment.py
GOEnrichmentRecord._err_fld
def _err_fld(self, fld, fldnames): """Unrecognized field. Print detailed Failure message.""" msg = ['ERROR. UNRECOGNIZED FIELD({F})'.format(F=fld)] actual_flds = set(self.get_prtflds_default() + self.goterm.__dict__.keys()) bad_flds = set(fldnames).difference(set(actual_flds)) if...
python
def _err_fld(self, fld, fldnames): """Unrecognized field. Print detailed Failure message.""" msg = ['ERROR. UNRECOGNIZED FIELD({F})'.format(F=fld)] actual_flds = set(self.get_prtflds_default() + self.goterm.__dict__.keys()) bad_flds = set(fldnames).difference(set(actual_flds)) if...
[ "def", "_err_fld", "(", "self", ",", "fld", ",", "fldnames", ")", ":", "msg", "=", "[", "'ERROR. UNRECOGNIZED FIELD({F})'", ".", "format", "(", "F", "=", "fld", ")", "]", "actual_flds", "=", "set", "(", "self", ".", "get_prtflds_default", "(", ")", "+", ...
Unrecognized field. Print detailed Failure message.
[ "Unrecognized", "field", ".", "Print", "detailed", "Failure", "message", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/go_enrichment.py#L227-L241
train
tanghaibao/goatools
goatools/go_enrichment.py
GOEnrichmentStudy.run_study_nts
def run_study_nts(self, study, **kws): """Run GOEA on study ids. Return results as a list of namedtuples.""" goea_results = self.run_study(study, **kws) return MgrNtGOEAs(goea_results).get_goea_nts_all()
python
def run_study_nts(self, study, **kws): """Run GOEA on study ids. Return results as a list of namedtuples.""" goea_results = self.run_study(study, **kws) return MgrNtGOEAs(goea_results).get_goea_nts_all()
[ "def", "run_study_nts", "(", "self", ",", "study", ",", "**", "kws", ")", ":", "goea_results", "=", "self", ".", "run_study", "(", "study", ",", "**", "kws", ")", "return", "MgrNtGOEAs", "(", "goea_results", ")", ".", "get_goea_nts_all", "(", ")" ]
Run GOEA on study ids. Return results as a list of namedtuples.
[ "Run", "GOEA", "on", "study", "ids", ".", "Return", "results", "as", "a", "list", "of", "namedtuples", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/go_enrichment.py#L302-L305
train
tanghaibao/goatools
goatools/go_enrichment.py
GOEnrichmentStudy.get_results_msg
def get_results_msg(self, results, study): """Return summary for GOEA results.""" # To convert msg list to string: "\n".join(msg) msg = [] if results: fmt = "{M:6,} GO terms are associated with {N:6,} of {NT:6,}" stu_items, num_gos_stu = self.get_item_cnt(results,...
python
def get_results_msg(self, results, study): """Return summary for GOEA results.""" # To convert msg list to string: "\n".join(msg) msg = [] if results: fmt = "{M:6,} GO terms are associated with {N:6,} of {NT:6,}" stu_items, num_gos_stu = self.get_item_cnt(results,...
[ "def", "get_results_msg", "(", "self", ",", "results", ",", "study", ")", ":", "msg", "=", "[", "]", "if", "results", ":", "fmt", "=", "\"{M:6,} GO terms are associated with {N:6,} of {NT:6,}\"", "stu_items", ",", "num_gos_stu", "=", "self", ".", "get_item_cnt", ...
Return summary for GOEA results.
[ "Return", "summary", "for", "GOEA", "results", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/go_enrichment.py#L307-L319
train
tanghaibao/goatools
goatools/go_enrichment.py
GOEnrichmentStudy.get_pval_uncorr
def get_pval_uncorr(self, study, log=sys.stdout): """Calculate the uncorrected pvalues for study items.""" results = [] study_in_pop = self.pop.intersection(study) # " 99% 378 of 382 study items found in population" go2studyitems = get_terms("study", study_in_pop, self.asso...
python
def get_pval_uncorr(self, study, log=sys.stdout): """Calculate the uncorrected pvalues for study items.""" results = [] study_in_pop = self.pop.intersection(study) # " 99% 378 of 382 study items found in population" go2studyitems = get_terms("study", study_in_pop, self.asso...
[ "def", "get_pval_uncorr", "(", "self", ",", "study", ",", "log", "=", "sys", ".", "stdout", ")", ":", "results", "=", "[", "]", "study_in_pop", "=", "self", ".", "pop", ".", "intersection", "(", "study", ")", "go2studyitems", "=", "get_terms", "(", "\"...
Calculate the uncorrected pvalues for study items.
[ "Calculate", "the", "uncorrected", "pvalues", "for", "study", "items", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/go_enrichment.py#L321-L359
train
tanghaibao/goatools
goatools/go_enrichment.py
GOEnrichmentStudy.get_study_items
def get_study_items(results): """Return a list of study items associated with the given results.""" study_items = set() for obj in results: study_items.update(obj.study_items) return study_items
python
def get_study_items(results): """Return a list of study items associated with the given results.""" study_items = set() for obj in results: study_items.update(obj.study_items) return study_items
[ "def", "get_study_items", "(", "results", ")", ":", "study_items", "=", "set", "(", ")", "for", "obj", "in", "results", ":", "study_items", ".", "update", "(", "obj", ".", "study_items", ")", "return", "study_items" ]
Return a list of study items associated with the given results.
[ "Return", "a", "list", "of", "study", "items", "associated", "with", "the", "given", "results", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/go_enrichment.py#L389-L394
train
tanghaibao/goatools
goatools/go_enrichment.py
GOEnrichmentStudy._update_pvalcorr
def _update_pvalcorr(ntmt, corrected_pvals): """Add data members to store multiple test corrections.""" if corrected_pvals is None: return for rec, val in zip(ntmt.results, corrected_pvals): rec.set_corrected_pval(ntmt.nt_method, val)
python
def _update_pvalcorr(ntmt, corrected_pvals): """Add data members to store multiple test corrections.""" if corrected_pvals is None: return for rec, val in zip(ntmt.results, corrected_pvals): rec.set_corrected_pval(ntmt.nt_method, val)
[ "def", "_update_pvalcorr", "(", "ntmt", ",", "corrected_pvals", ")", ":", "if", "corrected_pvals", "is", "None", ":", "return", "for", "rec", ",", "val", "in", "zip", "(", "ntmt", ".", "results", ",", "corrected_pvals", ")", ":", "rec", ".", "set_corrected...
Add data members to store multiple test corrections.
[ "Add", "data", "members", "to", "store", "multiple", "test", "corrections", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/go_enrichment.py#L429-L434
train
tanghaibao/goatools
goatools/go_enrichment.py
GOEnrichmentStudy.wr_txt
def wr_txt(self, fout_txt, goea_results, prtfmt=None, **kws): """Print GOEA results to text file.""" if not goea_results: sys.stdout.write(" 0 GOEA results. NOT WRITING {FOUT}\n".format(FOUT=fout_txt)) return with open(fout_txt, 'w') as prt: if 'title' in...
python
def wr_txt(self, fout_txt, goea_results, prtfmt=None, **kws): """Print GOEA results to text file.""" if not goea_results: sys.stdout.write(" 0 GOEA results. NOT WRITING {FOUT}\n".format(FOUT=fout_txt)) return with open(fout_txt, 'w') as prt: if 'title' in...
[ "def", "wr_txt", "(", "self", ",", "fout_txt", ",", "goea_results", ",", "prtfmt", "=", "None", ",", "**", "kws", ")", ":", "if", "not", "goea_results", ":", "sys", ".", "stdout", ".", "write", "(", "\" 0 GOEA results. NOT WRITING {FOUT}\\n\"", ".", "fo...
Print GOEA results to text file.
[ "Print", "GOEA", "results", "to", "text", "file", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/go_enrichment.py#L437-L450
train
tanghaibao/goatools
goatools/go_enrichment.py
GOEnrichmentStudy.prt_txt
def prt_txt(prt, goea_results, prtfmt=None, **kws): """Print GOEA results in text format.""" objprt = PrtFmt() if prtfmt is None: flds = ['GO', 'NS', 'p_uncorrected', 'ratio_in_study', 'ratio_in_pop', 'depth', 'name', 'study_items'] prtfmt = objprt.get...
python
def prt_txt(prt, goea_results, prtfmt=None, **kws): """Print GOEA results in text format.""" objprt = PrtFmt() if prtfmt is None: flds = ['GO', 'NS', 'p_uncorrected', 'ratio_in_study', 'ratio_in_pop', 'depth', 'name', 'study_items'] prtfmt = objprt.get...
[ "def", "prt_txt", "(", "prt", ",", "goea_results", ",", "prtfmt", "=", "None", ",", "**", "kws", ")", ":", "objprt", "=", "PrtFmt", "(", ")", "if", "prtfmt", "is", "None", ":", "flds", "=", "[", "'GO'", ",", "'NS'", ",", "'p_uncorrected'", ",", "'r...
Print GOEA results in text format.
[ "Print", "GOEA", "results", "in", "text", "format", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/go_enrichment.py#L453-L464
train
tanghaibao/goatools
goatools/go_enrichment.py
GOEnrichmentStudy.wr_xlsx
def wr_xlsx(self, fout_xlsx, goea_results, **kws): """Write a xlsx file.""" # kws: prt_if indent itemid2name(study_items) objprt = PrtFmt() prt_flds = kws.get('prt_flds', self.get_prtflds_default(goea_results)) xlsx_data = MgrNtGOEAs(goea_results).get_goea_nts_prt(prt_flds, **kws...
python
def wr_xlsx(self, fout_xlsx, goea_results, **kws): """Write a xlsx file.""" # kws: prt_if indent itemid2name(study_items) objprt = PrtFmt() prt_flds = kws.get('prt_flds', self.get_prtflds_default(goea_results)) xlsx_data = MgrNtGOEAs(goea_results).get_goea_nts_prt(prt_flds, **kws...
[ "def", "wr_xlsx", "(", "self", ",", "fout_xlsx", ",", "goea_results", ",", "**", "kws", ")", ":", "objprt", "=", "PrtFmt", "(", ")", "prt_flds", "=", "kws", ".", "get", "(", "'prt_flds'", ",", "self", ".", "get_prtflds_default", "(", "goea_results", ")",...
Write a xlsx file.
[ "Write", "a", "xlsx", "file", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/go_enrichment.py#L466-L474
train
tanghaibao/goatools
goatools/go_enrichment.py
GOEnrichmentStudy.wr_tsv
def wr_tsv(self, fout_tsv, goea_results, **kws): """Write tab-separated table data to file""" prt_flds = kws.get('prt_flds', self.get_prtflds_default(goea_results)) tsv_data = MgrNtGOEAs(goea_results).get_goea_nts_prt(prt_flds, **kws) RPT.wr_tsv(fout_tsv, tsv_data, **kws)
python
def wr_tsv(self, fout_tsv, goea_results, **kws): """Write tab-separated table data to file""" prt_flds = kws.get('prt_flds', self.get_prtflds_default(goea_results)) tsv_data = MgrNtGOEAs(goea_results).get_goea_nts_prt(prt_flds, **kws) RPT.wr_tsv(fout_tsv, tsv_data, **kws)
[ "def", "wr_tsv", "(", "self", ",", "fout_tsv", ",", "goea_results", ",", "**", "kws", ")", ":", "prt_flds", "=", "kws", ".", "get", "(", "'prt_flds'", ",", "self", ".", "get_prtflds_default", "(", "goea_results", ")", ")", "tsv_data", "=", "MgrNtGOEAs", ...
Write tab-separated table data to file
[ "Write", "tab", "-", "separated", "table", "data", "to", "file" ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/go_enrichment.py#L476-L480
train
tanghaibao/goatools
goatools/go_enrichment.py
GOEnrichmentStudy.prt_tsv
def prt_tsv(self, prt, goea_results, **kws): """Write tab-separated table data""" prt_flds = kws.get('prt_flds', self.get_prtflds_default(goea_results)) tsv_data = MgrNtGOEAs(goea_results).get_goea_nts_prt(prt_flds, **kws) RPT.prt_tsv(prt, tsv_data, **kws)
python
def prt_tsv(self, prt, goea_results, **kws): """Write tab-separated table data""" prt_flds = kws.get('prt_flds', self.get_prtflds_default(goea_results)) tsv_data = MgrNtGOEAs(goea_results).get_goea_nts_prt(prt_flds, **kws) RPT.prt_tsv(prt, tsv_data, **kws)
[ "def", "prt_tsv", "(", "self", ",", "prt", ",", "goea_results", ",", "**", "kws", ")", ":", "prt_flds", "=", "kws", ".", "get", "(", "'prt_flds'", ",", "self", ".", "get_prtflds_default", "(", "goea_results", ")", ")", "tsv_data", "=", "MgrNtGOEAs", "(",...
Write tab-separated table data
[ "Write", "tab", "-", "separated", "table", "data" ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/go_enrichment.py#L482-L486
train
tanghaibao/goatools
goatools/go_enrichment.py
GOEnrichmentStudy.get_ns2nts
def get_ns2nts(results, fldnames=None, **kws): """Get namedtuples of GOEA results, split into BP, MF, CC.""" ns2nts = cx.defaultdict(list) nts = MgrNtGOEAs(results).get_goea_nts_all(fldnames, **kws) for ntgoea in nts: ns2nts[ntgoea.NS].append(ntgoea) return ns2nts
python
def get_ns2nts(results, fldnames=None, **kws): """Get namedtuples of GOEA results, split into BP, MF, CC.""" ns2nts = cx.defaultdict(list) nts = MgrNtGOEAs(results).get_goea_nts_all(fldnames, **kws) for ntgoea in nts: ns2nts[ntgoea.NS].append(ntgoea) return ns2nts
[ "def", "get_ns2nts", "(", "results", ",", "fldnames", "=", "None", ",", "**", "kws", ")", ":", "ns2nts", "=", "cx", ".", "defaultdict", "(", "list", ")", "nts", "=", "MgrNtGOEAs", "(", "results", ")", ".", "get_goea_nts_all", "(", "fldnames", ",", "**"...
Get namedtuples of GOEA results, split into BP, MF, CC.
[ "Get", "namedtuples", "of", "GOEA", "results", "split", "into", "BP", "MF", "CC", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/go_enrichment.py#L489-L495
train
tanghaibao/goatools
goatools/go_enrichment.py
GOEnrichmentStudy.print_date
def print_date(min_ratio=None, pval=0.05): """Print GOATOOLS version and the date the GOEA was run.""" import goatools # Header contains provenance and parameters date = datetime.date.today() print("# Generated by GOATOOLS v{0} ({1})".format(goatools.__version__, date)) ...
python
def print_date(min_ratio=None, pval=0.05): """Print GOATOOLS version and the date the GOEA was run.""" import goatools # Header contains provenance and parameters date = datetime.date.today() print("# Generated by GOATOOLS v{0} ({1})".format(goatools.__version__, date)) ...
[ "def", "print_date", "(", "min_ratio", "=", "None", ",", "pval", "=", "0.05", ")", ":", "import", "goatools", "date", "=", "datetime", ".", "date", ".", "today", "(", ")", "print", "(", "\"# Generated by GOATOOLS v{0} ({1})\"", ".", "format", "(", "goatools"...
Print GOATOOLS version and the date the GOEA was run.
[ "Print", "GOATOOLS", "version", "and", "the", "date", "the", "GOEA", "was", "run", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/go_enrichment.py#L523-L530
train
tanghaibao/goatools
goatools/go_enrichment.py
GOEnrichmentStudy.print_results
def print_results(self, results, min_ratio=None, indent=False, pval=0.05, prt=sys.stdout): """Print GOEA results with some additional statistics calculated.""" results_adj = self.get_adj_records(results, min_ratio, pval) self.print_results_adj(results_adj, indent, prt)
python
def print_results(self, results, min_ratio=None, indent=False, pval=0.05, prt=sys.stdout): """Print GOEA results with some additional statistics calculated.""" results_adj = self.get_adj_records(results, min_ratio, pval) self.print_results_adj(results_adj, indent, prt)
[ "def", "print_results", "(", "self", ",", "results", ",", "min_ratio", "=", "None", ",", "indent", "=", "False", ",", "pval", "=", "0.05", ",", "prt", "=", "sys", ".", "stdout", ")", ":", "results_adj", "=", "self", ".", "get_adj_records", "(", "result...
Print GOEA results with some additional statistics calculated.
[ "Print", "GOEA", "results", "with", "some", "additional", "statistics", "calculated", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/go_enrichment.py#L532-L535
train
tanghaibao/goatools
goatools/go_enrichment.py
GOEnrichmentStudy.get_adj_records
def get_adj_records(results, min_ratio=None, pval=0.05): """Return GOEA results with some additional statistics calculated.""" records = [] for rec in results: # calculate some additional statistics # (over_under, is_ratio_different) rec.update_remaining_fldsd...
python
def get_adj_records(results, min_ratio=None, pval=0.05): """Return GOEA results with some additional statistics calculated.""" records = [] for rec in results: # calculate some additional statistics # (over_under, is_ratio_different) rec.update_remaining_fldsd...
[ "def", "get_adj_records", "(", "results", ",", "min_ratio", "=", "None", ",", "pval", "=", "0.05", ")", ":", "records", "=", "[", "]", "for", "rec", "in", "results", ":", "rec", ".", "update_remaining_fldsdefprt", "(", "min_ratio", "=", "min_ratio", ")", ...
Return GOEA results with some additional statistics calculated.
[ "Return", "GOEA", "results", "with", "some", "additional", "statistics", "calculated", "." ]
407682e573a108864a79031f8ca19ee3bf377626
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/go_enrichment.py#L538-L551
train