repository_name stringlengths 7 55 | func_path_in_repository stringlengths 4 223 | func_name stringlengths 1 134 | whole_func_string stringlengths 75 104k | language stringclasses 1
value | func_code_string stringlengths 75 104k | func_code_tokens listlengths 19 28.4k | func_documentation_string stringlengths 1 46.9k | func_documentation_tokens listlengths 1 1.97k | split_name stringclasses 1
value | func_code_url stringlengths 87 315 |
|---|---|---|---|---|---|---|---|---|---|---|
HarveyHunt/i3situation | i3situation/core/status.py | Status.handle_events | def handle_events(self):
"""
An event handler that processes events from stdin and calls the on_click
function of the respective object. This function is run in another
thread, so as to not stall the main thread.
"""
for event in sys.stdin:
if event.startswith... | python | def handle_events(self):
"""
An event handler that processes events from stdin and calls the on_click
function of the respective object. This function is run in another
thread, so as to not stall the main thread.
"""
for event in sys.stdin:
if event.startswith... | [
"def",
"handle_events",
"(",
"self",
")",
":",
"for",
"event",
"in",
"sys",
".",
"stdin",
":",
"if",
"event",
".",
"startswith",
"(",
"'['",
")",
":",
"continue",
"name",
"=",
"json",
".",
"loads",
"(",
"event",
".",
"lstrip",
"(",
"','",
")",
")",... | An event handler that processes events from stdin and calls the on_click
function of the respective object. This function is run in another
thread, so as to not stall the main thread. | [
"An",
"event",
"handler",
"that",
"processes",
"events",
"from",
"stdin",
"and",
"calls",
"the",
"on_click",
"function",
"of",
"the",
"respective",
"object",
".",
"This",
"function",
"is",
"run",
"in",
"another",
"thread",
"so",
"as",
"to",
"not",
"stall",
... | train | https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/core/status.py#L141-L153 |
Alir3z4/django-databrowse | django_databrowse/plugins/fieldchoices.py | FieldChoicePlugin.field_dict | def field_dict(self, model):
"""
Helper function that returns a dictionary of all fields in the given
model. If self.field_filter is set, it only includes the fields that
match the filter.
"""
if self.field_filter:
return dict(
[(f.name, f) for... | python | def field_dict(self, model):
"""
Helper function that returns a dictionary of all fields in the given
model. If self.field_filter is set, it only includes the fields that
match the filter.
"""
if self.field_filter:
return dict(
[(f.name, f) for... | [
"def",
"field_dict",
"(",
"self",
",",
"model",
")",
":",
"if",
"self",
".",
"field_filter",
":",
"return",
"dict",
"(",
"[",
"(",
"f",
".",
"name",
",",
"f",
")",
"for",
"f",
"in",
"model",
".",
"_meta",
".",
"fields",
"if",
"self",
".",
"field_... | Helper function that returns a dictionary of all fields in the given
model. If self.field_filter is set, it only includes the fields that
match the filter. | [
"Helper",
"function",
"that",
"returns",
"a",
"dictionary",
"of",
"all",
"fields",
"in",
"the",
"given",
"model",
".",
"If",
"self",
".",
"field_filter",
"is",
"set",
"it",
"only",
"includes",
"the",
"fields",
"that",
"match",
"the",
"filter",
"."
] | train | https://github.com/Alir3z4/django-databrowse/blob/4469495cd47a0da506ddf4e8cc752c2f453e0339/django_databrowse/plugins/fieldchoices.py#L25-L43 |
HarveyHunt/i3situation | i3situation/core/plugin_manager.py | Thread.run | def run(self):
"""
Calls the main function of a plugin and mutates the output dict
with its return value. Provides an easy way to change the output
whilst not needing to constantly poll a queue in another thread and
allowing plugin's to manage their own intervals.
"""
... | python | def run(self):
"""
Calls the main function of a plugin and mutates the output dict
with its return value. Provides an easy way to change the output
whilst not needing to constantly poll a queue in another thread and
allowing plugin's to manage their own intervals.
"""
... | [
"def",
"run",
"(",
"self",
")",
":",
"self",
".",
"running",
"=",
"True",
"while",
"self",
".",
"running",
":",
"ret",
"=",
"self",
".",
"func",
"(",
")",
"self",
".",
"output_dict",
"[",
"ret",
"[",
"'name'",
"]",
"]",
"=",
"ret",
"time",
".",
... | Calls the main function of a plugin and mutates the output dict
with its return value. Provides an easy way to change the output
whilst not needing to constantly poll a queue in another thread and
allowing plugin's to manage their own intervals. | [
"Calls",
"the",
"main",
"function",
"of",
"a",
"plugin",
"and",
"mutates",
"the",
"output",
"dict",
"with",
"its",
"return",
"value",
".",
"Provides",
"an",
"easy",
"way",
"to",
"change",
"the",
"output",
"whilst",
"not",
"needing",
"to",
"constantly",
"po... | train | https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/core/plugin_manager.py#L43-L55 |
HarveyHunt/i3situation | i3situation/core/plugin_manager.py | ThreadManager.add_thread | def add_thread(self, func, interval):
"""
Creates a thread, starts it and then adds it to the thread pool.
Func: Same as in the Thread class.
Interval: Same as in the Thread class.
"""
t = Thread(func, interval, self.output_dict)
t.start()
self._thread_po... | python | def add_thread(self, func, interval):
"""
Creates a thread, starts it and then adds it to the thread pool.
Func: Same as in the Thread class.
Interval: Same as in the Thread class.
"""
t = Thread(func, interval, self.output_dict)
t.start()
self._thread_po... | [
"def",
"add_thread",
"(",
"self",
",",
"func",
",",
"interval",
")",
":",
"t",
"=",
"Thread",
"(",
"func",
",",
"interval",
",",
"self",
".",
"output_dict",
")",
"t",
".",
"start",
"(",
")",
"self",
".",
"_thread_pool",
".",
"append",
"(",
"t",
")"... | Creates a thread, starts it and then adds it to the thread pool.
Func: Same as in the Thread class.
Interval: Same as in the Thread class. | [
"Creates",
"a",
"thread",
"starts",
"it",
"and",
"then",
"adds",
"it",
"to",
"the",
"thread",
"pool",
"."
] | train | https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/core/plugin_manager.py#L84-L93 |
HarveyHunt/i3situation | i3situation/core/plugin_manager.py | PluginLoader._compile_files | def _compile_files(self):
"""
Compiles python plugin files in order to be processed by the loader.
It compiles the plugins if they have been updated or haven't yet been
compiled.
"""
for f in glob.glob(os.path.join(self.dir_path, '*.py')):
# Check for compiled... | python | def _compile_files(self):
"""
Compiles python plugin files in order to be processed by the loader.
It compiles the plugins if they have been updated or haven't yet been
compiled.
"""
for f in glob.glob(os.path.join(self.dir_path, '*.py')):
# Check for compiled... | [
"def",
"_compile_files",
"(",
"self",
")",
":",
"for",
"f",
"in",
"glob",
".",
"glob",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"dir_path",
",",
"'*.py'",
")",
")",
":",
"# Check for compiled Python files that aren't in the __pycache__.",
"if",
... | Compiles python plugin files in order to be processed by the loader.
It compiles the plugins if they have been updated or haven't yet been
compiled. | [
"Compiles",
"python",
"plugin",
"files",
"in",
"order",
"to",
"be",
"processed",
"by",
"the",
"loader",
".",
"It",
"compiles",
"the",
"plugins",
"if",
"they",
"have",
"been",
"updated",
"or",
"haven",
"t",
"yet",
"been",
"compiled",
"."
] | train | https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/core/plugin_manager.py#L125-L142 |
HarveyHunt/i3situation | i3situation/core/plugin_manager.py | PluginLoader._load_compiled | def _load_compiled(self, file_path):
"""
Accepts a path to a compiled plugin and returns a module object.
file_path: A string that represents a complete file path to a compiled
plugin.
"""
name = os.path.splitext(os.path.split(file_path)[-1])[0]
plugin_directory ... | python | def _load_compiled(self, file_path):
"""
Accepts a path to a compiled plugin and returns a module object.
file_path: A string that represents a complete file path to a compiled
plugin.
"""
name = os.path.splitext(os.path.split(file_path)[-1])[0]
plugin_directory ... | [
"def",
"_load_compiled",
"(",
"self",
",",
"file_path",
")",
":",
"name",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"os",
".",
"path",
".",
"split",
"(",
"file_path",
")",
"[",
"-",
"1",
"]",
")",
"[",
"0",
"]",
"plugin_directory",
"=",
"os",
... | Accepts a path to a compiled plugin and returns a module object.
file_path: A string that represents a complete file path to a compiled
plugin. | [
"Accepts",
"a",
"path",
"to",
"a",
"compiled",
"plugin",
"and",
"returns",
"a",
"module",
"object",
"."
] | train | https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/core/plugin_manager.py#L144-L157 |
HarveyHunt/i3situation | i3situation/core/plugin_manager.py | PluginLoader.load_objects | def load_objects(self):
"""
Matches the plugins that have been specified in the config file
with the available plugins. Returns instantiated objects based upon
the classes defined in the plugins.
"""
objects = []
for settings in self._config:
if settin... | python | def load_objects(self):
"""
Matches the plugins that have been specified in the config file
with the available plugins. Returns instantiated objects based upon
the classes defined in the plugins.
"""
objects = []
for settings in self._config:
if settin... | [
"def",
"load_objects",
"(",
"self",
")",
":",
"objects",
"=",
"[",
"]",
"for",
"settings",
"in",
"self",
".",
"_config",
":",
"if",
"settings",
"[",
"'plugin'",
"]",
"in",
"self",
".",
"plugins",
":",
"module",
"=",
"self",
".",
"plugins",
"[",
"sett... | Matches the plugins that have been specified in the config file
with the available plugins. Returns instantiated objects based upon
the classes defined in the plugins. | [
"Matches",
"the",
"plugins",
"that",
"have",
"been",
"specified",
"in",
"the",
"config",
"file",
"with",
"the",
"available",
"plugins",
".",
"Returns",
"instantiated",
"objects",
"based",
"upon",
"the",
"classes",
"defined",
"in",
"the",
"plugins",
"."
] | train | https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/core/plugin_manager.py#L159-L180 |
HarveyHunt/i3situation | i3situation/core/plugin_manager.py | PluginLoader.refresh_files | def refresh_files(self):
"""
Discovers the available plugins and turns each into a module object.
This is a seperate function to allow plugins to be updated
dynamically by other parts of the application.
"""
plugins = {}
_plugin_files = glob.glob(os.path.join(self... | python | def refresh_files(self):
"""
Discovers the available plugins and turns each into a module object.
This is a seperate function to allow plugins to be updated
dynamically by other parts of the application.
"""
plugins = {}
_plugin_files = glob.glob(os.path.join(self... | [
"def",
"refresh_files",
"(",
"self",
")",
":",
"plugins",
"=",
"{",
"}",
"_plugin_files",
"=",
"glob",
".",
"glob",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"dir_path",
",",
"'[!_]*.pyc'",
")",
")",
"for",
"f",
"in",
"glob",
".",
"glo... | Discovers the available plugins and turns each into a module object.
This is a seperate function to allow plugins to be updated
dynamically by other parts of the application. | [
"Discovers",
"the",
"available",
"plugins",
"and",
"turns",
"each",
"into",
"a",
"module",
"object",
".",
"This",
"is",
"a",
"seperate",
"function",
"to",
"allow",
"plugins",
"to",
"be",
"updated",
"dynamically",
"by",
"other",
"parts",
"of",
"the",
"applica... | train | https://github.com/HarveyHunt/i3situation/blob/3160a21006fcc6961f240988874e228a5ec6f18e/i3situation/core/plugin_manager.py#L182-L199 |
Alir3z4/django-databrowse | django_databrowse/sites.py | ModelDatabrowse.root | def root(self, request, url):
"""
Handles main URL routing for the databrowse app.
`url` is the remainder of the URL -- e.g. 'objects/3'.
"""
# Delegate to the appropriate method, based on the URL.
if url is None:
return self.main_view(request)
try:
... | python | def root(self, request, url):
"""
Handles main URL routing for the databrowse app.
`url` is the remainder of the URL -- e.g. 'objects/3'.
"""
# Delegate to the appropriate method, based on the URL.
if url is None:
return self.main_view(request)
try:
... | [
"def",
"root",
"(",
"self",
",",
"request",
",",
"url",
")",
":",
"# Delegate to the appropriate method, based on the URL.",
"if",
"url",
"is",
"None",
":",
"return",
"self",
".",
"main_view",
"(",
"request",
")",
"try",
":",
"plugin_name",
",",
"rest_of_url",
... | Handles main URL routing for the databrowse app.
`url` is the remainder of the URL -- e.g. 'objects/3'. | [
"Handles",
"main",
"URL",
"routing",
"for",
"the",
"databrowse",
"app",
"."
] | train | https://github.com/Alir3z4/django-databrowse/blob/4469495cd47a0da506ddf4e8cc752c2f453e0339/django_databrowse/sites.py#L55-L73 |
Alir3z4/django-databrowse | django_databrowse/sites.py | DatabrowseSite.register | def register(self, *model_list, **options):
"""
Registers the given model(s) with the given databrowse site.
The model(s) should be Model classes, not instances.
If a databrowse class isn't given, it will use DefaultModelDatabrowse
(the default databrowse options).
If ... | python | def register(self, *model_list, **options):
"""
Registers the given model(s) with the given databrowse site.
The model(s) should be Model classes, not instances.
If a databrowse class isn't given, it will use DefaultModelDatabrowse
(the default databrowse options).
If ... | [
"def",
"register",
"(",
"self",
",",
"*",
"model_list",
",",
"*",
"*",
"options",
")",
":",
"databrowse_class",
"=",
"options",
".",
"pop",
"(",
"'databrowse_class'",
",",
"DefaultModelDatabrowse",
")",
"for",
"model",
"in",
"model_list",
":",
"if",
"model",... | Registers the given model(s) with the given databrowse site.
The model(s) should be Model classes, not instances.
If a databrowse class isn't given, it will use DefaultModelDatabrowse
(the default databrowse options).
If a model is already registered, this will raise AlreadyRegistered... | [
"Registers",
"the",
"given",
"model",
"(",
"s",
")",
"with",
"the",
"given",
"databrowse",
"site",
"."
] | train | https://github.com/Alir3z4/django-databrowse/blob/4469495cd47a0da506ddf4e8cc752c2f453e0339/django_databrowse/sites.py#L119-L136 |
Alir3z4/django-databrowse | django_databrowse/sites.py | DatabrowseSite.unregister | def unregister(self, *model_list):
"""
Unregisters the given model(s).
If a model isn't already registered, this will raise NotRegistered.
"""
for model in model_list:
if model not in self.registry:
raise NotRegistered('The model %s is not registered'... | python | def unregister(self, *model_list):
"""
Unregisters the given model(s).
If a model isn't already registered, this will raise NotRegistered.
"""
for model in model_list:
if model not in self.registry:
raise NotRegistered('The model %s is not registered'... | [
"def",
"unregister",
"(",
"self",
",",
"*",
"model_list",
")",
":",
"for",
"model",
"in",
"model_list",
":",
"if",
"model",
"not",
"in",
"self",
".",
"registry",
":",
"raise",
"NotRegistered",
"(",
"'The model %s is not registered'",
"%",
"model",
".",
"__na... | Unregisters the given model(s).
If a model isn't already registered, this will raise NotRegistered. | [
"Unregisters",
"the",
"given",
"model",
"(",
"s",
")",
"."
] | train | https://github.com/Alir3z4/django-databrowse/blob/4469495cd47a0da506ddf4e8cc752c2f453e0339/django_databrowse/sites.py#L138-L148 |
Alir3z4/django-databrowse | django_databrowse/sites.py | DatabrowseSite.root | def root(self, request, url):
"""
Handles main URL routing for the databrowse app.
`url` is the remainder of the URL -- e.g. 'comments/comment/'.
"""
self.root_url = request.path[:len(request.path) - len(url)]
url = url.rstrip('/') # Trim trailing slash, if it exists.
... | python | def root(self, request, url):
"""
Handles main URL routing for the databrowse app.
`url` is the remainder of the URL -- e.g. 'comments/comment/'.
"""
self.root_url = request.path[:len(request.path) - len(url)]
url = url.rstrip('/') # Trim trailing slash, if it exists.
... | [
"def",
"root",
"(",
"self",
",",
"request",
",",
"url",
")",
":",
"self",
".",
"root_url",
"=",
"request",
".",
"path",
"[",
":",
"len",
"(",
"request",
".",
"path",
")",
"-",
"len",
"(",
"url",
")",
"]",
"url",
"=",
"url",
".",
"rstrip",
"(",
... | Handles main URL routing for the databrowse app.
`url` is the remainder of the URL -- e.g. 'comments/comment/'. | [
"Handles",
"main",
"URL",
"routing",
"for",
"the",
"databrowse",
"app",
"."
] | train | https://github.com/Alir3z4/django-databrowse/blob/4469495cd47a0da506ddf4e8cc752c2f453e0339/django_databrowse/sites.py#L150-L164 |
Alir3z4/django-databrowse | django_databrowse/sites.py | DatabrowseSite.model_page | def model_page(self, request, app_label, model_name, rest_of_url=None):
"""
Handles the model-specific functionality of the databrowse site,
delegating<to the appropriate ModelDatabrowse class.
"""
try:
model = get_model(app_label, model_name)
except LookupErr... | python | def model_page(self, request, app_label, model_name, rest_of_url=None):
"""
Handles the model-specific functionality of the databrowse site,
delegating<to the appropriate ModelDatabrowse class.
"""
try:
model = get_model(app_label, model_name)
except LookupErr... | [
"def",
"model_page",
"(",
"self",
",",
"request",
",",
"app_label",
",",
"model_name",
",",
"rest_of_url",
"=",
"None",
")",
":",
"try",
":",
"model",
"=",
"get_model",
"(",
"app_label",
",",
"model_name",
")",
"except",
"LookupError",
":",
"model",
"=",
... | Handles the model-specific functionality of the databrowse site,
delegating<to the appropriate ModelDatabrowse class. | [
"Handles",
"the",
"model",
"-",
"specific",
"functionality",
"of",
"the",
"databrowse",
"site",
"delegating<to",
"the",
"appropriate",
"ModelDatabrowse",
"class",
"."
] | train | https://github.com/Alir3z4/django-databrowse/blob/4469495cd47a0da506ddf4e8cc752c2f453e0339/django_databrowse/sites.py#L173-L191 |
Alir3z4/django-databrowse | django_databrowse/datastructures.py | EasyInstanceField.values | def values(self):
"""
Returns a list of values for this field for this instance. It's a list
so we can accomodate many-to-many fields.
"""
# This import is deliberately inside the function because it causes
# some settings to be imported, and we don't want to do that at t... | python | def values(self):
"""
Returns a list of values for this field for this instance. It's a list
so we can accomodate many-to-many fields.
"""
# This import is deliberately inside the function because it causes
# some settings to be imported, and we don't want to do that at t... | [
"def",
"values",
"(",
"self",
")",
":",
"# This import is deliberately inside the function because it causes",
"# some settings to be imported, and we don't want to do that at the",
"# module level.",
"if",
"self",
".",
"field",
".",
"rel",
":",
"if",
"isinstance",
"(",
"self",... | Returns a list of values for this field for this instance. It's a list
so we can accomodate many-to-many fields. | [
"Returns",
"a",
"list",
"of",
"values",
"for",
"this",
"field",
"for",
"this",
"instance",
".",
"It",
"s",
"a",
"list",
"so",
"we",
"can",
"accomodate",
"many",
"-",
"to",
"-",
"many",
"fields",
"."
] | train | https://github.com/Alir3z4/django-databrowse/blob/4469495cd47a0da506ddf4e8cc752c2f453e0339/django_databrowse/datastructures.py#L194-L230 |
Alir3z4/django-databrowse | django_databrowse/datastructures.py | EasyInstanceField.urls | def urls(self):
"Returns a list of (value, URL) tuples."
# First, check the urls() method for each plugin.
plugin_urls = []
for plugin_name, plugin in \
self.model.model_databrowse().plugins.items():
urls = plugin.urls(plugin_name, self)
... | python | def urls(self):
"Returns a list of (value, URL) tuples."
# First, check the urls() method for each plugin.
plugin_urls = []
for plugin_name, plugin in \
self.model.model_databrowse().plugins.items():
urls = plugin.urls(plugin_name, self)
... | [
"def",
"urls",
"(",
"self",
")",
":",
"# First, check the urls() method for each plugin.",
"plugin_urls",
"=",
"[",
"]",
"for",
"plugin_name",
",",
"plugin",
"in",
"self",
".",
"model",
".",
"model_databrowse",
"(",
")",
".",
"plugins",
".",
"items",
"(",
")",... | Returns a list of (value, URL) tuples. | [
"Returns",
"a",
"list",
"of",
"(",
"value",
"URL",
")",
"tuples",
"."
] | train | https://github.com/Alir3z4/django-databrowse/blob/4469495cd47a0da506ddf4e8cc752c2f453e0339/django_databrowse/datastructures.py#L232-L273 |
Alir3z4/django-databrowse | django_databrowse/plugins/calendars.py | CalendarPlugin.field_dict | def field_dict(self, model):
"""
Helper function that returns a dictionary of all DateFields or
DateTimeFields in the given model. If self.field_names is set,
it takes that into account when building the dictionary.
"""
if self.field_names is None:
return dict... | python | def field_dict(self, model):
"""
Helper function that returns a dictionary of all DateFields or
DateTimeFields in the given model. If self.field_names is set,
it takes that into account when building the dictionary.
"""
if self.field_names is None:
return dict... | [
"def",
"field_dict",
"(",
"self",
",",
"model",
")",
":",
"if",
"self",
".",
"field_names",
"is",
"None",
":",
"return",
"dict",
"(",
"[",
"(",
"f",
".",
"name",
",",
"f",
")",
"for",
"f",
"in",
"model",
".",
"_meta",
".",
"fields",
"if",
"isinst... | Helper function that returns a dictionary of all DateFields or
DateTimeFields in the given model. If self.field_names is set,
it takes that into account when building the dictionary. | [
"Helper",
"function",
"that",
"returns",
"a",
"dictionary",
"of",
"all",
"DateFields",
"or",
"DateTimeFields",
"in",
"the",
"given",
"model",
".",
"If",
"self",
".",
"field_names",
"is",
"set",
"it",
"takes",
"that",
"into",
"account",
"when",
"building",
"t... | train | https://github.com/Alir3z4/django-databrowse/blob/4469495cd47a0da506ddf4e8cc752c2f453e0339/django_databrowse/plugins/calendars.py#L51-L64 |
BD2KGenomics/toil-scripts | src/toil_scripts/adam_kmers/count_kmers.py | kmer_dag | def kmer_dag(job,
input_file,
output_path,
kmer_length,
spark_conf,
workers,
cores,
memory,
sudo):
'''
Optionally launches a Spark cluster and then runs ADAM to count k-mers on an
input file.
:param ... | python | def kmer_dag(job,
input_file,
output_path,
kmer_length,
spark_conf,
workers,
cores,
memory,
sudo):
'''
Optionally launches a Spark cluster and then runs ADAM to count k-mers on an
input file.
:param ... | [
"def",
"kmer_dag",
"(",
"job",
",",
"input_file",
",",
"output_path",
",",
"kmer_length",
",",
"spark_conf",
",",
"workers",
",",
"cores",
",",
"memory",
",",
"sudo",
")",
":",
"require",
"(",
"(",
"spark_conf",
"is",
"not",
"None",
"and",
"workers",
"is... | Optionally launches a Spark cluster and then runs ADAM to count k-mers on an
input file.
:param job: Toil job
:param input_file: URL/path to input file to count k-mers on
:param output_path: URL/path to save k-mer counts at
:param kmer_length: The length of k-mer substrings to count.
:param spa... | [
"Optionally",
"launches",
"a",
"Spark",
"cluster",
"and",
"then",
"runs",
"ADAM",
"to",
"count",
"k",
"-",
"mers",
"on",
"an",
"input",
"file",
"."
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/adam_kmers/count_kmers.py#L20-L74 |
BD2KGenomics/toil-scripts | src/toil_scripts/adam_kmers/count_kmers.py | download_count_upload | def download_count_upload(job,
master_ip,
input_file,
output_file,
kmer_length,
spark_conf,
memory,
sudo):
'''
Runs k-mer counting... | python | def download_count_upload(job,
master_ip,
input_file,
output_file,
kmer_length,
spark_conf,
memory,
sudo):
'''
Runs k-mer counting... | [
"def",
"download_count_upload",
"(",
"job",
",",
"master_ip",
",",
"input_file",
",",
"output_file",
",",
"kmer_length",
",",
"spark_conf",
",",
"memory",
",",
"sudo",
")",
":",
"if",
"master_ip",
"is",
"not",
"None",
":",
"hdfs_dir",
"=",
"\"hdfs://{0}:{1}/\"... | Runs k-mer counting.
1. If the input file is located in S3, the file is copied into HDFS.
2. If the input file is not in Parquet format, the file is converted into Parquet.
3. The k-mers are counted and saved as text.
4. If the output path is an S3 URL, the file is copied back to S3.
:param job: T... | [
"Runs",
"k",
"-",
"mer",
"counting",
"."
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/adam_kmers/count_kmers.py#L76-L172 |
BD2KGenomics/toil-scripts | src/toil_scripts/adam_kmers/count_kmers.py | main | def main():
'''
Sets up command line parser for Toil/ADAM based k-mer counter, and launches
k-mer counter with optional Spark cluster.
'''
parser = argparse.ArgumentParser()
# add parser arguments
parser.add_argument('--input_path',
help='The full path to the input ... | python | def main():
'''
Sets up command line parser for Toil/ADAM based k-mer counter, and launches
k-mer counter with optional Spark cluster.
'''
parser = argparse.ArgumentParser()
# add parser arguments
parser.add_argument('--input_path',
help='The full path to the input ... | [
"def",
"main",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
")",
"# add parser arguments",
"parser",
".",
"add_argument",
"(",
"'--input_path'",
",",
"help",
"=",
"'The full path to the input SAM/BAM/ADAM/FASTQ file.'",
")",
"parser",
".",
"... | Sets up command line parser for Toil/ADAM based k-mer counter, and launches
k-mer counter with optional Spark cluster. | [
"Sets",
"up",
"command",
"line",
"parser",
"for",
"Toil",
"/",
"ADAM",
"based",
"k",
"-",
"mer",
"counter",
"and",
"launches",
"k",
"-",
"mer",
"counter",
"with",
"optional",
"Spark",
"cluster",
"."
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/adam_kmers/count_kmers.py#L175-L223 |
BD2KGenomics/toil-scripts | src/toil_scripts/gatk_germline/germline.py | run_gatk_germline_pipeline | def run_gatk_germline_pipeline(job, samples, config):
"""
Downloads shared files and calls the GATK best practices germline pipeline for a cohort of samples
:param JobFunctionWrappingJob job: passed automatically by Toil
:param list[GermlineSample] samples: List of GermlineSample namedtuples
:param... | python | def run_gatk_germline_pipeline(job, samples, config):
"""
Downloads shared files and calls the GATK best practices germline pipeline for a cohort of samples
:param JobFunctionWrappingJob job: passed automatically by Toil
:param list[GermlineSample] samples: List of GermlineSample namedtuples
:param... | [
"def",
"run_gatk_germline_pipeline",
"(",
"job",
",",
"samples",
",",
"config",
")",
":",
"# Determine the available disk space on a worker node before any jobs have been run.",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"st",
"=",
"os",
... | Downloads shared files and calls the GATK best practices germline pipeline for a cohort of samples
:param JobFunctionWrappingJob job: passed automatically by Toil
:param list[GermlineSample] samples: List of GermlineSample namedtuples
:param Namespace config: Configuration options for pipeline
Requ... | [
"Downloads",
"shared",
"files",
"and",
"calls",
"the",
"GATK",
"best",
"practices",
"germline",
"pipeline",
"for",
"a",
"cohort",
"of",
"samples"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/germline.py#L88-L132 |
BD2KGenomics/toil-scripts | src/toil_scripts/gatk_germline/germline.py | gatk_germline_pipeline | def gatk_germline_pipeline(job, samples, config):
"""
Runs the GATK best practices pipeline for germline SNP and INDEL discovery.
Steps in Pipeline
0: Generate and preprocess BAM
- Uploads processed BAM to output directory
1: Call Variants using HaplotypeCaller
- Uploads GVCF
2:... | python | def gatk_germline_pipeline(job, samples, config):
"""
Runs the GATK best practices pipeline for germline SNP and INDEL discovery.
Steps in Pipeline
0: Generate and preprocess BAM
- Uploads processed BAM to output directory
1: Call Variants using HaplotypeCaller
- Uploads GVCF
2:... | [
"def",
"gatk_germline_pipeline",
"(",
"job",
",",
"samples",
",",
"config",
")",
":",
"require",
"(",
"len",
"(",
"samples",
")",
">",
"0",
",",
"'No samples were provided!'",
")",
"# Get total size of genome reference files. This is used for configuring disk size.",
"gen... | Runs the GATK best practices pipeline for germline SNP and INDEL discovery.
Steps in Pipeline
0: Generate and preprocess BAM
- Uploads processed BAM to output directory
1: Call Variants using HaplotypeCaller
- Uploads GVCF
2: Genotype VCF
- Uploads VCF
3: Filter Variants usi... | [
"Runs",
"the",
"GATK",
"best",
"practices",
"pipeline",
"for",
"germline",
"SNP",
"and",
"INDEL",
"discovery",
"."
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/germline.py#L135-L233 |
BD2KGenomics/toil-scripts | src/toil_scripts/gatk_germline/germline.py | joint_genotype_and_filter | def joint_genotype_and_filter(job, gvcfs, config):
"""
Checks for enough disk space for joint genotyping, then calls the genotype and filter pipeline function.
:param JobFunctionWrappingJob job: passed automatically by Toil
:param dict gvcfs: Dictionary of GVCFs {Sample ID: FileStoreID}
:param Name... | python | def joint_genotype_and_filter(job, gvcfs, config):
"""
Checks for enough disk space for joint genotyping, then calls the genotype and filter pipeline function.
:param JobFunctionWrappingJob job: passed automatically by Toil
:param dict gvcfs: Dictionary of GVCFs {Sample ID: FileStoreID}
:param Name... | [
"def",
"joint_genotype_and_filter",
"(",
"job",
",",
"gvcfs",
",",
"config",
")",
":",
"# Get the total size of genome reference files",
"genome_ref_size",
"=",
"config",
".",
"genome_fasta",
".",
"size",
"+",
"config",
".",
"genome_fai",
".",
"size",
"+",
"config",... | Checks for enough disk space for joint genotyping, then calls the genotype and filter pipeline function.
:param JobFunctionWrappingJob job: passed automatically by Toil
:param dict gvcfs: Dictionary of GVCFs {Sample ID: FileStoreID}
:param Namespace config: Input parameters and reference FileStoreIDs
... | [
"Checks",
"for",
"enough",
"disk",
"space",
"for",
"joint",
"genotyping",
"then",
"calls",
"the",
"genotype",
"and",
"filter",
"pipeline",
"function",
"."
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/germline.py#L236-L262 |
BD2KGenomics/toil-scripts | src/toil_scripts/gatk_germline/germline.py | genotype_and_filter | def genotype_and_filter(job, gvcfs, config):
"""
Genotypes one or more GVCF files and runs either the VQSR or hard filtering pipeline. Uploads the genotyped VCF file
to the config output directory.
:param JobFunctionWrappingJob job: passed automatically by Toil
:param dict gvcfs: Dictionary of GVCF... | python | def genotype_and_filter(job, gvcfs, config):
"""
Genotypes one or more GVCF files and runs either the VQSR or hard filtering pipeline. Uploads the genotyped VCF file
to the config output directory.
:param JobFunctionWrappingJob job: passed automatically by Toil
:param dict gvcfs: Dictionary of GVCF... | [
"def",
"genotype_and_filter",
"(",
"job",
",",
"gvcfs",
",",
"config",
")",
":",
"# Get the total size of the genome reference",
"genome_ref_size",
"=",
"config",
".",
"genome_fasta",
".",
"size",
"+",
"config",
".",
"genome_fai",
".",
"size",
"+",
"config",
".",
... | Genotypes one or more GVCF files and runs either the VQSR or hard filtering pipeline. Uploads the genotyped VCF file
to the config output directory.
:param JobFunctionWrappingJob job: passed automatically by Toil
:param dict gvcfs: Dictionary of GVCFs {Sample ID: FileStoreID}
:param Namespace config: I... | [
"Genotypes",
"one",
"or",
"more",
"GVCF",
"files",
"and",
"runs",
"either",
"the",
"VQSR",
"or",
"hard",
"filtering",
"pipeline",
".",
"Uploads",
"the",
"genotyped",
"VCF",
"file",
"to",
"the",
"config",
"output",
"directory",
"."
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/germline.py#L265-L333 |
BD2KGenomics/toil-scripts | src/toil_scripts/gatk_germline/germline.py | annotate_vcfs | def annotate_vcfs(job, vcfs, config):
"""
Runs Oncotator for a group of VCF files. Each sample is annotated individually.
:param JobFunctionWrappingJob job: passed automatically by Toil
:param dict vcfs: Dictionary of VCF FileStoreIDs {Sample identifier: FileStoreID}
:param Namespace config: Input ... | python | def annotate_vcfs(job, vcfs, config):
"""
Runs Oncotator for a group of VCF files. Each sample is annotated individually.
:param JobFunctionWrappingJob job: passed automatically by Toil
:param dict vcfs: Dictionary of VCF FileStoreIDs {Sample identifier: FileStoreID}
:param Namespace config: Input ... | [
"def",
"annotate_vcfs",
"(",
"job",
",",
"vcfs",
",",
"config",
")",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Running Oncotator on the following samples:\\n%s'",
"%",
"'\\n'",
".",
"join",
"(",
"vcfs",
".",
"keys",
"(",
")",
")",
")",
"for",
... | Runs Oncotator for a group of VCF files. Each sample is annotated individually.
:param JobFunctionWrappingJob job: passed automatically by Toil
:param dict vcfs: Dictionary of VCF FileStoreIDs {Sample identifier: FileStoreID}
:param Namespace config: Input parameters and shared FileStoreIDs
Require... | [
"Runs",
"Oncotator",
"for",
"a",
"group",
"of",
"VCF",
"files",
".",
"Each",
"sample",
"is",
"annotated",
"individually",
"."
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/germline.py#L336-L373 |
BD2KGenomics/toil-scripts | src/toil_scripts/gatk_germline/germline.py | parse_manifest | def parse_manifest(path_to_manifest):
"""
Parses manifest file for Toil Germline Pipeline
:param str path_to_manifest: Path to sample manifest file
:return: List of GermlineSample namedtuples
:rtype: list[GermlineSample]
"""
bam_re = r"^(?P<uuid>\S+)\s(?P<url>\S+[bsc][r]?am)"
fq_re = r"... | python | def parse_manifest(path_to_manifest):
"""
Parses manifest file for Toil Germline Pipeline
:param str path_to_manifest: Path to sample manifest file
:return: List of GermlineSample namedtuples
:rtype: list[GermlineSample]
"""
bam_re = r"^(?P<uuid>\S+)\s(?P<url>\S+[bsc][r]?am)"
fq_re = r"... | [
"def",
"parse_manifest",
"(",
"path_to_manifest",
")",
":",
"bam_re",
"=",
"r\"^(?P<uuid>\\S+)\\s(?P<url>\\S+[bsc][r]?am)\"",
"fq_re",
"=",
"r\"^(?P<uuid>\\S+)\\s(?P<url>\\S+)\\s(?P<paired_url>\\S+)?\\s?(?P<rg_line>@RG\\S+)\"",
"samples",
"=",
"[",
"]",
"with",
"open",
"(",
"pa... | Parses manifest file for Toil Germline Pipeline
:param str path_to_manifest: Path to sample manifest file
:return: List of GermlineSample namedtuples
:rtype: list[GermlineSample] | [
"Parses",
"manifest",
"file",
"for",
"Toil",
"Germline",
"Pipeline"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/germline.py#L379-L416 |
BD2KGenomics/toil-scripts | src/toil_scripts/gatk_germline/germline.py | download_shared_files | def download_shared_files(job, config):
"""
Downloads shared reference files for Toil Germline pipeline
:param JobFunctionWrappingJob job: passed automatically by Toil
:param Namespace config: Pipeline configuration options
:return: Updated config with shared fileStoreIDS
:rtype: Namespace
... | python | def download_shared_files(job, config):
"""
Downloads shared reference files for Toil Germline pipeline
:param JobFunctionWrappingJob job: passed automatically by Toil
:param Namespace config: Pipeline configuration options
:return: Updated config with shared fileStoreIDS
:rtype: Namespace
... | [
"def",
"download_shared_files",
"(",
"job",
",",
"config",
")",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Downloading shared reference files'",
")",
"shared_files",
"=",
"{",
"'genome_fasta'",
",",
"'genome_fai'",
",",
"'genome_dict'",
"}",
"nonessent... | Downloads shared reference files for Toil Germline pipeline
:param JobFunctionWrappingJob job: passed automatically by Toil
:param Namespace config: Pipeline configuration options
:return: Updated config with shared fileStoreIDS
:rtype: Namespace | [
"Downloads",
"shared",
"reference",
"files",
"for",
"Toil",
"Germline",
"pipeline"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/germline.py#L419-L456 |
BD2KGenomics/toil-scripts | src/toil_scripts/gatk_germline/germline.py | reference_preprocessing | def reference_preprocessing(job, config):
"""
Creates a genome fasta index and sequence dictionary file if not already present in the pipeline config.
:param JobFunctionWrappingJob job: passed automatically by Toil
:param Namespace config: Pipeline configuration options and shared files.
... | python | def reference_preprocessing(job, config):
"""
Creates a genome fasta index and sequence dictionary file if not already present in the pipeline config.
:param JobFunctionWrappingJob job: passed automatically by Toil
:param Namespace config: Pipeline configuration options and shared files.
... | [
"def",
"reference_preprocessing",
"(",
"job",
",",
"config",
")",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Preparing Reference Files'",
")",
"genome_id",
"=",
"config",
".",
"genome_fasta",
"if",
"getattr",
"(",
"config",
",",
"'genome_fai'",
","... | Creates a genome fasta index and sequence dictionary file if not already present in the pipeline config.
:param JobFunctionWrappingJob job: passed automatically by Toil
:param Namespace config: Pipeline configuration options and shared files.
Requires FileStoreID for genome fasta f... | [
"Creates",
"a",
"genome",
"fasta",
"index",
"and",
"sequence",
"dictionary",
"file",
"if",
"not",
"already",
"present",
"in",
"the",
"pipeline",
"config",
"."
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/germline.py#L459-L480 |
BD2KGenomics/toil-scripts | src/toil_scripts/gatk_germline/germline.py | prepare_bam | def prepare_bam(job, uuid, url, config, paired_url=None, rg_line=None):
"""
Prepares BAM file for Toil germline pipeline.
Steps in pipeline
0: Download and align BAM or FASTQ sample
1: Sort BAM
2: Index BAM
3: Run GATK preprocessing pipeline (Optional)
- Uploads preprocessed BAM to ... | python | def prepare_bam(job, uuid, url, config, paired_url=None, rg_line=None):
"""
Prepares BAM file for Toil germline pipeline.
Steps in pipeline
0: Download and align BAM or FASTQ sample
1: Sort BAM
2: Index BAM
3: Run GATK preprocessing pipeline (Optional)
- Uploads preprocessed BAM to ... | [
"def",
"prepare_bam",
"(",
"job",
",",
"uuid",
",",
"url",
",",
"config",
",",
"paired_url",
"=",
"None",
",",
"rg_line",
"=",
"None",
")",
":",
"# 0: Align FASTQ or realign BAM",
"if",
"config",
".",
"run_bwa",
":",
"get_bam",
"=",
"job",
".",
"wrapJobFn"... | Prepares BAM file for Toil germline pipeline.
Steps in pipeline
0: Download and align BAM or FASTQ sample
1: Sort BAM
2: Index BAM
3: Run GATK preprocessing pipeline (Optional)
- Uploads preprocessed BAM to output directory
:param JobFunctionWrappingJob job: passed automatically by Toi... | [
"Prepares",
"BAM",
"file",
"for",
"Toil",
"germline",
"pipeline",
"."
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/germline.py#L483-L592 |
BD2KGenomics/toil-scripts | src/toil_scripts/gatk_germline/germline.py | setup_and_run_bwakit | def setup_and_run_bwakit(job, uuid, url, rg_line, config, paired_url=None):
"""
Downloads and runs bwakit for BAM or FASTQ files
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str uuid: Unique sample identifier
:param str url: FASTQ or BAM file URL. BAM alignment URL must ha... | python | def setup_and_run_bwakit(job, uuid, url, rg_line, config, paired_url=None):
"""
Downloads and runs bwakit for BAM or FASTQ files
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str uuid: Unique sample identifier
:param str url: FASTQ or BAM file URL. BAM alignment URL must ha... | [
"def",
"setup_and_run_bwakit",
"(",
"job",
",",
"uuid",
",",
"url",
",",
"rg_line",
",",
"config",
",",
"paired_url",
"=",
"None",
")",
":",
"bwa_config",
"=",
"deepcopy",
"(",
"config",
")",
"bwa_config",
".",
"uuid",
"=",
"uuid",
"bwa_config",
".",
"rg... | Downloads and runs bwakit for BAM or FASTQ files
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str uuid: Unique sample identifier
:param str url: FASTQ or BAM file URL. BAM alignment URL must have .bam extension.
:param Namespace config: Input parameters and shared FileStoreIDs... | [
"Downloads",
"and",
"runs",
"bwakit",
"for",
"BAM",
"or",
"FASTQ",
"files"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/germline.py#L595-L680 |
BD2KGenomics/toil-scripts | src/toil_scripts/gatk_germline/germline.py | gatk_haplotype_caller | def gatk_haplotype_caller(job,
bam, bai,
ref, fai, ref_dict,
annotations=None,
emit_threshold=10.0, call_threshold=30.0,
unsafe_mode=False,
hc_output=None):
"""... | python | def gatk_haplotype_caller(job,
bam, bai,
ref, fai, ref_dict,
annotations=None,
emit_threshold=10.0, call_threshold=30.0,
unsafe_mode=False,
hc_output=None):
"""... | [
"def",
"gatk_haplotype_caller",
"(",
"job",
",",
"bam",
",",
"bai",
",",
"ref",
",",
"fai",
",",
"ref_dict",
",",
"annotations",
"=",
"None",
",",
"emit_threshold",
"=",
"10.0",
",",
"call_threshold",
"=",
"30.0",
",",
"unsafe_mode",
"=",
"False",
",",
"... | Uses GATK HaplotypeCaller to identify SNPs and INDELs. Outputs variants in a Genomic VCF file.
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str bam: FileStoreID for BAM file
:param str bai: FileStoreID for BAM index file
:param str ref: FileStoreID for reference genome fasta f... | [
"Uses",
"GATK",
"HaplotypeCaller",
"to",
"identify",
"SNPs",
"and",
"INDELs",
".",
"Outputs",
"variants",
"in",
"a",
"Genomic",
"VCF",
"file",
"."
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/germline.py#L683-L749 |
BD2KGenomics/toil-scripts | src/toil_scripts/gatk_germline/germline.py | main | def main():
"""
GATK germline pipeline with variant filtering and annotation.
"""
# Define Parser object and add to jobTree
parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawTextHelpFormatter)
# Generate subparsers
subparsers = parser.add_subparsers(dest='com... | python | def main():
"""
GATK germline pipeline with variant filtering and annotation.
"""
# Define Parser object and add to jobTree
parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawTextHelpFormatter)
# Generate subparsers
subparsers = parser.add_subparsers(dest='com... | [
"def",
"main",
"(",
")",
":",
"# Define Parser object and add to jobTree",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"__doc__",
",",
"formatter_class",
"=",
"argparse",
".",
"RawTextHelpFormatter",
")",
"# Generate subparsers",
"subparse... | GATK germline pipeline with variant filtering and annotation. | [
"GATK",
"germline",
"pipeline",
"with",
"variant",
"filtering",
"and",
"annotation",
"."
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/germline.py#L752-L894 |
BD2KGenomics/toil-scripts | src/toil_scripts/adam_gatk_pipeline/align_and_call.py | sample_loop | def sample_loop(job, uuid_list, inputs):
"""
Loops over the sample_ids (uuids) in the manifest, creating child jobs to process each
"""
for uuid_rg in uuid_list:
uuid_items = uuid_rg.split(',')
uuid = uuid_items[0]
rg_line = None
if len(uuid_items) > 1:
rg_line = uuid_items[1]
job... | python | def sample_loop(job, uuid_list, inputs):
"""
Loops over the sample_ids (uuids) in the manifest, creating child jobs to process each
"""
for uuid_rg in uuid_list:
uuid_items = uuid_rg.split(',')
uuid = uuid_items[0]
rg_line = None
if len(uuid_items) > 1:
rg_line = uuid_items[1]
job... | [
"def",
"sample_loop",
"(",
"job",
",",
"uuid_list",
",",
"inputs",
")",
":",
"for",
"uuid_rg",
"in",
"uuid_list",
":",
"uuid_items",
"=",
"uuid_rg",
".",
"split",
"(",
"','",
")",
"uuid",
"=",
"uuid_items",
"[",
"0",
"]",
"rg_line",
"=",
"None",
"if",
... | Loops over the sample_ids (uuids) in the manifest, creating child jobs to process each | [
"Loops",
"over",
"the",
"sample_ids",
"(",
"uuids",
")",
"in",
"the",
"manifest",
"creating",
"child",
"jobs",
"to",
"process",
"each"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/adam_gatk_pipeline/align_and_call.py#L135-L148 |
BD2KGenomics/toil-scripts | src/toil_scripts/adam_gatk_pipeline/align_and_call.py | static_dag | def static_dag(job, uuid, rg_line, inputs):
"""
Prefer this here as it allows us to pull the job functions from other jobs
without rewrapping the job functions back together.
bwa_inputs: Input arguments to be passed to BWA.
adam_inputs: Input arguments to be passed to ADAM.
gatk_preprocess_inpu... | python | def static_dag(job, uuid, rg_line, inputs):
"""
Prefer this here as it allows us to pull the job functions from other jobs
without rewrapping the job functions back together.
bwa_inputs: Input arguments to be passed to BWA.
adam_inputs: Input arguments to be passed to ADAM.
gatk_preprocess_inpu... | [
"def",
"static_dag",
"(",
"job",
",",
"uuid",
",",
"rg_line",
",",
"inputs",
")",
":",
"# get work directory",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"inputs",
".",
"cpu_count",
"=",
"cpu_count",
"(",
")",
"inputs",
"."... | Prefer this here as it allows us to pull the job functions from other jobs
without rewrapping the job functions back together.
bwa_inputs: Input arguments to be passed to BWA.
adam_inputs: Input arguments to be passed to ADAM.
gatk_preprocess_inputs: Input arguments to be passed to GATK preprocessing.
... | [
"Prefer",
"this",
"here",
"as",
"it",
"allows",
"us",
"to",
"pull",
"the",
"job",
"functions",
"from",
"other",
"jobs",
"without",
"rewrapping",
"the",
"job",
"functions",
"back",
"together",
"."
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/adam_gatk_pipeline/align_and_call.py#L151-L266 |
BD2KGenomics/toil-scripts | src/toil_scripts/adam_gatk_pipeline/align_and_call.py | main | def main():
"""
This is a Toil pipeline used to perform alignment of fastqs.
"""
# Define Parser object and add to Toil
if mock_mode():
usage_msg = 'You have the TOIL_SCRIPTS_MOCK_MODE environment variable set, so this pipeline ' \
'will run in mock mode. To disable mock ... | python | def main():
"""
This is a Toil pipeline used to perform alignment of fastqs.
"""
# Define Parser object and add to Toil
if mock_mode():
usage_msg = 'You have the TOIL_SCRIPTS_MOCK_MODE environment variable set, so this pipeline ' \
'will run in mock mode. To disable mock ... | [
"def",
"main",
"(",
")",
":",
"# Define Parser object and add to Toil",
"if",
"mock_mode",
"(",
")",
":",
"usage_msg",
"=",
"'You have the TOIL_SCRIPTS_MOCK_MODE environment variable set, so this pipeline '",
"'will run in mock mode. To disable mock mode, set TOIL_SCRIPTS_MOCK_MODE=0'",
... | This is a Toil pipeline used to perform alignment of fastqs. | [
"This",
"is",
"a",
"Toil",
"pipeline",
"used",
"to",
"perform",
"alignment",
"of",
"fastqs",
"."
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/adam_gatk_pipeline/align_and_call.py#L388-L458 |
BD2KGenomics/toil-scripts | src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py | generate_unique_key | def generate_unique_key(master_key_path, url):
"""
Input1: Path to the BD2K Master Key (for S3 Encryption)
Input2: S3 URL (e.g. https://s3-us-west-2.amazonaws.com/cgl-driver-projects-encrypted/wcdt/exome_bams/DTB-111-N.bam)
Returns: 32-byte unique key generated for that URL
"""
with open(master... | python | def generate_unique_key(master_key_path, url):
"""
Input1: Path to the BD2K Master Key (for S3 Encryption)
Input2: S3 URL (e.g. https://s3-us-west-2.amazonaws.com/cgl-driver-projects-encrypted/wcdt/exome_bams/DTB-111-N.bam)
Returns: 32-byte unique key generated for that URL
"""
with open(master... | [
"def",
"generate_unique_key",
"(",
"master_key_path",
",",
"url",
")",
":",
"with",
"open",
"(",
"master_key_path",
",",
"'r'",
")",
"as",
"f",
":",
"master_key",
"=",
"f",
".",
"read",
"(",
")",
"assert",
"len",
"(",
"master_key",
")",
"==",
"32",
","... | Input1: Path to the BD2K Master Key (for S3 Encryption)
Input2: S3 URL (e.g. https://s3-us-west-2.amazonaws.com/cgl-driver-projects-encrypted/wcdt/exome_bams/DTB-111-N.bam)
Returns: 32-byte unique key generated for that URL | [
"Input1",
":",
"Path",
"to",
"the",
"BD2K",
"Master",
"Key",
"(",
"for",
"S3",
"Encryption",
")",
"Input2",
":",
"S3",
"URL",
"(",
"e",
".",
"g",
".",
"https",
":",
"//",
"s3",
"-",
"us",
"-",
"west",
"-",
"2",
".",
"amazonaws",
".",
"com",
"/"... | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py#L49-L62 |
BD2KGenomics/toil-scripts | src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py | download_encrypted_file | def download_encrypted_file(work_dir, url, key_path, name):
"""
Downloads encrypted file from S3
Input1: Working directory
Input2: S3 URL to be downloaded
Input3: Path to key necessary for decryption
Input4: name of file to be downloaded
"""
file_path = os.path.join(work_dir, name)
... | python | def download_encrypted_file(work_dir, url, key_path, name):
"""
Downloads encrypted file from S3
Input1: Working directory
Input2: S3 URL to be downloaded
Input3: Path to key necessary for decryption
Input4: name of file to be downloaded
"""
file_path = os.path.join(work_dir, name)
... | [
"def",
"download_encrypted_file",
"(",
"work_dir",
",",
"url",
",",
"key_path",
",",
"name",
")",
":",
"file_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"work_dir",
",",
"name",
")",
"key",
"=",
"generate_unique_key",
"(",
"key_path",
",",
"url",
")... | Downloads encrypted file from S3
Input1: Working directory
Input2: S3 URL to be downloaded
Input3: Path to key necessary for decryption
Input4: name of file to be downloaded | [
"Downloads",
"encrypted",
"file",
"from",
"S3"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py#L65-L85 |
BD2KGenomics/toil-scripts | src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py | return_input_paths | def return_input_paths(job, work_dir, ids, *args):
"""
Returns the paths of files from the FileStore
Input1: Toil job instance
Input2: Working directory
Input3: jobstore id dictionary
Input4: names of files to be returned from the jobstore
Returns: path(s) to the file(s) requested -- unpac... | python | def return_input_paths(job, work_dir, ids, *args):
"""
Returns the paths of files from the FileStore
Input1: Toil job instance
Input2: Working directory
Input3: jobstore id dictionary
Input4: names of files to be returned from the jobstore
Returns: path(s) to the file(s) requested -- unpac... | [
"def",
"return_input_paths",
"(",
"job",
",",
"work_dir",
",",
"ids",
",",
"*",
"args",
")",
":",
"paths",
"=",
"OrderedDict",
"(",
")",
"for",
"name",
"in",
"args",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"os",
".",
"path",
".",
... | Returns the paths of files from the FileStore
Input1: Toil job instance
Input2: Working directory
Input3: jobstore id dictionary
Input4: names of files to be returned from the jobstore
Returns: path(s) to the file(s) requested -- unpack these! | [
"Returns",
"the",
"paths",
"of",
"files",
"from",
"the",
"FileStore"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py#L111-L132 |
BD2KGenomics/toil-scripts | src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py | move_to_output_dir | def move_to_output_dir(work_dir, output_dir, uuid=None, files=list()):
"""
Moves files from work_dir to output_dir
Input1: Working directory
Input2: Output directory
Input3: UUID to be preprended onto file name
Input4: list of file names to be moved from working dir to output dir
"""
fo... | python | def move_to_output_dir(work_dir, output_dir, uuid=None, files=list()):
"""
Moves files from work_dir to output_dir
Input1: Working directory
Input2: Output directory
Input3: UUID to be preprended onto file name
Input4: list of file names to be moved from working dir to output dir
"""
fo... | [
"def",
"move_to_output_dir",
"(",
"work_dir",
",",
"output_dir",
",",
"uuid",
"=",
"None",
",",
"files",
"=",
"list",
"(",
")",
")",
":",
"for",
"fname",
"in",
"files",
":",
"if",
"uuid",
"is",
"None",
":",
"shutil",
".",
"move",
"(",
"os",
".",
"p... | Moves files from work_dir to output_dir
Input1: Working directory
Input2: Output directory
Input3: UUID to be preprended onto file name
Input4: list of file names to be moved from working dir to output dir | [
"Moves",
"files",
"from",
"work_dir",
"to",
"output_dir"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py#L135-L148 |
BD2KGenomics/toil-scripts | src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py | batch_start | def batch_start(job, input_args):
"""
Downloads shared files that are used by all samples for alignment and places them in the jobstore.
"""
shared_files = ['ref.fa', 'ref.fa.amb', 'ref.fa.ann', 'ref.fa.bwt', 'ref.fa.pac', 'ref.fa.sa', 'ref.fa.fai']
shared_ids = {}
for fname in shared_files:
... | python | def batch_start(job, input_args):
"""
Downloads shared files that are used by all samples for alignment and places them in the jobstore.
"""
shared_files = ['ref.fa', 'ref.fa.amb', 'ref.fa.ann', 'ref.fa.bwt', 'ref.fa.pac', 'ref.fa.sa', 'ref.fa.fai']
shared_ids = {}
for fname in shared_files:
... | [
"def",
"batch_start",
"(",
"job",
",",
"input_args",
")",
":",
"shared_files",
"=",
"[",
"'ref.fa'",
",",
"'ref.fa.amb'",
",",
"'ref.fa.ann'",
",",
"'ref.fa.bwt'",
",",
"'ref.fa.pac'",
",",
"'ref.fa.sa'",
",",
"'ref.fa.fai'",
"]",
"shared_ids",
"=",
"{",
"}",
... | Downloads shared files that are used by all samples for alignment and places them in the jobstore. | [
"Downloads",
"shared",
"files",
"that",
"are",
"used",
"by",
"all",
"samples",
"for",
"alignment",
"and",
"places",
"them",
"in",
"the",
"jobstore",
"."
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py#L152-L161 |
BD2KGenomics/toil-scripts | src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py | spawn_batch_jobs | def spawn_batch_jobs(job, shared_ids, input_args):
"""
Spawns an alignment job for every sample in the input configuration file
"""
samples = []
config = input_args['config']
with open(config, 'r') as f_in:
for line in f_in:
line = line.strip().split(',')
uuid = l... | python | def spawn_batch_jobs(job, shared_ids, input_args):
"""
Spawns an alignment job for every sample in the input configuration file
"""
samples = []
config = input_args['config']
with open(config, 'r') as f_in:
for line in f_in:
line = line.strip().split(',')
uuid = l... | [
"def",
"spawn_batch_jobs",
"(",
"job",
",",
"shared_ids",
",",
"input_args",
")",
":",
"samples",
"=",
"[",
"]",
"config",
"=",
"input_args",
"[",
"'config'",
"]",
"with",
"open",
"(",
"config",
",",
"'r'",
")",
"as",
"f_in",
":",
"for",
"line",
"in",
... | Spawns an alignment job for every sample in the input configuration file | [
"Spawns",
"an",
"alignment",
"job",
"for",
"every",
"sample",
"in",
"the",
"input",
"configuration",
"file"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py#L164-L177 |
BD2KGenomics/toil-scripts | src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py | alignment | def alignment(job, ids, input_args, sample):
"""
Runs BWA and then Bamsort on the supplied fastqs for this sample
Input1: Toil Job instance
Input2: jobstore id dictionary
Input3: Input arguments dictionary
Input4: Sample tuple -- contains uuid and urls for the sample
"""
uuid, urls = sa... | python | def alignment(job, ids, input_args, sample):
"""
Runs BWA and then Bamsort on the supplied fastqs for this sample
Input1: Toil Job instance
Input2: jobstore id dictionary
Input3: Input arguments dictionary
Input4: Sample tuple -- contains uuid and urls for the sample
"""
uuid, urls = sa... | [
"def",
"alignment",
"(",
"job",
",",
"ids",
",",
"input_args",
",",
"sample",
")",
":",
"uuid",
",",
"urls",
"=",
"sample",
"# ids['bam'] = job.fileStore.getEmptyFileStoreID()",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"output_... | Runs BWA and then Bamsort on the supplied fastqs for this sample
Input1: Toil Job instance
Input2: jobstore id dictionary
Input3: Input arguments dictionary
Input4: Sample tuple -- contains uuid and urls for the sample | [
"Runs",
"BWA",
"and",
"then",
"Bamsort",
"on",
"the",
"supplied",
"fastqs",
"for",
"this",
"sample"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py#L180-L238 |
BD2KGenomics/toil-scripts | src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py | upload_bam_to_s3 | def upload_bam_to_s3(job, ids, input_args, sample):
"""
Uploads output BAM from sample to S3
Input1: Toil Job instance
Input2: jobstore id dictionary
Input3: Input arguments dictionary
Input4: Sample tuple -- contains uuid and urls for the sample
"""
uuid, urls = sample
key_path = i... | python | def upload_bam_to_s3(job, ids, input_args, sample):
"""
Uploads output BAM from sample to S3
Input1: Toil Job instance
Input2: jobstore id dictionary
Input3: Input arguments dictionary
Input4: Sample tuple -- contains uuid and urls for the sample
"""
uuid, urls = sample
key_path = i... | [
"def",
"upload_bam_to_s3",
"(",
"job",
",",
"ids",
",",
"input_args",
",",
"sample",
")",
":",
"uuid",
",",
"urls",
"=",
"sample",
"key_path",
"=",
"input_args",
"[",
"'ssec'",
"]",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
"... | Uploads output BAM from sample to S3
Input1: Toil Job instance
Input2: jobstore id dictionary
Input3: Input arguments dictionary
Input4: Sample tuple -- contains uuid and urls for the sample | [
"Uploads",
"output",
"BAM",
"from",
"sample",
"to",
"S3"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/bwa_alignment/old_alignment_script/batch_align.py#L241-L272 |
BD2KGenomics/toil-scripts | src/toil_scripts/gatk_germline/vqsr.py | vqsr_pipeline | def vqsr_pipeline(job, uuid, vcf_id, config):
"""
Runs GATK Variant Quality Score Recalibration.
0: Start 0 --> 1 --> 3 --> 4 --> 5
1: Recalibrate SNPs | |
2: Recalibrate INDELS +-> 2 -+
3: Apply SNP Recalibration
4: Apply INDEL ... | python | def vqsr_pipeline(job, uuid, vcf_id, config):
"""
Runs GATK Variant Quality Score Recalibration.
0: Start 0 --> 1 --> 3 --> 4 --> 5
1: Recalibrate SNPs | |
2: Recalibrate INDELS +-> 2 -+
3: Apply SNP Recalibration
4: Apply INDEL ... | [
"def",
"vqsr_pipeline",
"(",
"job",
",",
"uuid",
",",
"vcf_id",
",",
"config",
")",
":",
"# Get the total size of the genome reference",
"genome_ref_size",
"=",
"config",
".",
"genome_fasta",
".",
"size",
"+",
"config",
".",
"genome_fai",
".",
"size",
"+",
"conf... | Runs GATK Variant Quality Score Recalibration.
0: Start 0 --> 1 --> 3 --> 4 --> 5
1: Recalibrate SNPs | |
2: Recalibrate INDELS +-> 2 -+
3: Apply SNP Recalibration
4: Apply INDEL Recalibration
5: Write VCF to output directory
:p... | [
"Runs",
"GATK",
"Variant",
"Quality",
"Score",
"Recalibration",
"."
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/vqsr.py#L12-L162 |
BD2KGenomics/toil-scripts | src/toil_scripts/gatk_germline/vqsr.py | get_short_annotations | def get_short_annotations(annotations):
"""
Converts full GATK annotation name to the shortened version
:param annotations:
:return:
"""
# Annotations need to match VCF header
short_name = {'QualByDepth': 'QD',
'FisherStrand': 'FS',
'StrandOddsRatio': 'SOR... | python | def get_short_annotations(annotations):
"""
Converts full GATK annotation name to the shortened version
:param annotations:
:return:
"""
# Annotations need to match VCF header
short_name = {'QualByDepth': 'QD',
'FisherStrand': 'FS',
'StrandOddsRatio': 'SOR... | [
"def",
"get_short_annotations",
"(",
"annotations",
")",
":",
"# Annotations need to match VCF header",
"short_name",
"=",
"{",
"'QualByDepth'",
":",
"'QD'",
",",
"'FisherStrand'",
":",
"'FS'",
",",
"'StrandOddsRatio'",
":",
"'SOR'",
",",
"'ReadPosRankSumTest'",
":",
... | Converts full GATK annotation name to the shortened version
:param annotations:
:return: | [
"Converts",
"full",
"GATK",
"annotation",
"name",
"to",
"the",
"shortened",
"version",
":",
"param",
"annotations",
":",
":",
"return",
":"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/vqsr.py#L165-L185 |
BD2KGenomics/toil-scripts | src/toil_scripts/transfer_gtex_to_s3/transfer_gtex_to_s3.py | parse_sra | def parse_sra(path_to_config):
"""
Parses genetorrent config file. Returns list of samples: [ [id1, id1 ], [id2, id2], ... ]
Returns duplicate of ids to follow UUID/URL standard.
"""
samples = []
with open(path_to_config, 'r') as f:
for line in f.readlines():
if not line.iss... | python | def parse_sra(path_to_config):
"""
Parses genetorrent config file. Returns list of samples: [ [id1, id1 ], [id2, id2], ... ]
Returns duplicate of ids to follow UUID/URL standard.
"""
samples = []
with open(path_to_config, 'r') as f:
for line in f.readlines():
if not line.iss... | [
"def",
"parse_sra",
"(",
"path_to_config",
")",
":",
"samples",
"=",
"[",
"]",
"with",
"open",
"(",
"path_to_config",
",",
"'r'",
")",
"as",
"f",
":",
"for",
"line",
"in",
"f",
".",
"readlines",
"(",
")",
":",
"if",
"not",
"line",
".",
"isspace",
"... | Parses genetorrent config file. Returns list of samples: [ [id1, id1 ], [id2, id2], ... ]
Returns duplicate of ids to follow UUID/URL standard. | [
"Parses",
"genetorrent",
"config",
"file",
".",
"Returns",
"list",
"of",
"samples",
":",
"[",
"[",
"id1",
"id1",
"]",
"[",
"id2",
"id2",
"]",
"...",
"]",
"Returns",
"duplicate",
"of",
"ids",
"to",
"follow",
"UUID",
"/",
"URL",
"standard",
"."
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/transfer_gtex_to_s3/transfer_gtex_to_s3.py#L82-L92 |
BD2KGenomics/toil-scripts | src/toil_scripts/transfer_gtex_to_s3/transfer_gtex_to_s3.py | tarball_files | def tarball_files(work_dir, tar_name, uuid=None, files=None):
"""
Tars a group of files together into a tarball
work_dir: str Current Working Directory
tar_name: str Name of tarball
uuid: str UUID to stamp files with
files: str(s) List of filenames to place in the ta... | python | def tarball_files(work_dir, tar_name, uuid=None, files=None):
"""
Tars a group of files together into a tarball
work_dir: str Current Working Directory
tar_name: str Name of tarball
uuid: str UUID to stamp files with
files: str(s) List of filenames to place in the ta... | [
"def",
"tarball_files",
"(",
"work_dir",
",",
"tar_name",
",",
"uuid",
"=",
"None",
",",
"files",
"=",
"None",
")",
":",
"with",
"tarfile",
".",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"work_dir",
",",
"tar_name",
")",
",",
"'w:gz'",
")",
... | Tars a group of files together into a tarball
work_dir: str Current Working Directory
tar_name: str Name of tarball
uuid: str UUID to stamp files with
files: str(s) List of filenames to place in the tarball from working directory | [
"Tars",
"a",
"group",
"of",
"files",
"together",
"into",
"a",
"tarball"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/transfer_gtex_to_s3/transfer_gtex_to_s3.py#L95-L109 |
BD2KGenomics/toil-scripts | src/toil_scripts/transfer_gtex_to_s3/transfer_gtex_to_s3.py | start_batch | def start_batch(job, input_args):
"""
This function will administer 5 jobs at a time then recursively call itself until subset is empty
"""
samples = parse_sra(input_args['sra'])
# for analysis_id in samples:
job.addChildJobFn(download_and_transfer_sample, input_args, samples, cores=1, disk='30'... | python | def start_batch(job, input_args):
"""
This function will administer 5 jobs at a time then recursively call itself until subset is empty
"""
samples = parse_sra(input_args['sra'])
# for analysis_id in samples:
job.addChildJobFn(download_and_transfer_sample, input_args, samples, cores=1, disk='30'... | [
"def",
"start_batch",
"(",
"job",
",",
"input_args",
")",
":",
"samples",
"=",
"parse_sra",
"(",
"input_args",
"[",
"'sra'",
"]",
")",
"# for analysis_id in samples:",
"job",
".",
"addChildJobFn",
"(",
"download_and_transfer_sample",
",",
"input_args",
",",
"sampl... | This function will administer 5 jobs at a time then recursively call itself until subset is empty | [
"This",
"function",
"will",
"administer",
"5",
"jobs",
"at",
"a",
"time",
"then",
"recursively",
"call",
"itself",
"until",
"subset",
"is",
"empty"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/transfer_gtex_to_s3/transfer_gtex_to_s3.py#L113-L119 |
BD2KGenomics/toil-scripts | src/toil_scripts/transfer_gtex_to_s3/transfer_gtex_to_s3.py | download_and_transfer_sample | def download_and_transfer_sample(job, input_args, samples):
"""
Downloads a sample from dbGaP via SRAToolKit, then uses S3AM to transfer it to S3
input_args: dict Dictionary of input arguments
analysis_id: str An analysis ID for a sample in CGHub
"""
if len(samples) > 1:
a... | python | def download_and_transfer_sample(job, input_args, samples):
"""
Downloads a sample from dbGaP via SRAToolKit, then uses S3AM to transfer it to S3
input_args: dict Dictionary of input arguments
analysis_id: str An analysis ID for a sample in CGHub
"""
if len(samples) > 1:
a... | [
"def",
"download_and_transfer_sample",
"(",
"job",
",",
"input_args",
",",
"samples",
")",
":",
"if",
"len",
"(",
"samples",
")",
">",
"1",
":",
"a",
"=",
"samples",
"[",
"len",
"(",
"samples",
")",
"/",
"2",
":",
"]",
"b",
"=",
"samples",
"[",
":"... | Downloads a sample from dbGaP via SRAToolKit, then uses S3AM to transfer it to S3
input_args: dict Dictionary of input arguments
analysis_id: str An analysis ID for a sample in CGHub | [
"Downloads",
"a",
"sample",
"from",
"dbGaP",
"via",
"SRAToolKit",
"then",
"uses",
"S3AM",
"to",
"transfer",
"it",
"to",
"S3"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/transfer_gtex_to_s3/transfer_gtex_to_s3.py#L122-L172 |
BD2KGenomics/toil-scripts | src/toil_scripts/transfer_gtex_to_s3/transfer_gtex_to_s3.py | main | def main():
"""
Transfer gTEX data from dbGaP (NCBI) to S3
"""
# Define Parser object and add to toil
parser = build_parser()
Job.Runner.addToilOptions(parser)
args = parser.parse_args()
# Store inputs from argparse
inputs = {'sra': args.sra,
'dbgap_key': args.dbgap_key... | python | def main():
"""
Transfer gTEX data from dbGaP (NCBI) to S3
"""
# Define Parser object and add to toil
parser = build_parser()
Job.Runner.addToilOptions(parser)
args = parser.parse_args()
# Store inputs from argparse
inputs = {'sra': args.sra,
'dbgap_key': args.dbgap_key... | [
"def",
"main",
"(",
")",
":",
"# Define Parser object and add to toil",
"parser",
"=",
"build_parser",
"(",
")",
"Job",
".",
"Runner",
".",
"addToilOptions",
"(",
"parser",
")",
"args",
"=",
"parser",
".",
"parse_args",
"(",
")",
"# Store inputs from argparse",
... | Transfer gTEX data from dbGaP (NCBI) to S3 | [
"Transfer",
"gTEX",
"data",
"from",
"dbGaP",
"(",
"NCBI",
")",
"to",
"S3"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/transfer_gtex_to_s3/transfer_gtex_to_s3.py#L175-L198 |
BD2KGenomics/toil-scripts | src/toil_scripts/gatk_germline/common.py | output_file_job | def output_file_job(job, filename, file_id, output_dir, s3_key_path=None):
"""
Uploads a file from the FileStore to an output directory on the local filesystem or S3.
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str filename: basename for file
:param str file_id: FileStore... | python | def output_file_job(job, filename, file_id, output_dir, s3_key_path=None):
"""
Uploads a file from the FileStore to an output directory on the local filesystem or S3.
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str filename: basename for file
:param str file_id: FileStore... | [
"def",
"output_file_job",
"(",
"job",
",",
"filename",
",",
"file_id",
",",
"output_dir",
",",
"s3_key_path",
"=",
"None",
")",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Writing {} to {}'",
".",
"format",
"(",
"filename",
",",
"output_dir",
")... | Uploads a file from the FileStore to an output directory on the local filesystem or S3.
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str filename: basename for file
:param str file_id: FileStoreID
:param str output_dir: Amazon S3 URL or local path
:param str s3_key_path: (... | [
"Uploads",
"a",
"file",
"from",
"the",
"FileStore",
"to",
"an",
"output",
"directory",
"on",
"the",
"local",
"filesystem",
"or",
"S3",
"."
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/common.py#L10-L32 |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | download_encrypted_file | def download_encrypted_file(job, input_args, name):
"""
Downloads encrypted files from S3 via header injection
input_args: dict Input dictionary defined in main()
name: str Symbolic name associated with file
"""
work_dir = job.fileStore.getLocalTempDir()
key_path = input_args['... | python | def download_encrypted_file(job, input_args, name):
"""
Downloads encrypted files from S3 via header injection
input_args: dict Input dictionary defined in main()
name: str Symbolic name associated with file
"""
work_dir = job.fileStore.getLocalTempDir()
key_path = input_args['... | [
"def",
"download_encrypted_file",
"(",
"job",
",",
"input_args",
",",
"name",
")",
":",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"key_path",
"=",
"input_args",
"[",
"'ssec'",
"]",
"file_path",
"=",
"os",
".",
"path",
".",... | Downloads encrypted files from S3 via header injection
input_args: dict Input dictionary defined in main()
name: str Symbolic name associated with file | [
"Downloads",
"encrypted",
"files",
"from",
"S3",
"via",
"header",
"injection"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L177-L206 |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | download_from_url | def download_from_url(job, url):
"""
Simple curl request made for a given url
url: str URL to download
"""
work_dir = job.fileStore.getLocalTempDir()
file_path = os.path.join(work_dir, os.path.basename(url))
if not os.path.exists(file_path):
if url.startswith('s3:'):
... | python | def download_from_url(job, url):
"""
Simple curl request made for a given url
url: str URL to download
"""
work_dir = job.fileStore.getLocalTempDir()
file_path = os.path.join(work_dir, os.path.basename(url))
if not os.path.exists(file_path):
if url.startswith('s3:'):
... | [
"def",
"download_from_url",
"(",
"job",
",",
"url",
")",
":",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"file_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"work_dir",
",",
"os",
".",
"path",
".",
"basename",
"(",
... | Simple curl request made for a given url
url: str URL to download | [
"Simple",
"curl",
"request",
"made",
"for",
"a",
"given",
"url"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L209-L226 |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | docker_call | def docker_call(work_dir, tool_parameters, tool, java_opts=None, outfile=None, sudo=False):
"""
Makes subprocess call of a command to a docker container.
tool_parameters: list An array of the parameters to be passed to the tool
tool: str Name of the Docker image to be used (e.g. quay.i... | python | def docker_call(work_dir, tool_parameters, tool, java_opts=None, outfile=None, sudo=False):
"""
Makes subprocess call of a command to a docker container.
tool_parameters: list An array of the parameters to be passed to the tool
tool: str Name of the Docker image to be used (e.g. quay.i... | [
"def",
"docker_call",
"(",
"work_dir",
",",
"tool_parameters",
",",
"tool",
",",
"java_opts",
"=",
"None",
",",
"outfile",
"=",
"None",
",",
"sudo",
"=",
"False",
")",
":",
"base_docker_call",
"=",
"'docker run --log-driver=none --rm -v {}:/data'",
".",
"format",
... | Makes subprocess call of a command to a docker container.
tool_parameters: list An array of the parameters to be passed to the tool
tool: str Name of the Docker image to be used (e.g. quay.io/ucsc_cgl/samtools)
java_opts: str Optional commands to pass to a java jar execution. (e.g... | [
"Makes",
"subprocess",
"call",
"of",
"a",
"command",
"to",
"a",
"docker",
"container",
"."
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L257-L281 |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | copy_to_output_dir | def copy_to_output_dir(work_dir, output_dir, uuid=None, files=list()):
"""
A list of files to move from work_dir to output_dir.
work_dir: str Current working directory
output_dir: str Output directory for files to go
uuid: str UUID to "stamp" onto output files
files: list ... | python | def copy_to_output_dir(work_dir, output_dir, uuid=None, files=list()):
"""
A list of files to move from work_dir to output_dir.
work_dir: str Current working directory
output_dir: str Output directory for files to go
uuid: str UUID to "stamp" onto output files
files: list ... | [
"def",
"copy_to_output_dir",
"(",
"work_dir",
",",
"output_dir",
",",
"uuid",
"=",
"None",
",",
"files",
"=",
"list",
"(",
")",
")",
":",
"for",
"fname",
"in",
"files",
":",
"if",
"uuid",
"is",
"None",
":",
"shutil",
".",
"copy",
"(",
"os",
".",
"p... | A list of files to move from work_dir to output_dir.
work_dir: str Current working directory
output_dir: str Output directory for files to go
uuid: str UUID to "stamp" onto output files
files: list List of files to iterate through | [
"A",
"list",
"of",
"files",
"to",
"move",
"from",
"work_dir",
"to",
"output_dir",
"."
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L284-L297 |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | program_checks | def program_checks(job, input_args):
"""
Checks that dependency programs are installed.
input_args: dict Dictionary of input arguments (from main())
"""
# Program checks
for program in ['curl', 'docker', 'unzip', 'samtools']:
assert which(program), 'Program "{}" must be installed... | python | def program_checks(job, input_args):
"""
Checks that dependency programs are installed.
input_args: dict Dictionary of input arguments (from main())
"""
# Program checks
for program in ['curl', 'docker', 'unzip', 'samtools']:
assert which(program), 'Program "{}" must be installed... | [
"def",
"program_checks",
"(",
"job",
",",
"input_args",
")",
":",
"# Program checks",
"for",
"program",
"in",
"[",
"'curl'",
",",
"'docker'",
",",
"'unzip'",
",",
"'samtools'",
"]",
":",
"assert",
"which",
"(",
"program",
")",
",",
"'Program \"{}\" must be ins... | Checks that dependency programs are installed.
input_args: dict Dictionary of input arguments (from main()) | [
"Checks",
"that",
"dependency",
"programs",
"are",
"installed",
"."
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L334-L343 |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | download_shared_files | def download_shared_files(job, input_args):
"""
Downloads and stores shared inputs files in the FileStore
input_args: dict Dictionary of input arguments (from main())
"""
shared_files = ['unc.bed', 'hg19.transcripts.fa', 'composite_exons.bed', 'normalize.pl', 'rsem_ref.zip',
... | python | def download_shared_files(job, input_args):
"""
Downloads and stores shared inputs files in the FileStore
input_args: dict Dictionary of input arguments (from main())
"""
shared_files = ['unc.bed', 'hg19.transcripts.fa', 'composite_exons.bed', 'normalize.pl', 'rsem_ref.zip',
... | [
"def",
"download_shared_files",
"(",
"job",
",",
"input_args",
")",
":",
"shared_files",
"=",
"[",
"'unc.bed'",
",",
"'hg19.transcripts.fa'",
",",
"'composite_exons.bed'",
",",
"'normalize.pl'",
",",
"'rsem_ref.zip'",
",",
"'ebwt.zip'",
",",
"'chromosomes.zip'",
"]",
... | Downloads and stores shared inputs files in the FileStore
input_args: dict Dictionary of input arguments (from main()) | [
"Downloads",
"and",
"stores",
"shared",
"inputs",
"files",
"in",
"the",
"FileStore"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L346-L363 |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | parse_config_file | def parse_config_file(job, ids, input_args):
"""
Launches pipeline for each sample.
shared_ids: dict Dictionary of fileStore IDs
input_args: dict Dictionary of input arguments
"""
samples = []
config = input_args['config']
with open(config, 'r') as f:
for line in f... | python | def parse_config_file(job, ids, input_args):
"""
Launches pipeline for each sample.
shared_ids: dict Dictionary of fileStore IDs
input_args: dict Dictionary of input arguments
"""
samples = []
config = input_args['config']
with open(config, 'r') as f:
for line in f... | [
"def",
"parse_config_file",
"(",
"job",
",",
"ids",
",",
"input_args",
")",
":",
"samples",
"=",
"[",
"]",
"config",
"=",
"input_args",
"[",
"'config'",
"]",
"with",
"open",
"(",
"config",
",",
"'r'",
")",
"as",
"f",
":",
"for",
"line",
"in",
"f",
... | Launches pipeline for each sample.
shared_ids: dict Dictionary of fileStore IDs
input_args: dict Dictionary of input arguments | [
"Launches",
"pipeline",
"for",
"each",
"sample",
"."
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L366-L381 |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | download_sample | def download_sample(job, ids, input_args, sample):
"""
Defines variables unique to a sample that are used in the rest of the pipelines
ids: dict Dictionary of fileStore IDS
input_args: dict Dictionary of input arguments
sample: tuple Contains uuid and sample_url
"""
if le... | python | def download_sample(job, ids, input_args, sample):
"""
Defines variables unique to a sample that are used in the rest of the pipelines
ids: dict Dictionary of fileStore IDS
input_args: dict Dictionary of input arguments
sample: tuple Contains uuid and sample_url
"""
if le... | [
"def",
"download_sample",
"(",
"job",
",",
"ids",
",",
"input_args",
",",
"sample",
")",
":",
"if",
"len",
"(",
"sample",
")",
"==",
"2",
":",
"uuid",
",",
"sample_location",
"=",
"sample",
"url1",
",",
"url2",
"=",
"None",
",",
"None",
"else",
":",
... | Defines variables unique to a sample that are used in the rest of the pipelines
ids: dict Dictionary of fileStore IDS
input_args: dict Dictionary of input arguments
sample: tuple Contains uuid and sample_url | [
"Defines",
"variables",
"unique",
"to",
"a",
"sample",
"that",
"are",
"used",
"in",
"the",
"rest",
"of",
"the",
"pipelines"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L384-L417 |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | static_dag_launchpoint | def static_dag_launchpoint(job, job_vars):
"""
Statically define jobs in the pipeline
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
input_args, ids = job_vars
if input_args['config_fastq']:
cores = input_args['cpu_count']
a = job.wrapJobFn(mapsplice, job_vars... | python | def static_dag_launchpoint(job, job_vars):
"""
Statically define jobs in the pipeline
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
input_args, ids = job_vars
if input_args['config_fastq']:
cores = input_args['cpu_count']
a = job.wrapJobFn(mapsplice, job_vars... | [
"def",
"static_dag_launchpoint",
"(",
"job",
",",
"job_vars",
")",
":",
"input_args",
",",
"ids",
"=",
"job_vars",
"if",
"input_args",
"[",
"'config_fastq'",
"]",
":",
"cores",
"=",
"input_args",
"[",
"'cpu_count'",
"]",
"a",
"=",
"job",
".",
"wrapJobFn",
... | Statically define jobs in the pipeline
job_vars: tuple Tuple of dictionaries: input_args and ids | [
"Statically",
"define",
"jobs",
"in",
"the",
"pipeline"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L420-L435 |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | merge_fastqs | def merge_fastqs(job, job_vars):
"""
Unzips input sample and concats the Read1 and Read2 groups together.
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
input_args, ids = job_vars
work_dir = job.fileStore.getLocalTempDir()
cores = input_args['cpu_count']
single_end_re... | python | def merge_fastqs(job, job_vars):
"""
Unzips input sample and concats the Read1 and Read2 groups together.
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
input_args, ids = job_vars
work_dir = job.fileStore.getLocalTempDir()
cores = input_args['cpu_count']
single_end_re... | [
"def",
"merge_fastqs",
"(",
"job",
",",
"job_vars",
")",
":",
"input_args",
",",
"ids",
"=",
"job_vars",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"cores",
"=",
"input_args",
"[",
"'cpu_count'",
"]",
"single_end_reads",
"=",... | Unzips input sample and concats the Read1 and Read2 groups together.
job_vars: tuple Tuple of dictionaries: input_args and ids | [
"Unzips",
"input",
"sample",
"and",
"concats",
"the",
"Read1",
"and",
"Read2",
"groups",
"together",
"."
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L438-L476 |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | mapsplice | def mapsplice(job, job_vars):
"""
Maps RNA-Seq reads to a reference genome.
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
# Unpack variables
input_args, ids = job_vars
work_dir = job.fileStore.getLocalTempDir()
cores = input_args['cpu_count']
sudo = input_args['s... | python | def mapsplice(job, job_vars):
"""
Maps RNA-Seq reads to a reference genome.
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
# Unpack variables
input_args, ids = job_vars
work_dir = job.fileStore.getLocalTempDir()
cores = input_args['cpu_count']
sudo = input_args['s... | [
"def",
"mapsplice",
"(",
"job",
",",
"job_vars",
")",
":",
"# Unpack variables",
"input_args",
",",
"ids",
"=",
"job_vars",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"cores",
"=",
"input_args",
"[",
"'cpu_count'",
"]",
"sudo... | Maps RNA-Seq reads to a reference genome.
job_vars: tuple Tuple of dictionaries: input_args and ids | [
"Maps",
"RNA",
"-",
"Seq",
"reads",
"to",
"a",
"reference",
"genome",
"."
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L479-L524 |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | add_read_groups | def add_read_groups(job, job_vars):
"""
This function adds read groups to the headers
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
input_args, ids = job_vars
work_dir = job.fileStore.getLocalTempDir()
sudo = input_args['sudo']
# I/O
alignments = return_input_pat... | python | def add_read_groups(job, job_vars):
"""
This function adds read groups to the headers
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
input_args, ids = job_vars
work_dir = job.fileStore.getLocalTempDir()
sudo = input_args['sudo']
# I/O
alignments = return_input_pat... | [
"def",
"add_read_groups",
"(",
"job",
",",
"job_vars",
")",
":",
"input_args",
",",
"ids",
"=",
"job_vars",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"sudo",
"=",
"input_args",
"[",
"'sudo'",
"]",
"# I/O",
"alignments",
"=... | This function adds read groups to the headers
job_vars: tuple Tuple of dictionaries: input_args and ids | [
"This",
"function",
"adds",
"read",
"groups",
"to",
"the",
"headers"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L548-L575 |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | bamsort_and_index | def bamsort_and_index(job, job_vars):
"""
Sorts bam file and produces index file
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
# Unpack variables
input_args, ids = job_vars
work_dir = job.fileStore.getLocalTempDir()
sudo = input_args['sudo']
# I/O
rg_alignmen... | python | def bamsort_and_index(job, job_vars):
"""
Sorts bam file and produces index file
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
# Unpack variables
input_args, ids = job_vars
work_dir = job.fileStore.getLocalTempDir()
sudo = input_args['sudo']
# I/O
rg_alignmen... | [
"def",
"bamsort_and_index",
"(",
"job",
",",
"job_vars",
")",
":",
"# Unpack variables",
"input_args",
",",
"ids",
"=",
"job_vars",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"sudo",
"=",
"input_args",
"[",
"'sudo'",
"]",
"# ... | Sorts bam file and produces index file
job_vars: tuple Tuple of dictionaries: input_args and ids | [
"Sorts",
"bam",
"file",
"and",
"produces",
"index",
"file"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L578-L604 |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | rseq_qc | def rseq_qc(job, job_vars):
"""
QC module: contains QC metrics and information about the BAM post alignment
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
input_args, ids = job_vars
work_dir = job.fileStore.getLocalTempDir()
uuid = input_args['uuid']
sudo = input_args... | python | def rseq_qc(job, job_vars):
"""
QC module: contains QC metrics and information about the BAM post alignment
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
input_args, ids = job_vars
work_dir = job.fileStore.getLocalTempDir()
uuid = input_args['uuid']
sudo = input_args... | [
"def",
"rseq_qc",
"(",
"job",
",",
"job_vars",
")",
":",
"input_args",
",",
"ids",
"=",
"job_vars",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"uuid",
"=",
"input_args",
"[",
"'uuid'",
"]",
"sudo",
"=",
"input_args",
"[",... | QC module: contains QC metrics and information about the BAM post alignment
job_vars: tuple Tuple of dictionaries: input_args and ids | [
"QC",
"module",
":",
"contains",
"QC",
"metrics",
"and",
"information",
"about",
"the",
"BAM",
"post",
"alignment"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L607-L625 |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | sort_bam_by_reference | def sort_bam_by_reference(job, job_vars):
"""
Sorts the bam by reference
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
# Unpack variables
input_args, ids = job_vars
work_dir = job.fileStore.getLocalTempDir()
# I/O
sorted_bam, sorted_bai = return_input_paths(job, ... | python | def sort_bam_by_reference(job, job_vars):
"""
Sorts the bam by reference
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
# Unpack variables
input_args, ids = job_vars
work_dir = job.fileStore.getLocalTempDir()
# I/O
sorted_bam, sorted_bai = return_input_paths(job, ... | [
"def",
"sort_bam_by_reference",
"(",
"job",
",",
"job_vars",
")",
":",
"# Unpack variables",
"input_args",
",",
"ids",
"=",
"job_vars",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"# I/O",
"sorted_bam",
",",
"sorted_bai",
"=",
"... | Sorts the bam by reference
job_vars: tuple Tuple of dictionaries: input_args and ids | [
"Sorts",
"the",
"bam",
"by",
"reference"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L628-L663 |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | exon_count | def exon_count(job, job_vars):
"""
Produces exon counts
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
input_args, ids = job_vars
work_dir = job.fileStore.getLocalTempDir()
uuid = input_args['uuid']
sudo = input_args['sudo']
# I/O
sort_by_ref, normalize_pl, co... | python | def exon_count(job, job_vars):
"""
Produces exon counts
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
input_args, ids = job_vars
work_dir = job.fileStore.getLocalTempDir()
uuid = input_args['uuid']
sudo = input_args['sudo']
# I/O
sort_by_ref, normalize_pl, co... | [
"def",
"exon_count",
"(",
"job",
",",
"job_vars",
")",
":",
"input_args",
",",
"ids",
"=",
"job_vars",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"uuid",
"=",
"input_args",
"[",
"'uuid'",
"]",
"sudo",
"=",
"input_args",
"... | Produces exon counts
job_vars: tuple Tuple of dictionaries: input_args and ids | [
"Produces",
"exon",
"counts"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L666-L705 |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | transcriptome | def transcriptome(job, job_vars):
"""
Creates a bam of just the transcriptome
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
input_args, ids = job_vars
work_dir = job.fileStore.getLocalTempDir()
sudo = input_args['sudo']
# I/O
sort_by_ref, bed, hg19_fa = return_in... | python | def transcriptome(job, job_vars):
"""
Creates a bam of just the transcriptome
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
input_args, ids = job_vars
work_dir = job.fileStore.getLocalTempDir()
sudo = input_args['sudo']
# I/O
sort_by_ref, bed, hg19_fa = return_in... | [
"def",
"transcriptome",
"(",
"job",
",",
"job_vars",
")",
":",
"input_args",
",",
"ids",
"=",
"job_vars",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"sudo",
"=",
"input_args",
"[",
"'sudo'",
"]",
"# I/O",
"sort_by_ref",
","... | Creates a bam of just the transcriptome
job_vars: tuple Tuple of dictionaries: input_args and ids | [
"Creates",
"a",
"bam",
"of",
"just",
"the",
"transcriptome"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L708-L734 |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | filter_bam | def filter_bam(job, job_vars):
"""
Performs filtering on the transcriptome bam
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
input_args, ids = job_vars
work_dir = job.fileStore.getLocalTempDir()
cores = input_args['cpu_count']
sudo = input_args['sudo']
# I/O
... | python | def filter_bam(job, job_vars):
"""
Performs filtering on the transcriptome bam
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
input_args, ids = job_vars
work_dir = job.fileStore.getLocalTempDir()
cores = input_args['cpu_count']
sudo = input_args['sudo']
# I/O
... | [
"def",
"filter_bam",
"(",
"job",
",",
"job_vars",
")",
":",
"input_args",
",",
"ids",
"=",
"job_vars",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"cores",
"=",
"input_args",
"[",
"'cpu_count'",
"]",
"sudo",
"=",
"input_args... | Performs filtering on the transcriptome bam
job_vars: tuple Tuple of dictionaries: input_args and ids | [
"Performs",
"filtering",
"on",
"the",
"transcriptome",
"bam"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L737-L762 |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | rsem | def rsem(job, job_vars):
"""
Runs RSEM to produce counts
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
input_args, ids = job_vars
work_dir = job.fileStore.getLocalTempDir()
cpus = input_args['cpu_count']
sudo = input_args['sudo']
single_end_reads = input_args['si... | python | def rsem(job, job_vars):
"""
Runs RSEM to produce counts
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
input_args, ids = job_vars
work_dir = job.fileStore.getLocalTempDir()
cpus = input_args['cpu_count']
sudo = input_args['sudo']
single_end_reads = input_args['si... | [
"def",
"rsem",
"(",
"job",
",",
"job_vars",
")",
":",
"input_args",
",",
"ids",
"=",
"job_vars",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"cpus",
"=",
"input_args",
"[",
"'cpu_count'",
"]",
"sudo",
"=",
"input_args",
"[... | Runs RSEM to produce counts
job_vars: tuple Tuple of dictionaries: input_args and ids | [
"Runs",
"RSEM",
"to",
"produce",
"counts"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L765-L800 |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | consolidate_output | def consolidate_output(job, job_vars, output_ids):
"""
Combine the contents of separate zipped outputs into one via streaming
job_vars: tuple Tuple of dictionaries: input_args and ids
output_ids: tuple Nested tuple of all the output fileStore IDs
"""
input_args, ids = job_vars
work_di... | python | def consolidate_output(job, job_vars, output_ids):
"""
Combine the contents of separate zipped outputs into one via streaming
job_vars: tuple Tuple of dictionaries: input_args and ids
output_ids: tuple Nested tuple of all the output fileStore IDs
"""
input_args, ids = job_vars
work_di... | [
"def",
"consolidate_output",
"(",
"job",
",",
"job_vars",
",",
"output_ids",
")",
":",
"input_args",
",",
"ids",
"=",
"job_vars",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"uuid",
"=",
"input_args",
"[",
"'uuid'",
"]",
"# ... | Combine the contents of separate zipped outputs into one via streaming
job_vars: tuple Tuple of dictionaries: input_args and ids
output_ids: tuple Nested tuple of all the output fileStore IDs | [
"Combine",
"the",
"contents",
"of",
"separate",
"zipped",
"outputs",
"into",
"one",
"via",
"streaming"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L826-L865 |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | upload_output_to_s3 | def upload_output_to_s3(job, job_vars):
"""
If s3_dir is specified in arguments, file will be uploaded to S3 using boto.
WARNING: ~/.boto credentials are necessary for this to succeed!
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
import boto
from boto.s3.key import Key
... | python | def upload_output_to_s3(job, job_vars):
"""
If s3_dir is specified in arguments, file will be uploaded to S3 using boto.
WARNING: ~/.boto credentials are necessary for this to succeed!
job_vars: tuple Tuple of dictionaries: input_args and ids
"""
import boto
from boto.s3.key import Key
... | [
"def",
"upload_output_to_s3",
"(",
"job",
",",
"job_vars",
")",
":",
"import",
"boto",
"from",
"boto",
".",
"s3",
".",
"key",
"import",
"Key",
"input_args",
",",
"ids",
"=",
"job_vars",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",... | If s3_dir is specified in arguments, file will be uploaded to S3 using boto.
WARNING: ~/.boto credentials are necessary for this to succeed!
job_vars: tuple Tuple of dictionaries: input_args and ids | [
"If",
"s3_dir",
"is",
"specified",
"in",
"arguments",
"file",
"will",
"be",
"uploaded",
"to",
"S3",
"using",
"boto",
".",
"WARNING",
":",
"~",
"/",
".",
"boto",
"credentials",
"are",
"necessary",
"for",
"this",
"to",
"succeed!"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L868-L892 |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | upload_bam_to_s3 | def upload_bam_to_s3(job, job_vars):
"""
Upload bam to S3. Requires S3AM and a ~/.boto config file.
"""
input_args, ids = job_vars
work_dir = job.fileStore.getLocalTempDir()
uuid = input_args['uuid']
# I/O
job.fileStore.readGlobalFile(ids['alignments.bam'], os.path.join(work_dir, 'alignm... | python | def upload_bam_to_s3(job, job_vars):
"""
Upload bam to S3. Requires S3AM and a ~/.boto config file.
"""
input_args, ids = job_vars
work_dir = job.fileStore.getLocalTempDir()
uuid = input_args['uuid']
# I/O
job.fileStore.readGlobalFile(ids['alignments.bam'], os.path.join(work_dir, 'alignm... | [
"def",
"upload_bam_to_s3",
"(",
"job",
",",
"job_vars",
")",
":",
"input_args",
",",
"ids",
"=",
"job_vars",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"uuid",
"=",
"input_args",
"[",
"'uuid'",
"]",
"# I/O",
"job",
".",
"... | Upload bam to S3. Requires S3AM and a ~/.boto config file. | [
"Upload",
"bam",
"to",
"S3",
".",
"Requires",
"S3AM",
"and",
"a",
"~",
"/",
".",
"boto",
"config",
"file",
"."
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L895-L915 |
BD2KGenomics/toil-scripts | src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py | main | def main():
"""
This is a Toil pipeline for the UNC best practice RNA-Seq analysis.
RNA-seq fastqs are combined, aligned, sorted, filtered, and quantified.
Please read the README.md located in the same directory.
"""
# Define Parser object and add to toil
parser = build_parser()
Job.Run... | python | def main():
"""
This is a Toil pipeline for the UNC best practice RNA-Seq analysis.
RNA-seq fastqs are combined, aligned, sorted, filtered, and quantified.
Please read the README.md located in the same directory.
"""
# Define Parser object and add to toil
parser = build_parser()
Job.Run... | [
"def",
"main",
"(",
")",
":",
"# Define Parser object and add to toil",
"parser",
"=",
"build_parser",
"(",
")",
"Job",
".",
"Runner",
".",
"addToilOptions",
"(",
"parser",
")",
"args",
"=",
"parser",
".",
"parse_args",
"(",
")",
"# Store inputs from argparse",
... | This is a Toil pipeline for the UNC best practice RNA-Seq analysis.
RNA-seq fastqs are combined, aligned, sorted, filtered, and quantified.
Please read the README.md located in the same directory. | [
"This",
"is",
"a",
"Toil",
"pipeline",
"for",
"the",
"UNC",
"best",
"practice",
"RNA",
"-",
"Seq",
"analysis",
".",
"RNA",
"-",
"seq",
"fastqs",
"are",
"combined",
"aligned",
"sorted",
"filtered",
"and",
"quantified",
"."
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/rnaseq_unc/rnaseq_unc_pipeline.py#L918-L951 |
BD2KGenomics/toil-scripts | src/toil_scripts/adam_pipeline/adam_preprocessing.py | remove_file | def remove_file(master_ip, filename, spark_on_toil):
"""
Remove the given file from hdfs with master at the given IP address
:type masterIP: MasterAddress
"""
master_ip = master_ip.actual
ssh_call = ['ssh', '-o', 'StrictHostKeyChecking=no', master_ip]
if spark_on_toil:
output = ch... | python | def remove_file(master_ip, filename, spark_on_toil):
"""
Remove the given file from hdfs with master at the given IP address
:type masterIP: MasterAddress
"""
master_ip = master_ip.actual
ssh_call = ['ssh', '-o', 'StrictHostKeyChecking=no', master_ip]
if spark_on_toil:
output = ch... | [
"def",
"remove_file",
"(",
"master_ip",
",",
"filename",
",",
"spark_on_toil",
")",
":",
"master_ip",
"=",
"master_ip",
".",
"actual",
"ssh_call",
"=",
"[",
"'ssh'",
",",
"'-o'",
",",
"'StrictHostKeyChecking=no'",
",",
"master_ip",
"]",
"if",
"spark_on_toil",
... | Remove the given file from hdfs with master at the given IP address
:type masterIP: MasterAddress | [
"Remove",
"the",
"given",
"file",
"from",
"hdfs",
"with",
"master",
"at",
"the",
"given",
"IP",
"address"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/adam_pipeline/adam_preprocessing.py#L52-L70 |
BD2KGenomics/toil-scripts | src/toil_scripts/adam_pipeline/adam_preprocessing.py | download_data | def download_data(job, master_ip, inputs, known_snps, bam, hdfs_snps, hdfs_bam):
"""
Downloads input data files from S3.
:type masterIP: MasterAddress
"""
log.info("Downloading known sites file %s to %s.", known_snps, hdfs_snps)
call_conductor(job, master_ip, known_snps, hdfs_snps, memory=inpu... | python | def download_data(job, master_ip, inputs, known_snps, bam, hdfs_snps, hdfs_bam):
"""
Downloads input data files from S3.
:type masterIP: MasterAddress
"""
log.info("Downloading known sites file %s to %s.", known_snps, hdfs_snps)
call_conductor(job, master_ip, known_snps, hdfs_snps, memory=inpu... | [
"def",
"download_data",
"(",
"job",
",",
"master_ip",
",",
"inputs",
",",
"known_snps",
",",
"bam",
",",
"hdfs_snps",
",",
"hdfs_bam",
")",
":",
"log",
".",
"info",
"(",
"\"Downloading known sites file %s to %s.\"",
",",
"known_snps",
",",
"hdfs_snps",
")",
"c... | Downloads input data files from S3.
:type masterIP: MasterAddress | [
"Downloads",
"input",
"data",
"files",
"from",
"S3",
"."
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/adam_pipeline/adam_preprocessing.py#L96-L107 |
BD2KGenomics/toil-scripts | src/toil_scripts/adam_pipeline/adam_preprocessing.py | adam_convert | def adam_convert(job, master_ip, inputs, in_file, in_snps, adam_file, adam_snps, spark_on_toil):
"""
Convert input sam/bam file and known SNPs file into ADAM format
"""
log.info("Converting input BAM to ADAM.")
call_adam(job, master_ip,
["transform", in_file, adam_file],
... | python | def adam_convert(job, master_ip, inputs, in_file, in_snps, adam_file, adam_snps, spark_on_toil):
"""
Convert input sam/bam file and known SNPs file into ADAM format
"""
log.info("Converting input BAM to ADAM.")
call_adam(job, master_ip,
["transform", in_file, adam_file],
... | [
"def",
"adam_convert",
"(",
"job",
",",
"master_ip",
",",
"inputs",
",",
"in_file",
",",
"in_snps",
",",
"adam_file",
",",
"adam_snps",
",",
"spark_on_toil",
")",
":",
"log",
".",
"info",
"(",
"\"Converting input BAM to ADAM.\"",
")",
"call_adam",
"(",
"job",
... | Convert input sam/bam file and known SNPs file into ADAM format | [
"Convert",
"input",
"sam",
"/",
"bam",
"file",
"and",
"known",
"SNPs",
"file",
"into",
"ADAM",
"format"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/adam_pipeline/adam_preprocessing.py#L110-L134 |
BD2KGenomics/toil-scripts | src/toil_scripts/adam_pipeline/adam_preprocessing.py | adam_transform | def adam_transform(job, master_ip, inputs, in_file, snp_file, hdfs_dir, out_file, spark_on_toil):
"""
Preprocess in_file with known SNPs snp_file:
- mark duplicates
- realign indels
- recalibrate base quality scores
"""
log.info("Marking duplicate reads.")
call_adam(job, mas... | python | def adam_transform(job, master_ip, inputs, in_file, snp_file, hdfs_dir, out_file, spark_on_toil):
"""
Preprocess in_file with known SNPs snp_file:
- mark duplicates
- realign indels
- recalibrate base quality scores
"""
log.info("Marking duplicate reads.")
call_adam(job, mas... | [
"def",
"adam_transform",
"(",
"job",
",",
"master_ip",
",",
"inputs",
",",
"in_file",
",",
"snp_file",
",",
"hdfs_dir",
",",
"out_file",
",",
"spark_on_toil",
")",
":",
"log",
".",
"info",
"(",
"\"Marking duplicate reads.\"",
")",
"call_adam",
"(",
"job",
",... | Preprocess in_file with known SNPs snp_file:
- mark duplicates
- realign indels
- recalibrate base quality scores | [
"Preprocess",
"in_file",
"with",
"known",
"SNPs",
"snp_file",
":",
"-",
"mark",
"duplicates",
"-",
"realign",
"indels",
"-",
"recalibrate",
"base",
"quality",
"scores"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/adam_pipeline/adam_preprocessing.py#L137-L197 |
BD2KGenomics/toil-scripts | src/toil_scripts/adam_pipeline/adam_preprocessing.py | upload_data | def upload_data(job, master_ip, inputs, hdfs_name, upload_name, spark_on_toil):
"""
Upload file hdfsName from hdfs to s3
"""
if mock_mode():
truncate_file(master_ip, hdfs_name, spark_on_toil)
log.info("Uploading output BAM %s to %s.", hdfs_name, upload_name)
call_conductor(job, master_... | python | def upload_data(job, master_ip, inputs, hdfs_name, upload_name, spark_on_toil):
"""
Upload file hdfsName from hdfs to s3
"""
if mock_mode():
truncate_file(master_ip, hdfs_name, spark_on_toil)
log.info("Uploading output BAM %s to %s.", hdfs_name, upload_name)
call_conductor(job, master_... | [
"def",
"upload_data",
"(",
"job",
",",
"master_ip",
",",
"inputs",
",",
"hdfs_name",
",",
"upload_name",
",",
"spark_on_toil",
")",
":",
"if",
"mock_mode",
"(",
")",
":",
"truncate_file",
"(",
"master_ip",
",",
"hdfs_name",
",",
"spark_on_toil",
")",
"log",
... | Upload file hdfsName from hdfs to s3 | [
"Upload",
"file",
"hdfsName",
"from",
"hdfs",
"to",
"s3"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/adam_pipeline/adam_preprocessing.py#L200-L210 |
BD2KGenomics/toil-scripts | src/toil_scripts/adam_pipeline/adam_preprocessing.py | download_run_and_upload | def download_run_and_upload(job, master_ip, inputs, spark_on_toil):
"""
Monolithic job that calls data download, conversion, transform, upload.
Previously, this was not monolithic; change came in due to #126/#134.
"""
master_ip = MasterAddress(master_ip)
bam_name = inputs.sample.split('://')[-1... | python | def download_run_and_upload(job, master_ip, inputs, spark_on_toil):
"""
Monolithic job that calls data download, conversion, transform, upload.
Previously, this was not monolithic; change came in due to #126/#134.
"""
master_ip = MasterAddress(master_ip)
bam_name = inputs.sample.split('://')[-1... | [
"def",
"download_run_and_upload",
"(",
"job",
",",
"master_ip",
",",
"inputs",
",",
"spark_on_toil",
")",
":",
"master_ip",
"=",
"MasterAddress",
"(",
"master_ip",
")",
"bam_name",
"=",
"inputs",
".",
"sample",
".",
"split",
"(",
"'://'",
")",
"[",
"-",
"1... | Monolithic job that calls data download, conversion, transform, upload.
Previously, this was not monolithic; change came in due to #126/#134. | [
"Monolithic",
"job",
"that",
"calls",
"data",
"download",
"conversion",
"transform",
"upload",
".",
"Previously",
"this",
"was",
"not",
"monolithic",
";",
"change",
"came",
"in",
"due",
"to",
"#126",
"/",
"#134",
"."
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/adam_pipeline/adam_preprocessing.py#L213-L264 |
BD2KGenomics/toil-scripts | src/toil_scripts/adam_pipeline/adam_preprocessing.py | static_adam_preprocessing_dag | def static_adam_preprocessing_dag(job, inputs, sample, output_dir, suffix=''):
"""
A Toil job function performing ADAM preprocessing on a single sample
"""
inputs.sample = sample
inputs.output_dir = output_dir
inputs.suffix = suffix
if inputs.master_ip is not None or inputs.run_local:
... | python | def static_adam_preprocessing_dag(job, inputs, sample, output_dir, suffix=''):
"""
A Toil job function performing ADAM preprocessing on a single sample
"""
inputs.sample = sample
inputs.output_dir = output_dir
inputs.suffix = suffix
if inputs.master_ip is not None or inputs.run_local:
... | [
"def",
"static_adam_preprocessing_dag",
"(",
"job",
",",
"inputs",
",",
"sample",
",",
"output_dir",
",",
"suffix",
"=",
"''",
")",
":",
"inputs",
".",
"sample",
"=",
"sample",
"inputs",
".",
"output_dir",
"=",
"output_dir",
"inputs",
".",
"suffix",
"=",
"... | A Toil job function performing ADAM preprocessing on a single sample | [
"A",
"Toil",
"job",
"function",
"performing",
"ADAM",
"preprocessing",
"on",
"a",
"single",
"sample"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/adam_pipeline/adam_preprocessing.py#L267-L303 |
BD2KGenomics/toil-scripts | src/toil_scripts/gatk_germline/hard_filter.py | hard_filter_pipeline | def hard_filter_pipeline(job, uuid, vcf_id, config):
"""
Runs GATK Hard Filtering on a Genomic VCF file and uploads the results.
0: Start 0 --> 1 --> 3 --> 5 --> 6
1: Select SNPs | |
2: Select INDELs +-> 2 --> 4 +
3: Apply SNP Filter
4: A... | python | def hard_filter_pipeline(job, uuid, vcf_id, config):
"""
Runs GATK Hard Filtering on a Genomic VCF file and uploads the results.
0: Start 0 --> 1 --> 3 --> 5 --> 6
1: Select SNPs | |
2: Select INDELs +-> 2 --> 4 +
3: Apply SNP Filter
4: A... | [
"def",
"hard_filter_pipeline",
"(",
"job",
",",
"uuid",
",",
"vcf_id",
",",
"config",
")",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Running Hard Filter on {}'",
".",
"format",
"(",
"uuid",
")",
")",
"# Get the total size of the genome reference",
"... | Runs GATK Hard Filtering on a Genomic VCF file and uploads the results.
0: Start 0 --> 1 --> 3 --> 5 --> 6
1: Select SNPs | |
2: Select INDELs +-> 2 --> 4 +
3: Apply SNP Filter
4: Apply INDEL Filter
5: Merge SNP and INDEL VCFs
6: Write fi... | [
"Runs",
"GATK",
"Hard",
"Filtering",
"on",
"a",
"Genomic",
"VCF",
"file",
"and",
"uploads",
"the",
"results",
"."
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/gatk_germline/hard_filter.py#L11-L137 |
BD2KGenomics/toil-scripts | src/toil_scripts/transfer_tcga_to_s3/transfer_tcga_to_s3.py | download_and_transfer_sample | def download_and_transfer_sample(job, sample, inputs):
"""
Downloads a sample from CGHub via GeneTorrent, then uses S3AM to transfer it to S3
input_args: dict Dictionary of input arguments
analysis_id: str An analysis ID for a sample in CGHub
"""
analysis_id = sample[0]
work_... | python | def download_and_transfer_sample(job, sample, inputs):
"""
Downloads a sample from CGHub via GeneTorrent, then uses S3AM to transfer it to S3
input_args: dict Dictionary of input arguments
analysis_id: str An analysis ID for a sample in CGHub
"""
analysis_id = sample[0]
work_... | [
"def",
"download_and_transfer_sample",
"(",
"job",
",",
"sample",
",",
"inputs",
")",
":",
"analysis_id",
"=",
"sample",
"[",
"0",
"]",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"folder_path",
"=",
"os",
".",
"path",
".",
... | Downloads a sample from CGHub via GeneTorrent, then uses S3AM to transfer it to S3
input_args: dict Dictionary of input arguments
analysis_id: str An analysis ID for a sample in CGHub | [
"Downloads",
"a",
"sample",
"from",
"CGHub",
"via",
"GeneTorrent",
"then",
"uses",
"S3AM",
"to",
"transfer",
"it",
"to",
"S3"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/transfer_tcga_to_s3/transfer_tcga_to_s3.py#L65-L108 |
BD2KGenomics/toil-scripts | src/toil_scripts/transfer_tcga_to_s3/transfer_tcga_to_s3.py | main | def main():
"""
This is a Toil pipeline to transfer TCGA data into an S3 Bucket
Data is pulled down with Genetorrent and transferred to S3 via S3AM.
"""
# Define Parser object and add to toil
parser = build_parser()
Job.Runner.addToilOptions(parser)
args = parser.parse_args()
# Stor... | python | def main():
"""
This is a Toil pipeline to transfer TCGA data into an S3 Bucket
Data is pulled down with Genetorrent and transferred to S3 via S3AM.
"""
# Define Parser object and add to toil
parser = build_parser()
Job.Runner.addToilOptions(parser)
args = parser.parse_args()
# Stor... | [
"def",
"main",
"(",
")",
":",
"# Define Parser object and add to toil",
"parser",
"=",
"build_parser",
"(",
")",
"Job",
".",
"Runner",
".",
"addToilOptions",
"(",
"parser",
")",
"args",
"=",
"parser",
".",
"parse_args",
"(",
")",
"# Store inputs from argparse",
... | This is a Toil pipeline to transfer TCGA data into an S3 Bucket
Data is pulled down with Genetorrent and transferred to S3 via S3AM. | [
"This",
"is",
"a",
"Toil",
"pipeline",
"to",
"transfer",
"TCGA",
"data",
"into",
"an",
"S3",
"Bucket"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/transfer_tcga_to_s3/transfer_tcga_to_s3.py#L111-L137 |
bd808/python-iptools | iptools/ipv6.py | validate_ip | def validate_ip(s):
"""Validate a hexidecimal IPv6 ip address.
>>> validate_ip('::')
True
>>> validate_ip('::1')
True
>>> validate_ip('2001:db8:85a3::8a2e:370:7334')
True
>>> validate_ip('2001:db8:85a3:0:0:8a2e:370:7334')
True
>>> validate_ip('2001:0db8:85a3:0000:0000:8a2e:0370... | python | def validate_ip(s):
"""Validate a hexidecimal IPv6 ip address.
>>> validate_ip('::')
True
>>> validate_ip('::1')
True
>>> validate_ip('2001:db8:85a3::8a2e:370:7334')
True
>>> validate_ip('2001:db8:85a3:0:0:8a2e:370:7334')
True
>>> validate_ip('2001:0db8:85a3:0000:0000:8a2e:0370... | [
"def",
"validate_ip",
"(",
"s",
")",
":",
"if",
"_HEX_RE",
".",
"match",
"(",
"s",
")",
":",
"return",
"len",
"(",
"s",
".",
"split",
"(",
"'::'",
")",
")",
"<=",
"2",
"if",
"_DOTTED_QUAD_RE",
".",
"match",
"(",
"s",
")",
":",
"halves",
"=",
"s... | Validate a hexidecimal IPv6 ip address.
>>> validate_ip('::')
True
>>> validate_ip('::1')
True
>>> validate_ip('2001:db8:85a3::8a2e:370:7334')
True
>>> validate_ip('2001:db8:85a3:0:0:8a2e:370:7334')
True
>>> validate_ip('2001:0db8:85a3:0000:0000:8a2e:0370:7334')
True
>>> va... | [
"Validate",
"a",
"hexidecimal",
"IPv6",
"ip",
"address",
"."
] | train | https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/ipv6.py#L157-L209 |
bd808/python-iptools | iptools/ipv6.py | ip2long | def ip2long(ip):
"""Convert a hexidecimal IPv6 address to a network byte order 128-bit
integer.
>>> ip2long('::') == 0
True
>>> ip2long('::1') == 1
True
>>> expect = 0x20010db885a3000000008a2e03707334
>>> ip2long('2001:db8:85a3::8a2e:370:7334') == expect
True
>>> ip2long('2001:... | python | def ip2long(ip):
"""Convert a hexidecimal IPv6 address to a network byte order 128-bit
integer.
>>> ip2long('::') == 0
True
>>> ip2long('::1') == 1
True
>>> expect = 0x20010db885a3000000008a2e03707334
>>> ip2long('2001:db8:85a3::8a2e:370:7334') == expect
True
>>> ip2long('2001:... | [
"def",
"ip2long",
"(",
"ip",
")",
":",
"if",
"not",
"validate_ip",
"(",
"ip",
")",
":",
"return",
"None",
"if",
"'.'",
"in",
"ip",
":",
"# convert IPv4 suffix to hex",
"chunks",
"=",
"ip",
".",
"split",
"(",
"':'",
")",
"v4_int",
"=",
"ipv4",
".",
"i... | Convert a hexidecimal IPv6 address to a network byte order 128-bit
integer.
>>> ip2long('::') == 0
True
>>> ip2long('::1') == 1
True
>>> expect = 0x20010db885a3000000008a2e03707334
>>> ip2long('2001:db8:85a3::8a2e:370:7334') == expect
True
>>> ip2long('2001:db8:85a3:0:0:8a2e:370:73... | [
"Convert",
"a",
"hexidecimal",
"IPv6",
"address",
"to",
"a",
"network",
"byte",
"order",
"128",
"-",
"bit",
"integer",
"."
] | train | https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/ipv6.py#L213-L277 |
bd808/python-iptools | iptools/ipv6.py | long2ip | def long2ip(l, rfc1924=False):
"""Convert a network byte order 128-bit integer to a canonical IPv6
address.
>>> long2ip(2130706433)
'::7f00:1'
>>> long2ip(42540766411282592856904266426630537217)
'2001:db8::1:0:0:1'
>>> long2ip(MIN_IP)
'::'
>>> long2ip(MAX_IP)
'ffff:ffff:ffff:ff... | python | def long2ip(l, rfc1924=False):
"""Convert a network byte order 128-bit integer to a canonical IPv6
address.
>>> long2ip(2130706433)
'::7f00:1'
>>> long2ip(42540766411282592856904266426630537217)
'2001:db8::1:0:0:1'
>>> long2ip(MIN_IP)
'::'
>>> long2ip(MAX_IP)
'ffff:ffff:ffff:ff... | [
"def",
"long2ip",
"(",
"l",
",",
"rfc1924",
"=",
"False",
")",
":",
"if",
"MAX_IP",
"<",
"l",
"or",
"l",
"<",
"MIN_IP",
":",
"raise",
"TypeError",
"(",
"\"expected int between %d and %d inclusive\"",
"%",
"(",
"MIN_IP",
",",
"MAX_IP",
")",
")",
"if",
"rf... | Convert a network byte order 128-bit integer to a canonical IPv6
address.
>>> long2ip(2130706433)
'::7f00:1'
>>> long2ip(42540766411282592856904266426630537217)
'2001:db8::1:0:0:1'
>>> long2ip(MIN_IP)
'::'
>>> long2ip(MAX_IP)
'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff'
>>> long2i... | [
"Convert",
"a",
"network",
"byte",
"order",
"128",
"-",
"bit",
"integer",
"to",
"a",
"canonical",
"IPv6",
"address",
"."
] | train | https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/ipv6.py#L281-L353 |
bd808/python-iptools | iptools/ipv6.py | long2rfc1924 | def long2rfc1924(l):
"""Convert a network byte order 128-bit integer to an rfc1924 IPv6
address.
>>> long2rfc1924(ip2long('1080::8:800:200C:417A'))
'4)+k&C#VzJ4br>0wv%Yp'
>>> long2rfc1924(ip2long('::'))
'00000000000000000000'
>>> long2rfc1924(MAX_IP)
'=r54lj&NUUO~Hi%c2ym0'
:param... | python | def long2rfc1924(l):
"""Convert a network byte order 128-bit integer to an rfc1924 IPv6
address.
>>> long2rfc1924(ip2long('1080::8:800:200C:417A'))
'4)+k&C#VzJ4br>0wv%Yp'
>>> long2rfc1924(ip2long('::'))
'00000000000000000000'
>>> long2rfc1924(MAX_IP)
'=r54lj&NUUO~Hi%c2ym0'
:param... | [
"def",
"long2rfc1924",
"(",
"l",
")",
":",
"if",
"MAX_IP",
"<",
"l",
"or",
"l",
"<",
"MIN_IP",
":",
"raise",
"TypeError",
"(",
"\"expected int between %d and %d inclusive\"",
"%",
"(",
"MIN_IP",
",",
"MAX_IP",
")",
")",
"o",
"=",
"[",
"]",
"r",
"=",
"l... | Convert a network byte order 128-bit integer to an rfc1924 IPv6
address.
>>> long2rfc1924(ip2long('1080::8:800:200C:417A'))
'4)+k&C#VzJ4br>0wv%Yp'
>>> long2rfc1924(ip2long('::'))
'00000000000000000000'
>>> long2rfc1924(MAX_IP)
'=r54lj&NUUO~Hi%c2ym0'
:param l: Network byte order 128-b... | [
"Convert",
"a",
"network",
"byte",
"order",
"128",
"-",
"bit",
"integer",
"to",
"an",
"rfc1924",
"IPv6",
"address",
"."
] | train | https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/ipv6.py#L357-L384 |
bd808/python-iptools | iptools/ipv6.py | rfc19242long | def rfc19242long(s):
"""Convert an RFC 1924 IPv6 address to a network byte order 128-bit
integer.
>>> expect = 0
>>> rfc19242long('00000000000000000000') == expect
True
>>> expect = 21932261930451111902915077091070067066
>>> rfc19242long('4)+k&C#VzJ4br>0wv%Yp') == expect
True
>>> r... | python | def rfc19242long(s):
"""Convert an RFC 1924 IPv6 address to a network byte order 128-bit
integer.
>>> expect = 0
>>> rfc19242long('00000000000000000000') == expect
True
>>> expect = 21932261930451111902915077091070067066
>>> rfc19242long('4)+k&C#VzJ4br>0wv%Yp') == expect
True
>>> r... | [
"def",
"rfc19242long",
"(",
"s",
")",
":",
"global",
"_RFC1924_REV",
"if",
"not",
"_RFC1924_RE",
".",
"match",
"(",
"s",
")",
":",
"return",
"None",
"if",
"_RFC1924_REV",
"is",
"None",
":",
"_RFC1924_REV",
"=",
"{",
"v",
":",
"k",
"for",
"k",
",",
"v... | Convert an RFC 1924 IPv6 address to a network byte order 128-bit
integer.
>>> expect = 0
>>> rfc19242long('00000000000000000000') == expect
True
>>> expect = 21932261930451111902915077091070067066
>>> rfc19242long('4)+k&C#VzJ4br>0wv%Yp') == expect
True
>>> rfc19242long('pizza') == None... | [
"Convert",
"an",
"RFC",
"1924",
"IPv6",
"address",
"to",
"a",
"network",
"byte",
"order",
"128",
"-",
"bit",
"integer",
"."
] | train | https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/ipv6.py#L387-L420 |
bd808/python-iptools | iptools/ipv6.py | validate_cidr | def validate_cidr(s):
"""Validate a CIDR notation ip address.
The string is considered a valid CIDR address if it consists of a valid
IPv6 address in hextet format followed by a forward slash (/) and a bit
mask length (0-128).
>>> validate_cidr('::/128')
True
>>> validate_cidr('::/0')
... | python | def validate_cidr(s):
"""Validate a CIDR notation ip address.
The string is considered a valid CIDR address if it consists of a valid
IPv6 address in hextet format followed by a forward slash (/) and a bit
mask length (0-128).
>>> validate_cidr('::/128')
True
>>> validate_cidr('::/0')
... | [
"def",
"validate_cidr",
"(",
"s",
")",
":",
"if",
"_CIDR_RE",
".",
"match",
"(",
"s",
")",
":",
"ip",
",",
"mask",
"=",
"s",
".",
"split",
"(",
"'/'",
")",
"if",
"validate_ip",
"(",
"ip",
")",
":",
"if",
"int",
"(",
"mask",
")",
">",
"128",
"... | Validate a CIDR notation ip address.
The string is considered a valid CIDR address if it consists of a valid
IPv6 address in hextet format followed by a forward slash (/) and a bit
mask length (0-128).
>>> validate_cidr('::/128')
True
>>> validate_cidr('::/0')
True
>>> validate_cidr('... | [
"Validate",
"a",
"CIDR",
"notation",
"ip",
"address",
"."
] | train | https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/ipv6.py#L423-L462 |
bd808/python-iptools | iptools/ipv6.py | cidr2block | def cidr2block(cidr):
"""Convert a CIDR notation ip address into a tuple containing the network
block start and end addresses.
>>> cidr2block('2001:db8::/48')
('2001:db8::', '2001:db8:0:ffff:ffff:ffff:ffff:ffff')
>>> cidr2block('::/0')
('::', 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff')
:p... | python | def cidr2block(cidr):
"""Convert a CIDR notation ip address into a tuple containing the network
block start and end addresses.
>>> cidr2block('2001:db8::/48')
('2001:db8::', '2001:db8:0:ffff:ffff:ffff:ffff:ffff')
>>> cidr2block('::/0')
('::', 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff')
:p... | [
"def",
"cidr2block",
"(",
"cidr",
")",
":",
"if",
"not",
"validate_cidr",
"(",
"cidr",
")",
":",
"return",
"None",
"ip",
",",
"prefix",
"=",
"cidr",
".",
"split",
"(",
"'/'",
")",
"prefix",
"=",
"int",
"(",
"prefix",
")",
"ip",
"=",
"ip2long",
"(",... | Convert a CIDR notation ip address into a tuple containing the network
block start and end addresses.
>>> cidr2block('2001:db8::/48')
('2001:db8::', '2001:db8:0:ffff:ffff:ffff:ffff:ffff')
>>> cidr2block('::/0')
('::', 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff')
:param cidr: CIDR notation ip a... | [
"Convert",
"a",
"CIDR",
"notation",
"ip",
"address",
"into",
"a",
"tuple",
"containing",
"the",
"network",
"block",
"start",
"and",
"end",
"addresses",
"."
] | train | https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/ipv6.py#L466-L496 |
BD2KGenomics/toil-scripts | src/toil_scripts/spladder_pipeline/spladder_pipeline.py | parse_input_samples | def parse_input_samples(job, inputs):
"""
Parses config file to pull sample information.
Stores samples as tuples of (uuid, URL)
:param JobFunctionWrappingJob job: passed by Toil automatically
:param Namespace inputs: Stores input arguments (see main)
"""
job.fileStore.logToMaster('Parsing ... | python | def parse_input_samples(job, inputs):
"""
Parses config file to pull sample information.
Stores samples as tuples of (uuid, URL)
:param JobFunctionWrappingJob job: passed by Toil automatically
:param Namespace inputs: Stores input arguments (see main)
"""
job.fileStore.logToMaster('Parsing ... | [
"def",
"parse_input_samples",
"(",
"job",
",",
"inputs",
")",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Parsing input samples and batching jobs'",
")",
"samples",
"=",
"[",
"]",
"if",
"inputs",
".",
"config",
":",
"with",
"open",
"(",
"inputs",
... | Parses config file to pull sample information.
Stores samples as tuples of (uuid, URL)
:param JobFunctionWrappingJob job: passed by Toil automatically
:param Namespace inputs: Stores input arguments (see main) | [
"Parses",
"config",
"file",
"to",
"pull",
"sample",
"information",
".",
"Stores",
"samples",
"as",
"tuples",
"of",
"(",
"uuid",
"URL",
")"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/spladder_pipeline/spladder_pipeline.py#L43-L60 |
BD2KGenomics/toil-scripts | src/toil_scripts/spladder_pipeline/spladder_pipeline.py | download_sample | def download_sample(job, sample, inputs):
"""
Download the input sample
:param JobFunctionWrappingJob job: passed by Toil automatically
:param tuple sample: Tuple containing (UUID,URL) of a sample
:param Namespace inputs: Stores input arguments (see main)
"""
uuid, url = sample
job.file... | python | def download_sample(job, sample, inputs):
"""
Download the input sample
:param JobFunctionWrappingJob job: passed by Toil automatically
:param tuple sample: Tuple containing (UUID,URL) of a sample
:param Namespace inputs: Stores input arguments (see main)
"""
uuid, url = sample
job.file... | [
"def",
"download_sample",
"(",
"job",
",",
"sample",
",",
"inputs",
")",
":",
"uuid",
",",
"url",
"=",
"sample",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Downloading sample: {}'",
".",
"format",
"(",
"uuid",
")",
")",
"# Download sample",
"tar_id"... | Download the input sample
:param JobFunctionWrappingJob job: passed by Toil automatically
:param tuple sample: Tuple containing (UUID,URL) of a sample
:param Namespace inputs: Stores input arguments (see main) | [
"Download",
"the",
"input",
"sample"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/spladder_pipeline/spladder_pipeline.py#L63-L80 |
BD2KGenomics/toil-scripts | src/toil_scripts/spladder_pipeline/spladder_pipeline.py | process_sample | def process_sample(job, inputs, tar_id):
"""
Converts sample.tar(.gz) into two fastq files.
Due to edge conditions... BEWARE: HERE BE DRAGONS
:param JobFunctionWrappingJob job: passed by Toil automatically
:param Namespace inputs: Stores input arguments (see main)
:param str tar_id: FileStore I... | python | def process_sample(job, inputs, tar_id):
"""
Converts sample.tar(.gz) into two fastq files.
Due to edge conditions... BEWARE: HERE BE DRAGONS
:param JobFunctionWrappingJob job: passed by Toil automatically
:param Namespace inputs: Stores input arguments (see main)
:param str tar_id: FileStore I... | [
"def",
"process_sample",
"(",
"job",
",",
"inputs",
",",
"tar_id",
")",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Processing sample into read pairs: {}'",
".",
"format",
"(",
"inputs",
".",
"uuid",
")",
")",
"work_dir",
"=",
"job",
".",
"fileS... | Converts sample.tar(.gz) into two fastq files.
Due to edge conditions... BEWARE: HERE BE DRAGONS
:param JobFunctionWrappingJob job: passed by Toil automatically
:param Namespace inputs: Stores input arguments (see main)
:param str tar_id: FileStore ID of sample tar | [
"Converts",
"sample",
".",
"tar",
"(",
".",
"gz",
")",
"into",
"two",
"fastq",
"files",
".",
"Due",
"to",
"edge",
"conditions",
"...",
"BEWARE",
":",
"HERE",
"BE",
"DRAGONS"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/spladder_pipeline/spladder_pipeline.py#L83-L129 |
BD2KGenomics/toil-scripts | src/toil_scripts/spladder_pipeline/spladder_pipeline.py | cutadapt | def cutadapt(job, inputs, r1_id, r2_id):
"""
Filters out adapters that may be left in the RNA-seq files
:param JobFunctionWrappingJob job: passed by Toil automatically
:param Namespace inputs: Stores input arguments (see main)
:param str r1_id: FileStore ID of read 1 fastq
:param str r2_id: Fil... | python | def cutadapt(job, inputs, r1_id, r2_id):
"""
Filters out adapters that may be left in the RNA-seq files
:param JobFunctionWrappingJob job: passed by Toil automatically
:param Namespace inputs: Stores input arguments (see main)
:param str r1_id: FileStore ID of read 1 fastq
:param str r2_id: Fil... | [
"def",
"cutadapt",
"(",
"job",
",",
"inputs",
",",
"r1_id",
",",
"r2_id",
")",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Running CutAdapt: {}'",
".",
"format",
"(",
"inputs",
".",
"uuid",
")",
")",
"work_dir",
"=",
"job",
".",
"fileStore",... | Filters out adapters that may be left in the RNA-seq files
:param JobFunctionWrappingJob job: passed by Toil automatically
:param Namespace inputs: Stores input arguments (see main)
:param str r1_id: FileStore ID of read 1 fastq
:param str r2_id: FileStore ID of read 2 fastq | [
"Filters",
"out",
"adapters",
"that",
"may",
"be",
"left",
"in",
"the",
"RNA",
"-",
"seq",
"files"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/spladder_pipeline/spladder_pipeline.py#L132-L177 |
BD2KGenomics/toil-scripts | src/toil_scripts/spladder_pipeline/spladder_pipeline.py | star | def star(job, inputs, r1_cutadapt, r2_cutadapt):
"""
Performs alignment of fastqs to BAM via STAR
:param JobFunctionWrappingJob job: passed by Toil automatically
:param Namespace inputs: Stores input arguments (see main)
:param str r1_cutadapt: FileStore ID of read 1 fastq
:param str r2_cutadap... | python | def star(job, inputs, r1_cutadapt, r2_cutadapt):
"""
Performs alignment of fastqs to BAM via STAR
:param JobFunctionWrappingJob job: passed by Toil automatically
:param Namespace inputs: Stores input arguments (see main)
:param str r1_cutadapt: FileStore ID of read 1 fastq
:param str r2_cutadap... | [
"def",
"star",
"(",
"job",
",",
"inputs",
",",
"r1_cutadapt",
",",
"r2_cutadapt",
")",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Aligning with STAR: {}'",
".",
"format",
"(",
"inputs",
".",
"uuid",
")",
")",
"work_dir",
"=",
"job",
".",
"f... | Performs alignment of fastqs to BAM via STAR
:param JobFunctionWrappingJob job: passed by Toil automatically
:param Namespace inputs: Stores input arguments (see main)
:param str r1_cutadapt: FileStore ID of read 1 fastq
:param str r2_cutadapt: FileStore ID of read 2 fastq | [
"Performs",
"alignment",
"of",
"fastqs",
"to",
"BAM",
"via",
"STAR"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/spladder_pipeline/spladder_pipeline.py#L180-L232 |
BD2KGenomics/toil-scripts | src/toil_scripts/spladder_pipeline/spladder_pipeline.py | variant_calling_and_qc | def variant_calling_and_qc(job, inputs, bam_id, bai_id):
"""
Perform variant calling with samtools nad QC with CheckBias
:param JobFunctionWrappingJob job: passed by Toil automatically
:param Namespace inputs: Stores input arguments (see main)
:param str bam_id: FileStore ID of bam
:param str b... | python | def variant_calling_and_qc(job, inputs, bam_id, bai_id):
"""
Perform variant calling with samtools nad QC with CheckBias
:param JobFunctionWrappingJob job: passed by Toil automatically
:param Namespace inputs: Stores input arguments (see main)
:param str bam_id: FileStore ID of bam
:param str b... | [
"def",
"variant_calling_and_qc",
"(",
"job",
",",
"inputs",
",",
"bam_id",
",",
"bai_id",
")",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Variant calling and QC: {}'",
".",
"format",
"(",
"inputs",
".",
"uuid",
")",
")",
"work_dir",
"=",
"job",... | Perform variant calling with samtools nad QC with CheckBias
:param JobFunctionWrappingJob job: passed by Toil automatically
:param Namespace inputs: Stores input arguments (see main)
:param str bam_id: FileStore ID of bam
:param str bai_id: FileStore ID of bam index file
:return: FileStore ID of qc... | [
"Perform",
"variant",
"calling",
"with",
"samtools",
"nad",
"QC",
"with",
"CheckBias"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/spladder_pipeline/spladder_pipeline.py#L235-L279 |
BD2KGenomics/toil-scripts | src/toil_scripts/spladder_pipeline/spladder_pipeline.py | spladder | def spladder(job, inputs, bam_id, bai_id):
"""
Run SplAdder to detect and quantify alternative splicing events
:param JobFunctionWrappingJob job: passed by Toil automatically
:param Namespace inputs: Stores input arguments (see main)
:param str bam_id: FileStore ID of bam
:param str bai_id: Fil... | python | def spladder(job, inputs, bam_id, bai_id):
"""
Run SplAdder to detect and quantify alternative splicing events
:param JobFunctionWrappingJob job: passed by Toil automatically
:param Namespace inputs: Stores input arguments (see main)
:param str bam_id: FileStore ID of bam
:param str bai_id: Fil... | [
"def",
"spladder",
"(",
"job",
",",
"inputs",
",",
"bam_id",
",",
"bai_id",
")",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'SplAdder: {}'",
".",
"format",
"(",
"inputs",
".",
"uuid",
")",
")",
"work_dir",
"=",
"job",
".",
"fileStore",
"."... | Run SplAdder to detect and quantify alternative splicing events
:param JobFunctionWrappingJob job: passed by Toil automatically
:param Namespace inputs: Stores input arguments (see main)
:param str bam_id: FileStore ID of bam
:param str bai_id: FileStore ID of bam index file
:return: FileStore ID o... | [
"Run",
"SplAdder",
"to",
"detect",
"and",
"quantify",
"alternative",
"splicing",
"events"
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/spladder_pipeline/spladder_pipeline.py#L282-L334 |
BD2KGenomics/toil-scripts | src/toil_scripts/spladder_pipeline/spladder_pipeline.py | consolidate_output_tarballs | def consolidate_output_tarballs(job, inputs, vcqc_id, spladder_id):
"""
Combine the contents of separate tarballs into one.
:param JobFunctionWrappingJob job: passed by Toil automatically
:param Namespace inputs: Stores input arguments (see main)
:param str vcqc_id: FileStore ID of variant calling ... | python | def consolidate_output_tarballs(job, inputs, vcqc_id, spladder_id):
"""
Combine the contents of separate tarballs into one.
:param JobFunctionWrappingJob job: passed by Toil automatically
:param Namespace inputs: Stores input arguments (see main)
:param str vcqc_id: FileStore ID of variant calling ... | [
"def",
"consolidate_output_tarballs",
"(",
"job",
",",
"inputs",
",",
"vcqc_id",
",",
"spladder_id",
")",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Consolidating files and uploading: {}'",
".",
"format",
"(",
"inputs",
".",
"uuid",
")",
")",
"work... | Combine the contents of separate tarballs into one.
:param JobFunctionWrappingJob job: passed by Toil automatically
:param Namespace inputs: Stores input arguments (see main)
:param str vcqc_id: FileStore ID of variant calling and QC tarball
:param str spladder_id: FileStore ID of spladder tarball | [
"Combine",
"the",
"contents",
"of",
"separate",
"tarballs",
"into",
"one",
"."
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/spladder_pipeline/spladder_pipeline.py#L337-L376 |
BD2KGenomics/toil-scripts | src/toil_scripts/spladder_pipeline/spladder_pipeline.py | main | def main():
"""
This Toil pipeline aligns reads and performs alternative splicing analysis.
Please read the README.md located in the same directory for run instructions.
"""
# Define Parser object and add to toil
url_prefix = 'https://s3-us-west-2.amazonaws.com/cgl-pipeline-inputs/'
parser ... | python | def main():
"""
This Toil pipeline aligns reads and performs alternative splicing analysis.
Please read the README.md located in the same directory for run instructions.
"""
# Define Parser object and add to toil
url_prefix = 'https://s3-us-west-2.amazonaws.com/cgl-pipeline-inputs/'
parser ... | [
"def",
"main",
"(",
")",
":",
"# Define Parser object and add to toil",
"url_prefix",
"=",
"'https://s3-us-west-2.amazonaws.com/cgl-pipeline-inputs/'",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"main",
".",
"__doc__",
",",
"formatter_class",... | This Toil pipeline aligns reads and performs alternative splicing analysis.
Please read the README.md located in the same directory for run instructions. | [
"This",
"Toil",
"pipeline",
"aligns",
"reads",
"and",
"performs",
"alternative",
"splicing",
"analysis",
"."
] | train | https://github.com/BD2KGenomics/toil-scripts/blob/f878d863defcdccaabb7fe06f991451b7a198fb7/src/toil_scripts/spladder_pipeline/spladder_pipeline.py#L379-L425 |
bd808/python-iptools | iptools/ipv4.py | validate_ip | def validate_ip(s):
"""Validate a dotted-quad ip address.
The string is considered a valid dotted-quad address if it consists of
one to four octets (0-255) seperated by periods (.).
>>> validate_ip('127.0.0.1')
True
>>> validate_ip('127.0')
True
>>> validate_ip('127.0.0.256')
Fals... | python | def validate_ip(s):
"""Validate a dotted-quad ip address.
The string is considered a valid dotted-quad address if it consists of
one to four octets (0-255) seperated by periods (.).
>>> validate_ip('127.0.0.1')
True
>>> validate_ip('127.0')
True
>>> validate_ip('127.0.0.256')
Fals... | [
"def",
"validate_ip",
"(",
"s",
")",
":",
"if",
"_DOTTED_QUAD_RE",
".",
"match",
"(",
"s",
")",
":",
"quads",
"=",
"s",
".",
"split",
"(",
"'.'",
")",
"for",
"q",
"in",
"quads",
":",
"if",
"int",
"(",
"q",
")",
">",
"255",
":",
"return",
"False... | Validate a dotted-quad ip address.
The string is considered a valid dotted-quad address if it consists of
one to four octets (0-255) seperated by periods (.).
>>> validate_ip('127.0.0.1')
True
>>> validate_ip('127.0')
True
>>> validate_ip('127.0.0.256')
False
>>> validate_ip(LOCAL... | [
"Validate",
"a",
"dotted",
"-",
"quad",
"ip",
"address",
"."
] | train | https://github.com/bd808/python-iptools/blob/5d3fae0056297540355bb7c6c112703cfaa4b6ce/iptools/ipv4.py#L190-L222 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.