partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
test
get_config_path
Determine the path to the config file. This will return, in this order of precedence: - the value of $BUGWARRIORRC if set - $XDG_CONFIG_HOME/bugwarrior/bugwarriorc if exists - ~/.bugwarriorrc if exists - <dir>/bugwarrior/bugwarriorc if exists, for dir in $XDG_CONFIG_DIRS - $XDG_CONFIG_HOME/bugwa...
bugwarrior/config.py
def get_config_path(): """ Determine the path to the config file. This will return, in this order of precedence: - the value of $BUGWARRIORRC if set - $XDG_CONFIG_HOME/bugwarrior/bugwarriorc if exists - ~/.bugwarriorrc if exists - <dir>/bugwarrior/bugwarriorc if exists, for dir in $XDG_CONFI...
def get_config_path(): """ Determine the path to the config file. This will return, in this order of precedence: - the value of $BUGWARRIORRC if set - $XDG_CONFIG_HOME/bugwarrior/bugwarriorc if exists - ~/.bugwarriorrc if exists - <dir>/bugwarrior/bugwarriorc if exists, for dir in $XDG_CONFI...
[ "Determine", "the", "path", "to", "the", "config", "file", ".", "This", "will", "return", "in", "this", "order", "of", "precedence", ":", "-", "the", "value", "of", "$BUGWARRIORRC", "if", "set", "-", "$XDG_CONFIG_HOME", "/", "bugwarrior", "/", "bugwarriorc",...
ralphbean/bugwarrior
python
https://github.com/ralphbean/bugwarrior/blob/b2a5108f7b40cb0c437509b64eaa28f941f7ac8b/bugwarrior/config.py#L186-L210
[ "def", "get_config_path", "(", ")", ":", "if", "os", ".", "environ", ".", "get", "(", "BUGWARRIORRC", ")", ":", "return", "os", ".", "environ", "[", "BUGWARRIORRC", "]", "xdg_config_home", "=", "(", "os", ".", "environ", ".", "get", "(", "'XDG_CONFIG_HOM...
b2a5108f7b40cb0c437509b64eaa28f941f7ac8b
test
fix_logging_path
Expand environment variables and user home (~) in the log.file and return as relative path.
bugwarrior/config.py
def fix_logging_path(config, main_section): """ Expand environment variables and user home (~) in the log.file and return as relative path. """ log_file = config.get(main_section, 'log.file') if log_file: log_file = os.path.expanduser(os.path.expandvars(log_file)) if os.path.isab...
def fix_logging_path(config, main_section): """ Expand environment variables and user home (~) in the log.file and return as relative path. """ log_file = config.get(main_section, 'log.file') if log_file: log_file = os.path.expanduser(os.path.expandvars(log_file)) if os.path.isab...
[ "Expand", "environment", "variables", "and", "user", "home", "(", "~", ")", "in", "the", "log", ".", "file", "and", "return", "as", "relative", "path", "." ]
ralphbean/bugwarrior
python
https://github.com/ralphbean/bugwarrior/blob/b2a5108f7b40cb0c437509b64eaa28f941f7ac8b/bugwarrior/config.py#L213-L223
[ "def", "fix_logging_path", "(", "config", ",", "main_section", ")", ":", "log_file", "=", "config", ".", "get", "(", "main_section", ",", "'log.file'", ")", "if", "log_file", ":", "log_file", "=", "os", ".", "path", ".", "expanduser", "(", "os", ".", "pa...
b2a5108f7b40cb0c437509b64eaa28f941f7ac8b
test
BugwarriorConfigParser.getint
Accepts both integers and empty values.
bugwarrior/config.py
def getint(self, section, option): """ Accepts both integers and empty values. """ try: return super(BugwarriorConfigParser, self).getint(section, option) except ValueError: if self.get(section, option) == u'': return None else: ...
def getint(self, section, option): """ Accepts both integers and empty values. """ try: return super(BugwarriorConfigParser, self).getint(section, option) except ValueError: if self.get(section, option) == u'': return None else: ...
[ "Accepts", "both", "integers", "and", "empty", "values", "." ]
ralphbean/bugwarrior
python
https://github.com/ralphbean/bugwarrior/blob/b2a5108f7b40cb0c437509b64eaa28f941f7ac8b/bugwarrior/config.py#L272-L282
[ "def", "getint", "(", "self", ",", "section", ",", "option", ")", ":", "try", ":", "return", "super", "(", "BugwarriorConfigParser", ",", "self", ")", ".", "getint", "(", "section", ",", "option", ")", "except", "ValueError", ":", "if", "self", ".", "g...
b2a5108f7b40cb0c437509b64eaa28f941f7ac8b
test
_get_bug_attr
Default longdescs/flags case to [] since they may not be present.
bugwarrior/services/bz.py
def _get_bug_attr(bug, attr): """Default longdescs/flags case to [] since they may not be present.""" if attr in ("longdescs", "flags"): return getattr(bug, attr, []) return getattr(bug, attr)
def _get_bug_attr(bug, attr): """Default longdescs/flags case to [] since they may not be present.""" if attr in ("longdescs", "flags"): return getattr(bug, attr, []) return getattr(bug, attr)
[ "Default", "longdescs", "/", "flags", "case", "to", "[]", "since", "they", "may", "not", "be", "present", "." ]
ralphbean/bugwarrior
python
https://github.com/ralphbean/bugwarrior/blob/b2a5108f7b40cb0c437509b64eaa28f941f7ac8b/bugwarrior/services/bz.py#L286-L290
[ "def", "_get_bug_attr", "(", "bug", ",", "attr", ")", ":", "if", "attr", "in", "(", "\"longdescs\"", ",", "\"flags\"", ")", ":", "return", "getattr", "(", "bug", ",", "attr", ",", "[", "]", ")", "return", "getattr", "(", "bug", ",", "attr", ")" ]
b2a5108f7b40cb0c437509b64eaa28f941f7ac8b
test
pull
Pull down tasks from forges and add them to your taskwarrior tasks. Relies on configuration in bugwarriorrc
bugwarrior/command.py
def pull(dry_run, flavor, interactive, debug): """ Pull down tasks from forges and add them to your taskwarrior tasks. Relies on configuration in bugwarriorrc """ try: main_section = _get_section_name(flavor) config = _try_load_config(main_section, interactive) lockfile_path =...
def pull(dry_run, flavor, interactive, debug): """ Pull down tasks from forges and add them to your taskwarrior tasks. Relies on configuration in bugwarriorrc """ try: main_section = _get_section_name(flavor) config = _try_load_config(main_section, interactive) lockfile_path =...
[ "Pull", "down", "tasks", "from", "forges", "and", "add", "them", "to", "your", "taskwarrior", "tasks", "." ]
ralphbean/bugwarrior
python
https://github.com/ralphbean/bugwarrior/blob/b2a5108f7b40cb0c437509b64eaa28f941f7ac8b/bugwarrior/command.py#L54-L85
[ "def", "pull", "(", "dry_run", ",", "flavor", ",", "interactive", ",", "debug", ")", ":", "try", ":", "main_section", "=", "_get_section_name", "(", "flavor", ")", "config", "=", "_try_load_config", "(", "main_section", ",", "interactive", ")", "lockfile_path"...
b2a5108f7b40cb0c437509b64eaa28f941f7ac8b
test
BitbucketService.get_data
Perform a request to the fully qualified url and return json.
bugwarrior/services/bitbucket.py
def get_data(self, url): """ Perform a request to the fully qualified url and return json. """ return self.json_response(requests.get(url, **self.requests_kwargs))
def get_data(self, url): """ Perform a request to the fully qualified url and return json. """ return self.json_response(requests.get(url, **self.requests_kwargs))
[ "Perform", "a", "request", "to", "the", "fully", "qualified", "url", "and", "return", "json", "." ]
ralphbean/bugwarrior
python
https://github.com/ralphbean/bugwarrior/blob/b2a5108f7b40cb0c437509b64eaa28f941f7ac8b/bugwarrior/services/bitbucket.py#L142-L144
[ "def", "get_data", "(", "self", ",", "url", ")", ":", "return", "self", ".", "json_response", "(", "requests", ".", "get", "(", "url", ",", "*", "*", "self", ".", "requests_kwargs", ")", ")" ]
b2a5108f7b40cb0c437509b64eaa28f941f7ac8b
test
BitbucketService.get_collection
Pages through an object collection from the bitbucket API. Returns an iterator that lazily goes through all the 'values' of all the pages in the collection.
bugwarrior/services/bitbucket.py
def get_collection(self, url): """ Pages through an object collection from the bitbucket API. Returns an iterator that lazily goes through all the 'values' of all the pages in the collection. """ url = self.BASE_API2 + url while url is not None: response = self.get_da...
def get_collection(self, url): """ Pages through an object collection from the bitbucket API. Returns an iterator that lazily goes through all the 'values' of all the pages in the collection. """ url = self.BASE_API2 + url while url is not None: response = self.get_da...
[ "Pages", "through", "an", "object", "collection", "from", "the", "bitbucket", "API", ".", "Returns", "an", "iterator", "that", "lazily", "goes", "through", "all", "the", "values", "of", "all", "the", "pages", "in", "the", "collection", "." ]
ralphbean/bugwarrior
python
https://github.com/ralphbean/bugwarrior/blob/b2a5108f7b40cb0c437509b64eaa28f941f7ac8b/bugwarrior/services/bitbucket.py#L146-L155
[ "def", "get_collection", "(", "self", ",", "url", ")", ":", "url", "=", "self", ".", "BASE_API2", "+", "url", "while", "url", "is", "not", "None", ":", "response", "=", "self", ".", "get_data", "(", "url", ")", "for", "value", "in", "response", "[", ...
b2a5108f7b40cb0c437509b64eaa28f941f7ac8b
test
hamdist
Count the # of differences between equal length strings str1 and str2
bugwarrior/db.py
def hamdist(str1, str2): """Count the # of differences between equal length strings str1 and str2""" diffs = 0 for ch1, ch2 in zip(str1, str2): if ch1 != ch2: diffs += 1 return diffs
def hamdist(str1, str2): """Count the # of differences between equal length strings str1 and str2""" diffs = 0 for ch1, ch2 in zip(str1, str2): if ch1 != ch2: diffs += 1 return diffs
[ "Count", "the", "#", "of", "differences", "between", "equal", "length", "strings", "str1", "and", "str2" ]
ralphbean/bugwarrior
python
https://github.com/ralphbean/bugwarrior/blob/b2a5108f7b40cb0c437509b64eaa28f941f7ac8b/bugwarrior/db.py#L91-L97
[ "def", "hamdist", "(", "str1", ",", "str2", ")", ":", "diffs", "=", "0", "for", "ch1", ",", "ch2", "in", "zip", "(", "str1", ",", "str2", ")", ":", "if", "ch1", "!=", "ch2", ":", "diffs", "+=", "1", "return", "diffs" ]
b2a5108f7b40cb0c437509b64eaa28f941f7ac8b
test
find_local_uuid
For a given issue issue, find its local UUID. Assembles a list of task IDs existing in taskwarrior matching the supplied issue (`issue`) on the combination of any set of supplied unique identifiers (`keys`) or, optionally, the task's description field (should `legacy_matching` be `True`). :params:...
bugwarrior/db.py
def find_local_uuid(tw, keys, issue, legacy_matching=False): """ For a given issue issue, find its local UUID. Assembles a list of task IDs existing in taskwarrior matching the supplied issue (`issue`) on the combination of any set of supplied unique identifiers (`keys`) or, optionally, the task's ...
def find_local_uuid(tw, keys, issue, legacy_matching=False): """ For a given issue issue, find its local UUID. Assembles a list of task IDs existing in taskwarrior matching the supplied issue (`issue`) on the combination of any set of supplied unique identifiers (`keys`) or, optionally, the task's ...
[ "For", "a", "given", "issue", "issue", "find", "its", "local", "UUID", "." ]
ralphbean/bugwarrior
python
https://github.com/ralphbean/bugwarrior/blob/b2a5108f7b40cb0c437509b64eaa28f941f7ac8b/bugwarrior/db.py#L129-L212
[ "def", "find_local_uuid", "(", "tw", ",", "keys", ",", "issue", ",", "legacy_matching", "=", "False", ")", ":", "if", "not", "issue", "[", "'description'", "]", ":", "raise", "ValueError", "(", "'Issue %s has no description.'", "%", "issue", ")", "possibilitie...
b2a5108f7b40cb0c437509b64eaa28f941f7ac8b
test
merge_left
Merge array field from the remote_issue into local_task * Local 'left' entries are preserved without modification * Remote 'left' are appended to task if not present in local. :param `field`: Task field to merge. :param `local_task`: `taskw.task.Task` object into which to merge remote changes....
bugwarrior/db.py
def merge_left(field, local_task, remote_issue, hamming=False): """ Merge array field from the remote_issue into local_task * Local 'left' entries are preserved without modification * Remote 'left' are appended to task if not present in local. :param `field`: Task field to merge. :param `local_tas...
def merge_left(field, local_task, remote_issue, hamming=False): """ Merge array field from the remote_issue into local_task * Local 'left' entries are preserved without modification * Remote 'left' are appended to task if not present in local. :param `field`: Task field to merge. :param `local_tas...
[ "Merge", "array", "field", "from", "the", "remote_issue", "into", "local_task" ]
ralphbean/bugwarrior
python
https://github.com/ralphbean/bugwarrior/blob/b2a5108f7b40cb0c437509b64eaa28f941f7ac8b/bugwarrior/db.py#L215-L263
[ "def", "merge_left", "(", "field", ",", "local_task", ",", "remote_issue", ",", "hamming", "=", "False", ")", ":", "# Ensure that empty defaults are present", "local_field", "=", "local_task", ".", "get", "(", "field", ",", "[", "]", ")", "remote_field", "=", ...
b2a5108f7b40cb0c437509b64eaa28f941f7ac8b
test
build_uda_config_overrides
Returns a list of UDAs defined by given targets For all targets in `targets`, build a dictionary of configuration overrides representing the UDAs defined by the passed-in services (`targets`). Given a hypothetical situation in which you have two services, the first of which defining a UDA named 'servi...
bugwarrior/db.py
def build_uda_config_overrides(targets): """ Returns a list of UDAs defined by given targets For all targets in `targets`, build a dictionary of configuration overrides representing the UDAs defined by the passed-in services (`targets`). Given a hypothetical situation in which you have two services, t...
def build_uda_config_overrides(targets): """ Returns a list of UDAs defined by given targets For all targets in `targets`, build a dictionary of configuration overrides representing the UDAs defined by the passed-in services (`targets`). Given a hypothetical situation in which you have two services, t...
[ "Returns", "a", "list", "of", "UDAs", "defined", "by", "given", "targets" ]
ralphbean/bugwarrior
python
https://github.com/ralphbean/bugwarrior/blob/b2a5108f7b40cb0c437509b64eaa28f941f7ac8b/bugwarrior/db.py#L476-L514
[ "def", "build_uda_config_overrides", "(", "targets", ")", ":", "from", "bugwarrior", ".", "services", "import", "get_service", "targets_udas", "=", "{", "}", "for", "target", "in", "targets", ":", "targets_udas", ".", "update", "(", "get_service", "(", "target",...
b2a5108f7b40cb0c437509b64eaa28f941f7ac8b
test
_parse_sprint_string
Parse the big ugly sprint string stored by JIRA. They look like: com.atlassian.greenhopper.service.sprint.Sprint@4c9c41a5[id=2322,rapid ViewId=1173,state=ACTIVE,name=Sprint 1,startDate=2016-09-06T16:08:07.4 55Z,endDate=2016-09-23T16:08:00.000Z,completeDate=<null>,sequence=2322]
bugwarrior/services/jira.py
def _parse_sprint_string(sprint): """ Parse the big ugly sprint string stored by JIRA. They look like: com.atlassian.greenhopper.service.sprint.Sprint@4c9c41a5[id=2322,rapid ViewId=1173,state=ACTIVE,name=Sprint 1,startDate=2016-09-06T16:08:07.4 55Z,endDate=2016-09-23T16:08:00.000Z,compl...
def _parse_sprint_string(sprint): """ Parse the big ugly sprint string stored by JIRA. They look like: com.atlassian.greenhopper.service.sprint.Sprint@4c9c41a5[id=2322,rapid ViewId=1173,state=ACTIVE,name=Sprint 1,startDate=2016-09-06T16:08:07.4 55Z,endDate=2016-09-23T16:08:00.000Z,compl...
[ "Parse", "the", "big", "ugly", "sprint", "string", "stored", "by", "JIRA", "." ]
ralphbean/bugwarrior
python
https://github.com/ralphbean/bugwarrior/blob/b2a5108f7b40cb0c437509b64eaa28f941f7ac8b/bugwarrior/services/jira.py#L43-L53
[ "def", "_parse_sprint_string", "(", "sprint", ")", ":", "entries", "=", "sprint", "[", "sprint", ".", "index", "(", "'['", ")", "+", "1", ":", "sprint", ".", "index", "(", "']'", ")", "]", ".", "split", "(", "'='", ")", "fields", "=", "sum", "(", ...
b2a5108f7b40cb0c437509b64eaa28f941f7ac8b
test
GmailService.get_credentials
Gets valid user credentials from storage. If nothing has been stored, or if the stored credentials are invalid, the OAuth2 flow is completed to obtain the new credentials. Returns: Credentials, the obtained credential.
bugwarrior/services/gmail.py
def get_credentials(self): """Gets valid user credentials from storage. If nothing has been stored, or if the stored credentials are invalid, the OAuth2 flow is completed to obtain the new credentials. Returns: Credentials, the obtained credential. """ with ...
def get_credentials(self): """Gets valid user credentials from storage. If nothing has been stored, or if the stored credentials are invalid, the OAuth2 flow is completed to obtain the new credentials. Returns: Credentials, the obtained credential. """ with ...
[ "Gets", "valid", "user", "credentials", "from", "storage", "." ]
ralphbean/bugwarrior
python
https://github.com/ralphbean/bugwarrior/blob/b2a5108f7b40cb0c437509b64eaa28f941f7ac8b/bugwarrior/services/gmail.py#L120-L140
[ "def", "get_credentials", "(", "self", ")", ":", "with", "self", ".", "AUTHENTICATION_LOCK", ":", "log", ".", "info", "(", "'Starting authentication for %s'", ",", "self", ".", "target", ")", "store", "=", "oauth2client", ".", "file", ".", "Storage", "(", "s...
b2a5108f7b40cb0c437509b64eaa28f941f7ac8b
test
multi_rouge_n
Efficient way to compute highly repetitive scoring i.e. sequences are involved multiple time Args: sequences(list[str]): list of sequences (either hyp or ref) scores_ids(list[tuple(int)]): list of pairs (hyp_id, ref_id) ie. scores[i] = rouge_n(scores_ids[i][0], ...
rouge/rouge_score.py
def multi_rouge_n(sequences, scores_ids, n=2): """ Efficient way to compute highly repetitive scoring i.e. sequences are involved multiple time Args: sequences(list[str]): list of sequences (either hyp or ref) scores_ids(list[tuple(int)]): list of pairs (hyp_id, ref_id) ie. ...
def multi_rouge_n(sequences, scores_ids, n=2): """ Efficient way to compute highly repetitive scoring i.e. sequences are involved multiple time Args: sequences(list[str]): list of sequences (either hyp or ref) scores_ids(list[tuple(int)]): list of pairs (hyp_id, ref_id) ie. ...
[ "Efficient", "way", "to", "compute", "highly", "repetitive", "scoring", "i", ".", "e", ".", "sequences", "are", "involved", "multiple", "time" ]
pltrdy/rouge
python
https://github.com/pltrdy/rouge/blob/7bf8a83af5ca5c1677b93620b4e1f85ffd63b377/rouge/rouge_score.py#L140-L174
[ "def", "multi_rouge_n", "(", "sequences", ",", "scores_ids", ",", "n", "=", "2", ")", ":", "ngrams", "=", "[", "_get_word_ngrams", "(", "n", ",", "sequence", ")", "for", "sequence", "in", "sequences", "]", "counts", "=", "[", "len", "(", "ngram", ")", ...
7bf8a83af5ca5c1677b93620b4e1f85ffd63b377
test
rouge_n
Computes ROUGE-N of two text collections of sentences. Sourece: http://research.microsoft.com/en-us/um/people/cyl/download/ papers/rouge-working-note-v1.3.1.pdf Args: evaluated_sentences: The sentences that have been picked by the summarizer reference_sentences: The s...
rouge/rouge_score.py
def rouge_n(evaluated_sentences, reference_sentences, n=2): """ Computes ROUGE-N of two text collections of sentences. Sourece: http://research.microsoft.com/en-us/um/people/cyl/download/ papers/rouge-working-note-v1.3.1.pdf Args: evaluated_sentences: The sentences that have been picked by th...
def rouge_n(evaluated_sentences, reference_sentences, n=2): """ Computes ROUGE-N of two text collections of sentences. Sourece: http://research.microsoft.com/en-us/um/people/cyl/download/ papers/rouge-working-note-v1.3.1.pdf Args: evaluated_sentences: The sentences that have been picked by th...
[ "Computes", "ROUGE", "-", "N", "of", "two", "text", "collections", "of", "sentences", ".", "Sourece", ":", "http", ":", "//", "research", ".", "microsoft", ".", "com", "/", "en", "-", "us", "/", "um", "/", "people", "/", "cyl", "/", "download", "/", ...
pltrdy/rouge
python
https://github.com/pltrdy/rouge/blob/7bf8a83af5ca5c1677b93620b4e1f85ffd63b377/rouge/rouge_score.py#L177-L207
[ "def", "rouge_n", "(", "evaluated_sentences", ",", "reference_sentences", ",", "n", "=", "2", ")", ":", "if", "len", "(", "evaluated_sentences", ")", "<=", "0", "or", "len", "(", "reference_sentences", ")", "<=", "0", ":", "raise", "ValueError", "(", "\"Co...
7bf8a83af5ca5c1677b93620b4e1f85ffd63b377
test
_union_lcs
Returns LCS_u(r_i, C) which is the LCS score of the union longest common subsequence between reference sentence ri and candidate summary C. For example: if r_i= w1 w2 w3 w4 w5, and C contains two sentences: c1 = w1 w2 w6 w7 w8 and c2 = w1 w3 w8 w9 w5, then the longest common subsequence of r_i and c1 ...
rouge/rouge_score.py
def _union_lcs(evaluated_sentences, reference_sentence, prev_union=None): """ Returns LCS_u(r_i, C) which is the LCS score of the union longest common subsequence between reference sentence ri and candidate summary C. For example: if r_i= w1 w2 w3 w4 w5, and C contains two sentences: c1 = w1 w2 w6 w...
def _union_lcs(evaluated_sentences, reference_sentence, prev_union=None): """ Returns LCS_u(r_i, C) which is the LCS score of the union longest common subsequence between reference sentence ri and candidate summary C. For example: if r_i= w1 w2 w3 w4 w5, and C contains two sentences: c1 = w1 w2 w6 w...
[ "Returns", "LCS_u", "(", "r_i", "C", ")", "which", "is", "the", "LCS", "score", "of", "the", "union", "longest", "common", "subsequence", "between", "reference", "sentence", "ri", "and", "candidate", "summary", "C", ".", "For", "example", ":", "if", "r_i",...
pltrdy/rouge
python
https://github.com/pltrdy/rouge/blob/7bf8a83af5ca5c1677b93620b4e1f85ffd63b377/rouge/rouge_score.py#L227-L267
[ "def", "_union_lcs", "(", "evaluated_sentences", ",", "reference_sentence", ",", "prev_union", "=", "None", ")", ":", "if", "prev_union", "is", "None", ":", "prev_union", "=", "set", "(", ")", "if", "len", "(", "evaluated_sentences", ")", "<=", "0", ":", "...
7bf8a83af5ca5c1677b93620b4e1f85ffd63b377
test
rouge_l_summary_level
Computes ROUGE-L (summary level) of two text collections of sentences. http://research.microsoft.com/en-us/um/people/cyl/download/papers/ rouge-working-note-v1.3.1.pdf Calculated according to: R_lcs = SUM(1, u)[LCS<union>(r_i,C)]/m P_lcs = SUM(1, u)[LCS<union>(r_i,C)]/n F_lcs = ((1 + beta^2)*R_...
rouge/rouge_score.py
def rouge_l_summary_level(evaluated_sentences, reference_sentences): """ Computes ROUGE-L (summary level) of two text collections of sentences. http://research.microsoft.com/en-us/um/people/cyl/download/papers/ rouge-working-note-v1.3.1.pdf Calculated according to: R_lcs = SUM(1, u)[LCS<union>(...
def rouge_l_summary_level(evaluated_sentences, reference_sentences): """ Computes ROUGE-L (summary level) of two text collections of sentences. http://research.microsoft.com/en-us/um/people/cyl/download/papers/ rouge-working-note-v1.3.1.pdf Calculated according to: R_lcs = SUM(1, u)[LCS<union>(...
[ "Computes", "ROUGE", "-", "L", "(", "summary", "level", ")", "of", "two", "text", "collections", "of", "sentences", ".", "http", ":", "//", "research", ".", "microsoft", ".", "com", "/", "en", "-", "us", "/", "um", "/", "people", "/", "cyl", "/", "...
pltrdy/rouge
python
https://github.com/pltrdy/rouge/blob/7bf8a83af5ca5c1677b93620b4e1f85ffd63b377/rouge/rouge_score.py#L270-L324
[ "def", "rouge_l_summary_level", "(", "evaluated_sentences", ",", "reference_sentences", ")", ":", "if", "len", "(", "evaluated_sentences", ")", "<=", "0", "or", "len", "(", "reference_sentences", ")", "<=", "0", ":", "raise", "ValueError", "(", "\"Collections must...
7bf8a83af5ca5c1677b93620b4e1f85ffd63b377
test
FilesRouge.get_scores
Calculate ROUGE scores between each pair of lines (hyp_file[i], ref_file[i]). Args: * hyp_path: hypothesis file path * ref_path: references file path * avg (False): whether to get an average scores or a list
rouge/rouge.py
def get_scores(self, avg=False, ignore_empty=False): """Calculate ROUGE scores between each pair of lines (hyp_file[i], ref_file[i]). Args: * hyp_path: hypothesis file path * ref_path: references file path * avg (False): whether to get an average scores or a list ...
def get_scores(self, avg=False, ignore_empty=False): """Calculate ROUGE scores between each pair of lines (hyp_file[i], ref_file[i]). Args: * hyp_path: hypothesis file path * ref_path: references file path * avg (False): whether to get an average scores or a list ...
[ "Calculate", "ROUGE", "scores", "between", "each", "pair", "of", "lines", "(", "hyp_file", "[", "i", "]", "ref_file", "[", "i", "]", ")", ".", "Args", ":", "*", "hyp_path", ":", "hypothesis", "file", "path", "*", "ref_path", ":", "references", "file", ...
pltrdy/rouge
python
https://github.com/pltrdy/rouge/blob/7bf8a83af5ca5c1677b93620b4e1f85ffd63b377/rouge/rouge.py#L34-L50
[ "def", "get_scores", "(", "self", ",", "avg", "=", "False", ",", "ignore_empty", "=", "False", ")", ":", "hyp_path", ",", "ref_path", "=", "self", ".", "hyp_path", ",", "self", ".", "ref_path", "with", "io", ".", "open", "(", "hyp_path", ",", "encoding...
7bf8a83af5ca5c1677b93620b4e1f85ffd63b377
test
calc_pvalues
calculate pvalues for all categories in the graph :param set query: set of identifiers for which the p value is calculated :param dict gene_sets: gmt file dict after background was set :param set background: total number of genes in your annotated database. :returns: pvalues x: overlapped...
gseapy/stats.py
def calc_pvalues(query, gene_sets, background=20000, **kwargs): """ calculate pvalues for all categories in the graph :param set query: set of identifiers for which the p value is calculated :param dict gene_sets: gmt file dict after background was set :param set background: total number of genes in yo...
def calc_pvalues(query, gene_sets, background=20000, **kwargs): """ calculate pvalues for all categories in the graph :param set query: set of identifiers for which the p value is calculated :param dict gene_sets: gmt file dict after background was set :param set background: total number of genes in yo...
[ "calculate", "pvalues", "for", "all", "categories", "in", "the", "graph" ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/stats.py#L10-L77
[ "def", "calc_pvalues", "(", "query", ",", "gene_sets", ",", "background", "=", "20000", ",", "*", "*", "kwargs", ")", ":", "# number of genes in your query data", "k", "=", "len", "(", "query", ")", "query", "=", "set", "(", "query", ")", "vals", "=", "[...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
fdrcorrection
benjamini hocheberg fdr correction. inspired by statsmodels
gseapy/stats.py
def fdrcorrection(pvals, alpha=0.05): """ benjamini hocheberg fdr correction. inspired by statsmodels """ # Implement copy from GOATools. pvals = np.asarray(pvals) pvals_sortind = np.argsort(pvals) pvals_sorted = np.take(pvals, pvals_sortind) ecdffactor = _ecdf(pvals_sorted) reject = p...
def fdrcorrection(pvals, alpha=0.05): """ benjamini hocheberg fdr correction. inspired by statsmodels """ # Implement copy from GOATools. pvals = np.asarray(pvals) pvals_sortind = np.argsort(pvals) pvals_sorted = np.take(pvals, pvals_sortind) ecdffactor = _ecdf(pvals_sorted) reject = p...
[ "benjamini", "hocheberg", "fdr", "correction", ".", "inspired", "by", "statsmodels" ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/stats.py#L85-L107
[ "def", "fdrcorrection", "(", "pvals", ",", "alpha", "=", "0.05", ")", ":", "# Implement copy from GOATools.", "pvals", "=", "np", ".", "asarray", "(", "pvals", ")", "pvals_sortind", "=", "np", ".", "argsort", "(", "pvals", ")", "pvals_sorted", "=", "np", "...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
zscore
Standardize the mean and variance of the data axis Parameters. :param data2d: DataFrame to normalize. :param axis: int, Which axis to normalize across. If 0, normalize across rows, if 1, normalize across columns. If None, don't change data :Returns: Normalized DataFrame...
gseapy/plot.py
def zscore(data2d, axis=0): """Standardize the mean and variance of the data axis Parameters. :param data2d: DataFrame to normalize. :param axis: int, Which axis to normalize across. If 0, normalize across rows, if 1, normalize across columns. If None, don't change data ...
def zscore(data2d, axis=0): """Standardize the mean and variance of the data axis Parameters. :param data2d: DataFrame to normalize. :param axis: int, Which axis to normalize across. If 0, normalize across rows, if 1, normalize across columns. If None, don't change data ...
[ "Standardize", "the", "mean", "and", "variance", "of", "the", "data", "axis", "Parameters", "." ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/plot.py#L28-L57
[ "def", "zscore", "(", "data2d", ",", "axis", "=", "0", ")", ":", "if", "axis", "is", "None", ":", "# normalized to mean and std using entire matrix", "# z_scored = (data2d - data2d.values.mean()) / data2d.values.std(ddof=1)", "return", "data2d", "assert", "axis", "in", "[...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
heatmap
Visualize the dataframe. :param df: DataFrame from expression table. :param z_score: z_score axis{0, 1}. If None, don't normalize data. :param title: gene set name. :param outdir: path to save heatmap. :param figsize: heatmap figsize. :param cmap: matplotlib colormap. :param ofname: output ...
gseapy/plot.py
def heatmap(df, z_score=None, title='', figsize=(5,5), cmap='RdBu_r', xticklabels=True, yticklabels=True, ofname=None, **kwargs): """Visualize the dataframe. :param df: DataFrame from expression table. :param z_score: z_score axis{0, 1}. If None, don't normalize data. :param title: gene se...
def heatmap(df, z_score=None, title='', figsize=(5,5), cmap='RdBu_r', xticklabels=True, yticklabels=True, ofname=None, **kwargs): """Visualize the dataframe. :param df: DataFrame from expression table. :param z_score: z_score axis{0, 1}. If None, don't normalize data. :param title: gene se...
[ "Visualize", "the", "dataframe", "." ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/plot.py#L67-L117
[ "def", "heatmap", "(", "df", ",", "z_score", "=", "None", ",", "title", "=", "''", ",", "figsize", "=", "(", "5", ",", "5", ")", ",", "cmap", "=", "'RdBu_r'", ",", "xticklabels", "=", "True", ",", "yticklabels", "=", "True", ",", "ofname", "=", "...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
gseaplot
This is the main function for reproducing the gsea plot. :param rank_metric: pd.Series for rankings, rank_metric.values. :param term: gene_set name :param hits_indices: hits indices of rank_metric.index presented in gene set S. :param nes: Normalized enrichment scores. :param pval: nominal p-value....
gseapy/plot.py
def gseaplot(rank_metric, term, hits_indices, nes, pval, fdr, RES, pheno_pos='', pheno_neg='', figsize=(6,5.5), cmap='seismic', ofname=None, **kwargs): """This is the main function for reproducing the gsea plot. :param rank_metric: pd.Series for rankings, rank_metric.values. :p...
def gseaplot(rank_metric, term, hits_indices, nes, pval, fdr, RES, pheno_pos='', pheno_neg='', figsize=(6,5.5), cmap='seismic', ofname=None, **kwargs): """This is the main function for reproducing the gsea plot. :param rank_metric: pd.Series for rankings, rank_metric.values. :p...
[ "This", "is", "the", "main", "function", "for", "reproducing", "the", "gsea", "plot", "." ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/plot.py#L119-L243
[ "def", "gseaplot", "(", "rank_metric", ",", "term", ",", "hits_indices", ",", "nes", ",", "pval", ",", "fdr", ",", "RES", ",", "pheno_pos", "=", "''", ",", "pheno_neg", "=", "''", ",", "figsize", "=", "(", "6", ",", "5.5", ")", ",", "cmap", "=", ...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
dotplot
Visualize enrichr results. :param df: GSEApy DataFrame results. :param column: which column of DataFrame to show. Default: Adjusted P-value :param title: figure title :param cutoff: p-adjust cut-off. :param top_term: number of enriched terms to show. :param ascending: bool, the order of y axis....
gseapy/plot.py
def dotplot(df, column='Adjusted P-value', title='', cutoff=0.05, top_term=10, sizes=None, norm=None, legend=True, figsize=(6, 5.5), cmap='RdBu_r', ofname=None, **kwargs): """Visualize enrichr results. :param df: GSEApy DataFrame results. :param column: which column of DataFrame t...
def dotplot(df, column='Adjusted P-value', title='', cutoff=0.05, top_term=10, sizes=None, norm=None, legend=True, figsize=(6, 5.5), cmap='RdBu_r', ofname=None, **kwargs): """Visualize enrichr results. :param df: GSEApy DataFrame results. :param column: which column of DataFrame t...
[ "Visualize", "enrichr", "results", "." ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/plot.py#L253-L380
[ "def", "dotplot", "(", "df", ",", "column", "=", "'Adjusted P-value'", ",", "title", "=", "''", ",", "cutoff", "=", "0.05", ",", "top_term", "=", "10", ",", "sizes", "=", "None", ",", "norm", "=", "None", ",", "legend", "=", "True", ",", "figsize", ...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
barplot
Visualize enrichr results. :param df: GSEApy DataFrame results. :param column: which column of DataFrame to show. Default: Adjusted P-value :param title: figure title. :param cutoff: cut-off of the cloumn you've chosen. :param top_term: number of top enriched terms to show. :param figsize: tupl...
gseapy/plot.py
def barplot(df, column='Adjusted P-value', title="", cutoff=0.05, top_term=10, figsize=(6.5,6), color='salmon', ofname=None, **kwargs): """Visualize enrichr results. :param df: GSEApy DataFrame results. :param column: which column of DataFrame to show. Default: Adjusted P-value :param title...
def barplot(df, column='Adjusted P-value', title="", cutoff=0.05, top_term=10, figsize=(6.5,6), color='salmon', ofname=None, **kwargs): """Visualize enrichr results. :param df: GSEApy DataFrame results. :param column: which column of DataFrame to show. Default: Adjusted P-value :param title...
[ "Visualize", "enrichr", "results", "." ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/plot.py#L382-L434
[ "def", "barplot", "(", "df", ",", "column", "=", "'Adjusted P-value'", ",", "title", "=", "\"\"", ",", "cutoff", "=", "0.05", ",", "top_term", "=", "10", ",", "figsize", "=", "(", "6.5", ",", "6", ")", ",", "color", "=", "'salmon'", ",", "ofname", ...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
adjust_spines
function for removing spines and ticks. :param ax: axes object :param spines: a list of spines names to keep. e.g [left, right, top, bottom] if spines = []. remove all spines and ticks.
gseapy/plot.py
def adjust_spines(ax, spines): """function for removing spines and ticks. :param ax: axes object :param spines: a list of spines names to keep. e.g [left, right, top, bottom] if spines = []. remove all spines and ticks. """ for loc, spine in ax.spines.items(): if loc in...
def adjust_spines(ax, spines): """function for removing spines and ticks. :param ax: axes object :param spines: a list of spines names to keep. e.g [left, right, top, bottom] if spines = []. remove all spines and ticks. """ for loc, spine in ax.spines.items(): if loc in...
[ "function", "for", "removing", "spines", "and", "ticks", "." ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/plot.py#L436-L463
[ "def", "adjust_spines", "(", "ax", ",", "spines", ")", ":", "for", "loc", ",", "spine", "in", "ax", ".", "spines", ".", "items", "(", ")", ":", "if", "loc", "in", "spines", ":", "# spine.set_position(('outward', 10)) # outward by 10 points", "# spine.set_smart_...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
main
The Main function/pipeline for GSEApy.
gseapy/__main__.py
def main(): """The Main function/pipeline for GSEApy.""" # Parse options... argparser = prepare_argparser() args = argparser.parse_args() subcommand = args.subcommand_name if subcommand == "replot": # reproduce plots using GSEAPY from .gsea import Replot rep = Replot(in...
def main(): """The Main function/pipeline for GSEApy.""" # Parse options... argparser = prepare_argparser() args = argparser.parse_args() subcommand = args.subcommand_name if subcommand == "replot": # reproduce plots using GSEAPY from .gsea import Replot rep = Replot(in...
[ "The", "Main", "function", "/", "pipeline", "for", "GSEApy", "." ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/__main__.py#L16-L84
[ "def", "main", "(", ")", ":", "# Parse options...", "argparser", "=", "prepare_argparser", "(", ")", "args", "=", "argparser", ".", "parse_args", "(", ")", "subcommand", "=", "args", ".", "subcommand_name", "if", "subcommand", "==", "\"replot\"", ":", "# repro...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
prepare_argparser
Prepare argparser object. New options will be added in this function first.
gseapy/__main__.py
def prepare_argparser(): """Prepare argparser object. New options will be added in this function first.""" description = "%(prog)s -- Gene Set Enrichment Analysis in Python" epilog = "For command line options of each command, type: %(prog)s COMMAND -h" # top-level parser argparser = ap.ArgumentPars...
def prepare_argparser(): """Prepare argparser object. New options will be added in this function first.""" description = "%(prog)s -- Gene Set Enrichment Analysis in Python" epilog = "For command line options of each command, type: %(prog)s COMMAND -h" # top-level parser argparser = ap.ArgumentPars...
[ "Prepare", "argparser", "object", ".", "New", "options", "will", "be", "added", "in", "this", "function", "first", "." ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/__main__.py#L87-L110
[ "def", "prepare_argparser", "(", ")", ":", "description", "=", "\"%(prog)s -- Gene Set Enrichment Analysis in Python\"", "epilog", "=", "\"For command line options of each command, type: %(prog)s COMMAND -h\"", "# top-level parser", "argparser", "=", "ap", ".", "ArgumentParser", "(...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
add_output_option
output option
gseapy/__main__.py
def add_output_option(parser): """output option""" parser.add_argument("-o", "--outdir", dest="outdir", type=str, default='GSEApy_reports', metavar='', action="store", help="The GSEApy output directory. Default: the current working directory") parser.add_argu...
def add_output_option(parser): """output option""" parser.add_argument("-o", "--outdir", dest="outdir", type=str, default='GSEApy_reports', metavar='', action="store", help="The GSEApy output directory. Default: the current working directory") parser.add_argu...
[ "output", "option" ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/__main__.py#L112-L131
[ "def", "add_output_option", "(", "parser", ")", ":", "parser", ".", "add_argument", "(", "\"-o\"", ",", "\"--outdir\"", ",", "dest", "=", "\"outdir\"", ",", "type", "=", "str", ",", "default", "=", "'GSEApy_reports'", ",", "metavar", "=", "''", ",", "actio...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
add_output_group
output group
gseapy/__main__.py
def add_output_group(parser, required=True): """output group""" output_group = parser.add_mutually_exclusive_group(required=required) output_group.add_argument("-o", "--ofile", dest="ofile", type=str, default='GSEApy_reports', help="Output file name. Mutually exclusive with --...
def add_output_group(parser, required=True): """output group""" output_group = parser.add_mutually_exclusive_group(required=required) output_group.add_argument("-o", "--ofile", dest="ofile", type=str, default='GSEApy_reports', help="Output file name. Mutually exclusive with --...
[ "output", "group" ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/__main__.py#L134-L141
[ "def", "add_output_group", "(", "parser", ",", "required", "=", "True", ")", ":", "output_group", "=", "parser", ".", "add_mutually_exclusive_group", "(", "required", "=", "required", ")", "output_group", ".", "add_argument", "(", "\"-o\"", ",", "\"--ofile\"", "...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
add_gsea_parser
Add main function 'gsea' argument parsers.
gseapy/__main__.py
def add_gsea_parser(subparsers): """Add main function 'gsea' argument parsers.""" argparser_gsea = subparsers.add_parser("gsea", help="Main GSEApy Function: run GSEApy instead of GSEA.") # group for input files group_input = argparser_gsea.add_argument_group("Input files arguments") group_input.ad...
def add_gsea_parser(subparsers): """Add main function 'gsea' argument parsers.""" argparser_gsea = subparsers.add_parser("gsea", help="Main GSEApy Function: run GSEApy instead of GSEA.") # group for input files group_input = argparser_gsea.add_argument_group("Input files arguments") group_input.ad...
[ "Add", "main", "function", "gsea", "argument", "parsers", "." ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/__main__.py#L144-L188
[ "def", "add_gsea_parser", "(", "subparsers", ")", ":", "argparser_gsea", "=", "subparsers", ".", "add_parser", "(", "\"gsea\"", ",", "help", "=", "\"Main GSEApy Function: run GSEApy instead of GSEA.\"", ")", "# group for input files", "group_input", "=", "argparser_gsea", ...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
add_prerank_parser
Add function 'prerank' argument parsers.
gseapy/__main__.py
def add_prerank_parser(subparsers): """Add function 'prerank' argument parsers.""" argparser_prerank = subparsers.add_parser("prerank", help="Run GSEApy Prerank tool on preranked gene list.") # group for input files prerank_input = argparser_prerank.add_argument_group("Input files arguments") prer...
def add_prerank_parser(subparsers): """Add function 'prerank' argument parsers.""" argparser_prerank = subparsers.add_parser("prerank", help="Run GSEApy Prerank tool on preranked gene list.") # group for input files prerank_input = argparser_prerank.add_argument_group("Input files arguments") prer...
[ "Add", "function", "prerank", "argument", "parsers", "." ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/__main__.py#L191-L227
[ "def", "add_prerank_parser", "(", "subparsers", ")", ":", "argparser_prerank", "=", "subparsers", ".", "add_parser", "(", "\"prerank\"", ",", "help", "=", "\"Run GSEApy Prerank tool on preranked gene list.\"", ")", "# group for input files", "prerank_input", "=", "argparser...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
add_plot_parser
Add function 'plot' argument parsers.
gseapy/__main__.py
def add_plot_parser(subparsers): """Add function 'plot' argument parsers.""" argparser_replot = subparsers.add_parser("replot", help="Reproduce GSEA desktop output figures.") group_replot = argparser_replot.add_argument_group("Input arguments") group_replot.add_argument("-i", "--indir", action="store...
def add_plot_parser(subparsers): """Add function 'plot' argument parsers.""" argparser_replot = subparsers.add_parser("replot", help="Reproduce GSEA desktop output figures.") group_replot = argparser_replot.add_argument_group("Input arguments") group_replot.add_argument("-i", "--indir", action="store...
[ "Add", "function", "plot", "argument", "parsers", "." ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/__main__.py#L271-L285
[ "def", "add_plot_parser", "(", "subparsers", ")", ":", "argparser_replot", "=", "subparsers", ".", "add_parser", "(", "\"replot\"", ",", "help", "=", "\"Reproduce GSEA desktop output figures.\"", ")", "group_replot", "=", "argparser_replot", ".", "add_argument_group", "...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
add_enrichr_parser
Add function 'enrichr' argument parsers.
gseapy/__main__.py
def add_enrichr_parser(subparsers): """Add function 'enrichr' argument parsers.""" argparser_enrichr = subparsers.add_parser("enrichr", help="Using Enrichr API to perform GO analysis.") # group for required options. enrichr_opt = argparser_enrichr.add_argument_group("Input arguments") enrichr_opt....
def add_enrichr_parser(subparsers): """Add function 'enrichr' argument parsers.""" argparser_enrichr = subparsers.add_parser("enrichr", help="Using Enrichr API to perform GO analysis.") # group for required options. enrichr_opt = argparser_enrichr.add_argument_group("Input arguments") enrichr_opt....
[ "Add", "function", "enrichr", "argument", "parsers", "." ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/__main__.py#L288-L317
[ "def", "add_enrichr_parser", "(", "subparsers", ")", ":", "argparser_enrichr", "=", "subparsers", ".", "add_parser", "(", "\"enrichr\"", ",", "help", "=", "\"Using Enrichr API to perform GO analysis.\"", ")", "# group for required options.", "enrichr_opt", "=", "argparser_e...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
add_biomart_parser
Add function 'biomart' argument parsers.
gseapy/__main__.py
def add_biomart_parser(subparsers): """Add function 'biomart' argument parsers.""" argparser_biomart = subparsers.add_parser("biomart", help="Using BioMart API to convert gene ids.") # group for required options. biomart_opt = argparser_biomart.add_argument_group("Input arguments") biomart_opt.add...
def add_biomart_parser(subparsers): """Add function 'biomart' argument parsers.""" argparser_biomart = subparsers.add_parser("biomart", help="Using BioMart API to convert gene ids.") # group for required options. biomart_opt = argparser_biomart.add_argument_group("Input arguments") biomart_opt.add...
[ "Add", "function", "biomart", "argument", "parsers", "." ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/__main__.py#L320-L342
[ "def", "add_biomart_parser", "(", "subparsers", ")", ":", "argparser_biomart", "=", "subparsers", ".", "add_parser", "(", "\"biomart\"", ",", "help", "=", "\"Using BioMart API to convert gene ids.\"", ")", "# group for required options.", "biomart_opt", "=", "argparser_biom...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
enrichment_score
This is the most important function of GSEApy. It has the same algorithm with GSEA and ssGSEA. :param gene_list: The ordered gene list gene_name_list, rank_metric.index.values :param gene_set: gene_sets in gmt file, please use gsea_gmt_parser to get gene_set. :param weighted_score_type: It's ...
gseapy/algorithm.py
def enrichment_score(gene_list, correl_vector, gene_set, weighted_score_type=1, nperm=1000, rs=np.random.RandomState(), single=False, scale=False): """This is the most important function of GSEApy. It has the same algorithm with GSEA and ssGSEA. :param gene_list: The ordered gene li...
def enrichment_score(gene_list, correl_vector, gene_set, weighted_score_type=1, nperm=1000, rs=np.random.RandomState(), single=False, scale=False): """This is the most important function of GSEApy. It has the same algorithm with GSEA and ssGSEA. :param gene_list: The ordered gene li...
[ "This", "is", "the", "most", "important", "function", "of", "GSEApy", ".", "It", "has", "the", "same", "algorithm", "with", "GSEA", "and", "ssGSEA", "." ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/algorithm.py#L10-L85
[ "def", "enrichment_score", "(", "gene_list", ",", "correl_vector", ",", "gene_set", ",", "weighted_score_type", "=", "1", ",", "nperm", "=", "1000", ",", "rs", "=", "np", ".", "random", ".", "RandomState", "(", ")", ",", "single", "=", "False", ",", "sca...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
enrichment_score_tensor
Next generation algorithm of GSEA and ssGSEA. :param gene_mat: the ordered gene list(vector) with or without gene indices matrix. :param cor_mat: correlation vector or matrix (e.g. signal to noise scores) corresponding to the genes in the gene list or mat...
gseapy/algorithm.py
def enrichment_score_tensor(gene_mat, cor_mat, gene_sets, weighted_score_type, nperm=1000, rs=np.random.RandomState(), single=False, scale=False): """Next generation algorithm of GSEA and ssGSEA. :param gene_mat: the ordered gene list(vector) with or without gene indices ...
def enrichment_score_tensor(gene_mat, cor_mat, gene_sets, weighted_score_type, nperm=1000, rs=np.random.RandomState(), single=False, scale=False): """Next generation algorithm of GSEA and ssGSEA. :param gene_mat: the ordered gene list(vector) with or without gene indices ...
[ "Next", "generation", "algorithm", "of", "GSEA", "and", "ssGSEA", "." ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/algorithm.py#L89-L188
[ "def", "enrichment_score_tensor", "(", "gene_mat", ",", "cor_mat", ",", "gene_sets", ",", "weighted_score_type", ",", "nperm", "=", "1000", ",", "rs", "=", "np", ".", "random", ".", "RandomState", "(", ")", ",", "single", "=", "False", ",", "scale", "=", ...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
ranking_metric_tensor
Build shuffled ranking matrix when permutation_type eq to phenotype. :param exprs: gene_expression DataFrame, gene_name indexed. :param str method: calculate correlation or ranking. methods including: 1. 'signal_to_noise'. 2. 't_test'. ...
gseapy/algorithm.py
def ranking_metric_tensor(exprs, method, permutation_num, pos, neg, classes, ascending, rs=np.random.RandomState()): """Build shuffled ranking matrix when permutation_type eq to phenotype. :param exprs: gene_expression DataFrame, gene_name indexed. :param str method: calc...
def ranking_metric_tensor(exprs, method, permutation_num, pos, neg, classes, ascending, rs=np.random.RandomState()): """Build shuffled ranking matrix when permutation_type eq to phenotype. :param exprs: gene_expression DataFrame, gene_name indexed. :param str method: calc...
[ "Build", "shuffled", "ranking", "matrix", "when", "permutation_type", "eq", "to", "phenotype", "." ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/algorithm.py#L191-L253
[ "def", "ranking_metric_tensor", "(", "exprs", ",", "method", ",", "permutation_num", ",", "pos", ",", "neg", ",", "classes", ",", "ascending", ",", "rs", "=", "np", ".", "random", ".", "RandomState", "(", ")", ")", ":", "# S: samples, G: gene number", "G", ...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
ranking_metric
The main function to rank an expression table. :param df: gene_expression DataFrame. :param method: The method used to calculate a correlation or ranking. Default: 'log2_ratio_of_classes'. Others methods are: 1. 'signal_to_noise' ...
gseapy/algorithm.py
def ranking_metric(df, method, pos, neg, classes, ascending): """The main function to rank an expression table. :param df: gene_expression DataFrame. :param method: The method used to calculate a correlation or ranking. Default: 'log2_ratio_of_classes'. Others methods are...
def ranking_metric(df, method, pos, neg, classes, ascending): """The main function to rank an expression table. :param df: gene_expression DataFrame. :param method: The method used to calculate a correlation or ranking. Default: 'log2_ratio_of_classes'. Others methods are...
[ "The", "main", "function", "to", "rank", "an", "expression", "table", "." ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/algorithm.py#L255-L320
[ "def", "ranking_metric", "(", "df", ",", "method", ",", "pos", ",", "neg", ",", "classes", ",", "ascending", ")", ":", "# exclude any zero stds.", "df_mean", "=", "df", ".", "groupby", "(", "by", "=", "classes", ",", "axis", "=", "1", ")", ".", "mean",...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
gsea_compute_tensor
compute enrichment scores and enrichment nulls. :param data: preprocessed expression dataframe or a pre-ranked file if prerank=True. :param dict gmt: all gene sets in .gmt file. need to call load_gmt() to get results. :param int n: permutation number. default: 1000. :param str method: r...
gseapy/algorithm.py
def gsea_compute_tensor(data, gmt, n, weighted_score_type, permutation_type, method, pheno_pos, pheno_neg, classes, ascending, processes=1, seed=None, single=False, scale=False): """compute enrichment scores and enrichment nulls. :param data: preprocessed expression datafr...
def gsea_compute_tensor(data, gmt, n, weighted_score_type, permutation_type, method, pheno_pos, pheno_neg, classes, ascending, processes=1, seed=None, single=False, scale=False): """compute enrichment scores and enrichment nulls. :param data: preprocessed expression datafr...
[ "compute", "enrichment", "scores", "and", "enrichment", "nulls", "." ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/algorithm.py#L323-L418
[ "def", "gsea_compute_tensor", "(", "data", ",", "gmt", ",", "n", ",", "weighted_score_type", ",", "permutation_type", ",", "method", ",", "pheno_pos", ",", "pheno_neg", ",", "classes", ",", "ascending", ",", "processes", "=", "1", ",", "seed", "=", "None", ...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
gsea_compute
compute enrichment scores and enrichment nulls. :param data: preprocessed expression dataframe or a pre-ranked file if prerank=True. :param dict gmt: all gene sets in .gmt file. need to call load_gmt() to get results. :param int n: permutation number. default: 1000. :param str method: r...
gseapy/algorithm.py
def gsea_compute(data, gmt, n, weighted_score_type, permutation_type, method, pheno_pos, pheno_neg, classes, ascending, processes=1, seed=None, single=False, scale=False): """compute enrichment scores and enrichment nulls. :param data: preprocessed expression dataframe or ...
def gsea_compute(data, gmt, n, weighted_score_type, permutation_type, method, pheno_pos, pheno_neg, classes, ascending, processes=1, seed=None, single=False, scale=False): """compute enrichment scores and enrichment nulls. :param data: preprocessed expression dataframe or ...
[ "compute", "enrichment", "scores", "and", "enrichment", "nulls", "." ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/algorithm.py#L422-L507
[ "def", "gsea_compute", "(", "data", ",", "gmt", ",", "n", ",", "weighted_score_type", ",", "permutation_type", ",", "method", ",", "pheno_pos", ",", "pheno_neg", ",", "classes", ",", "ascending", ",", "processes", "=", "1", ",", "seed", "=", "None", ",", ...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
gsea_pval
Compute nominal p-value. From article (PNAS): estimate nominal p-value for S from esnull by using the positive or negative portion of the distribution corresponding to the sign of the observed ES(S).
gseapy/algorithm.py
def gsea_pval(es, esnull): """Compute nominal p-value. From article (PNAS): estimate nominal p-value for S from esnull by using the positive or negative portion of the distribution corresponding to the sign of the observed ES(S). """ # to speed up, using numpy function to compute pval in p...
def gsea_pval(es, esnull): """Compute nominal p-value. From article (PNAS): estimate nominal p-value for S from esnull by using the positive or negative portion of the distribution corresponding to the sign of the observed ES(S). """ # to speed up, using numpy function to compute pval in p...
[ "Compute", "nominal", "p", "-", "value", "." ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/algorithm.py#L509-L524
[ "def", "gsea_pval", "(", "es", ",", "esnull", ")", ":", "# to speed up, using numpy function to compute pval in parallel.", "condlist", "=", "[", "es", "<", "0", ",", "es", ">=", "0", "]", "choicelist", "=", "[", "np", ".", "sum", "(", "esnull", "<", "es", ...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
normalize
normalize the ES(S,pi) and the observed ES(S), separately rescaling the positive and negative scores by dividing the mean of the ES(S,pi). return: NES, NESnull
gseapy/algorithm.py
def normalize(es, esnull): """normalize the ES(S,pi) and the observed ES(S), separately rescaling the positive and negative scores by dividing the mean of the ES(S,pi). return: NES, NESnull """ nEnrichmentScores =np.zeros(es.shape) nEnrichmentNulls=np.zeros(esnull.shape) esnu...
def normalize(es, esnull): """normalize the ES(S,pi) and the observed ES(S), separately rescaling the positive and negative scores by dividing the mean of the ES(S,pi). return: NES, NESnull """ nEnrichmentScores =np.zeros(es.shape) nEnrichmentNulls=np.zeros(esnull.shape) esnu...
[ "normalize", "the", "ES", "(", "S", "pi", ")", "and", "the", "observed", "ES", "(", "S", ")", "separately", "rescaling", "the", "positive", "and", "negative", "scores", "by", "dividing", "the", "mean", "of", "the", "ES", "(", "S", "pi", ")", ".", "re...
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/algorithm.py#L527-L554
[ "def", "normalize", "(", "es", ",", "esnull", ")", ":", "nEnrichmentScores", "=", "np", ".", "zeros", "(", "es", ".", "shape", ")", "nEnrichmentNulls", "=", "np", ".", "zeros", "(", "esnull", ".", "shape", ")", "esnull_pos", "=", "(", "esnull", "*", ...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
gsea_significance
Compute nominal pvals, normalized ES, and FDR q value. For a given NES(S) = NES* >= 0. The FDR is the ratio of the percentage of all (S,pi) with NES(S,pi) >= 0, whose NES(S,pi) >= NES*, divided by the percentage of observed S wih NES(S) >= 0, whose NES(S) >= NES*, and similarly if NES(S) = NES*...
gseapy/algorithm.py
def gsea_significance(enrichment_scores, enrichment_nulls): """Compute nominal pvals, normalized ES, and FDR q value. For a given NES(S) = NES* >= 0. The FDR is the ratio of the percentage of all (S,pi) with NES(S,pi) >= 0, whose NES(S,pi) >= NES*, divided by the percentage of observed S wi...
def gsea_significance(enrichment_scores, enrichment_nulls): """Compute nominal pvals, normalized ES, and FDR q value. For a given NES(S) = NES* >= 0. The FDR is the ratio of the percentage of all (S,pi) with NES(S,pi) >= 0, whose NES(S,pi) >= NES*, divided by the percentage of observed S wi...
[ "Compute", "nominal", "pvals", "normalized", "ES", "and", "FDR", "q", "value", "." ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/algorithm.py#L557-L629
[ "def", "gsea_significance", "(", "enrichment_scores", ",", "enrichment_nulls", ")", ":", "# For a zero by zero division (undetermined, results in a NaN),", "np", ".", "seterr", "(", "divide", "=", "'ignore'", ",", "invalid", "=", "'ignore'", ")", "# import warnings", "# w...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
log_init
logging start
gseapy/utils.py
def log_init(outlog, log_level=logging.INFO): """logging start""" # clear old root logger handlers logging.getLogger("gseapy").handlers = [] # init a root logger logging.basicConfig(level = logging.DEBUG, format = 'LINE %(lineno)-4d: %(asctime)s [%(levelname)-8s] %(mess...
def log_init(outlog, log_level=logging.INFO): """logging start""" # clear old root logger handlers logging.getLogger("gseapy").handlers = [] # init a root logger logging.basicConfig(level = logging.DEBUG, format = 'LINE %(lineno)-4d: %(asctime)s [%(levelname)-8s] %(mess...
[ "logging", "start" ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/utils.py#L39-L61
[ "def", "log_init", "(", "outlog", ",", "log_level", "=", "logging", ".", "INFO", ")", ":", "# clear old root logger handlers", "logging", ".", "getLogger", "(", "\"gseapy\"", ")", ".", "handlers", "=", "[", "]", "# init a root logger", "logging", ".", "basicConf...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
log_stop
log stop
gseapy/utils.py
def log_stop(logger): """log stop""" handlers = logger.handlers[:] for handler in handlers: handler.close() logger.removeHandler(handler)
def log_stop(logger): """log stop""" handlers = logger.handlers[:] for handler in handlers: handler.close() logger.removeHandler(handler)
[ "log", "stop" ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/utils.py#L63-L69
[ "def", "log_stop", "(", "logger", ")", ":", "handlers", "=", "logger", ".", "handlers", "[", ":", "]", "for", "handler", "in", "handlers", ":", "handler", ".", "close", "(", ")", "logger", ".", "removeHandler", "(", "handler", ")" ]
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
retry
retry connection. define max tries num if the backoff_factor is 0.1, then sleep() will sleep for [0.1s, 0.2s, 0.4s, ...] between retries. It will also force a retry if the status code returned is 500, 502, 503 or 504.
gseapy/utils.py
def retry(num=5): """"retry connection. define max tries num if the backoff_factor is 0.1, then sleep() will sleep for [0.1s, 0.2s, 0.4s, ...] between retries. It will also force a retry if the status code returned is 500, 502, 503 or 504. """ s = requests.Sessi...
def retry(num=5): """"retry connection. define max tries num if the backoff_factor is 0.1, then sleep() will sleep for [0.1s, 0.2s, 0.4s, ...] between retries. It will also force a retry if the status code returned is 500, 502, 503 or 504. """ s = requests.Sessi...
[ "retry", "connection", ".", "define", "max", "tries", "num", "if", "the", "backoff_factor", "is", "0", ".", "1", "then", "sleep", "()", "will", "sleep", "for", "[", "0", ".", "1s", "0", ".", "2s", "0", ".", "4s", "...", "]", "between", "retries", "...
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/utils.py#L72-L86
[ "def", "retry", "(", "num", "=", "5", ")", ":", "s", "=", "requests", ".", "Session", "(", ")", "retries", "=", "Retry", "(", "total", "=", "num", ",", "backoff_factor", "=", "0.1", ",", "status_forcelist", "=", "[", "500", ",", "502", ",", "503", ...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
gsea_cls_parser
Extract class(phenotype) name from .cls file. :param cls: the a class list instance or .cls file which is identical to GSEA input . :return: phenotype name and a list of class vector.
gseapy/parser.py
def gsea_cls_parser(cls): """Extract class(phenotype) name from .cls file. :param cls: the a class list instance or .cls file which is identical to GSEA input . :return: phenotype name and a list of class vector. """ if isinstance(cls, list) : classes = cls sample_name= unique(clas...
def gsea_cls_parser(cls): """Extract class(phenotype) name from .cls file. :param cls: the a class list instance or .cls file which is identical to GSEA input . :return: phenotype name and a list of class vector. """ if isinstance(cls, list) : classes = cls sample_name= unique(clas...
[ "Extract", "class", "(", "phenotype", ")", "name", "from", ".", "cls", "file", "." ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/parser.py#L13-L31
[ "def", "gsea_cls_parser", "(", "cls", ")", ":", "if", "isinstance", "(", "cls", ",", "list", ")", ":", "classes", "=", "cls", "sample_name", "=", "unique", "(", "classes", ")", "elif", "isinstance", "(", "cls", ",", "str", ")", ":", "with", "open", "...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
gsea_edb_parser
Parse results.edb file stored under **edb** file folder. :param results_path: the .results file located inside edb folder. :param index: gene_set index of gmt database, used for iterating items. :return: enrichment_term, hit_index,nes, pval, fdr.
gseapy/parser.py
def gsea_edb_parser(results_path, index=0): """Parse results.edb file stored under **edb** file folder. :param results_path: the .results file located inside edb folder. :param index: gene_set index of gmt database, used for iterating items. :return: enrichment_term, hit_index,nes, pval, fdr. """ ...
def gsea_edb_parser(results_path, index=0): """Parse results.edb file stored under **edb** file folder. :param results_path: the .results file located inside edb folder. :param index: gene_set index of gmt database, used for iterating items. :return: enrichment_term, hit_index,nes, pval, fdr. """ ...
[ "Parse", "results", ".", "edb", "file", "stored", "under", "**", "edb", "**", "file", "folder", "." ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/parser.py#L33-L62
[ "def", "gsea_edb_parser", "(", "results_path", ",", "index", "=", "0", ")", ":", "from", "bs4", "import", "BeautifulSoup", "soup", "=", "BeautifulSoup", "(", "open", "(", "results_path", ")", ",", "features", "=", "'xml'", ")", "tag", "=", "soup", ".", "...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
gsea_gmt_parser
Parse gene_sets.gmt(gene set database) file or download from enrichr server. :param gmt: the gene_sets.gmt file of GSEA input or an enrichr library name. checkout full enrichr library name here: http://amp.pharm.mssm.edu/Enrichr/#stats :param min_size: Minimum allowed number of genes from gene...
gseapy/parser.py
def gsea_gmt_parser(gmt, min_size = 3, max_size = 1000, gene_list=None): """Parse gene_sets.gmt(gene set database) file or download from enrichr server. :param gmt: the gene_sets.gmt file of GSEA input or an enrichr library name. checkout full enrichr library name here: http://amp.pharm.mssm.ed...
def gsea_gmt_parser(gmt, min_size = 3, max_size = 1000, gene_list=None): """Parse gene_sets.gmt(gene set database) file or download from enrichr server. :param gmt: the gene_sets.gmt file of GSEA input or an enrichr library name. checkout full enrichr library name here: http://amp.pharm.mssm.ed...
[ "Parse", "gene_sets", ".", "gmt", "(", "gene", "set", "database", ")", "file", "or", "download", "from", "enrichr", "server", "." ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/parser.py#L65-L146
[ "def", "gsea_gmt_parser", "(", "gmt", ",", "min_size", "=", "3", ",", "max_size", "=", "1000", ",", "gene_list", "=", "None", ")", ":", "if", "gmt", ".", "lower", "(", ")", ".", "endswith", "(", "\".gmt\"", ")", ":", "logging", ".", "info", "(", "\...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
get_library_name
return enrichr active enrichr library name. :param str database: Select one from { 'Human', 'Mouse', 'Yeast', 'Fly', 'Fish', 'Worm' }
gseapy/parser.py
def get_library_name(database='Human'): """return enrichr active enrichr library name. :param str database: Select one from { 'Human', 'Mouse', 'Yeast', 'Fly', 'Fish', 'Worm' } """ # make a get request to get the gmt names and meta data from Enrichr # old code # response = requests.get(...
def get_library_name(database='Human'): """return enrichr active enrichr library name. :param str database: Select one from { 'Human', 'Mouse', 'Yeast', 'Fly', 'Fish', 'Worm' } """ # make a get request to get the gmt names and meta data from Enrichr # old code # response = requests.get(...
[ "return", "enrichr", "active", "enrichr", "library", "name", ".", ":", "param", "str", "database", ":", "Select", "one", "from", "{", "Human", "Mouse", "Yeast", "Fly", "Fish", "Worm", "}" ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/parser.py#L148-L177
[ "def", "get_library_name", "(", "database", "=", "'Human'", ")", ":", "# make a get request to get the gmt names and meta data from Enrichr", "# old code", "# response = requests.get('http://amp.pharm.mssm.edu/Enrichr/geneSetLibrary?mode=meta')", "# gmt_data = response.json()", "# # generate...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
Biomart.get_marts
Get available marts and their names.
gseapy/parser.py
def get_marts(self): """Get available marts and their names.""" mart_names = pd.Series(self.names, name="Name") mart_descriptions = pd.Series(self.displayNames, name="Description") return pd.concat([mart_names, mart_descriptions], axis=1)
def get_marts(self): """Get available marts and their names.""" mart_names = pd.Series(self.names, name="Name") mart_descriptions = pd.Series(self.displayNames, name="Description") return pd.concat([mart_names, mart_descriptions], axis=1)
[ "Get", "available", "marts", "and", "their", "names", "." ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/parser.py#L211-L217
[ "def", "get_marts", "(", "self", ")", ":", "mart_names", "=", "pd", ".", "Series", "(", "self", ".", "names", ",", "name", "=", "\"Name\"", ")", "mart_descriptions", "=", "pd", ".", "Series", "(", "self", ".", "displayNames", ",", "name", "=", "\"Descr...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
Biomart.get_datasets
Get available datasets from mart you've selected
gseapy/parser.py
def get_datasets(self, mart='ENSEMBL_MART_ENSEMBL'): """Get available datasets from mart you've selected""" datasets = self.datasets(mart, raw=True) return pd.read_csv(StringIO(datasets), header=None, usecols=[1, 2], names = ["Name", "Description"],sep="\t")
def get_datasets(self, mart='ENSEMBL_MART_ENSEMBL'): """Get available datasets from mart you've selected""" datasets = self.datasets(mart, raw=True) return pd.read_csv(StringIO(datasets), header=None, usecols=[1, 2], names = ["Name", "Description"],sep="\t")
[ "Get", "available", "datasets", "from", "mart", "you", "ve", "selected" ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/parser.py#L219-L223
[ "def", "get_datasets", "(", "self", ",", "mart", "=", "'ENSEMBL_MART_ENSEMBL'", ")", ":", "datasets", "=", "self", ".", "datasets", "(", "mart", ",", "raw", "=", "True", ")", "return", "pd", ".", "read_csv", "(", "StringIO", "(", "datasets", ")", ",", ...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
Biomart.get_attributes
Get available attritbutes from dataset you've selected
gseapy/parser.py
def get_attributes(self, dataset): """Get available attritbutes from dataset you've selected""" attributes = self.attributes(dataset) attr_ = [ (k, v[0]) for k, v in attributes.items()] return pd.DataFrame(attr_, columns=["Attribute","Description"])
def get_attributes(self, dataset): """Get available attritbutes from dataset you've selected""" attributes = self.attributes(dataset) attr_ = [ (k, v[0]) for k, v in attributes.items()] return pd.DataFrame(attr_, columns=["Attribute","Description"])
[ "Get", "available", "attritbutes", "from", "dataset", "you", "ve", "selected" ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/parser.py#L225-L229
[ "def", "get_attributes", "(", "self", ",", "dataset", ")", ":", "attributes", "=", "self", ".", "attributes", "(", "dataset", ")", "attr_", "=", "[", "(", "k", ",", "v", "[", "0", "]", ")", "for", "k", ",", "v", "in", "attributes", ".", "items", ...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
Biomart.get_filters
Get available filters from dataset you've selected
gseapy/parser.py
def get_filters(self, dataset): """Get available filters from dataset you've selected""" filters = self.filters(dataset) filt_ = [ (k, v[0]) for k, v in filters.items()] return pd.DataFrame(filt_, columns=["Filter", "Description"])
def get_filters(self, dataset): """Get available filters from dataset you've selected""" filters = self.filters(dataset) filt_ = [ (k, v[0]) for k, v in filters.items()] return pd.DataFrame(filt_, columns=["Filter", "Description"])
[ "Get", "available", "filters", "from", "dataset", "you", "ve", "selected" ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/parser.py#L231-L235
[ "def", "get_filters", "(", "self", ",", "dataset", ")", ":", "filters", "=", "self", ".", "filters", "(", "dataset", ")", "filt_", "=", "[", "(", "k", ",", "v", "[", "0", "]", ")", "for", "k", ",", "v", "in", "filters", ".", "items", "(", ")", ...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
Biomart.query
mapping ids using BioMart. :param dataset: str, default: 'hsapiens_gene_ensembl' :param attributes: str, list, tuple :param filters: dict, {'filter name': list(filter value)} :param host: www.ensembl.org, asia.ensembl.org, useast.ensembl.org :return: a dataframe contains all a...
gseapy/parser.py
def query(self, dataset='hsapiens_gene_ensembl', attributes=[], filters={}, filename=None): """mapping ids using BioMart. :param dataset: str, default: 'hsapiens_gene_ensembl' :param attributes: str, list, tuple :param filters: dict, {'filter name': list(filter value)} ...
def query(self, dataset='hsapiens_gene_ensembl', attributes=[], filters={}, filename=None): """mapping ids using BioMart. :param dataset: str, default: 'hsapiens_gene_ensembl' :param attributes: str, list, tuple :param filters: dict, {'filter name': list(filter value)} ...
[ "mapping", "ids", "using", "BioMart", "." ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/parser.py#L237-L295
[ "def", "query", "(", "self", ",", "dataset", "=", "'hsapiens_gene_ensembl'", ",", "attributes", "=", "[", "]", ",", "filters", "=", "{", "}", ",", "filename", "=", "None", ")", ":", "if", "not", "attributes", ":", "attributes", "=", "[", "'ensembl_gene_i...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
gsea
Run Gene Set Enrichment Analysis. :param data: Gene expression data table, Pandas DataFrame, gct file. :param gene_sets: Enrichr Library name or .gmt gene sets file or dict of gene sets. Same input with GSEA. :param cls: A list or a .cls file format required for GSEA. :param str outdir: Results output ...
gseapy/gsea.py
def gsea(data, gene_sets, cls, outdir='GSEA_', min_size=15, max_size=500, permutation_num=1000, weighted_score_type=1,permutation_type='gene_set', method='log2_ratio_of_classes', ascending=False, processes=1, figsize=(6.5,6), format='pdf', graph_num=20, no_plot=False, seed=None, verbose=False...
def gsea(data, gene_sets, cls, outdir='GSEA_', min_size=15, max_size=500, permutation_num=1000, weighted_score_type=1,permutation_type='gene_set', method='log2_ratio_of_classes', ascending=False, processes=1, figsize=(6.5,6), format='pdf', graph_num=20, no_plot=False, seed=None, verbose=False...
[ "Run", "Gene", "Set", "Enrichment", "Analysis", "." ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/gsea.py#L858-L933
[ "def", "gsea", "(", "data", ",", "gene_sets", ",", "cls", ",", "outdir", "=", "'GSEA_'", ",", "min_size", "=", "15", ",", "max_size", "=", "500", ",", "permutation_num", "=", "1000", ",", "weighted_score_type", "=", "1", ",", "permutation_type", "=", "'g...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
ssgsea
Run Gene Set Enrichment Analysis with single sample GSEA tool :param data: Expression table, pd.Series, pd.DataFrame, GCT file, or .rnk file format. :param gene_sets: Enrichr Library name or .gmt gene sets file or dict of gene sets. Same input with GSEA. :param outdir: Results output directory. :param ...
gseapy/gsea.py
def ssgsea(data, gene_sets, outdir="ssGSEA_", sample_norm_method='rank', min_size=15, max_size=2000, permutation_num=0, weighted_score_type=0.25, scale=True, ascending=False, processes=1, figsize=(7,6), format='pdf', graph_num=20, no_plot=False, seed=None, verbose=False): """Run Gene Set Enric...
def ssgsea(data, gene_sets, outdir="ssGSEA_", sample_norm_method='rank', min_size=15, max_size=2000, permutation_num=0, weighted_score_type=0.25, scale=True, ascending=False, processes=1, figsize=(7,6), format='pdf', graph_num=20, no_plot=False, seed=None, verbose=False): """Run Gene Set Enric...
[ "Run", "Gene", "Set", "Enrichment", "Analysis", "with", "single", "sample", "GSEA", "tool" ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/gsea.py#L936-L988
[ "def", "ssgsea", "(", "data", ",", "gene_sets", ",", "outdir", "=", "\"ssGSEA_\"", ",", "sample_norm_method", "=", "'rank'", ",", "min_size", "=", "15", ",", "max_size", "=", "2000", ",", "permutation_num", "=", "0", ",", "weighted_score_type", "=", "0.25", ...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
prerank
Run Gene Set Enrichment Analysis with pre-ranked correlation defined by user. :param rnk: pre-ranked correlation table or pandas DataFrame. Same input with ``GSEA`` .rnk file. :param gene_sets: Enrichr Library name or .gmt gene sets file or dict of gene sets. Same input with GSEA. :param outdir: results ou...
gseapy/gsea.py
def prerank(rnk, gene_sets, outdir='GSEA_Prerank', pheno_pos='Pos', pheno_neg='Neg', min_size=15, max_size=500, permutation_num=1000, weighted_score_type=1, ascending=False, processes=1, figsize=(6.5,6), format='pdf', graph_num=20, no_plot=False, seed=None, verbose=False): """ Ru...
def prerank(rnk, gene_sets, outdir='GSEA_Prerank', pheno_pos='Pos', pheno_neg='Neg', min_size=15, max_size=500, permutation_num=1000, weighted_score_type=1, ascending=False, processes=1, figsize=(6.5,6), format='pdf', graph_num=20, no_plot=False, seed=None, verbose=False): """ Ru...
[ "Run", "Gene", "Set", "Enrichment", "Analysis", "with", "pre", "-", "ranked", "correlation", "defined", "by", "user", "." ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/gsea.py#L991-L1031
[ "def", "prerank", "(", "rnk", ",", "gene_sets", ",", "outdir", "=", "'GSEA_Prerank'", ",", "pheno_pos", "=", "'Pos'", ",", "pheno_neg", "=", "'Neg'", ",", "min_size", "=", "15", ",", "max_size", "=", "500", ",", "permutation_num", "=", "1000", ",", "weig...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
replot
The main function to reproduce GSEA desktop outputs. :param indir: GSEA desktop results directory. In the sub folder, you must contain edb file folder. :param outdir: Output directory. :param float weighted_score_type: weighted score type. choose from {0,1,1.5,2}. Default: 1. :param list figsize: Matpl...
gseapy/gsea.py
def replot(indir, outdir='GSEA_Replot', weighted_score_type=1, min_size=3, max_size=1000, figsize=(6.5,6), graph_num=20, format='pdf', verbose=False): """The main function to reproduce GSEA desktop outputs. :param indir: GSEA desktop results directory. In the sub folder, you must contain edb file fo...
def replot(indir, outdir='GSEA_Replot', weighted_score_type=1, min_size=3, max_size=1000, figsize=(6.5,6), graph_num=20, format='pdf', verbose=False): """The main function to reproduce GSEA desktop outputs. :param indir: GSEA desktop results directory. In the sub folder, you must contain edb file fo...
[ "The", "main", "function", "to", "reproduce", "GSEA", "desktop", "outputs", "." ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/gsea.py#L1034-L1056
[ "def", "replot", "(", "indir", ",", "outdir", "=", "'GSEA_Replot'", ",", "weighted_score_type", "=", "1", ",", "min_size", "=", "3", ",", "max_size", "=", "1000", ",", "figsize", "=", "(", "6.5", ",", "6", ")", ",", "graph_num", "=", "20", ",", "form...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
GSEAbase.prepare_outdir
create temp directory.
gseapy/gsea.py
def prepare_outdir(self): """create temp directory.""" self._outdir = self.outdir if self._outdir is None: self._tmpdir = TemporaryDirectory() self.outdir = self._tmpdir.name elif isinstance(self.outdir, str): mkdirs(self.outdir) else: ...
def prepare_outdir(self): """create temp directory.""" self._outdir = self.outdir if self._outdir is None: self._tmpdir = TemporaryDirectory() self.outdir = self._tmpdir.name elif isinstance(self.outdir, str): mkdirs(self.outdir) else: ...
[ "create", "temp", "directory", "." ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/gsea.py#L34-L54
[ "def", "prepare_outdir", "(", "self", ")", ":", "self", ".", "_outdir", "=", "self", ".", "outdir", "if", "self", ".", "_outdir", "is", "None", ":", "self", ".", "_tmpdir", "=", "TemporaryDirectory", "(", ")", "self", ".", "outdir", "=", "self", ".", ...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
GSEAbase._set_cores
set cpu numbers to be used
gseapy/gsea.py
def _set_cores(self): """set cpu numbers to be used""" cpu_num = cpu_count()-1 if self._processes > cpu_num: cores = cpu_num elif self._processes < 1: cores = 1 else: cores = self._processes # have to be int if user input is float ...
def _set_cores(self): """set cpu numbers to be used""" cpu_num = cpu_count()-1 if self._processes > cpu_num: cores = cpu_num elif self._processes < 1: cores = 1 else: cores = self._processes # have to be int if user input is float ...
[ "set", "cpu", "numbers", "to", "be", "used" ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/gsea.py#L56-L67
[ "def", "_set_cores", "(", "self", ")", ":", "cpu_num", "=", "cpu_count", "(", ")", "-", "1", "if", "self", ".", "_processes", ">", "cpu_num", ":", "cores", "=", "cpu_num", "elif", "self", ".", "_processes", "<", "1", ":", "cores", "=", "1", "else", ...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
GSEAbase._load_ranking
Parse ranking file. This file contains ranking correlation vector( or expression values) and gene names or ids. :param rnk: the .rnk file of GSEA input or a Pandas DataFrame, Series instance. :return: a Pandas Series with gene name indexed rankings
gseapy/gsea.py
def _load_ranking(self, rnk): """Parse ranking file. This file contains ranking correlation vector( or expression values) and gene names or ids. :param rnk: the .rnk file of GSEA input or a Pandas DataFrame, Series instance. :return: a Pandas Series with gene name indexed ran...
def _load_ranking(self, rnk): """Parse ranking file. This file contains ranking correlation vector( or expression values) and gene names or ids. :param rnk: the .rnk file of GSEA input or a Pandas DataFrame, Series instance. :return: a Pandas Series with gene name indexed ran...
[ "Parse", "ranking", "file", ".", "This", "file", "contains", "ranking", "correlation", "vector", "(", "or", "expression", "values", ")", "and", "gene", "names", "or", "ids", "." ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/gsea.py#L69-L110
[ "def", "_load_ranking", "(", "self", ",", "rnk", ")", ":", "# load data", "if", "isinstance", "(", "rnk", ",", "pd", ".", "DataFrame", ")", ":", "rank_metric", "=", "rnk", ".", "copy", "(", ")", "# handle dataframe with gene_name as index.", "if", "rnk", "."...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
GSEAbase.load_gmt
load gene set dict
gseapy/gsea.py
def load_gmt(self, gene_list, gmt): """load gene set dict""" if isinstance(gmt, dict): genesets_dict = gmt elif isinstance(gmt, str): genesets_dict = self.parse_gmt(gmt) else: raise Exception("Error parsing gmt parameter for gene sets") ...
def load_gmt(self, gene_list, gmt): """load gene set dict""" if isinstance(gmt, dict): genesets_dict = gmt elif isinstance(gmt, str): genesets_dict = self.parse_gmt(gmt) else: raise Exception("Error parsing gmt parameter for gene sets") ...
[ "load", "gene", "set", "dict" ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/gsea.py#L112-L143
[ "def", "load_gmt", "(", "self", ",", "gene_list", ",", "gmt", ")", ":", "if", "isinstance", "(", "gmt", ",", "dict", ")", ":", "genesets_dict", "=", "gmt", "elif", "isinstance", "(", "gmt", ",", "str", ")", ":", "genesets_dict", "=", "self", ".", "pa...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
GSEAbase.parse_gmt
gmt parser
gseapy/gsea.py
def parse_gmt(self, gmt): """gmt parser""" if gmt.lower().endswith(".gmt"): with open(gmt) as genesets: genesets_dict = { line.strip().split("\t")[0]: line.strip().split("\t")[2:] for line in genesets.readlines()} return geneset...
def parse_gmt(self, gmt): """gmt parser""" if gmt.lower().endswith(".gmt"): with open(gmt) as genesets: genesets_dict = { line.strip().split("\t")[0]: line.strip().split("\t")[2:] for line in genesets.readlines()} return geneset...
[ "gmt", "parser" ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/gsea.py#L145-L169
[ "def", "parse_gmt", "(", "self", ",", "gmt", ")", ":", "if", "gmt", ".", "lower", "(", ")", ".", "endswith", "(", "\".gmt\"", ")", ":", "with", "open", "(", "gmt", ")", "as", "genesets", ":", "genesets_dict", "=", "{", "line", ".", "strip", "(", ...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
GSEAbase.get_libraries
return active enrichr library name.Offical API
gseapy/gsea.py
def get_libraries(self, database=''): """return active enrichr library name.Offical API """ lib_url='http://amp.pharm.mssm.edu/%sEnrichr/datasetStatistics'%database libs_json = json.loads(requests.get(lib_url).text) libs = [lib['libraryName'] for lib in libs_json['statistics']] ...
def get_libraries(self, database=''): """return active enrichr library name.Offical API """ lib_url='http://amp.pharm.mssm.edu/%sEnrichr/datasetStatistics'%database libs_json = json.loads(requests.get(lib_url).text) libs = [lib['libraryName'] for lib in libs_json['statistics']] ...
[ "return", "active", "enrichr", "library", "name", ".", "Offical", "API" ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/gsea.py#L171-L177
[ "def", "get_libraries", "(", "self", ",", "database", "=", "''", ")", ":", "lib_url", "=", "'http://amp.pharm.mssm.edu/%sEnrichr/datasetStatistics'", "%", "database", "libs_json", "=", "json", ".", "loads", "(", "requests", ".", "get", "(", "lib_url", ")", ".", ...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
GSEAbase._download_libraries
download enrichr libraries.
gseapy/gsea.py
def _download_libraries(self, libname): """ download enrichr libraries.""" self._logger.info("Downloading and generating Enrichr library gene sets......") s = retry(5) # queery string ENRICHR_URL = 'http://amp.pharm.mssm.edu/Enrichr/geneSetLibrary' query_string = '?mode=t...
def _download_libraries(self, libname): """ download enrichr libraries.""" self._logger.info("Downloading and generating Enrichr library gene sets......") s = retry(5) # queery string ENRICHR_URL = 'http://amp.pharm.mssm.edu/Enrichr/geneSetLibrary' query_string = '?mode=t...
[ "download", "enrichr", "libraries", "." ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/gsea.py#L179-L204
[ "def", "_download_libraries", "(", "self", ",", "libname", ")", ":", "self", ".", "_logger", ".", "info", "(", "\"Downloading and generating Enrichr library gene sets......\"", ")", "s", "=", "retry", "(", "5", ")", "# queery string", "ENRICHR_URL", "=", "'http://am...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
GSEAbase._heatmat
only use for gsea heatmap
gseapy/gsea.py
def _heatmat(self, df, classes, pheno_pos, pheno_neg): """only use for gsea heatmap""" width = len(classes) if len(classes) >= 6 else 5 cls_booA =list(map(lambda x: True if x == pheno_pos else False, classes)) cls_booB =list(map(lambda x: True if x == pheno_neg else False, classes)) ...
def _heatmat(self, df, classes, pheno_pos, pheno_neg): """only use for gsea heatmap""" width = len(classes) if len(classes) >= 6 else 5 cls_booA =list(map(lambda x: True if x == pheno_pos else False, classes)) cls_booB =list(map(lambda x: True if x == pheno_neg else False, classes)) ...
[ "only", "use", "for", "gsea", "heatmap" ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/gsea.py#L206-L216
[ "def", "_heatmat", "(", "self", ",", "df", ",", "classes", ",", "pheno_pos", ",", "pheno_neg", ")", ":", "width", "=", "len", "(", "classes", ")", "if", "len", "(", "classes", ")", ">=", "6", "else", "5", "cls_booA", "=", "list", "(", "map", "(", ...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
GSEAbase._plotting
Plotting API. :param rank_metric: sorted pd.Series with rankings values. :param results: self.results :param data: preprocessed expression table
gseapy/gsea.py
def _plotting(self, rank_metric, results, graph_num, outdir, format, figsize, pheno_pos='', pheno_neg=''): """ Plotting API. :param rank_metric: sorted pd.Series with rankings values. :param results: self.results :param data: preprocessed expression table ...
def _plotting(self, rank_metric, results, graph_num, outdir, format, figsize, pheno_pos='', pheno_neg=''): """ Plotting API. :param rank_metric: sorted pd.Series with rankings values. :param results: self.results :param data: preprocessed expression table ...
[ "Plotting", "API", ".", ":", "param", "rank_metric", ":", "sorted", "pd", ".", "Series", "with", "rankings", "values", ".", ":", "param", "results", ":", "self", ".", "results", ":", "param", "data", ":", "preprocessed", "expression", "table" ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/gsea.py#L218-L256
[ "def", "_plotting", "(", "self", ",", "rank_metric", ",", "results", ",", "graph_num", ",", "outdir", ",", "format", ",", "figsize", ",", "pheno_pos", "=", "''", ",", "pheno_neg", "=", "''", ")", ":", "# no values need to be returned", "if", "self", ".", "...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
GSEAbase._save_results
reformat gsea results, and save to txt
gseapy/gsea.py
def _save_results(self, zipdata, outdir, module, gmt, rank_metric, permutation_type): """reformat gsea results, and save to txt""" res = OrderedDict() for gs, gseale, ind, RES in zipdata: rdict = OrderedDict() rdict['es'] = gseale[0] rdict['nes'] = gseale[1] ...
def _save_results(self, zipdata, outdir, module, gmt, rank_metric, permutation_type): """reformat gsea results, and save to txt""" res = OrderedDict() for gs, gseale, ind, RES in zipdata: rdict = OrderedDict() rdict['es'] = gseale[0] rdict['nes'] = gseale[1] ...
[ "reformat", "gsea", "results", "and", "save", "to", "txt" ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/gsea.py#L259-L312
[ "def", "_save_results", "(", "self", ",", "zipdata", ",", "outdir", ",", "module", ",", "gmt", ",", "rank_metric", ",", "permutation_type", ")", ":", "res", "=", "OrderedDict", "(", ")", "for", "gs", ",", "gseale", ",", "ind", ",", "RES", "in", "zipdat...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
GSEA.load_data
pre-processed the data frame.new filtering methods will be implement here.
gseapy/gsea.py
def load_data(self, cls_vec): """pre-processed the data frame.new filtering methods will be implement here. """ # read data in if isinstance(self.data, pd.DataFrame) : exprs = self.data.copy() # handle index is gene_names if exprs.index.dtype == 'O': ...
def load_data(self, cls_vec): """pre-processed the data frame.new filtering methods will be implement here. """ # read data in if isinstance(self.data, pd.DataFrame) : exprs = self.data.copy() # handle index is gene_names if exprs.index.dtype == 'O': ...
[ "pre", "-", "processed", "the", "data", "frame", ".", "new", "filtering", "methods", "will", "be", "implement", "here", "." ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/gsea.py#L348-L382
[ "def", "load_data", "(", "self", ",", "cls_vec", ")", ":", "# read data in", "if", "isinstance", "(", "self", ".", "data", ",", "pd", ".", "DataFrame", ")", ":", "exprs", "=", "self", ".", "data", ".", "copy", "(", ")", "# handle index is gene_names", "i...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
GSEA.run
GSEA main procedure
gseapy/gsea.py
def run(self): """GSEA main procedure""" assert self.permutation_type in ["phenotype", "gene_set"] assert self.min_size <= self.max_size # Start Analysis self._logger.info("Parsing data files for GSEA.............................") # phenotype labels parsing phe...
def run(self): """GSEA main procedure""" assert self.permutation_type in ["phenotype", "gene_set"] assert self.min_size <= self.max_size # Start Analysis self._logger.info("Parsing data files for GSEA.............................") # phenotype labels parsing phe...
[ "GSEA", "main", "procedure" ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/gsea.py#L384-L438
[ "def", "run", "(", "self", ")", ":", "assert", "self", ".", "permutation_type", "in", "[", "\"phenotype\"", ",", "\"gene_set\"", "]", "assert", "self", ".", "min_size", "<=", "self", ".", "max_size", "# Start Analysis", "self", ".", "_logger", ".", "info", ...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
Prerank.run
GSEA prerank workflow
gseapy/gsea.py
def run(self): """GSEA prerank workflow""" assert self.min_size <= self.max_size # parsing rankings dat2 = self._load_ranking(self.rnk) assert len(dat2) > 1 # cpu numbers self._set_cores() # Start Analysis self._logger.info("Parsing data files f...
def run(self): """GSEA prerank workflow""" assert self.min_size <= self.max_size # parsing rankings dat2 = self._load_ranking(self.rnk) assert len(dat2) > 1 # cpu numbers self._set_cores() # Start Analysis self._logger.info("Parsing data files f...
[ "GSEA", "prerank", "workflow" ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/gsea.py#L474-L515
[ "def", "run", "(", "self", ")", ":", "assert", "self", ".", "min_size", "<=", "self", ".", "max_size", "# parsing rankings", "dat2", "=", "self", ".", "_load_ranking", "(", "self", ".", "rnk", ")", "assert", "len", "(", "dat2", ")", ">", "1", "# cpu nu...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
SingleSampleGSEA.norm_samples
normalization samples see here: http://rowley.mit.edu/caw_web/ssGSEAProjection/ssGSEAProjection.Library.R
gseapy/gsea.py
def norm_samples(self, dat): """normalization samples see here: http://rowley.mit.edu/caw_web/ssGSEAProjection/ssGSEAProjection.Library.R """ if self.sample_norm_method == 'rank': data = dat.rank(axis=0, method='average', na_option='bottom') data = 10000*data ...
def norm_samples(self, dat): """normalization samples see here: http://rowley.mit.edu/caw_web/ssGSEAProjection/ssGSEAProjection.Library.R """ if self.sample_norm_method == 'rank': data = dat.rank(axis=0, method='average', na_option='bottom') data = 10000*data ...
[ "normalization", "samples", "see", "here", ":", "http", ":", "//", "rowley", ".", "mit", ".", "edu", "/", "caw_web", "/", "ssGSEAProjection", "/", "ssGSEAProjection", ".", "Library", ".", "R" ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/gsea.py#L602-L623
[ "def", "norm_samples", "(", "self", ",", "dat", ")", ":", "if", "self", ".", "sample_norm_method", "==", "'rank'", ":", "data", "=", "dat", ".", "rank", "(", "axis", "=", "0", ",", "method", "=", "'average'", ",", "na_option", "=", "'bottom'", ")", "...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
SingleSampleGSEA.run
run entry
gseapy/gsea.py
def run(self): """run entry""" self._logger.info("Parsing data files for ssGSEA...........................") # load data data = self.load_data() # normalized samples, and rank normdat = self.norm_samples(data) # filtering out gene sets and build gene sets dictiona...
def run(self): """run entry""" self._logger.info("Parsing data files for ssGSEA...........................") # load data data = self.load_data() # normalized samples, and rank normdat = self.norm_samples(data) # filtering out gene sets and build gene sets dictiona...
[ "run", "entry" ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/gsea.py#L625-L648
[ "def", "run", "(", "self", ")", ":", "self", ".", "_logger", ".", "info", "(", "\"Parsing data files for ssGSEA...........................\"", ")", "# load data", "data", "=", "self", ".", "load_data", "(", ")", "# normalized samples, and rank", "normdat", "=", "sel...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
SingleSampleGSEA.runSamplesPermu
Single Sample GSEA workflow with permutation procedure
gseapy/gsea.py
def runSamplesPermu(self, df, gmt=None): """Single Sample GSEA workflow with permutation procedure""" assert self.min_size <= self.max_size mkdirs(self.outdir) self.resultsOnSamples = OrderedDict() outdir = self.outdir # iter throught each sample for name, ser in...
def runSamplesPermu(self, df, gmt=None): """Single Sample GSEA workflow with permutation procedure""" assert self.min_size <= self.max_size mkdirs(self.outdir) self.resultsOnSamples = OrderedDict() outdir = self.outdir # iter throught each sample for name, ser in...
[ "Single", "Sample", "GSEA", "workflow", "with", "permutation", "procedure" ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/gsea.py#L650-L691
[ "def", "runSamplesPermu", "(", "self", ",", "df", ",", "gmt", "=", "None", ")", ":", "assert", "self", ".", "min_size", "<=", "self", ".", "max_size", "mkdirs", "(", "self", ".", "outdir", ")", "self", ".", "resultsOnSamples", "=", "OrderedDict", "(", ...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
SingleSampleGSEA.runSamples
Single Sample GSEA workflow. multiprocessing utility on samples.
gseapy/gsea.py
def runSamples(self, df, gmt=None): """Single Sample GSEA workflow. multiprocessing utility on samples. """ # df.index.values are gene_names # Save each sample results to odict self.resultsOnSamples = OrderedDict() outdir = self.outdir # run ssgsea for...
def runSamples(self, df, gmt=None): """Single Sample GSEA workflow. multiprocessing utility on samples. """ # df.index.values are gene_names # Save each sample results to odict self.resultsOnSamples = OrderedDict() outdir = self.outdir # run ssgsea for...
[ "Single", "Sample", "GSEA", "workflow", ".", "multiprocessing", "utility", "on", "samples", "." ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/gsea.py#L693-L747
[ "def", "runSamples", "(", "self", ",", "df", ",", "gmt", "=", "None", ")", ":", "# df.index.values are gene_names", "# Save each sample results to odict", "self", ".", "resultsOnSamples", "=", "OrderedDict", "(", ")", "outdir", "=", "self", ".", "outdir", "# run s...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
SingleSampleGSEA._save
save es and stats
gseapy/gsea.py
def _save(self, outdir): """save es and stats""" # save raw ES to one csv file samplesRawES = pd.DataFrame(self.resultsOnSamples) samplesRawES.index.name = 'Term|ES' # normalize enrichment scores by using the entire data set, as indicated # by Barbie et al., 2009, online ...
def _save(self, outdir): """save es and stats""" # save raw ES to one csv file samplesRawES = pd.DataFrame(self.resultsOnSamples) samplesRawES.index.name = 'Term|ES' # normalize enrichment scores by using the entire data set, as indicated # by Barbie et al., 2009, online ...
[ "save", "es", "and", "stats" ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/gsea.py#L749-L779
[ "def", "_save", "(", "self", ",", "outdir", ")", ":", "# save raw ES to one csv file", "samplesRawES", "=", "pd", ".", "DataFrame", "(", "self", ".", "resultsOnSamples", ")", "samplesRawES", ".", "index", ".", "name", "=", "'Term|ES'", "# normalize enrichment scor...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
Replot.run
main replot function
gseapy/gsea.py
def run(self): """main replot function""" assert self.min_size <= self.max_size assert self.fignum > 0 import glob from bs4 import BeautifulSoup # parsing files....... try: results_path = glob.glob(self.indir+'*/edb/results.edb')[0] rank_p...
def run(self): """main replot function""" assert self.min_size <= self.max_size assert self.fignum > 0 import glob from bs4 import BeautifulSoup # parsing files....... try: results_path = glob.glob(self.indir+'*/edb/results.edb')[0] rank_p...
[ "main", "replot", "function" ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/gsea.py#L802-L854
[ "def", "run", "(", "self", ")", ":", "assert", "self", ".", "min_size", "<=", "self", ".", "max_size", "assert", "self", ".", "fignum", ">", "0", "import", "glob", "from", "bs4", "import", "BeautifulSoup", "# parsing files.......", "try", ":", "results_path"...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
enrichr
Enrichr API. :param gene_list: Flat file with list of genes, one gene id per row, or a python list object :param gene_sets: Enrichr Library to query. Required enrichr library name(s). Separate each name by comma. :param organism: Enrichr supported organism. Select from (human, mouse, yeast, fly, fish, worm...
gseapy/enrichr.py
def enrichr(gene_list, gene_sets, organism='human', description='', outdir='Enrichr', background='hsapiens_gene_ensembl', cutoff=0.05, format='pdf', figsize=(8,6), top_term=10, no_plot=False, verbose=False): """Enrichr API. :param gene_list: Flat file with list of genes, one gene id per...
def enrichr(gene_list, gene_sets, organism='human', description='', outdir='Enrichr', background='hsapiens_gene_ensembl', cutoff=0.05, format='pdf', figsize=(8,6), top_term=10, no_plot=False, verbose=False): """Enrichr API. :param gene_list: Flat file with list of genes, one gene id per...
[ "Enrichr", "API", "." ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/enrichr.py#L355-L393
[ "def", "enrichr", "(", "gene_list", ",", "gene_sets", ",", "organism", "=", "'human'", ",", "description", "=", "''", ",", "outdir", "=", "'Enrichr'", ",", "background", "=", "'hsapiens_gene_ensembl'", ",", "cutoff", "=", "0.05", ",", "format", "=", "'pdf'",...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
Enrichr.prepare_outdir
create temp directory.
gseapy/enrichr.py
def prepare_outdir(self): """create temp directory.""" self._outdir = self.outdir if self._outdir is None: self._tmpdir = TemporaryDirectory() self.outdir = self._tmpdir.name elif isinstance(self.outdir, str): mkdirs(self.outdir) else: ...
def prepare_outdir(self): """create temp directory.""" self._outdir = self.outdir if self._outdir is None: self._tmpdir = TemporaryDirectory() self.outdir = self._tmpdir.name elif isinstance(self.outdir, str): mkdirs(self.outdir) else: ...
[ "create", "temp", "directory", "." ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/enrichr.py#L50-L63
[ "def", "prepare_outdir", "(", "self", ")", ":", "self", ".", "_outdir", "=", "self", ".", "outdir", "if", "self", ".", "_outdir", "is", "None", ":", "self", ".", "_tmpdir", "=", "TemporaryDirectory", "(", ")", "self", ".", "outdir", "=", "self", ".", ...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
Enrichr.parse_genesets
parse gene_sets input file type
gseapy/enrichr.py
def parse_genesets(self): """parse gene_sets input file type""" enrichr_library = self.get_libraries() if isinstance(self.gene_sets, list): gss = self.gene_sets elif isinstance(self.gene_sets, str): gss = [ g.strip() for g in self.gene_sets.strip().split(",") ] ...
def parse_genesets(self): """parse gene_sets input file type""" enrichr_library = self.get_libraries() if isinstance(self.gene_sets, list): gss = self.gene_sets elif isinstance(self.gene_sets, str): gss = [ g.strip() for g in self.gene_sets.strip().split(",") ] ...
[ "parse", "gene_sets", "input", "file", "type" ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/enrichr.py#L65-L96
[ "def", "parse_genesets", "(", "self", ")", ":", "enrichr_library", "=", "self", ".", "get_libraries", "(", ")", "if", "isinstance", "(", "self", ".", "gene_sets", ",", "list", ")", ":", "gss", "=", "self", ".", "gene_sets", "elif", "isinstance", "(", "se...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
Enrichr.parse_genelists
parse gene list
gseapy/enrichr.py
def parse_genelists(self): """parse gene list""" if isinstance(self.gene_list, list): genes = self.gene_list elif isinstance(self.gene_list, pd.DataFrame): # input type is bed file if self.gene_list.shape[1] >=3: genes= self.gene_list.iloc[:,:3...
def parse_genelists(self): """parse gene list""" if isinstance(self.gene_list, list): genes = self.gene_list elif isinstance(self.gene_list, pd.DataFrame): # input type is bed file if self.gene_list.shape[1] >=3: genes= self.gene_list.iloc[:,:3...
[ "parse", "gene", "list" ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/enrichr.py#L98-L126
[ "def", "parse_genelists", "(", "self", ")", ":", "if", "isinstance", "(", "self", ".", "gene_list", ",", "list", ")", ":", "genes", "=", "self", ".", "gene_list", "elif", "isinstance", "(", "self", ".", "gene_list", ",", "pd", ".", "DataFrame", ")", ":...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
Enrichr.send_genes
send gene list to enrichr server
gseapy/enrichr.py
def send_genes(self, gene_list, url): """ send gene list to enrichr server""" payload = { 'list': (None, gene_list), 'description': (None, self.descriptions) } # response response = requests.post(url, files=payload) if not response.ok: r...
def send_genes(self, gene_list, url): """ send gene list to enrichr server""" payload = { 'list': (None, gene_list), 'description': (None, self.descriptions) } # response response = requests.post(url, files=payload) if not response.ok: r...
[ "send", "gene", "list", "to", "enrichr", "server" ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/enrichr.py#L128-L141
[ "def", "send_genes", "(", "self", ",", "gene_list", ",", "url", ")", ":", "payload", "=", "{", "'list'", ":", "(", "None", ",", "gene_list", ")", ",", "'description'", ":", "(", "None", ",", "self", ".", "descriptions", ")", "}", "# response", "respons...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
Enrichr.check_genes
Compare the genes sent and received to get successfully recognized genes
gseapy/enrichr.py
def check_genes(self, gene_list, usr_list_id): ''' Compare the genes sent and received to get successfully recognized genes ''' response = requests.get('http://amp.pharm.mssm.edu/Enrichr/view?userListId=%s' % usr_list_id) if not response.ok: raise Exception('Error get...
def check_genes(self, gene_list, usr_list_id): ''' Compare the genes sent and received to get successfully recognized genes ''' response = requests.get('http://amp.pharm.mssm.edu/Enrichr/view?userListId=%s' % usr_list_id) if not response.ok: raise Exception('Error get...
[ "Compare", "the", "genes", "sent", "and", "received", "to", "get", "successfully", "recognized", "genes" ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/enrichr.py#L143-L152
[ "def", "check_genes", "(", "self", ",", "gene_list", ",", "usr_list_id", ")", ":", "response", "=", "requests", ".", "get", "(", "'http://amp.pharm.mssm.edu/Enrichr/view?userListId=%s'", "%", "usr_list_id", ")", "if", "not", "response", ".", "ok", ":", "raise", ...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
Enrichr.get_results
Enrichr API
gseapy/enrichr.py
def get_results(self, gene_list): """Enrichr API""" ADDLIST_URL = 'http://amp.pharm.mssm.edu/%sEnrichr/addList'%self._organism job_id = self.send_genes(gene_list, ADDLIST_URL) user_list_id = job_id['userListId'] RESULTS_URL = 'http://amp.pharm.mssm.edu/%sEnrichr/export'%self._or...
def get_results(self, gene_list): """Enrichr API""" ADDLIST_URL = 'http://amp.pharm.mssm.edu/%sEnrichr/addList'%self._organism job_id = self.send_genes(gene_list, ADDLIST_URL) user_list_id = job_id['userListId'] RESULTS_URL = 'http://amp.pharm.mssm.edu/%sEnrichr/export'%self._or...
[ "Enrichr", "API" ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/enrichr.py#L154-L170
[ "def", "get_results", "(", "self", ",", "gene_list", ")", ":", "ADDLIST_URL", "=", "'http://amp.pharm.mssm.edu/%sEnrichr/addList'", "%", "self", ".", "_organism", "job_id", "=", "self", ".", "send_genes", "(", "gene_list", ",", "ADDLIST_URL", ")", "user_list_id", ...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
Enrichr.get_background
get background gene
gseapy/enrichr.py
def get_background(self): """get background gene""" # input is a file if os.path.isfile(self.background): with open(self.background) as b: bg2 = b.readlines() bg = [g.strip() for g in bg2] return set(bg) # package included ...
def get_background(self): """get background gene""" # input is a file if os.path.isfile(self.background): with open(self.background) as b: bg2 = b.readlines() bg = [g.strip() for g in bg2] return set(bg) # package included ...
[ "get", "background", "gene" ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/enrichr.py#L186-L217
[ "def", "get_background", "(", "self", ")", ":", "# input is a file", "if", "os", ".", "path", ".", "isfile", "(", "self", ".", "background", ")", ":", "with", "open", "(", "self", ".", "background", ")", "as", "b", ":", "bg2", "=", "b", ".", "readlin...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
Enrichr.get_organism
Select Enrichr organism from below: Human & Mouse: H. sapiens & M. musculus Fly: D. melanogaster Yeast: S. cerevisiae Worm: C. elegans Fish: D. rerio
gseapy/enrichr.py
def get_organism(self): """Select Enrichr organism from below: Human & Mouse: H. sapiens & M. musculus Fly: D. melanogaster Yeast: S. cerevisiae Worm: C. elegans Fish: D. rerio """ organism = {'default': ['', 'hs', 'mm', 'human','mouse', ...
def get_organism(self): """Select Enrichr organism from below: Human & Mouse: H. sapiens & M. musculus Fly: D. melanogaster Yeast: S. cerevisiae Worm: C. elegans Fish: D. rerio """ organism = {'default': ['', 'hs', 'mm', 'human','mouse', ...
[ "Select", "Enrichr", "organism", "from", "below", ":" ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/enrichr.py#L219-L248
[ "def", "get_organism", "(", "self", ")", ":", "organism", "=", "{", "'default'", ":", "[", "''", ",", "'hs'", ",", "'mm'", ",", "'human'", ",", "'mouse'", ",", "'homo sapiens'", ",", "'mus musculus'", ",", "'h. sapiens'", ",", "'m. musculus'", "]", ",", ...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
Enrichr.enrich
use local mode p = p-value computed using the Fisher exact test (Hypergeometric test) Not implemented here: combine score = log(p)·z see here: http://amp.pharm.mssm.edu/Enrichr/help#background&q=4 columns contain: Term Overlap ...
gseapy/enrichr.py
def enrich(self, gmt): """use local mode p = p-value computed using the Fisher exact test (Hypergeometric test) Not implemented here: combine score = log(p)·z see here: http://amp.pharm.mssm.edu/Enrichr/help#background&q=4 columns contain: ...
def enrich(self, gmt): """use local mode p = p-value computed using the Fisher exact test (Hypergeometric test) Not implemented here: combine score = log(p)·z see here: http://amp.pharm.mssm.edu/Enrichr/help#background&q=4 columns contain: ...
[ "use", "local", "mode", "p", "=", "p", "-", "value", "computed", "using", "the", "Fisher", "exact", "test", "(", "Hypergeometric", "test", ")" ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/enrichr.py#L250-L300
[ "def", "enrich", "(", "self", ",", "gmt", ")", ":", "if", "isscalar", "(", "self", ".", "background", ")", ":", "if", "isinstance", "(", "self", ".", "background", ",", "int", ")", "or", "self", ".", "background", ".", "isdigit", "(", ")", ":", "se...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
Enrichr.run
run enrichr for one sample gene list but multi-libraries
gseapy/enrichr.py
def run(self): """run enrichr for one sample gene list but multi-libraries""" # set organism self.get_organism() # read input file genes_list = self.parse_genelists() gss = self.parse_genesets() # if gmt self._logger.info("Connecting to Enrichr Server to ...
def run(self): """run enrichr for one sample gene list but multi-libraries""" # set organism self.get_organism() # read input file genes_list = self.parse_genelists() gss = self.parse_genesets() # if gmt self._logger.info("Connecting to Enrichr Server to ...
[ "run", "enrichr", "for", "one", "sample", "gene", "list", "but", "multi", "-", "libraries" ]
zqfang/GSEApy
python
https://github.com/zqfang/GSEApy/blob/673e9ec1391e3b14d3e8a4353117151fd2cb9345/gseapy/enrichr.py#L302-L352
[ "def", "run", "(", "self", ")", ":", "# set organism", "self", ".", "get_organism", "(", ")", "# read input file", "genes_list", "=", "self", ".", "parse_genelists", "(", ")", "gss", "=", "self", ".", "parse_genesets", "(", ")", "# if gmt", "self", ".", "_...
673e9ec1391e3b14d3e8a4353117151fd2cb9345
test
cube
Create a cube primitive Note that this is made of 6 quads, not triangles
meshlabxml/create.py
def cube(script, size=1.0, center=False, color=None): """Create a cube primitive Note that this is made of 6 quads, not triangles """ """# Convert size to list if it isn't already if not isinstance(size, list): size = list(size) # If a single value was supplied use it for all 3 axes ...
def cube(script, size=1.0, center=False, color=None): """Create a cube primitive Note that this is made of 6 quads, not triangles """ """# Convert size to list if it isn't already if not isinstance(size, list): size = list(size) # If a single value was supplied use it for all 3 axes ...
[ "Create", "a", "cube", "primitive" ]
3DLIRIOUS/MeshLabXML
python
https://github.com/3DLIRIOUS/MeshLabXML/blob/177cce21e92baca500f56a932d66bd9a33257af8/meshlabxml/create.py#L13-L47
[ "def", "cube", "(", "script", ",", "size", "=", "1.0", ",", "center", "=", "False", ",", "color", "=", "None", ")", ":", "\"\"\"# Convert size to list if it isn't already\n if not isinstance(size, list):\n size = list(size)\n # If a single value was supplied use it f...
177cce21e92baca500f56a932d66bd9a33257af8
test
cylinder
Create a cylinder or cone primitive. Usage is based on OpenSCAD. # height = height of the cylinder # radius1 = radius of the cone on bottom end # radius2 = radius of the cone on top end # center = If true will center the height of the cone/cylinder around # the origin. Default is false, placing the ...
meshlabxml/create.py
def cylinder(script, up='z', height=1.0, radius=None, radius1=None, radius2=None, diameter=None, diameter1=None, diameter2=None, center=False, cir_segments=32, color=None): """Create a cylinder or cone primitive. Usage is based on OpenSCAD. # height = height of the cylinder # radiu...
def cylinder(script, up='z', height=1.0, radius=None, radius1=None, radius2=None, diameter=None, diameter1=None, diameter2=None, center=False, cir_segments=32, color=None): """Create a cylinder or cone primitive. Usage is based on OpenSCAD. # height = height of the cylinder # radiu...
[ "Create", "a", "cylinder", "or", "cone", "primitive", ".", "Usage", "is", "based", "on", "OpenSCAD", ".", "#", "height", "=", "height", "of", "the", "cylinder", "#", "radius1", "=", "radius", "of", "the", "cone", "on", "bottom", "end", "#", "radius2", ...
3DLIRIOUS/MeshLabXML
python
https://github.com/3DLIRIOUS/MeshLabXML/blob/177cce21e92baca500f56a932d66bd9a33257af8/meshlabxml/create.py#L63-L131
[ "def", "cylinder", "(", "script", ",", "up", "=", "'z'", ",", "height", "=", "1.0", ",", "radius", "=", "None", ",", "radius1", "=", "None", ",", "radius2", "=", "None", ",", "diameter", "=", "None", ",", "diameter1", "=", "None", ",", "diameter2", ...
177cce21e92baca500f56a932d66bd9a33257af8
test
icosphere
create an icosphere mesh radius Radius of the sphere # subdivisions = Subdivision level; Number of the recursive subdivision of the # surface. Default is 3 (a sphere approximation composed by 1280 faces). # Admitted values are in the range 0 (an icosahedron) to 8 (a 1.3 MegaTris # approximation of ...
meshlabxml/create.py
def icosphere(script, radius=1.0, diameter=None, subdivisions=3, color=None): """create an icosphere mesh radius Radius of the sphere # subdivisions = Subdivision level; Number of the recursive subdivision of the # surface. Default is 3 (a sphere approximation composed by 1280 faces). # Admitted va...
def icosphere(script, radius=1.0, diameter=None, subdivisions=3, color=None): """create an icosphere mesh radius Radius of the sphere # subdivisions = Subdivision level; Number of the recursive subdivision of the # surface. Default is 3 (a sphere approximation composed by 1280 faces). # Admitted va...
[ "create", "an", "icosphere", "mesh" ]
3DLIRIOUS/MeshLabXML
python
https://github.com/3DLIRIOUS/MeshLabXML/blob/177cce21e92baca500f56a932d66bd9a33257af8/meshlabxml/create.py#L134-L164
[ "def", "icosphere", "(", "script", ",", "radius", "=", "1.0", ",", "diameter", "=", "None", ",", "subdivisions", "=", "3", ",", "color", "=", "None", ")", ":", "if", "diameter", "is", "not", "None", ":", "radius", "=", "diameter", "/", "2", "filter_x...
177cce21e92baca500f56a932d66bd9a33257af8
test
sphere_cap
# angle = Angle of the cone subtending the cap. It must be <180 less than 180 # subdivisions = Subdivision level; Number of the recursive subdivision of the # surface. Default is 3 (a sphere approximation composed by 1280 faces). # Admitted values are in the range 0 (an icosahedron) to 8 (a 1.3 MegaTris ...
meshlabxml/create.py
def sphere_cap(script, angle=1.0, subdivisions=3, color=None): """# angle = Angle of the cone subtending the cap. It must be <180 less than 180 # subdivisions = Subdivision level; Number of the recursive subdivision of the # surface. Default is 3 (a sphere approximation composed by 1280 faces). # Admitt...
def sphere_cap(script, angle=1.0, subdivisions=3, color=None): """# angle = Angle of the cone subtending the cap. It must be <180 less than 180 # subdivisions = Subdivision level; Number of the recursive subdivision of the # surface. Default is 3 (a sphere approximation composed by 1280 faces). # Admitt...
[ "#", "angle", "=", "Angle", "of", "the", "cone", "subtending", "the", "cap", ".", "It", "must", "be", "<180", "less", "than", "180", "#", "subdivisions", "=", "Subdivision", "level", ";", "Number", "of", "the", "recursive", "subdivision", "of", "the", "#...
3DLIRIOUS/MeshLabXML
python
https://github.com/3DLIRIOUS/MeshLabXML/blob/177cce21e92baca500f56a932d66bd9a33257af8/meshlabxml/create.py#L167-L193
[ "def", "sphere_cap", "(", "script", ",", "angle", "=", "1.0", ",", "subdivisions", "=", "3", ",", "color", "=", "None", ")", ":", "filter_xml", "=", "''", ".", "join", "(", "[", "' <filter name=\"Sphere Cap\">\\n'", ",", "' <Param name=\"angle\" '", ",", ...
177cce21e92baca500f56a932d66bd9a33257af8
test
torus
Create a torus mesh Args: major_radius (float, (optional)): radius from the origin to the center of the cross sections minor_radius (float, (optional)): radius of the torus cross section inner_diameter (float, (optional)): inner diameter of torus. If both...
meshlabxml/create.py
def torus(script, major_radius=3.0, minor_radius=1.0, inner_diameter=None, outer_diameter=None, major_segments=48, minor_segments=12, color=None): """Create a torus mesh Args: major_radius (float, (optional)): radius from the origin to the center of the cross sections ...
def torus(script, major_radius=3.0, minor_radius=1.0, inner_diameter=None, outer_diameter=None, major_segments=48, minor_segments=12, color=None): """Create a torus mesh Args: major_radius (float, (optional)): radius from the origin to the center of the cross sections ...
[ "Create", "a", "torus", "mesh" ]
3DLIRIOUS/MeshLabXML
python
https://github.com/3DLIRIOUS/MeshLabXML/blob/177cce21e92baca500f56a932d66bd9a33257af8/meshlabxml/create.py#L196-L256
[ "def", "torus", "(", "script", ",", "major_radius", "=", "3.0", ",", "minor_radius", "=", "1.0", ",", "inner_diameter", "=", "None", ",", "outer_diameter", "=", "None", ",", "major_segments", "=", "48", ",", "minor_segments", "=", "12", ",", "color", "=", ...
177cce21e92baca500f56a932d66bd9a33257af8
test
grid
2D square/plane/grid created on XY plane x_segments # Number of segments in the X direction. y_segments # Number of segments in the Y direction. center="false" # If true square will be centered on origin; otherwise it is place in the positive XY quadrant.
meshlabxml/create.py
def grid(script, size=1.0, x_segments=1, y_segments=1, center=False, color=None): """2D square/plane/grid created on XY plane x_segments # Number of segments in the X direction. y_segments # Number of segments in the Y direction. center="false" # If true square will be centered on origin; ...
def grid(script, size=1.0, x_segments=1, y_segments=1, center=False, color=None): """2D square/plane/grid created on XY plane x_segments # Number of segments in the X direction. y_segments # Number of segments in the Y direction. center="false" # If true square will be centered on origin; ...
[ "2D", "square", "/", "plane", "/", "grid", "created", "on", "XY", "plane" ]
3DLIRIOUS/MeshLabXML
python
https://github.com/3DLIRIOUS/MeshLabXML/blob/177cce21e92baca500f56a932d66bd9a33257af8/meshlabxml/create.py#L259-L318
[ "def", "grid", "(", "script", ",", "size", "=", "1.0", ",", "x_segments", "=", "1", ",", "y_segments", "=", "1", ",", "center", "=", "False", ",", "color", "=", "None", ")", ":", "size", "=", "util", ".", "make_list", "(", "size", ",", "2", ")", ...
177cce21e92baca500f56a932d66bd9a33257af8
test
annulus
Create a 2D (surface) circle or annulus radius1=1 # Outer radius of the circle radius2=0 # Inner radius of the circle (if non-zero it creates an annulus) color="" # specify a color name to apply vertex colors to the newly created mesh OpenSCAD: parameters: diameter overrides radius, radius1 & radius2 o...
meshlabxml/create.py
def annulus(script, radius=None, radius1=None, radius2=None, diameter=None, diameter1=None, diameter2=None, cir_segments=32, color=None): """Create a 2D (surface) circle or annulus radius1=1 # Outer radius of the circle radius2=0 # Inner radius of the circle (if non-zero it creates an annulus) ...
def annulus(script, radius=None, radius1=None, radius2=None, diameter=None, diameter1=None, diameter2=None, cir_segments=32, color=None): """Create a 2D (surface) circle or annulus radius1=1 # Outer radius of the circle radius2=0 # Inner radius of the circle (if non-zero it creates an annulus) ...
[ "Create", "a", "2D", "(", "surface", ")", "circle", "or", "annulus", "radius1", "=", "1", "#", "Outer", "radius", "of", "the", "circle", "radius2", "=", "0", "#", "Inner", "radius", "of", "the", "circle", "(", "if", "non", "-", "zero", "it", "creates...
3DLIRIOUS/MeshLabXML
python
https://github.com/3DLIRIOUS/MeshLabXML/blob/177cce21e92baca500f56a932d66bd9a33257af8/meshlabxml/create.py#L321-L373
[ "def", "annulus", "(", "script", ",", "radius", "=", "None", ",", "radius1", "=", "None", ",", "radius2", "=", "None", ",", "diameter", "=", "None", ",", "diameter1", "=", "None", ",", "diameter2", "=", "None", ",", "cir_segments", "=", "32", ",", "c...
177cce21e92baca500f56a932d66bd9a33257af8
test
cylinder_open_hires
Creates a round open tube, e.g. a cylinder with no top or bottom. Useful if you want to wrap it around and join the open ends together, forming a torus. invert_normals (bool (optional)): if True normals point outward; in false normals point inward.
meshlabxml/create.py
def cylinder_open_hires(script, height=1.0, radius=1, diameter=None, cir_segments=48, height_segments=1, invert_normals=False, center=False, color=None): """ Creates a round open tube, e.g. a cylinder with no top or bottom. Useful if you want to wrap it around an...
def cylinder_open_hires(script, height=1.0, radius=1, diameter=None, cir_segments=48, height_segments=1, invert_normals=False, center=False, color=None): """ Creates a round open tube, e.g. a cylinder with no top or bottom. Useful if you want to wrap it around an...
[ "Creates", "a", "round", "open", "tube", "e", ".", "g", ".", "a", "cylinder", "with", "no", "top", "or", "bottom", "." ]
3DLIRIOUS/MeshLabXML
python
https://github.com/3DLIRIOUS/MeshLabXML/blob/177cce21e92baca500f56a932d66bd9a33257af8/meshlabxml/create.py#L376-L405
[ "def", "cylinder_open_hires", "(", "script", ",", "height", "=", "1.0", ",", "radius", "=", "1", ",", "diameter", "=", "None", ",", "cir_segments", "=", "48", ",", "height_segments", "=", "1", ",", "invert_normals", "=", "False", ",", "center", "=", "Fal...
177cce21e92baca500f56a932d66bd9a33257af8
test
cube_open_hires_old
Creates a square open tube, e.g. a box with no top or bottom. Useful if you want to wrap it around and join the open ends together, forming a torus.
meshlabxml/create.py
def cube_open_hires_old(script, size=1.0, x_segments=1, y_segments=1, z_segments=1, center=False, color=None): """ Creates a square open tube, e.g. a box with no top or bottom. Useful if you want to wrap it around and join the open ends together, forming a torus. """ """# Convert si...
def cube_open_hires_old(script, size=1.0, x_segments=1, y_segments=1, z_segments=1, center=False, color=None): """ Creates a square open tube, e.g. a box with no top or bottom. Useful if you want to wrap it around and join the open ends together, forming a torus. """ """# Convert si...
[ "Creates", "a", "square", "open", "tube", "e", ".", "g", ".", "a", "box", "with", "no", "top", "or", "bottom", "." ]
3DLIRIOUS/MeshLabXML
python
https://github.com/3DLIRIOUS/MeshLabXML/blob/177cce21e92baca500f56a932d66bd9a33257af8/meshlabxml/create.py#L408-L452
[ "def", "cube_open_hires_old", "(", "script", ",", "size", "=", "1.0", ",", "x_segments", "=", "1", ",", "y_segments", "=", "1", ",", "z_segments", "=", "1", ",", "center", "=", "False", ",", "color", "=", "None", ")", ":", "\"\"\"# Convert size to list if ...
177cce21e92baca500f56a932d66bd9a33257af8
test
cube_open_hires
Creates a square open tube, e.g. a box with no top or bottom. Useful if you want to wrap it around and join the open ends together, forming a torus.
meshlabxml/create.py
def cube_open_hires(script, size=1.0, x_segments=1, y_segments=1, z_segments=1, center=False, color=None): """ Creates a square open tube, e.g. a box with no top or bottom. Useful if you want to wrap it around and join the open ends together, forming a torus. """ """# Convert size t...
def cube_open_hires(script, size=1.0, x_segments=1, y_segments=1, z_segments=1, center=False, color=None): """ Creates a square open tube, e.g. a box with no top or bottom. Useful if you want to wrap it around and join the open ends together, forming a torus. """ """# Convert size t...
[ "Creates", "a", "square", "open", "tube", "e", ".", "g", ".", "a", "box", "with", "no", "top", "or", "bottom", "." ]
3DLIRIOUS/MeshLabXML
python
https://github.com/3DLIRIOUS/MeshLabXML/blob/177cce21e92baca500f56a932d66bd9a33257af8/meshlabxml/create.py#L455-L507
[ "def", "cube_open_hires", "(", "script", ",", "size", "=", "1.0", ",", "x_segments", "=", "1", ",", "y_segments", "=", "1", ",", "z_segments", "=", "1", ",", "center", "=", "False", ",", "color", "=", "None", ")", ":", "\"\"\"# Convert size to list if it i...
177cce21e92baca500f56a932d66bd9a33257af8