partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
test | NextflowGenerator._add_dependency | Automatically Adds a dependency of a process.
This method adds a template to the process list attribute as a
dependency. It will adapt the input lane, output lane and process
id of the process that depends on it.
Parameters
----------
p : Process
Process cla... | flowcraft/generator/engine.py | def _add_dependency(self, p, template, inlane, outlane, pid):
"""Automatically Adds a dependency of a process.
This method adds a template to the process list attribute as a
dependency. It will adapt the input lane, output lane and process
id of the process that depends on it.
... | def _add_dependency(self, p, template, inlane, outlane, pid):
"""Automatically Adds a dependency of a process.
This method adds a template to the process list attribute as a
dependency. It will adapt the input lane, output lane and process
id of the process that depends on it.
... | [
"Automatically",
"Adds",
"a",
"dependency",
"of",
"a",
"process",
"."
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/engine.py#L408-L457 | [
"def",
"_add_dependency",
"(",
"self",
",",
"p",
",",
"template",
",",
"inlane",
",",
"outlane",
",",
"pid",
")",
":",
"dependency_proc",
"=",
"self",
".",
"process_map",
"[",
"template",
"]",
"(",
"template",
"=",
"template",
")",
"if",
"dependency_proc",... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | NextflowGenerator._search_tree_backwards | Searches the process tree backwards in search of a provided process
The search takes into consideration the provided parent lanes and
searches only those
Parameters
----------
template : str
Name of the process template attribute being searched
parent_lanes ... | flowcraft/generator/engine.py | def _search_tree_backwards(self, template, parent_lanes):
"""Searches the process tree backwards in search of a provided process
The search takes into consideration the provided parent lanes and
searches only those
Parameters
----------
template : str
Name o... | def _search_tree_backwards(self, template, parent_lanes):
"""Searches the process tree backwards in search of a provided process
The search takes into consideration the provided parent lanes and
searches only those
Parameters
----------
template : str
Name o... | [
"Searches",
"the",
"process",
"tree",
"backwards",
"in",
"search",
"of",
"a",
"provided",
"process"
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/engine.py#L459-L488 | [
"def",
"_search_tree_backwards",
"(",
"self",
",",
"template",
",",
"parent_lanes",
")",
":",
"for",
"p",
"in",
"self",
".",
"processes",
"[",
":",
":",
"-",
"1",
"]",
":",
"# Ignore process in different lanes",
"if",
"p",
".",
"lane",
"not",
"in",
"parent... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | NextflowGenerator._build_header | Adds the header template to the master template string | flowcraft/generator/engine.py | def _build_header(self):
"""Adds the header template to the master template string
"""
logger.debug("===============")
logger.debug("Building header")
logger.debug("===============")
self.template += hs.header | def _build_header(self):
"""Adds the header template to the master template string
"""
logger.debug("===============")
logger.debug("Building header")
logger.debug("===============")
self.template += hs.header | [
"Adds",
"the",
"header",
"template",
"to",
"the",
"master",
"template",
"string"
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/engine.py#L518-L525 | [
"def",
"_build_header",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"===============\"",
")",
"logger",
".",
"debug",
"(",
"\"Building header\"",
")",
"logger",
".",
"debug",
"(",
"\"===============\"",
")",
"self",
".",
"template",
"+=",
"hs",
"."... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | NextflowGenerator._build_footer | Adds the footer template to the master template string | flowcraft/generator/engine.py | def _build_footer(self):
"""Adds the footer template to the master template string"""
logger.debug("===============")
logger.debug("Building header")
logger.debug("===============")
self.template += fs.footer | def _build_footer(self):
"""Adds the footer template to the master template string"""
logger.debug("===============")
logger.debug("Building header")
logger.debug("===============")
self.template += fs.footer | [
"Adds",
"the",
"footer",
"template",
"to",
"the",
"master",
"template",
"string"
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/engine.py#L527-L533 | [
"def",
"_build_footer",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"===============\"",
")",
"logger",
".",
"debug",
"(",
"\"Building header\"",
")",
"logger",
".",
"debug",
"(",
"\"===============\"",
")",
"self",
".",
"template",
"+=",
"fs",
"."... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | NextflowGenerator._update_raw_input | Given a process, this method updates the
:attr:`~Process.main_raw_inputs` attribute with the corresponding
raw input channel of that process. The input channel and input type
can be overridden if the `input_channel` and `input_type` arguments
are provided.
Parameters
---... | flowcraft/generator/engine.py | def _update_raw_input(self, p, sink_channel=None, input_type=None):
"""Given a process, this method updates the
:attr:`~Process.main_raw_inputs` attribute with the corresponding
raw input channel of that process. The input channel and input type
can be overridden if the `input_channel` a... | def _update_raw_input(self, p, sink_channel=None, input_type=None):
"""Given a process, this method updates the
:attr:`~Process.main_raw_inputs` attribute with the corresponding
raw input channel of that process. The input channel and input type
can be overridden if the `input_channel` a... | [
"Given",
"a",
"process",
"this",
"method",
"updates",
"the",
":",
"attr",
":",
"~Process",
".",
"main_raw_inputs",
"attribute",
"with",
"the",
"corresponding",
"raw",
"input",
"channel",
"of",
"that",
"process",
".",
"The",
"input",
"channel",
"and",
"input",
... | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/engine.py#L535-L578 | [
"def",
"_update_raw_input",
"(",
"self",
",",
"p",
",",
"sink_channel",
"=",
"None",
",",
"input_type",
"=",
"None",
")",
":",
"process_input",
"=",
"input_type",
"if",
"input_type",
"else",
"p",
".",
"input_type",
"process_channel",
"=",
"sink_channel",
"if",... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | NextflowGenerator._update_extra_inputs | Given a process, this method updates the
:attr:`~Process.extra_inputs` attribute with the corresponding extra
inputs of that process
Parameters
----------
p : flowcraft.Process.Process | flowcraft/generator/engine.py | def _update_extra_inputs(self, p):
"""Given a process, this method updates the
:attr:`~Process.extra_inputs` attribute with the corresponding extra
inputs of that process
Parameters
----------
p : flowcraft.Process.Process
"""
if p.extra_input:
... | def _update_extra_inputs(self, p):
"""Given a process, this method updates the
:attr:`~Process.extra_inputs` attribute with the corresponding extra
inputs of that process
Parameters
----------
p : flowcraft.Process.Process
"""
if p.extra_input:
... | [
"Given",
"a",
"process",
"this",
"method",
"updates",
"the",
":",
"attr",
":",
"~Process",
".",
"extra_inputs",
"attribute",
"with",
"the",
"corresponding",
"extra",
"inputs",
"of",
"that",
"process"
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/engine.py#L580-L634 | [
"def",
"_update_extra_inputs",
"(",
"self",
",",
"p",
")",
":",
"if",
"p",
".",
"extra_input",
":",
"logger",
".",
"debug",
"(",
"\"[{}] Found extra input: {}\"",
".",
"format",
"(",
"p",
".",
"template",
",",
"p",
".",
"extra_input",
")",
")",
"if",
"p"... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | NextflowGenerator._update_secondary_channels | Given a process, this method updates the
:attr:`~Process.secondary_channels` attribute with the corresponding
secondary inputs of that channel.
The rationale of the secondary channels is the following:
- Start storing any secondary emitting channels, by checking the
`... | flowcraft/generator/engine.py | def _update_secondary_channels(self, p):
"""Given a process, this method updates the
:attr:`~Process.secondary_channels` attribute with the corresponding
secondary inputs of that channel.
The rationale of the secondary channels is the following:
- Start storing any secondar... | def _update_secondary_channels(self, p):
"""Given a process, this method updates the
:attr:`~Process.secondary_channels` attribute with the corresponding
secondary inputs of that channel.
The rationale of the secondary channels is the following:
- Start storing any secondar... | [
"Given",
"a",
"process",
"this",
"method",
"updates",
"the",
":",
"attr",
":",
"~Process",
".",
"secondary_channels",
"attribute",
"with",
"the",
"corresponding",
"secondary",
"inputs",
"of",
"that",
"channel",
"."
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/engine.py#L691-L757 | [
"def",
"_update_secondary_channels",
"(",
"self",
",",
"p",
")",
":",
"# Check if the current process has a start of a secondary",
"# side channel",
"if",
"p",
".",
"link_start",
":",
"logger",
".",
"debug",
"(",
"\"[{}] Found secondary link start: {}\"",
".",
"format",
"... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | NextflowGenerator._set_channels | Sets the main channels for the pipeline
This method will parse de the :attr:`~Process.processes` attribute
and perform the following tasks for each process:
- Sets the input/output channels and main input forks and adds
them to the process's
:attr:`flowcraft.pro... | flowcraft/generator/engine.py | def _set_channels(self):
"""Sets the main channels for the pipeline
This method will parse de the :attr:`~Process.processes` attribute
and perform the following tasks for each process:
- Sets the input/output channels and main input forks and adds
them to the process'... | def _set_channels(self):
"""Sets the main channels for the pipeline
This method will parse de the :attr:`~Process.processes` attribute
and perform the following tasks for each process:
- Sets the input/output channels and main input forks and adds
them to the process'... | [
"Sets",
"the",
"main",
"channels",
"for",
"the",
"pipeline"
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/engine.py#L759-L809 | [
"def",
"_set_channels",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"=====================\"",
")",
"logger",
".",
"debug",
"(",
"\"Setting main channels\"",
")",
"logger",
".",
"debug",
"(",
"\"=====================\"",
")",
"for",
"i",
",",
"p",
"i... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | NextflowGenerator._set_init_process | Sets the main raw inputs and secondary inputs on the init process
This method will fetch the :class:`flowcraft.process.Init` process
instance and sets the raw input (
:func:`flowcraft.process.Init.set_raw_inputs`) for
that process. This will handle the connection of the user parameters
... | flowcraft/generator/engine.py | def _set_init_process(self):
"""Sets the main raw inputs and secondary inputs on the init process
This method will fetch the :class:`flowcraft.process.Init` process
instance and sets the raw input (
:func:`flowcraft.process.Init.set_raw_inputs`) for
that process. This will handl... | def _set_init_process(self):
"""Sets the main raw inputs and secondary inputs on the init process
This method will fetch the :class:`flowcraft.process.Init` process
instance and sets the raw input (
:func:`flowcraft.process.Init.set_raw_inputs`) for
that process. This will handl... | [
"Sets",
"the",
"main",
"raw",
"inputs",
"and",
"secondary",
"inputs",
"on",
"the",
"init",
"process"
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/engine.py#L811-L831 | [
"def",
"_set_init_process",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"========================\"",
")",
"logger",
".",
"debug",
"(",
"\"Setting secondary inputs\"",
")",
"logger",
".",
"debug",
"(",
"\"========================\"",
")",
"# Get init process... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | NextflowGenerator._set_secondary_channels | Sets the secondary channels for the pipeline
This will iterate over the
:py:attr:`NextflowGenerator.secondary_channels` dictionary that is
populated when executing
:func:`~NextflowGenerator._update_secondary_channels` method. | flowcraft/generator/engine.py | def _set_secondary_channels(self):
"""Sets the secondary channels for the pipeline
This will iterate over the
:py:attr:`NextflowGenerator.secondary_channels` dictionary that is
populated when executing
:func:`~NextflowGenerator._update_secondary_channels` method.
"""
... | def _set_secondary_channels(self):
"""Sets the secondary channels for the pipeline
This will iterate over the
:py:attr:`NextflowGenerator.secondary_channels` dictionary that is
populated when executing
:func:`~NextflowGenerator._update_secondary_channels` method.
"""
... | [
"Sets",
"the",
"secondary",
"channels",
"for",
"the",
"pipeline"
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/engine.py#L833-L863 | [
"def",
"_set_secondary_channels",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"==========================\"",
")",
"logger",
".",
"debug",
"(",
"\"Setting secondary channels\"",
")",
"logger",
".",
"debug",
"(",
"\"==========================\"",
")",
"logger... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | NextflowGenerator._set_general_compilers | Adds compiler channels to the :attr:`processes` attribute.
This method will iterate over the pipeline's processes and check
if any process is feeding channels to a compiler process. If so, that
compiler process is added to the pipeline and those channels are
linked to the compiler via s... | flowcraft/generator/engine.py | def _set_general_compilers(self):
"""Adds compiler channels to the :attr:`processes` attribute.
This method will iterate over the pipeline's processes and check
if any process is feeding channels to a compiler process. If so, that
compiler process is added to the pipeline and those chan... | def _set_general_compilers(self):
"""Adds compiler channels to the :attr:`processes` attribute.
This method will iterate over the pipeline's processes and check
if any process is feeding channels to a compiler process. If so, that
compiler process is added to the pipeline and those chan... | [
"Adds",
"compiler",
"channels",
"to",
"the",
":",
"attr",
":",
"processes",
"attribute",
"."
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/engine.py#L872-L902 | [
"def",
"_set_general_compilers",
"(",
"self",
")",
":",
"for",
"c",
",",
"c_info",
"in",
"self",
".",
"compilers",
".",
"items",
"(",
")",
":",
"# Instantiate compiler class object and set empty channel list",
"compiler_cls",
"=",
"c_info",
"[",
"\"cls\"",
"]",
"(... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | NextflowGenerator._set_status_channels | Compiles all status channels for the status compiler process | flowcraft/generator/engine.py | def _set_status_channels(self):
"""Compiles all status channels for the status compiler process
"""
status_inst = pc.StatusCompiler(template="status_compiler")
report_inst = pc.ReportCompiler(template="report_compiler")
# Compile status channels from pipeline process
st... | def _set_status_channels(self):
"""Compiles all status channels for the status compiler process
"""
status_inst = pc.StatusCompiler(template="status_compiler")
report_inst = pc.ReportCompiler(template="report_compiler")
# Compile status channels from pipeline process
st... | [
"Compiles",
"all",
"status",
"channels",
"for",
"the",
"status",
"compiler",
"process"
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/engine.py#L904-L941 | [
"def",
"_set_status_channels",
"(",
"self",
")",
":",
"status_inst",
"=",
"pc",
".",
"StatusCompiler",
"(",
"template",
"=",
"\"status_compiler\"",
")",
"report_inst",
"=",
"pc",
".",
"ReportCompiler",
"(",
"template",
"=",
"\"report_compiler\"",
")",
"# Compile s... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | NextflowGenerator._get_resources_string | Returns the nextflow resources string from a dictionary object
If the dictionary has at least on of the resource directives, these
will be compiled for each process in the dictionary and returned
as a string read for injection in the nextflow config file template.
This dictionary shoul... | flowcraft/generator/engine.py | def _get_resources_string(res_dict, pid):
""" Returns the nextflow resources string from a dictionary object
If the dictionary has at least on of the resource directives, these
will be compiled for each process in the dictionary and returned
as a string read for injection in the nextflo... | def _get_resources_string(res_dict, pid):
""" Returns the nextflow resources string from a dictionary object
If the dictionary has at least on of the resource directives, these
will be compiled for each process in the dictionary and returned
as a string read for injection in the nextflo... | [
"Returns",
"the",
"nextflow",
"resources",
"string",
"from",
"a",
"dictionary",
"object"
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/engine.py#L944-L981 | [
"def",
"_get_resources_string",
"(",
"res_dict",
",",
"pid",
")",
":",
"config_str",
"=",
"\"\"",
"ignore_directives",
"=",
"[",
"\"container\"",
",",
"\"version\"",
"]",
"for",
"p",
",",
"directives",
"in",
"res_dict",
".",
"items",
"(",
")",
":",
"for",
... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | NextflowGenerator._get_container_string | Returns the nextflow containers string from a dictionary object
If the dictionary has at least on of the container directives, these
will be compiled for each process in the dictionary and returned
as a string read for injection in the nextflow config file template.
This dictionary sho... | flowcraft/generator/engine.py | def _get_container_string(cont_dict, pid):
""" Returns the nextflow containers string from a dictionary object
If the dictionary has at least on of the container directives, these
will be compiled for each process in the dictionary and returned
as a string read for injection in the next... | def _get_container_string(cont_dict, pid):
""" Returns the nextflow containers string from a dictionary object
If the dictionary has at least on of the container directives, these
will be compiled for each process in the dictionary and returned
as a string read for injection in the next... | [
"Returns",
"the",
"nextflow",
"containers",
"string",
"from",
"a",
"dictionary",
"object"
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/engine.py#L984-L1026 | [
"def",
"_get_container_string",
"(",
"cont_dict",
",",
"pid",
")",
":",
"config_str",
"=",
"\"\"",
"for",
"p",
",",
"directives",
"in",
"cont_dict",
".",
"items",
"(",
")",
":",
"container",
"=",
"\"\"",
"if",
"\"container\"",
"in",
"directives",
":",
"con... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | NextflowGenerator._get_params_string | Returns the nextflow params string from a dictionary object.
The params dict should be a set of key:value pairs with the
parameter name, and the default parameter value::
self.params = {
"genomeSize": 2.1,
"minCoverage": 15
}
The values ... | flowcraft/generator/engine.py | def _get_params_string(self):
"""Returns the nextflow params string from a dictionary object.
The params dict should be a set of key:value pairs with the
parameter name, and the default parameter value::
self.params = {
"genomeSize": 2.1,
"minCoverag... | def _get_params_string(self):
"""Returns the nextflow params string from a dictionary object.
The params dict should be a set of key:value pairs with the
parameter name, and the default parameter value::
self.params = {
"genomeSize": 2.1,
"minCoverag... | [
"Returns",
"the",
"nextflow",
"params",
"string",
"from",
"a",
"dictionary",
"object",
"."
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/engine.py#L1028-L1078 | [
"def",
"_get_params_string",
"(",
"self",
")",
":",
"params_str",
"=",
"\"\"",
"for",
"p",
"in",
"self",
".",
"processes",
":",
"logger",
".",
"debug",
"(",
"\"[{}] Adding parameters: {}\\n\"",
".",
"format",
"(",
"p",
".",
"template",
",",
"p",
".",
"para... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | NextflowGenerator._get_merged_params_string | Returns the merged nextflow params string from a dictionary object.
The params dict should be a set of key:value pairs with the
parameter name, and the default parameter value::
self.params = {
"genomeSize": 2.1,
"minCoverage": 15
}
The ... | flowcraft/generator/engine.py | def _get_merged_params_string(self):
"""Returns the merged nextflow params string from a dictionary object.
The params dict should be a set of key:value pairs with the
parameter name, and the default parameter value::
self.params = {
"genomeSize": 2.1,
... | def _get_merged_params_string(self):
"""Returns the merged nextflow params string from a dictionary object.
The params dict should be a set of key:value pairs with the
parameter name, and the default parameter value::
self.params = {
"genomeSize": 2.1,
... | [
"Returns",
"the",
"merged",
"nextflow",
"params",
"string",
"from",
"a",
"dictionary",
"object",
"."
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/engine.py#L1135-L1174 | [
"def",
"_get_merged_params_string",
"(",
"self",
")",
":",
"params_temp",
"=",
"{",
"}",
"for",
"p",
"in",
"self",
".",
"processes",
":",
"logger",
".",
"debug",
"(",
"\"[{}] Adding parameters: {}\"",
".",
"format",
"(",
"p",
".",
"template",
",",
"p",
"."... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | NextflowGenerator._get_manifest_string | Returns the nextflow manifest config string to include in the
config file from the information on the pipeline.
Returns
-------
str
Nextflow manifest configuration string | flowcraft/generator/engine.py | def _get_manifest_string(self):
"""Returns the nextflow manifest config string to include in the
config file from the information on the pipeline.
Returns
-------
str
Nextflow manifest configuration string
"""
config_str = ""
config_str += '... | def _get_manifest_string(self):
"""Returns the nextflow manifest config string to include in the
config file from the information on the pipeline.
Returns
-------
str
Nextflow manifest configuration string
"""
config_str = ""
config_str += '... | [
"Returns",
"the",
"nextflow",
"manifest",
"config",
"string",
"to",
"include",
"in",
"the",
"config",
"file",
"from",
"the",
"information",
"on",
"the",
"pipeline",
"."
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/engine.py#L1237-L1252 | [
"def",
"_get_manifest_string",
"(",
"self",
")",
":",
"config_str",
"=",
"\"\"",
"config_str",
"+=",
"'\\n\\tname = \"{}\"'",
".",
"format",
"(",
"self",
".",
"pipeline_name",
")",
"config_str",
"+=",
"'\\n\\tmainScript = \"{}\"'",
".",
"format",
"(",
"self",
".",... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | NextflowGenerator._set_configurations | This method will iterate over all process in the pipeline and
populate the nextflow configuration files with the directives
of each process in the pipeline. | flowcraft/generator/engine.py | def _set_configurations(self):
"""This method will iterate over all process in the pipeline and
populate the nextflow configuration files with the directives
of each process in the pipeline.
"""
logger.debug("======================")
logger.debug("Setting configurations"... | def _set_configurations(self):
"""This method will iterate over all process in the pipeline and
populate the nextflow configuration files with the directives
of each process in the pipeline.
"""
logger.debug("======================")
logger.debug("Setting configurations"... | [
"This",
"method",
"will",
"iterate",
"over",
"all",
"process",
"in",
"the",
"pipeline",
"and",
"populate",
"the",
"nextflow",
"configuration",
"files",
"with",
"the",
"directives",
"of",
"each",
"process",
"in",
"the",
"pipeline",
"."
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/engine.py#L1267-L1320 | [
"def",
"_set_configurations",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"======================\"",
")",
"logger",
".",
"debug",
"(",
"\"Setting configurations\"",
")",
"logger",
".",
"debug",
"(",
"\"======================\"",
")",
"resources",
"=",
"... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | NextflowGenerator.dag_to_file | Writes dag to output file
Parameters
----------
dict_viz: dict
Tree like dictionary that is used to export tree data of processes
to html file and here for the dotfile .treeDag.json | flowcraft/generator/engine.py | def dag_to_file(self, dict_viz, output_file=".treeDag.json"):
"""Writes dag to output file
Parameters
----------
dict_viz: dict
Tree like dictionary that is used to export tree data of processes
to html file and here for the dotfile .treeDag.json
"""
... | def dag_to_file(self, dict_viz, output_file=".treeDag.json"):
"""Writes dag to output file
Parameters
----------
dict_viz: dict
Tree like dictionary that is used to export tree data of processes
to html file and here for the dotfile .treeDag.json
"""
... | [
"Writes",
"dag",
"to",
"output",
"file"
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/engine.py#L1322-L1336 | [
"def",
"dag_to_file",
"(",
"self",
",",
"dict_viz",
",",
"output_file",
"=",
"\".treeDag.json\"",
")",
":",
"outfile_dag",
"=",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"dirname",
"(",
"self",
".",
"nf_file",
")",
",",
"output_file",
")",
",",
... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | NextflowGenerator.render_pipeline | Write pipeline attributes to json
This function writes the pipeline and their attributes to a json file,
that is intended to be read by resources/pipeline_graph.html to render
a graphical output showing the DAG. | flowcraft/generator/engine.py | def render_pipeline(self):
"""Write pipeline attributes to json
This function writes the pipeline and their attributes to a json file,
that is intended to be read by resources/pipeline_graph.html to render
a graphical output showing the DAG.
"""
dict_viz = {
... | def render_pipeline(self):
"""Write pipeline attributes to json
This function writes the pipeline and their attributes to a json file,
that is intended to be read by resources/pipeline_graph.html to render
a graphical output showing the DAG.
"""
dict_viz = {
... | [
"Write",
"pipeline",
"attributes",
"to",
"json"
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/engine.py#L1338-L1410 | [
"def",
"render_pipeline",
"(",
"self",
")",
":",
"dict_viz",
"=",
"{",
"\"name\"",
":",
"\"root\"",
",",
"\"children\"",
":",
"[",
"]",
"}",
"last_of_us",
"=",
"{",
"}",
"f_tree",
"=",
"self",
".",
"_fork_tree",
"if",
"self",
".",
"_fork_tree",
"else",
... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | NextflowGenerator.write_configs | Wrapper method that writes all configuration files to the pipeline
directory | flowcraft/generator/engine.py | def write_configs(self, project_root):
"""Wrapper method that writes all configuration files to the pipeline
directory
"""
# Write resources config
with open(join(project_root, "resources.config"), "w") as fh:
fh.write(self.resources)
# Write containers conf... | def write_configs(self, project_root):
"""Wrapper method that writes all configuration files to the pipeline
directory
"""
# Write resources config
with open(join(project_root, "resources.config"), "w") as fh:
fh.write(self.resources)
# Write containers conf... | [
"Wrapper",
"method",
"that",
"writes",
"all",
"configuration",
"files",
"to",
"the",
"pipeline",
"directory"
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/engine.py#L1412-L1447 | [
"def",
"write_configs",
"(",
"self",
",",
"project_root",
")",
":",
"# Write resources config",
"with",
"open",
"(",
"join",
"(",
"project_root",
",",
"\"resources.config\"",
")",
",",
"\"w\"",
")",
"as",
"fh",
":",
"fh",
".",
"write",
"(",
"self",
".",
"r... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | NextflowGenerator.export_params | Export pipeline params as a JSON to stdout
This run mode iterates over the pipeline processes and exports the
params dictionary of each component as a JSON to stdout. | flowcraft/generator/engine.py | def export_params(self):
"""Export pipeline params as a JSON to stdout
This run mode iterates over the pipeline processes and exports the
params dictionary of each component as a JSON to stdout.
"""
params_json = {}
# Skip first init process
for p in self.proce... | def export_params(self):
"""Export pipeline params as a JSON to stdout
This run mode iterates over the pipeline processes and exports the
params dictionary of each component as a JSON to stdout.
"""
params_json = {}
# Skip first init process
for p in self.proce... | [
"Export",
"pipeline",
"params",
"as",
"a",
"JSON",
"to",
"stdout"
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/engine.py#L1449-L1463 | [
"def",
"export_params",
"(",
"self",
")",
":",
"params_json",
"=",
"{",
"}",
"# Skip first init process",
"for",
"p",
"in",
"self",
".",
"processes",
"[",
"1",
":",
"]",
":",
"params_json",
"[",
"p",
".",
"template",
"]",
"=",
"p",
".",
"params",
"# Fl... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | NextflowGenerator.export_directives | Export pipeline directives as a JSON to stdout | flowcraft/generator/engine.py | def export_directives(self):
"""Export pipeline directives as a JSON to stdout
"""
directives_json = {}
# Skip first init process
for p in self.processes[1:]:
directives_json[p.template] = p.directives
# Flush params json to stdout
sys.stdout.write(... | def export_directives(self):
"""Export pipeline directives as a JSON to stdout
"""
directives_json = {}
# Skip first init process
for p in self.processes[1:]:
directives_json[p.template] = p.directives
# Flush params json to stdout
sys.stdout.write(... | [
"Export",
"pipeline",
"directives",
"as",
"a",
"JSON",
"to",
"stdout"
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/engine.py#L1465-L1476 | [
"def",
"export_directives",
"(",
"self",
")",
":",
"directives_json",
"=",
"{",
"}",
"# Skip first init process",
"for",
"p",
"in",
"self",
".",
"processes",
"[",
"1",
":",
"]",
":",
"directives_json",
"[",
"p",
".",
"template",
"]",
"=",
"p",
".",
"dire... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | NextflowGenerator.fetch_docker_tags | Export all dockerhub tags associated with each component given by
the -t flag. | flowcraft/generator/engine.py | def fetch_docker_tags(self):
"""
Export all dockerhub tags associated with each component given by
the -t flag.
"""
# dict to store the already parsed components (useful when forks are
# given to the pipeline string via -t flag
dict_of_parsed = {}
# fetc... | def fetch_docker_tags(self):
"""
Export all dockerhub tags associated with each component given by
the -t flag.
"""
# dict to store the already parsed components (useful when forks are
# given to the pipeline string via -t flag
dict_of_parsed = {}
# fetc... | [
"Export",
"all",
"dockerhub",
"tags",
"associated",
"with",
"each",
"component",
"given",
"by",
"the",
"-",
"t",
"flag",
"."
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/engine.py#L1478-L1587 | [
"def",
"fetch_docker_tags",
"(",
"self",
")",
":",
"# dict to store the already parsed components (useful when forks are",
"# given to the pipeline string via -t flag",
"dict_of_parsed",
"=",
"{",
"}",
"# fetches terminal width and subtracts 3 because we always add a",
"# new line characte... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | NextflowGenerator.build | Main pipeline builder
This method is responsible for building the
:py:attr:`NextflowGenerator.template` attribute that will contain
the nextflow code of the pipeline.
First it builds the header, then sets the main channels, the
secondary inputs, secondary channels and finally t... | flowcraft/generator/engine.py | def build(self):
"""Main pipeline builder
This method is responsible for building the
:py:attr:`NextflowGenerator.template` attribute that will contain
the nextflow code of the pipeline.
First it builds the header, then sets the main channels, the
secondary inputs, seco... | def build(self):
"""Main pipeline builder
This method is responsible for building the
:py:attr:`NextflowGenerator.template` attribute that will contain
the nextflow code of the pipeline.
First it builds the header, then sets the main channels, the
secondary inputs, seco... | [
"Main",
"pipeline",
"builder"
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/engine.py#L1589-L1643 | [
"def",
"build",
"(",
"self",
")",
":",
"logger",
".",
"info",
"(",
"colored_print",
"(",
"\"\\tSuccessfully connected {} process(es) with {} \"",
"\"fork(s) across {} lane(s) \\u2713\"",
".",
"format",
"(",
"len",
"(",
"self",
".",
"processes",
"[",
"1",
":",
"]",
... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | set_kmers | Returns a kmer list based on the provided kmer option and max read len.
Parameters
----------
kmer_opt : str
The k-mer option. Can be either ``'auto'``, ``'default'`` or a
sequence of space separated integers, ``'23, 45, 67'``.
max_read_len : int
The maximum read length of the c... | flowcraft/templates/metaspades.py | def set_kmers(kmer_opt, max_read_len):
"""Returns a kmer list based on the provided kmer option and max read len.
Parameters
----------
kmer_opt : str
The k-mer option. Can be either ``'auto'``, ``'default'`` or a
sequence of space separated integers, ``'23, 45, 67'``.
max_read_len ... | def set_kmers(kmer_opt, max_read_len):
"""Returns a kmer list based on the provided kmer option and max read len.
Parameters
----------
kmer_opt : str
The k-mer option. Can be either ``'auto'``, ``'default'`` or a
sequence of space separated integers, ``'23, 45, 67'``.
max_read_len ... | [
"Returns",
"a",
"kmer",
"list",
"based",
"on",
"the",
"provided",
"kmer",
"option",
"and",
"max",
"read",
"len",
"."
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/metaspades.py#L107-L150 | [
"def",
"set_kmers",
"(",
"kmer_opt",
",",
"max_read_len",
")",
":",
"logger",
".",
"debug",
"(",
"\"Kmer option set to: {}\"",
".",
"format",
"(",
"kmer_opt",
")",
")",
"# Check if kmer option is set to auto",
"if",
"kmer_opt",
"==",
"\"auto\"",
":",
"if",
"max_re... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | main | Main executor of the spades template.
Parameters
----------
sample_id : str
Sample Identification string.
fastq_pair : list
Two element list containing the paired FastQ files.
max_len : int
Maximum read length. This value is determined in
:py:class:`templates.integri... | flowcraft/templates/metaspades.py | def main(sample_id, fastq_pair, max_len, kmer, clear):
"""Main executor of the spades template.
Parameters
----------
sample_id : str
Sample Identification string.
fastq_pair : list
Two element list containing the paired FastQ files.
max_len : int
Maximum read length. Th... | def main(sample_id, fastq_pair, max_len, kmer, clear):
"""Main executor of the spades template.
Parameters
----------
sample_id : str
Sample Identification string.
fastq_pair : list
Two element list containing the paired FastQ files.
max_len : int
Maximum read length. Th... | [
"Main",
"executor",
"of",
"the",
"spades",
"template",
"."
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/metaspades.py#L154-L239 | [
"def",
"main",
"(",
"sample_id",
",",
"fastq_pair",
",",
"max_len",
",",
"kmer",
",",
"clear",
")",
":",
"logger",
".",
"info",
"(",
"\"Starting spades\"",
")",
"logger",
".",
"info",
"(",
"\"Setting SPAdes kmers\"",
")",
"kmers",
"=",
"set_kmers",
"(",
"k... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | FlowcraftReport._get_report_id | Returns a hash of the reports JSON file | flowcraft/generator/report.py | def _get_report_id(self):
"""Returns a hash of the reports JSON file
"""
if self.watch:
# Searches for the first occurence of the nextflow pipeline
# file name in the .nextflow.log file
pipeline_path = get_nextflow_filepath(self.log_file)
# Get ... | def _get_report_id(self):
"""Returns a hash of the reports JSON file
"""
if self.watch:
# Searches for the first occurence of the nextflow pipeline
# file name in the .nextflow.log file
pipeline_path = get_nextflow_filepath(self.log_file)
# Get ... | [
"Returns",
"a",
"hash",
"of",
"the",
"reports",
"JSON",
"file"
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/report.py#L181-L217 | [
"def",
"_get_report_id",
"(",
"self",
")",
":",
"if",
"self",
".",
"watch",
":",
"# Searches for the first occurence of the nextflow pipeline",
"# file name in the .nextflow.log file",
"pipeline_path",
"=",
"get_nextflow_filepath",
"(",
"self",
".",
"log_file",
")",
"# Get ... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | FlowcraftReport._update_pipeline_status | Parses the .nextflow.log file for signatures of pipeline status and sets
the :attr:`status_info` attribute. | flowcraft/generator/report.py | def _update_pipeline_status(self):
"""
Parses the .nextflow.log file for signatures of pipeline status and sets
the :attr:`status_info` attribute.
"""
prev_status = self.status_info
with open(self.log_file) as fh:
for line in fh:
if "Sessio... | def _update_pipeline_status(self):
"""
Parses the .nextflow.log file for signatures of pipeline status and sets
the :attr:`status_info` attribute.
"""
prev_status = self.status_info
with open(self.log_file) as fh:
for line in fh:
if "Sessio... | [
"Parses",
"the",
".",
"nextflow",
".",
"log",
"file",
"for",
"signatures",
"of",
"pipeline",
"status",
"and",
"sets",
"the",
":",
"attr",
":",
"status_info",
"attribute",
"."
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/report.py#L219-L245 | [
"def",
"_update_pipeline_status",
"(",
"self",
")",
":",
"prev_status",
"=",
"self",
".",
"status_info",
"with",
"open",
"(",
"self",
".",
"log_file",
")",
"as",
"fh",
":",
"for",
"line",
"in",
"fh",
":",
"if",
"\"Session aborted\"",
"in",
"line",
":",
"... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | FlowcraftReport.update_trace_watch | Parses the nextflow trace file and retrieves the path of report JSON
files that have not been sent to the service yet. | flowcraft/generator/report.py | def update_trace_watch(self):
"""Parses the nextflow trace file and retrieves the path of report JSON
files that have not been sent to the service yet.
"""
# Check the size stamp of the tracefile. Only proceed with the parsing
# if it changed from the previous size.
size... | def update_trace_watch(self):
"""Parses the nextflow trace file and retrieves the path of report JSON
files that have not been sent to the service yet.
"""
# Check the size stamp of the tracefile. Only proceed with the parsing
# if it changed from the previous size.
size... | [
"Parses",
"the",
"nextflow",
"trace",
"file",
"and",
"retrieves",
"the",
"path",
"of",
"report",
"JSON",
"files",
"that",
"have",
"not",
"been",
"sent",
"to",
"the",
"service",
"yet",
"."
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/report.py#L247-L291 | [
"def",
"update_trace_watch",
"(",
"self",
")",
":",
"# Check the size stamp of the tracefile. Only proceed with the parsing",
"# if it changed from the previous size.",
"size_stamp",
"=",
"os",
".",
"path",
".",
"getsize",
"(",
"self",
".",
"trace_file",
")",
"self",
".",
... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | FlowcraftReport.update_log_watch | Parses nextflow log file and updates the run status | flowcraft/generator/report.py | def update_log_watch(self):
"""Parses nextflow log file and updates the run status
"""
# Check the size stamp of the tracefile. Only proceed with the parsing
# if it changed from the previous size.
size_stamp = os.path.getsize(self.log_file)
self.trace_retry = 0
... | def update_log_watch(self):
"""Parses nextflow log file and updates the run status
"""
# Check the size stamp of the tracefile. Only proceed with the parsing
# if it changed from the previous size.
size_stamp = os.path.getsize(self.log_file)
self.trace_retry = 0
... | [
"Parses",
"nextflow",
"log",
"file",
"and",
"updates",
"the",
"run",
"status"
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/report.py#L293-L307 | [
"def",
"update_log_watch",
"(",
"self",
")",
":",
"# Check the size stamp of the tracefile. Only proceed with the parsing",
"# if it changed from the previous size.",
"size_stamp",
"=",
"os",
".",
"path",
".",
"getsize",
"(",
"self",
".",
"log_file",
")",
"self",
".",
"tr... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | FlowcraftReport._send_live_report | Sends a PUT request with the report JSON files currently in the
report_queue attribute.
Parameters
----------
report_id : str
Hash of the report JSON as retrieved from :func:`~_get_report_hash` | flowcraft/generator/report.py | def _send_live_report(self, report_id):
"""Sends a PUT request with the report JSON files currently in the
report_queue attribute.
Parameters
----------
report_id : str
Hash of the report JSON as retrieved from :func:`~_get_report_hash`
"""
# Determi... | def _send_live_report(self, report_id):
"""Sends a PUT request with the report JSON files currently in the
report_queue attribute.
Parameters
----------
report_id : str
Hash of the report JSON as retrieved from :func:`~_get_report_hash`
"""
# Determi... | [
"Sends",
"a",
"PUT",
"request",
"with",
"the",
"report",
"JSON",
"files",
"currently",
"in",
"the",
"report_queue",
"attribute",
"."
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/report.py#L309-L379 | [
"def",
"_send_live_report",
"(",
"self",
",",
"report_id",
")",
":",
"# Determines the maximum number of reports sent at the same time in",
"# the same payload",
"buffer_size",
"=",
"100",
"logger",
".",
"debug",
"(",
"\"Report buffer size set to: {}\"",
".",
"format",
"(",
... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | FlowcraftReport._init_live_reports | Sends a POST request to initialize the live reports
Parameters
----------
report_id : str
Hash of the report JSON as retrieved from :func:`~_get_report_hash` | flowcraft/generator/report.py | def _init_live_reports(self, report_id):
"""Sends a POST request to initialize the live reports
Parameters
----------
report_id : str
Hash of the report JSON as retrieved from :func:`~_get_report_hash`
"""
logger.debug("Sending initial POST request to {} to ... | def _init_live_reports(self, report_id):
"""Sends a POST request to initialize the live reports
Parameters
----------
report_id : str
Hash of the report JSON as retrieved from :func:`~_get_report_hash`
"""
logger.debug("Sending initial POST request to {} to ... | [
"Sends",
"a",
"POST",
"request",
"to",
"initialize",
"the",
"live",
"reports"
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/report.py#L381-L414 | [
"def",
"_init_live_reports",
"(",
"self",
",",
"report_id",
")",
":",
"logger",
".",
"debug",
"(",
"\"Sending initial POST request to {} to start report live\"",
"\" update\"",
".",
"format",
"(",
"self",
".",
"broadcast_address",
")",
")",
"try",
":",
"with",
"open... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | FlowcraftReport._close_connection | Sends a delete request for the report JSON hash
Parameters
----------
report_id : str
Hash of the report JSON as retrieved from :func:`~_get_report_hash` | flowcraft/generator/report.py | def _close_connection(self, report_id):
"""Sends a delete request for the report JSON hash
Parameters
----------
report_id : str
Hash of the report JSON as retrieved from :func:`~_get_report_hash`
"""
logger.debug(
"Closing connection and sending... | def _close_connection(self, report_id):
"""Sends a delete request for the report JSON hash
Parameters
----------
report_id : str
Hash of the report JSON as retrieved from :func:`~_get_report_hash`
"""
logger.debug(
"Closing connection and sending... | [
"Sends",
"a",
"delete",
"request",
"for",
"the",
"report",
"JSON",
"hash"
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/report.py#L416-L441 | [
"def",
"_close_connection",
"(",
"self",
",",
"report_id",
")",
":",
"logger",
".",
"debug",
"(",
"\"Closing connection and sending DELETE request to {}\"",
".",
"format",
"(",
"self",
".",
"broadcast_address",
")",
")",
"try",
":",
"r",
"=",
"requests",
".",
"d... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | convert_adatpers | Generates an adapter file for FastQC from a fasta file.
The provided adapters file is assumed to be a simple fasta file with the
adapter's name as header and the corresponding sequence::
>TruSeq_Universal_Adapter
AATGATACGGCGACCACCGAGATCTACACTCTTTCCCTACACGACGCTCTTCCGATCT
>TruSeq_Adapte... | flowcraft/templates/fastqc.py | def convert_adatpers(adapter_fasta):
"""Generates an adapter file for FastQC from a fasta file.
The provided adapters file is assumed to be a simple fasta file with the
adapter's name as header and the corresponding sequence::
>TruSeq_Universal_Adapter
AATGATACGGCGACCACCGAGATCTACACTCTTTCCC... | def convert_adatpers(adapter_fasta):
"""Generates an adapter file for FastQC from a fasta file.
The provided adapters file is assumed to be a simple fasta file with the
adapter's name as header and the corresponding sequence::
>TruSeq_Universal_Adapter
AATGATACGGCGACCACCGAGATCTACACTCTTTCCC... | [
"Generates",
"an",
"adapter",
"file",
"for",
"FastQC",
"from",
"a",
"fasta",
"file",
"."
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/fastqc.py#L81-L129 | [
"def",
"convert_adatpers",
"(",
"adapter_fasta",
")",
":",
"adapter_out",
"=",
"\"fastqc_adapters.tab\"",
"logger",
".",
"debug",
"(",
"\"Setting output adapters file to: {}\"",
".",
"format",
"(",
"adapter_out",
")",
")",
"try",
":",
"with",
"open",
"(",
"adapter_f... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | main | Main executor of the fastq template.
Parameters
----------
fastq_pair : list
Two element list containing the paired FastQ files.
adapter_file : str
Path to adapters file.
cpus : int or str
Number of cpu's that will be by FastQC. | flowcraft/templates/fastqc.py | def main(fastq_pair, adapter_file, cpus):
""" Main executor of the fastq template.
Parameters
----------
fastq_pair : list
Two element list containing the paired FastQ files.
adapter_file : str
Path to adapters file.
cpus : int or str
Number of cpu's that will be by Fast... | def main(fastq_pair, adapter_file, cpus):
""" Main executor of the fastq template.
Parameters
----------
fastq_pair : list
Two element list containing the paired FastQ files.
adapter_file : str
Path to adapters file.
cpus : int or str
Number of cpu's that will be by Fast... | [
"Main",
"executor",
"of",
"the",
"fastq",
"template",
"."
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/fastqc.py#L133-L231 | [
"def",
"main",
"(",
"fastq_pair",
",",
"adapter_file",
",",
"cpus",
")",
":",
"logger",
".",
"info",
"(",
"\"Starting fastqc\"",
")",
"# If an adapter file was provided, convert it to FastQC format",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"adapter_file",
")",
... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | send_to_output | Send dictionary to output json file
This function sends master_dict dictionary to a json file if master_dict is
populated with entries, otherwise it won't create the file
Parameters
----------
master_dict: dict
dictionary that stores all entries for a specific query sequence
in mult... | flowcraft/templates/mashdist2json.py | def send_to_output(master_dict, mash_output, sample_id, assembly_file):
"""Send dictionary to output json file
This function sends master_dict dictionary to a json file if master_dict is
populated with entries, otherwise it won't create the file
Parameters
----------
master_dict: dict
d... | def send_to_output(master_dict, mash_output, sample_id, assembly_file):
"""Send dictionary to output json file
This function sends master_dict dictionary to a json file if master_dict is
populated with entries, otherwise it won't create the file
Parameters
----------
master_dict: dict
d... | [
"Send",
"dictionary",
"to",
"output",
"json",
"file",
"This",
"function",
"sends",
"master_dict",
"dictionary",
"to",
"a",
"json",
"file",
"if",
"master_dict",
"is",
"populated",
"with",
"entries",
"otherwise",
"it",
"won",
"t",
"create",
"the",
"file"
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/mashdist2json.py#L49-L114 | [
"def",
"send_to_output",
"(",
"master_dict",
",",
"mash_output",
",",
"sample_id",
",",
"assembly_file",
")",
":",
"plot_dict",
"=",
"{",
"}",
"# create a new file only if master_dict is populated",
"if",
"master_dict",
":",
"out_file",
"=",
"open",
"(",
"\"{}.json\""... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | main | Main function that allows to dump a mash dist txt file to a json file
Parameters
----------
mash_output: str
A string with the input file.
hash_cutoff: str
the percentage cutoff for the percentage of shared hashes between query
and plasmid in database that is allowed for the pla... | flowcraft/templates/mashdist2json.py | def main(mash_output, hash_cutoff, sample_id, assembly_file):
"""
Main function that allows to dump a mash dist txt file to a json file
Parameters
----------
mash_output: str
A string with the input file.
hash_cutoff: str
the percentage cutoff for the percentage of shared hashes... | def main(mash_output, hash_cutoff, sample_id, assembly_file):
"""
Main function that allows to dump a mash dist txt file to a json file
Parameters
----------
mash_output: str
A string with the input file.
hash_cutoff: str
the percentage cutoff for the percentage of shared hashes... | [
"Main",
"function",
"that",
"allows",
"to",
"dump",
"a",
"mash",
"dist",
"txt",
"file",
"to",
"a",
"json",
"file"
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/mashdist2json.py#L118-L166 | [
"def",
"main",
"(",
"mash_output",
",",
"hash_cutoff",
",",
"sample_id",
",",
"assembly_file",
")",
":",
"input_f",
"=",
"open",
"(",
"mash_output",
",",
"\"r\"",
")",
"master_dict",
"=",
"{",
"}",
"for",
"line",
"in",
"input_f",
":",
"tab_split",
"=",
"... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | MainWrapper.build_versions | Writes versions JSON for a template file
This method creates the JSON file ``.versions`` based on the metadata
and specific functions that are present in a given template script.
It starts by fetching the template metadata, which can be specified
via the ``__version__``, ``__template__... | flowcraft/templates/flowcraft_utils/flowcraft_base.py | def build_versions(self):
"""Writes versions JSON for a template file
This method creates the JSON file ``.versions`` based on the metadata
and specific functions that are present in a given template script.
It starts by fetching the template metadata, which can be specified
vi... | def build_versions(self):
"""Writes versions JSON for a template file
This method creates the JSON file ``.versions`` based on the metadata
and specific functions that are present in a given template script.
It starts by fetching the template metadata, which can be specified
vi... | [
"Writes",
"versions",
"JSON",
"for",
"a",
"template",
"file"
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/flowcraft_utils/flowcraft_base.py#L67-L122 | [
"def",
"build_versions",
"(",
"self",
")",
":",
"version_storage",
"=",
"[",
"]",
"template_version",
"=",
"self",
".",
"context",
".",
"get",
"(",
"\"__version__\"",
",",
"None",
")",
"template_program",
"=",
"self",
".",
"context",
".",
"get",
"(",
"\"__... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | main | converts top results from mash screen txt output to json format
Parameters
----------
mash_output: str
this is a string that stores the path to this file, i.e, the name of
the file
sample_id: str
sample name | flowcraft/templates/mashscreen2json.py | def main(mash_output, sample_id):
'''
converts top results from mash screen txt output to json format
Parameters
----------
mash_output: str
this is a string that stores the path to this file, i.e, the name of
the file
sample_id: str
sample name
'''
logger.info(... | def main(mash_output, sample_id):
'''
converts top results from mash screen txt output to json format
Parameters
----------
mash_output: str
this is a string that stores the path to this file, i.e, the name of
the file
sample_id: str
sample name
'''
logger.info(... | [
"converts",
"top",
"results",
"from",
"mash",
"screen",
"txt",
"output",
"to",
"json",
"format"
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/mashscreen2json.py#L46-L124 | [
"def",
"main",
"(",
"mash_output",
",",
"sample_id",
")",
":",
"logger",
".",
"info",
"(",
"\"Reading file : {}\"",
".",
"format",
"(",
"mash_output",
")",
")",
"read_mash_output",
"=",
"open",
"(",
"mash_output",
")",
"dic",
"=",
"{",
"}",
"median_list",
... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | colored_print | This function enables users to add a color to the print. It also enables
to pass end_char to print allowing to print several strings in the same line
in different prints.
Parameters
----------
color_string: str
The color code to pass to the function, which enables color change as
we... | flowcraft/generator/process_details.py | def colored_print(msg, color_label="white_bold"):
"""
This function enables users to add a color to the print. It also enables
to pass end_char to print allowing to print several strings in the same line
in different prints.
Parameters
----------
color_string: str
The color code to ... | def colored_print(msg, color_label="white_bold"):
"""
This function enables users to add a color to the print. It also enables
to pass end_char to print allowing to print several strings in the same line
in different prints.
Parameters
----------
color_string: str
The color code to ... | [
"This",
"function",
"enables",
"users",
"to",
"add",
"a",
"color",
"to",
"the",
"print",
".",
"It",
"also",
"enables",
"to",
"pass",
"end_char",
"to",
"print",
"allowing",
"to",
"print",
"several",
"strings",
"in",
"the",
"same",
"line",
"in",
"different",... | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/process_details.py#L18-L47 | [
"def",
"colored_print",
"(",
"msg",
",",
"color_label",
"=",
"\"white_bold\"",
")",
":",
"if",
"sys",
".",
"stdout",
".",
"encoding",
"!=",
"\"UTF-8\"",
":",
"msg",
"=",
"\"\"",
".",
"join",
"(",
"[",
"i",
"if",
"ord",
"(",
"i",
")",
"<",
"128",
"e... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | procs_dict_parser | This function handles the dictionary of attributes of each Process class
to print to stdout lists of all the components or the components which the
user specifies in the -t flag.
Parameters
----------
procs_dict: dict
A dictionary with the class attributes for all the components (or
... | flowcraft/generator/process_details.py | def procs_dict_parser(procs_dict):
"""
This function handles the dictionary of attributes of each Process class
to print to stdout lists of all the components or the components which the
user specifies in the -t flag.
Parameters
----------
procs_dict: dict
A dictionary with the clas... | def procs_dict_parser(procs_dict):
"""
This function handles the dictionary of attributes of each Process class
to print to stdout lists of all the components or the components which the
user specifies in the -t flag.
Parameters
----------
procs_dict: dict
A dictionary with the clas... | [
"This",
"function",
"handles",
"the",
"dictionary",
"of",
"attributes",
"of",
"each",
"Process",
"class",
"to",
"print",
"to",
"stdout",
"lists",
"of",
"all",
"the",
"components",
"or",
"the",
"components",
"which",
"the",
"user",
"specifies",
"in",
"the",
"... | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/process_details.py#L50-L107 | [
"def",
"procs_dict_parser",
"(",
"procs_dict",
")",
":",
"logger",
".",
"info",
"(",
"colored_print",
"(",
"\"\\n===== L I S T O F P R O C E S S E S =====\\n\"",
",",
"\"green_bold\"",
")",
")",
"#Sort to print alphabetically ordered list of processes to ease reading",
"procs... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | proc_collector | Function that collects all processes available and stores a dictionary of
the required arguments of each process class to be passed to
procs_dict_parser
Parameters
----------
process_map: dict
The dictionary with the Processes currently available in flowcraft
and their corresponding... | flowcraft/generator/process_details.py | def proc_collector(process_map, args, pipeline_string):
"""
Function that collects all processes available and stores a dictionary of
the required arguments of each process class to be passed to
procs_dict_parser
Parameters
----------
process_map: dict
The dictionary with the Proces... | def proc_collector(process_map, args, pipeline_string):
"""
Function that collects all processes available and stores a dictionary of
the required arguments of each process class to be passed to
procs_dict_parser
Parameters
----------
process_map: dict
The dictionary with the Proces... | [
"Function",
"that",
"collects",
"all",
"processes",
"available",
"and",
"stores",
"a",
"dictionary",
"of",
"the",
"required",
"arguments",
"of",
"each",
"process",
"class",
"to",
"be",
"passed",
"to",
"procs_dict_parser"
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/process_details.py#L110-L169 | [
"def",
"proc_collector",
"(",
"process_map",
",",
"args",
",",
"pipeline_string",
")",
":",
"arguments_list",
"=",
"[",
"]",
"# prints a detailed list of the process class arguments",
"if",
"args",
".",
"detailed_list",
":",
"# list of attributes to be passed to proc_collecto... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | guess_file_compression | Guesses the compression of an input file.
This function guesses the compression of a given file by checking for
a binary signature at the beginning of the file. These signatures are
stored in the :py:data:`MAGIC_DICT` dictionary. The supported compression
formats are gzip, bzip2 and zip. If none of the... | flowcraft/templates/integrity_coverage.py | def guess_file_compression(file_path, magic_dict=None):
"""Guesses the compression of an input file.
This function guesses the compression of a given file by checking for
a binary signature at the beginning of the file. These signatures are
stored in the :py:data:`MAGIC_DICT` dictionary. The supported ... | def guess_file_compression(file_path, magic_dict=None):
"""Guesses the compression of an input file.
This function guesses the compression of a given file by checking for
a binary signature at the beginning of the file. These signatures are
stored in the :py:data:`MAGIC_DICT` dictionary. The supported ... | [
"Guesses",
"the",
"compression",
"of",
"an",
"input",
"file",
"."
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/integrity_coverage.py#L140-L180 | [
"def",
"guess_file_compression",
"(",
"file_path",
",",
"magic_dict",
"=",
"None",
")",
":",
"if",
"not",
"magic_dict",
":",
"magic_dict",
"=",
"MAGIC_DICT",
"max_len",
"=",
"max",
"(",
"len",
"(",
"x",
")",
"for",
"x",
"in",
"magic_dict",
")",
"with",
"... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | get_qual_range | Get range of the Unicode encode range for a given string of characters.
The encoding is determined from the result of the :py:func:`ord` built-in.
Parameters
----------
qual_str : str
Arbitrary string.
Returns
-------
x : tuple
(Minimum Unicode code, Maximum Unicode code). | flowcraft/templates/integrity_coverage.py | def get_qual_range(qual_str):
""" Get range of the Unicode encode range for a given string of characters.
The encoding is determined from the result of the :py:func:`ord` built-in.
Parameters
----------
qual_str : str
Arbitrary string.
Returns
-------
x : tuple
(Minimu... | def get_qual_range(qual_str):
""" Get range of the Unicode encode range for a given string of characters.
The encoding is determined from the result of the :py:func:`ord` built-in.
Parameters
----------
qual_str : str
Arbitrary string.
Returns
-------
x : tuple
(Minimu... | [
"Get",
"range",
"of",
"the",
"Unicode",
"encode",
"range",
"for",
"a",
"given",
"string",
"of",
"characters",
"."
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/integrity_coverage.py#L183-L201 | [
"def",
"get_qual_range",
"(",
"qual_str",
")",
":",
"vals",
"=",
"[",
"ord",
"(",
"c",
")",
"for",
"c",
"in",
"qual_str",
"]",
"return",
"min",
"(",
"vals",
")",
",",
"max",
"(",
"vals",
")"
] | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | get_encodings_in_range | Returns the valid encodings for a given encoding range.
The encoding ranges are stored in the :py:data:`RANGES` dictionary, with
the encoding name as a string and a list as a value containing the
phred score and a tuple with the encoding range. For a given encoding
range provided via the two first argu... | flowcraft/templates/integrity_coverage.py | def get_encodings_in_range(rmin, rmax):
""" Returns the valid encodings for a given encoding range.
The encoding ranges are stored in the :py:data:`RANGES` dictionary, with
the encoding name as a string and a list as a value containing the
phred score and a tuple with the encoding range. For a given en... | def get_encodings_in_range(rmin, rmax):
""" Returns the valid encodings for a given encoding range.
The encoding ranges are stored in the :py:data:`RANGES` dictionary, with
the encoding name as a string and a list as a value containing the
phred score and a tuple with the encoding range. For a given en... | [
"Returns",
"the",
"valid",
"encodings",
"for",
"a",
"given",
"encoding",
"range",
"."
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/integrity_coverage.py#L204-L237 | [
"def",
"get_encodings_in_range",
"(",
"rmin",
",",
"rmax",
")",
":",
"valid_encodings",
"=",
"[",
"]",
"valid_phred",
"=",
"[",
"]",
"for",
"encoding",
",",
"(",
"phred",
",",
"(",
"emin",
",",
"emax",
")",
")",
"in",
"RANGES",
".",
"items",
"(",
")"... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | main | Main executor of the integrity_coverage template.
Parameters
----------
sample_id : str
Sample Identification string.
fastq_pair : list
Two element list containing the paired FastQ files.
gsize : float or int
Estimate of genome size in Mb.
minimum_coverage : float or int... | flowcraft/templates/integrity_coverage.py | def main(sample_id, fastq_pair, gsize, minimum_coverage, opts):
""" Main executor of the integrity_coverage template.
Parameters
----------
sample_id : str
Sample Identification string.
fastq_pair : list
Two element list containing the paired FastQ files.
gsize : float or int
... | def main(sample_id, fastq_pair, gsize, minimum_coverage, opts):
""" Main executor of the integrity_coverage template.
Parameters
----------
sample_id : str
Sample Identification string.
fastq_pair : list
Two element list containing the paired FastQ files.
gsize : float or int
... | [
"Main",
"executor",
"of",
"the",
"integrity_coverage",
"template",
"."
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/integrity_coverage.py#L241-L469 | [
"def",
"main",
"(",
"sample_id",
",",
"fastq_pair",
",",
"gsize",
",",
"minimum_coverage",
",",
"opts",
")",
":",
"logger",
".",
"info",
"(",
"\"Starting integrity coverage main\"",
")",
"# Check for runtime options",
"if",
"\"-e\"",
"in",
"opts",
":",
"skip_encod... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | parse_coverage_table | Parses a file with coverage information into objects.
This function parses a TSV file containing coverage results for
all contigs in a given assembly and will build an ``OrderedDict``
with the information about their coverage and length. The length
information is actually gathered from the contig head... | flowcraft/templates/process_assembly_mapping.py | def parse_coverage_table(coverage_file):
"""Parses a file with coverage information into objects.
This function parses a TSV file containing coverage results for
all contigs in a given assembly and will build an ``OrderedDict``
with the information about their coverage and length. The length
infor... | def parse_coverage_table(coverage_file):
"""Parses a file with coverage information into objects.
This function parses a TSV file containing coverage results for
all contigs in a given assembly and will build an ``OrderedDict``
with the information about their coverage and length. The length
infor... | [
"Parses",
"a",
"file",
"with",
"coverage",
"information",
"into",
"objects",
"."
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/process_assembly_mapping.py#L122-L164 | [
"def",
"parse_coverage_table",
"(",
"coverage_file",
")",
":",
"# Stores the correspondence between a contig and the corresponding coverage",
"# e.g.: {\"contig_1\": {\"cov\": 424} }",
"coverage_dict",
"=",
"OrderedDict",
"(",
")",
"# Stores the total coverage",
"total_cov",
"=",
"0"... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | filter_assembly | Generates a filtered assembly file.
This function generates a filtered assembly file based on an original
assembly and a minimum coverage threshold.
Parameters
----------
assembly_file : str
Path to original assembly file.
minimum_coverage : int or float
Minimum coverage requir... | flowcraft/templates/process_assembly_mapping.py | def filter_assembly(assembly_file, minimum_coverage, coverage_info,
output_file):
"""Generates a filtered assembly file.
This function generates a filtered assembly file based on an original
assembly and a minimum coverage threshold.
Parameters
----------
assembly_file : st... | def filter_assembly(assembly_file, minimum_coverage, coverage_info,
output_file):
"""Generates a filtered assembly file.
This function generates a filtered assembly file based on an original
assembly and a minimum coverage threshold.
Parameters
----------
assembly_file : st... | [
"Generates",
"a",
"filtered",
"assembly",
"file",
"."
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/process_assembly_mapping.py#L167-L209 | [
"def",
"filter_assembly",
"(",
"assembly_file",
",",
"minimum_coverage",
",",
"coverage_info",
",",
"output_file",
")",
":",
"# This flag will determine whether sequence data should be written or",
"# ignored because the current contig did not pass the minimum",
"# coverage threshold",
... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | filter_bam | Uses Samtools to filter a BAM file according to minimum coverage
Provided with a minimum coverage value, this function will use Samtools
to filter a BAM file. This is performed to apply the same filter to
the BAM file as the one applied to the assembly file in
:py:func:`filter_assembly`.
Parameter... | flowcraft/templates/process_assembly_mapping.py | def filter_bam(coverage_info, bam_file, min_coverage, output_bam):
"""Uses Samtools to filter a BAM file according to minimum coverage
Provided with a minimum coverage value, this function will use Samtools
to filter a BAM file. This is performed to apply the same filter to
the BAM file as the one appl... | def filter_bam(coverage_info, bam_file, min_coverage, output_bam):
"""Uses Samtools to filter a BAM file according to minimum coverage
Provided with a minimum coverage value, this function will use Samtools
to filter a BAM file. This is performed to apply the same filter to
the BAM file as the one appl... | [
"Uses",
"Samtools",
"to",
"filter",
"a",
"BAM",
"file",
"according",
"to",
"minimum",
"coverage"
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/process_assembly_mapping.py#L212-L301 | [
"def",
"filter_bam",
"(",
"coverage_info",
",",
"bam_file",
",",
"min_coverage",
",",
"output_bam",
")",
":",
"# Get list of contigs that will be kept",
"contig_list",
"=",
"[",
"x",
"for",
"x",
",",
"vals",
"in",
"coverage_info",
".",
"items",
"(",
")",
"if",
... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | check_filtered_assembly | Checks whether a filtered assembly passes a size threshold
Given a minimum coverage threshold, this function evaluates whether an
assembly will pass the minimum threshold of ``genome_size * 1e6 * 0.8``,
which means 80% of the expected genome size or the maximum threshold
of ``genome_size * 1e6 * 1.5``,... | flowcraft/templates/process_assembly_mapping.py | def check_filtered_assembly(coverage_info, coverage_bp, minimum_coverage,
genome_size, contig_size, max_contigs,
sample_id):
"""Checks whether a filtered assembly passes a size threshold
Given a minimum coverage threshold, this function evaluates whether ... | def check_filtered_assembly(coverage_info, coverage_bp, minimum_coverage,
genome_size, contig_size, max_contigs,
sample_id):
"""Checks whether a filtered assembly passes a size threshold
Given a minimum coverage threshold, this function evaluates whether ... | [
"Checks",
"whether",
"a",
"filtered",
"assembly",
"passes",
"a",
"size",
"threshold"
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/process_assembly_mapping.py#L304-L441 | [
"def",
"check_filtered_assembly",
"(",
"coverage_info",
",",
"coverage_bp",
",",
"minimum_coverage",
",",
"genome_size",
",",
"contig_size",
",",
"max_contigs",
",",
"sample_id",
")",
":",
"# Get size of assembly after filtering contigs below minimum_coverage",
"assembly_len",
... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | evaluate_min_coverage | Evaluates the minimum coverage threshold from the value provided in
the coverage_opt.
Parameters
----------
coverage_opt : str or int or float
If set to "auto" it will try to automatically determine the coverage
to 1/3 of the assembly size, to a minimum value of 10. If it set
to... | flowcraft/templates/process_assembly_mapping.py | def evaluate_min_coverage(coverage_opt, assembly_coverage, assembly_size):
""" Evaluates the minimum coverage threshold from the value provided in
the coverage_opt.
Parameters
----------
coverage_opt : str or int or float
If set to "auto" it will try to automatically determine the coverage
... | def evaluate_min_coverage(coverage_opt, assembly_coverage, assembly_size):
""" Evaluates the minimum coverage threshold from the value provided in
the coverage_opt.
Parameters
----------
coverage_opt : str or int or float
If set to "auto" it will try to automatically determine the coverage
... | [
"Evaluates",
"the",
"minimum",
"coverage",
"threshold",
"from",
"the",
"value",
"provided",
"in",
"the",
"coverage_opt",
"."
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/process_assembly_mapping.py#L475-L515 | [
"def",
"evaluate_min_coverage",
"(",
"coverage_opt",
",",
"assembly_coverage",
",",
"assembly_size",
")",
":",
"if",
"coverage_opt",
"==",
"\"auto\"",
":",
"# Get the 1/3 value of the current assembly coverage",
"min_coverage",
"=",
"(",
"assembly_coverage",
"/",
"assembly_... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | get_assembly_size | Returns the number of nucleotides and the size per contig for the
provided assembly file path
Parameters
----------
assembly_file : str
Path to assembly file.
Returns
-------
assembly_size : int
Size of the assembly in nucleotides
contig_size : dict
Length of ea... | flowcraft/templates/process_assembly_mapping.py | def get_assembly_size(assembly_file):
"""Returns the number of nucleotides and the size per contig for the
provided assembly file path
Parameters
----------
assembly_file : str
Path to assembly file.
Returns
-------
assembly_size : int
Size of the assembly in nucleotide... | def get_assembly_size(assembly_file):
"""Returns the number of nucleotides and the size per contig for the
provided assembly file path
Parameters
----------
assembly_file : str
Path to assembly file.
Returns
-------
assembly_size : int
Size of the assembly in nucleotide... | [
"Returns",
"the",
"number",
"of",
"nucleotides",
"and",
"the",
"size",
"per",
"contig",
"for",
"the",
"provided",
"assembly",
"file",
"path"
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/process_assembly_mapping.py#L518-L556 | [
"def",
"get_assembly_size",
"(",
"assembly_file",
")",
":",
"assembly_size",
"=",
"0",
"contig_size",
"=",
"{",
"}",
"header",
"=",
"\"\"",
"with",
"open",
"(",
"assembly_file",
")",
"as",
"fh",
":",
"for",
"line",
"in",
"fh",
":",
"# Skip empty lines",
"i... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | main | Main executor of the process_assembly_mapping template.
Parameters
----------
sample_id : str
Sample Identification string.
assembly_file : str
Path to assembly file in Fasta format.
coverage_file : str
Path to TSV file with coverage information for each contig.
coverage... | flowcraft/templates/process_assembly_mapping.py | def main(sample_id, assembly_file, coverage_file, coverage_bp_file, bam_file,
opts, gsize):
"""Main executor of the process_assembly_mapping template.
Parameters
----------
sample_id : str
Sample Identification string.
assembly_file : str
Path to assembly file in Fasta form... | def main(sample_id, assembly_file, coverage_file, coverage_bp_file, bam_file,
opts, gsize):
"""Main executor of the process_assembly_mapping template.
Parameters
----------
sample_id : str
Sample Identification string.
assembly_file : str
Path to assembly file in Fasta form... | [
"Main",
"executor",
"of",
"the",
"process_assembly_mapping",
"template",
"."
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/process_assembly_mapping.py#L560-L628 | [
"def",
"main",
"(",
"sample_id",
",",
"assembly_file",
",",
"coverage_file",
",",
"coverage_bp_file",
",",
"bam_file",
",",
"opts",
",",
"gsize",
")",
":",
"min_assembly_coverage",
",",
"max_contigs",
"=",
"opts",
"logger",
".",
"info",
"(",
"\"Starting assembly... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | main | Main executor of the process_spades template.
Parameters
----------
sample_id : str
Sample Identification string.
assembly_file : str
Path to the assembly file generated by Spades.
gsize : int
Estimate of genome size.
opts : list
List of options for processing sp... | flowcraft/templates/process_assembly.py | def main(sample_id, assembly_file, gsize, opts, assembler):
"""Main executor of the process_spades template.
Parameters
----------
sample_id : str
Sample Identification string.
assembly_file : str
Path to the assembly file generated by Spades.
gsize : int
Estimate of gen... | def main(sample_id, assembly_file, gsize, opts, assembler):
"""Main executor of the process_spades template.
Parameters
----------
sample_id : str
Sample Identification string.
assembly_file : str
Path to the assembly file generated by Spades.
gsize : int
Estimate of gen... | [
"Main",
"executor",
"of",
"the",
"process_spades",
"template",
"."
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/process_assembly.py#L447-L577 | [
"def",
"main",
"(",
"sample_id",
",",
"assembly_file",
",",
"gsize",
",",
"opts",
",",
"assembler",
")",
":",
"logger",
".",
"info",
"(",
"\"Starting assembly file processing\"",
")",
"warnings",
"=",
"[",
"]",
"fails",
"=",
"\"\"",
"min_contig_len",
",",
"m... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | convert_camel_case | Convers a CamelCase string into a snake_case one
Parameters
----------
name : str
An arbitrary string that may be CamelCase
Returns
-------
str
The input string converted into snake_case | flowcraft/generator/process_collector.py | def convert_camel_case(name):
"""Convers a CamelCase string into a snake_case one
Parameters
----------
name : str
An arbitrary string that may be CamelCase
Returns
-------
str
The input string converted into snake_case
"""
s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2',... | def convert_camel_case(name):
"""Convers a CamelCase string into a snake_case one
Parameters
----------
name : str
An arbitrary string that may be CamelCase
Returns
-------
str
The input string converted into snake_case
"""
s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2',... | [
"Convers",
"a",
"CamelCase",
"string",
"into",
"a",
"snake_case",
"one"
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/process_collector.py#L10-L25 | [
"def",
"convert_camel_case",
"(",
"name",
")",
":",
"s1",
"=",
"re",
".",
"sub",
"(",
"'(.)([A-Z][a-z]+)'",
",",
"r'\\1_\\2'",
",",
"name",
")",
"return",
"re",
".",
"sub",
"(",
"'([a-z0-9])([A-Z])'",
",",
"r'\\1_\\2'",
",",
"s1",
")",
".",
"lower",
"(",... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | collect_process_map | Collects Process classes and return dict mapping templates to classes
This function crawls through the components module and retrieves all
classes that inherit from the Process class. Then, it converts the name
of the classes (which should be CamelCase) to snake_case, which is used
as the template name... | flowcraft/generator/process_collector.py | def collect_process_map():
"""Collects Process classes and return dict mapping templates to classes
This function crawls through the components module and retrieves all
classes that inherit from the Process class. Then, it converts the name
of the classes (which should be CamelCase) to snake_case, whic... | def collect_process_map():
"""Collects Process classes and return dict mapping templates to classes
This function crawls through the components module and retrieves all
classes that inherit from the Process class. Then, it converts the name
of the classes (which should be CamelCase) to snake_case, whic... | [
"Collects",
"Process",
"classes",
"and",
"return",
"dict",
"mapping",
"templates",
"to",
"classes"
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/generator/process_collector.py#L28-L59 | [
"def",
"collect_process_map",
"(",
")",
":",
"process_map",
"=",
"{",
"}",
"prefix",
"=",
"\"{}.\"",
".",
"format",
"(",
"components",
".",
"__name__",
")",
"for",
"importer",
",",
"modname",
",",
"_",
"in",
"pkgutil",
".",
"iter_modules",
"(",
"components... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | main | Main executor of the process_newick template.
Parameters
----------
newick : str
path to the newick file. | flowcraft/templates/process_newick.py | def main(newick):
"""Main executor of the process_newick template.
Parameters
----------
newick : str
path to the newick file.
"""
logger.info("Starting newick file processing")
print(newick)
tree = dendropy.Tree.get(file=open(newick, 'r'), schema="newick")
tree.reroot_... | def main(newick):
"""Main executor of the process_newick template.
Parameters
----------
newick : str
path to the newick file.
"""
logger.info("Starting newick file processing")
print(newick)
tree = dendropy.Tree.get(file=open(newick, 'r'), schema="newick")
tree.reroot_... | [
"Main",
"executor",
"of",
"the",
"process_newick",
"template",
"."
] | assemblerflow/flowcraft | python | https://github.com/assemblerflow/flowcraft/blob/fc3f4bddded1efc76006600016dc71a06dd908c0/flowcraft/templates/process_newick.py#L53-L85 | [
"def",
"main",
"(",
"newick",
")",
":",
"logger",
".",
"info",
"(",
"\"Starting newick file processing\"",
")",
"print",
"(",
"newick",
")",
"tree",
"=",
"dendropy",
".",
"Tree",
".",
"get",
"(",
"file",
"=",
"open",
"(",
"newick",
",",
"'r'",
")",
","... | fc3f4bddded1efc76006600016dc71a06dd908c0 |
test | CMD.factorize | Factorize s.t. CUR = data
Updated Values
--------------
.C : updated values for C.
.U : updated values for U.
.R : updated values for R. | msaf/pymf/cmd.py | def factorize(self):
""" Factorize s.t. CUR = data
Updated Values
--------------
.C : updated values for C.
.U : updated values for U.
.R : updated values for R.
"""
[prow, pcol] = self.sample_probability()
self._rid = self.s... | def factorize(self):
""" Factorize s.t. CUR = data
Updated Values
--------------
.C : updated values for C.
.U : updated values for U.
.R : updated values for R.
"""
[prow, pcol] = self.sample_probability()
self._rid = self.s... | [
"Factorize",
"s",
".",
"t",
".",
"CUR",
"=",
"data"
] | urinieto/msaf | python | https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/pymf/cmd.py#L72-L89 | [
"def",
"factorize",
"(",
"self",
")",
":",
"[",
"prow",
",",
"pcol",
"]",
"=",
"self",
".",
"sample_probability",
"(",
")",
"self",
".",
"_rid",
"=",
"self",
".",
"sample",
"(",
"self",
".",
"_rrank",
",",
"prow",
")",
"self",
".",
"_cid",
"=",
"... | 9dbb57d77a1310465a65cc40f1641d083ca74385 |
test | CUR.factorize | Factorize s.t. CUR = data
Updated Values
--------------
.C : updated values for C.
.U : updated values for U.
.R : updated values for R. | msaf/pymf/cur.py | def factorize(self):
""" Factorize s.t. CUR = data
Updated Values
--------------
.C : updated values for C.
.U : updated values for U.
.R : updated values for R.
"""
[prow, pcol] = self.sample_probability()
self._rid = self.sam... | def factorize(self):
""" Factorize s.t. CUR = data
Updated Values
--------------
.C : updated values for C.
.U : updated values for U.
.R : updated values for R.
"""
[prow, pcol] = self.sample_probability()
self._rid = self.sam... | [
"Factorize",
"s",
".",
"t",
".",
"CUR",
"=",
"data"
] | urinieto/msaf | python | https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/pymf/cur.py#L122-L138 | [
"def",
"factorize",
"(",
"self",
")",
":",
"[",
"prow",
",",
"pcol",
"]",
"=",
"self",
".",
"sample_probability",
"(",
")",
"self",
".",
"_rid",
"=",
"self",
".",
"sample",
"(",
"self",
".",
"_rrank",
",",
"prow",
")",
"self",
".",
"_cid",
"=",
"... | 9dbb57d77a1310465a65cc40f1641d083ca74385 |
test | quickhull | Find data points on the convex hull of a supplied data set
Args:
sample: data points as column vectors n x d
n - number samples
d - data dimension (should be two)
Returns:
a k x d matrix containint the convex hull data points | msaf/pymf/chnmf.py | def quickhull(sample):
""" Find data points on the convex hull of a supplied data set
Args:
sample: data points as column vectors n x d
n - number samples
d - data dimension (should be two)
Returns:
a k x d matrix containint the convex hull data poin... | def quickhull(sample):
""" Find data points on the convex hull of a supplied data set
Args:
sample: data points as column vectors n x d
n - number samples
d - data dimension (should be two)
Returns:
a k x d matrix containint the convex hull data poin... | [
"Find",
"data",
"points",
"on",
"the",
"convex",
"hull",
"of",
"a",
"supplied",
"data",
"set"
] | urinieto/msaf | python | https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/pymf/chnmf.py#L27-L60 | [
"def",
"quickhull",
"(",
"sample",
")",
":",
"link",
"=",
"lambda",
"a",
",",
"b",
":",
"np",
".",
"concatenate",
"(",
"(",
"a",
",",
"b",
"[",
"1",
":",
"]",
")",
")",
"edge",
"=",
"lambda",
"a",
",",
"b",
":",
"np",
".",
"concatenate",
"(",... | 9dbb57d77a1310465a65cc40f1641d083ca74385 |
test | CHNMF._map_w_to_data | Return data points that are most similar to basis vectors W | msaf/pymf/chnmf.py | def _map_w_to_data(self):
""" Return data points that are most similar to basis vectors W
"""
# assign W to the next best data sample
self._Wmapped_index = vq(self.data, self.W)
self.Wmapped = np.zeros(self.W.shape)
# do not directly assign, i.e. Wdist = self.data[:,sel... | def _map_w_to_data(self):
""" Return data points that are most similar to basis vectors W
"""
# assign W to the next best data sample
self._Wmapped_index = vq(self.data, self.W)
self.Wmapped = np.zeros(self.W.shape)
# do not directly assign, i.e. Wdist = self.data[:,sel... | [
"Return",
"data",
"points",
"that",
"are",
"most",
"similar",
"to",
"basis",
"vectors",
"W"
] | urinieto/msaf | python | https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/pymf/chnmf.py#L137-L150 | [
"def",
"_map_w_to_data",
"(",
"self",
")",
":",
"# assign W to the next best data sample",
"self",
".",
"_Wmapped_index",
"=",
"vq",
"(",
"self",
".",
"data",
",",
"self",
".",
"W",
")",
"self",
".",
"Wmapped",
"=",
"np",
".",
"zeros",
"(",
"self",
".",
... | 9dbb57d77a1310465a65cc40f1641d083ca74385 |
test | CHNMF.update_w | compute new W | msaf/pymf/chnmf.py | def update_w(self):
""" compute new W """
def select_hull_points(data, n=3):
""" select data points for pairwise projections of the first n
dimensions """
# iterate over all projections and select data points
idx = np.array([])
# iterate over... | def update_w(self):
""" compute new W """
def select_hull_points(data, n=3):
""" select data points for pairwise projections of the first n
dimensions """
# iterate over all projections and select data points
idx = np.array([])
# iterate over... | [
"compute",
"new",
"W"
] | urinieto/msaf | python | https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/pymf/chnmf.py#L152-L191 | [
"def",
"update_w",
"(",
"self",
")",
":",
"def",
"select_hull_points",
"(",
"data",
",",
"n",
"=",
"3",
")",
":",
"\"\"\" select data points for pairwise projections of the first n\n dimensions \"\"\"",
"# iterate over all projections and select data points",
"idx",
... | 9dbb57d77a1310465a65cc40f1641d083ca74385 |
test | CHNMF.factorize | Factorize s.t. WH = data
Parameters
----------
show_progress : bool
print some extra information to stdout.
compute_h : bool
iteratively update values for H.
compute_w : bool
iteratively update value... | msaf/pymf/chnmf.py | def factorize(self, show_progress=False, compute_w=True, compute_h=True,
compute_err=True, niter=1):
""" Factorize s.t. WH = data
Parameters
----------
show_progress : bool
print some extra information to stdout.
compute_h : ... | def factorize(self, show_progress=False, compute_w=True, compute_h=True,
compute_err=True, niter=1):
""" Factorize s.t. WH = data
Parameters
----------
show_progress : bool
print some extra information to stdout.
compute_h : ... | [
"Factorize",
"s",
".",
"t",
".",
"WH",
"=",
"data"
] | urinieto/msaf | python | https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/pymf/chnmf.py#L193-L218 | [
"def",
"factorize",
"(",
"self",
",",
"show_progress",
"=",
"False",
",",
"compute_w",
"=",
"True",
",",
"compute_h",
"=",
"True",
",",
"compute_err",
"=",
"True",
",",
"niter",
"=",
"1",
")",
":",
"AA",
".",
"factorize",
"(",
"self",
",",
"niter",
"... | 9dbb57d77a1310465a65cc40f1641d083ca74385 |
test | GMAP.update_w | compute new W | msaf/pymf/gmap.py | def update_w(self):
""" compute new W """
def select_next(iterval):
""" select the next best data sample using robust map
or simply the max iterval ... """
if self._robust_map:
k = np.argsort(iterval)[::-1]
d_sub = self.data[:,k[:self... | def update_w(self):
""" compute new W """
def select_next(iterval):
""" select the next best data sample using robust map
or simply the max iterval ... """
if self._robust_map:
k = np.argsort(iterval)[::-1]
d_sub = self.data[:,k[:self... | [
"compute",
"new",
"W"
] | urinieto/msaf | python | https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/pymf/gmap.py#L93-L173 | [
"def",
"update_w",
"(",
"self",
")",
":",
"def",
"select_next",
"(",
"iterval",
")",
":",
"\"\"\" select the next best data sample using robust map\n or simply the max iterval ... \"\"\"",
"if",
"self",
".",
"_robust_map",
":",
"k",
"=",
"np",
".",
"argsort",
... | 9dbb57d77a1310465a65cc40f1641d083ca74385 |
test | GMAP.factorize | Factorize s.t. WH = data
Parameters
----------
show_progress : bool
print some extra information to stdout.
False, default
compute_h : bool
iteratively update values for H.
True, default
... | msaf/pymf/gmap.py | def factorize(self, show_progress=False, compute_w=True, compute_h=True,
compute_err=True, robust_cluster=3, niter=1, robust_nselect=-1):
""" Factorize s.t. WH = data
Parameters
----------
show_progress : bool
print some extra informatio... | def factorize(self, show_progress=False, compute_w=True, compute_h=True,
compute_err=True, robust_cluster=3, niter=1, robust_nselect=-1):
""" Factorize s.t. WH = data
Parameters
----------
show_progress : bool
print some extra informatio... | [
"Factorize",
"s",
".",
"t",
".",
"WH",
"=",
"data"
] | urinieto/msaf | python | https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/pymf/gmap.py#L175-L215 | [
"def",
"factorize",
"(",
"self",
",",
"show_progress",
"=",
"False",
",",
"compute_w",
"=",
"True",
",",
"compute_h",
"=",
"True",
",",
"compute_err",
"=",
"True",
",",
"robust_cluster",
"=",
"3",
",",
"niter",
"=",
"1",
",",
"robust_nselect",
"=",
"-",
... | 9dbb57d77a1310465a65cc40f1641d083ca74385 |
test | Segmenter.process | Main process.
Returns
-------
est_idxs : np.array(N) or list
Estimated times for the segment boundaries in frame indeces.
List if hierarchical segmentation.
est_labels : np.array(N-1) or list
Estimated labels for the segments.
List if hiera... | msaf/algorithms/scluster/segmenter.py | def process(self):
"""Main process.
Returns
-------
est_idxs : np.array(N) or list
Estimated times for the segment boundaries in frame indeces.
List if hierarchical segmentation.
est_labels : np.array(N-1) or list
Estimated labels for the segme... | def process(self):
"""Main process.
Returns
-------
est_idxs : np.array(N) or list
Estimated times for the segment boundaries in frame indeces.
List if hierarchical segmentation.
est_labels : np.array(N-1) or list
Estimated labels for the segme... | [
"Main",
"process",
".",
"Returns",
"-------",
"est_idxs",
":",
"np",
".",
"array",
"(",
"N",
")",
"or",
"list",
"Estimated",
"times",
"for",
"the",
"segment",
"boundaries",
"in",
"frame",
"indeces",
".",
"List",
"if",
"hierarchical",
"segmentation",
".",
"... | urinieto/msaf | python | https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/algorithms/scluster/segmenter.py#L22-L51 | [
"def",
"process",
"(",
"self",
")",
":",
"# This algorithm only accepts one specific kind of features:",
"# Combination of PCP + MFCC. Let's get them:",
"pcp_obj",
"=",
"Features",
".",
"select_features",
"(",
"\"pcp\"",
",",
"self",
".",
"file_struct",
",",
"self",
".",
... | 9dbb57d77a1310465a65cc40f1641d083ca74385 |
test | Segmenter.processFlat | Main process.for flat segmentation.
Returns
-------
est_idxs : np.array(N)
Estimated times for the segment boundaries in frame indeces.
est_labels : np.array(N-1)
Estimated labels for the segments. | msaf/algorithms/scluster/segmenter.py | def processFlat(self):
"""Main process.for flat segmentation.
Returns
-------
est_idxs : np.array(N)
Estimated times for the segment boundaries in frame indeces.
est_labels : np.array(N-1)
Estimated labels for the segments.
"""
self.config[... | def processFlat(self):
"""Main process.for flat segmentation.
Returns
-------
est_idxs : np.array(N)
Estimated times for the segment boundaries in frame indeces.
est_labels : np.array(N-1)
Estimated labels for the segments.
"""
self.config[... | [
"Main",
"process",
".",
"for",
"flat",
"segmentation",
".",
"Returns",
"-------",
"est_idxs",
":",
"np",
".",
"array",
"(",
"N",
")",
"Estimated",
"times",
"for",
"the",
"segment",
"boundaries",
"in",
"frame",
"indeces",
".",
"est_labels",
":",
"np",
".",
... | urinieto/msaf | python | https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/algorithms/scluster/segmenter.py#L53-L65 | [
"def",
"processFlat",
"(",
"self",
")",
":",
"self",
".",
"config",
"[",
"\"hier\"",
"]",
"=",
"False",
"est_idxs",
",",
"est_labels",
",",
"F",
"=",
"self",
".",
"process",
"(",
")",
"assert",
"est_idxs",
"[",
"0",
"]",
"==",
"0",
"and",
"est_idxs",... | 9dbb57d77a1310465a65cc40f1641d083ca74385 |
test | Segmenter.processHierarchical | Main process.for hierarchial segmentation.
Returns
-------
est_idxs : list
List with np.arrays for each layer of segmentation containing
the estimated indeces for the segment boundaries.
est_labels : list
List with np.arrays containing the labels for e... | msaf/algorithms/scluster/segmenter.py | def processHierarchical(self):
"""Main process.for hierarchial segmentation.
Returns
-------
est_idxs : list
List with np.arrays for each layer of segmentation containing
the estimated indeces for the segment boundaries.
est_labels : list
List ... | def processHierarchical(self):
"""Main process.for hierarchial segmentation.
Returns
-------
est_idxs : list
List with np.arrays for each layer of segmentation containing
the estimated indeces for the segment boundaries.
est_labels : list
List ... | [
"Main",
"process",
".",
"for",
"hierarchial",
"segmentation",
".",
"Returns",
"-------",
"est_idxs",
":",
"list",
"List",
"with",
"np",
".",
"arrays",
"for",
"each",
"layer",
"of",
"segmentation",
"containing",
"the",
"estimated",
"indeces",
"for",
"the",
"seg... | urinieto/msaf | python | https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/algorithms/scluster/segmenter.py#L67-L85 | [
"def",
"processHierarchical",
"(",
"self",
")",
":",
"self",
".",
"config",
"[",
"\"hier\"",
"]",
"=",
"True",
"est_idxs",
",",
"est_labels",
",",
"F",
"=",
"self",
".",
"process",
"(",
")",
"for",
"layer",
"in",
"range",
"(",
"len",
"(",
"est_idxs",
... | 9dbb57d77a1310465a65cc40f1641d083ca74385 |
test | median_filter | Median filter along the first axis of the feature matrix X. | msaf/algorithms/foote/segmenter.py | def median_filter(X, M=8):
"""Median filter along the first axis of the feature matrix X."""
for i in range(X.shape[1]):
X[:, i] = filters.median_filter(X[:, i], size=M)
return X | def median_filter(X, M=8):
"""Median filter along the first axis of the feature matrix X."""
for i in range(X.shape[1]):
X[:, i] = filters.median_filter(X[:, i], size=M)
return X | [
"Median",
"filter",
"along",
"the",
"first",
"axis",
"of",
"the",
"feature",
"matrix",
"X",
"."
] | urinieto/msaf | python | https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/algorithms/foote/segmenter.py#L15-L19 | [
"def",
"median_filter",
"(",
"X",
",",
"M",
"=",
"8",
")",
":",
"for",
"i",
"in",
"range",
"(",
"X",
".",
"shape",
"[",
"1",
"]",
")",
":",
"X",
"[",
":",
",",
"i",
"]",
"=",
"filters",
".",
"median_filter",
"(",
"X",
"[",
":",
",",
"i",
... | 9dbb57d77a1310465a65cc40f1641d083ca74385 |
test | compute_gaussian_krnl | Creates a gaussian kernel following Foote's paper. | msaf/algorithms/foote/segmenter.py | def compute_gaussian_krnl(M):
"""Creates a gaussian kernel following Foote's paper."""
g = signal.gaussian(M, M // 3., sym=True)
G = np.dot(g.reshape(-1, 1), g.reshape(1, -1))
G[M // 2:, :M // 2] = -G[M // 2:, :M // 2]
G[:M // 2, M // 2:] = -G[:M // 2, M // 2:]
return G | def compute_gaussian_krnl(M):
"""Creates a gaussian kernel following Foote's paper."""
g = signal.gaussian(M, M // 3., sym=True)
G = np.dot(g.reshape(-1, 1), g.reshape(1, -1))
G[M // 2:, :M // 2] = -G[M // 2:, :M // 2]
G[:M // 2, M // 2:] = -G[:M // 2, M // 2:]
return G | [
"Creates",
"a",
"gaussian",
"kernel",
"following",
"Foote",
"s",
"paper",
"."
] | urinieto/msaf | python | https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/algorithms/foote/segmenter.py#L22-L28 | [
"def",
"compute_gaussian_krnl",
"(",
"M",
")",
":",
"g",
"=",
"signal",
".",
"gaussian",
"(",
"M",
",",
"M",
"//",
"3.",
",",
"sym",
"=",
"True",
")",
"G",
"=",
"np",
".",
"dot",
"(",
"g",
".",
"reshape",
"(",
"-",
"1",
",",
"1",
")",
",",
... | 9dbb57d77a1310465a65cc40f1641d083ca74385 |
test | compute_ssm | Computes the self-similarity matrix of X. | msaf/algorithms/foote/segmenter.py | def compute_ssm(X, metric="seuclidean"):
"""Computes the self-similarity matrix of X."""
D = distance.pdist(X, metric=metric)
D = distance.squareform(D)
D /= D.max()
return 1 - D | def compute_ssm(X, metric="seuclidean"):
"""Computes the self-similarity matrix of X."""
D = distance.pdist(X, metric=metric)
D = distance.squareform(D)
D /= D.max()
return 1 - D | [
"Computes",
"the",
"self",
"-",
"similarity",
"matrix",
"of",
"X",
"."
] | urinieto/msaf | python | https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/algorithms/foote/segmenter.py#L31-L36 | [
"def",
"compute_ssm",
"(",
"X",
",",
"metric",
"=",
"\"seuclidean\"",
")",
":",
"D",
"=",
"distance",
".",
"pdist",
"(",
"X",
",",
"metric",
"=",
"metric",
")",
"D",
"=",
"distance",
".",
"squareform",
"(",
"D",
")",
"D",
"/=",
"D",
".",
"max",
"... | 9dbb57d77a1310465a65cc40f1641d083ca74385 |
test | compute_nc | Computes the novelty curve from the self-similarity matrix X and
the gaussian kernel G. | msaf/algorithms/foote/segmenter.py | def compute_nc(X, G):
"""Computes the novelty curve from the self-similarity matrix X and
the gaussian kernel G."""
N = X.shape[0]
M = G.shape[0]
nc = np.zeros(N)
for i in range(M // 2, N - M // 2 + 1):
nc[i] = np.sum(X[i - M // 2:i + M // 2, i - M // 2:i + M // 2] * G)
# Norma... | def compute_nc(X, G):
"""Computes the novelty curve from the self-similarity matrix X and
the gaussian kernel G."""
N = X.shape[0]
M = G.shape[0]
nc = np.zeros(N)
for i in range(M // 2, N - M // 2 + 1):
nc[i] = np.sum(X[i - M // 2:i + M // 2, i - M // 2:i + M // 2] * G)
# Norma... | [
"Computes",
"the",
"novelty",
"curve",
"from",
"the",
"self",
"-",
"similarity",
"matrix",
"X",
"and",
"the",
"gaussian",
"kernel",
"G",
"."
] | urinieto/msaf | python | https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/algorithms/foote/segmenter.py#L39-L52 | [
"def",
"compute_nc",
"(",
"X",
",",
"G",
")",
":",
"N",
"=",
"X",
".",
"shape",
"[",
"0",
"]",
"M",
"=",
"G",
".",
"shape",
"[",
"0",
"]",
"nc",
"=",
"np",
".",
"zeros",
"(",
"N",
")",
"for",
"i",
"in",
"range",
"(",
"M",
"//",
"2",
","... | 9dbb57d77a1310465a65cc40f1641d083ca74385 |
test | pick_peaks | Obtain peaks from a novelty curve using an adaptive threshold. | msaf/algorithms/foote/segmenter.py | def pick_peaks(nc, L=16):
"""Obtain peaks from a novelty curve using an adaptive threshold."""
offset = nc.mean() / 20.
nc = filters.gaussian_filter1d(nc, sigma=4) # Smooth out nc
th = filters.median_filter(nc, size=L) + offset
#th = filters.gaussian_filter(nc, sigma=L/2., mode="nearest") + offse... | def pick_peaks(nc, L=16):
"""Obtain peaks from a novelty curve using an adaptive threshold."""
offset = nc.mean() / 20.
nc = filters.gaussian_filter1d(nc, sigma=4) # Smooth out nc
th = filters.median_filter(nc, size=L) + offset
#th = filters.gaussian_filter(nc, sigma=L/2., mode="nearest") + offse... | [
"Obtain",
"peaks",
"from",
"a",
"novelty",
"curve",
"using",
"an",
"adaptive",
"threshold",
"."
] | urinieto/msaf | python | https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/algorithms/foote/segmenter.py#L55-L77 | [
"def",
"pick_peaks",
"(",
"nc",
",",
"L",
"=",
"16",
")",
":",
"offset",
"=",
"nc",
".",
"mean",
"(",
")",
"/",
"20.",
"nc",
"=",
"filters",
".",
"gaussian_filter1d",
"(",
"nc",
",",
"sigma",
"=",
"4",
")",
"# Smooth out nc",
"th",
"=",
"filters",
... | 9dbb57d77a1310465a65cc40f1641d083ca74385 |
test | Segmenter.processFlat | Main process.
Returns
-------
est_idxs : np.array(N)
Estimated indeces the segment boundaries in frames.
est_labels : np.array(N-1)
Estimated labels for the segments. | msaf/algorithms/foote/segmenter.py | def processFlat(self):
"""Main process.
Returns
-------
est_idxs : np.array(N)
Estimated indeces the segment boundaries in frames.
est_labels : np.array(N-1)
Estimated labels for the segments.
"""
# Preprocess to obtain features
F =... | def processFlat(self):
"""Main process.
Returns
-------
est_idxs : np.array(N)
Estimated indeces the segment boundaries in frames.
est_labels : np.array(N-1)
Estimated labels for the segments.
"""
# Preprocess to obtain features
F =... | [
"Main",
"process",
".",
"Returns",
"-------",
"est_idxs",
":",
"np",
".",
"array",
"(",
"N",
")",
"Estimated",
"indeces",
"the",
"segment",
"boundaries",
"in",
"frames",
".",
"est_labels",
":",
"np",
".",
"array",
"(",
"N",
"-",
"1",
")",
"Estimated",
... | urinieto/msaf | python | https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/algorithms/foote/segmenter.py#L89-L134 | [
"def",
"processFlat",
"(",
"self",
")",
":",
"# Preprocess to obtain features",
"F",
"=",
"self",
".",
"_preprocess",
"(",
")",
"# Normalize",
"F",
"=",
"msaf",
".",
"utils",
".",
"normalize",
"(",
"F",
",",
"norm_type",
"=",
"self",
".",
"config",
"[",
... | 9dbb57d77a1310465a65cc40f1641d083ca74385 |
test | SIVM_GSAT.factorize | Factorize s.t. WH = data
Parameters
----------
show_progress : bool
print some extra information to stdout.
niter : int
number of iterations.
compute_h : bool
iteratively update values for H.
... | msaf/pymf/sivm_gsat.py | def factorize(self, show_progress=False, compute_w=True, compute_h=True,
compute_err=True, niter=1):
""" Factorize s.t. WH = data
Parameters
----------
show_progress : bool
print some extra information to stdout.
niter : int
... | def factorize(self, show_progress=False, compute_w=True, compute_h=True,
compute_err=True, niter=1):
""" Factorize s.t. WH = data
Parameters
----------
show_progress : bool
print some extra information to stdout.
niter : int
... | [
"Factorize",
"s",
".",
"t",
".",
"WH",
"=",
"data"
] | urinieto/msaf | python | https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/pymf/sivm_gsat.py#L128-L180 | [
"def",
"factorize",
"(",
"self",
",",
"show_progress",
"=",
"False",
",",
"compute_w",
"=",
"True",
",",
"compute_h",
"=",
"True",
",",
"compute_err",
"=",
"True",
",",
"niter",
"=",
"1",
")",
":",
"if",
"show_progress",
":",
"self",
".",
"_logger",
".... | 9dbb57d77a1310465a65cc40f1641d083ca74385 |
test | gaussian_filter | Gaussian filter along the first axis of the feature matrix X. | msaf/algorithms/sf/segmenter.py | def gaussian_filter(X, M=8, axis=0):
"""Gaussian filter along the first axis of the feature matrix X."""
for i in range(X.shape[axis]):
if axis == 1:
X[:, i] = filters.gaussian_filter(X[:, i], sigma=M / 2.)
elif axis == 0:
X[i, :] = filters.gaussian_filter(X[i, :], sigma=... | def gaussian_filter(X, M=8, axis=0):
"""Gaussian filter along the first axis of the feature matrix X."""
for i in range(X.shape[axis]):
if axis == 1:
X[:, i] = filters.gaussian_filter(X[:, i], sigma=M / 2.)
elif axis == 0:
X[i, :] = filters.gaussian_filter(X[i, :], sigma=... | [
"Gaussian",
"filter",
"along",
"the",
"first",
"axis",
"of",
"the",
"feature",
"matrix",
"X",
"."
] | urinieto/msaf | python | https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/algorithms/sf/segmenter.py#L21-L28 | [
"def",
"gaussian_filter",
"(",
"X",
",",
"M",
"=",
"8",
",",
"axis",
"=",
"0",
")",
":",
"for",
"i",
"in",
"range",
"(",
"X",
".",
"shape",
"[",
"axis",
"]",
")",
":",
"if",
"axis",
"==",
"1",
":",
"X",
"[",
":",
",",
"i",
"]",
"=",
"filt... | 9dbb57d77a1310465a65cc40f1641d083ca74385 |
test | compute_nc | Computes the novelty curve from the structural features. | msaf/algorithms/sf/segmenter.py | def compute_nc(X):
"""Computes the novelty curve from the structural features."""
N = X.shape[0]
# nc = np.sum(np.diff(X, axis=0), axis=1) # Difference between SF's
nc = np.zeros(N)
for i in range(N - 1):
nc[i] = distance.euclidean(X[i, :], X[i + 1, :])
# Normalize
nc += np.abs(nc.... | def compute_nc(X):
"""Computes the novelty curve from the structural features."""
N = X.shape[0]
# nc = np.sum(np.diff(X, axis=0), axis=1) # Difference between SF's
nc = np.zeros(N)
for i in range(N - 1):
nc[i] = distance.euclidean(X[i, :], X[i + 1, :])
# Normalize
nc += np.abs(nc.... | [
"Computes",
"the",
"novelty",
"curve",
"from",
"the",
"structural",
"features",
"."
] | urinieto/msaf | python | https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/algorithms/sf/segmenter.py#L48-L60 | [
"def",
"compute_nc",
"(",
"X",
")",
":",
"N",
"=",
"X",
".",
"shape",
"[",
"0",
"]",
"# nc = np.sum(np.diff(X, axis=0), axis=1) # Difference between SF's",
"nc",
"=",
"np",
".",
"zeros",
"(",
"N",
")",
"for",
"i",
"in",
"range",
"(",
"N",
"-",
"1",
")",
... | 9dbb57d77a1310465a65cc40f1641d083ca74385 |
test | pick_peaks | Obtain peaks from a novelty curve using an adaptive threshold. | msaf/algorithms/sf/segmenter.py | def pick_peaks(nc, L=16, offset_denom=0.1):
"""Obtain peaks from a novelty curve using an adaptive threshold."""
offset = nc.mean() * float(offset_denom)
th = filters.median_filter(nc, size=L) + offset
#th = filters.gaussian_filter(nc, sigma=L/2., mode="nearest") + offset
#import pylab as plt
#p... | def pick_peaks(nc, L=16, offset_denom=0.1):
"""Obtain peaks from a novelty curve using an adaptive threshold."""
offset = nc.mean() * float(offset_denom)
th = filters.median_filter(nc, size=L) + offset
#th = filters.gaussian_filter(nc, sigma=L/2., mode="nearest") + offset
#import pylab as plt
#p... | [
"Obtain",
"peaks",
"from",
"a",
"novelty",
"curve",
"using",
"an",
"adaptive",
"threshold",
"."
] | urinieto/msaf | python | https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/algorithms/sf/segmenter.py#L63-L80 | [
"def",
"pick_peaks",
"(",
"nc",
",",
"L",
"=",
"16",
",",
"offset_denom",
"=",
"0.1",
")",
":",
"offset",
"=",
"nc",
".",
"mean",
"(",
")",
"*",
"float",
"(",
"offset_denom",
")",
"th",
"=",
"filters",
".",
"median_filter",
"(",
"nc",
",",
"size",
... | 9dbb57d77a1310465a65cc40f1641d083ca74385 |
test | circular_shift | Shifts circularly the X squre matrix in order to get a
time-lag matrix. | msaf/algorithms/sf/segmenter.py | def circular_shift(X):
"""Shifts circularly the X squre matrix in order to get a
time-lag matrix."""
N = X.shape[0]
L = np.zeros(X.shape)
for i in range(N):
L[i, :] = np.asarray([X[(i + j) % N, j] for j in range(N)])
return L | def circular_shift(X):
"""Shifts circularly the X squre matrix in order to get a
time-lag matrix."""
N = X.shape[0]
L = np.zeros(X.shape)
for i in range(N):
L[i, :] = np.asarray([X[(i + j) % N, j] for j in range(N)])
return L | [
"Shifts",
"circularly",
"the",
"X",
"squre",
"matrix",
"in",
"order",
"to",
"get",
"a",
"time",
"-",
"lag",
"matrix",
"."
] | urinieto/msaf | python | https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/algorithms/sf/segmenter.py#L83-L90 | [
"def",
"circular_shift",
"(",
"X",
")",
":",
"N",
"=",
"X",
".",
"shape",
"[",
"0",
"]",
"L",
"=",
"np",
".",
"zeros",
"(",
"X",
".",
"shape",
")",
"for",
"i",
"in",
"range",
"(",
"N",
")",
":",
"L",
"[",
"i",
",",
":",
"]",
"=",
"np",
... | 9dbb57d77a1310465a65cc40f1641d083ca74385 |
test | embedded_space | Time-delay embedding with m dimensions and tau delays. | msaf/algorithms/sf/segmenter.py | def embedded_space(X, m, tau=1):
"""Time-delay embedding with m dimensions and tau delays."""
N = X.shape[0] - int(np.ceil(m))
Y = np.zeros((N, int(np.ceil(X.shape[1] * m))))
for i in range(N):
# print X[i:i+m,:].flatten().shape, w, X.shape
# print Y[i,:].shape
rem = int((m % 1) ... | def embedded_space(X, m, tau=1):
"""Time-delay embedding with m dimensions and tau delays."""
N = X.shape[0] - int(np.ceil(m))
Y = np.zeros((N, int(np.ceil(X.shape[1] * m))))
for i in range(N):
# print X[i:i+m,:].flatten().shape, w, X.shape
# print Y[i,:].shape
rem = int((m % 1) ... | [
"Time",
"-",
"delay",
"embedding",
"with",
"m",
"dimensions",
"and",
"tau",
"delays",
"."
] | urinieto/msaf | python | https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/algorithms/sf/segmenter.py#L93-L103 | [
"def",
"embedded_space",
"(",
"X",
",",
"m",
",",
"tau",
"=",
"1",
")",
":",
"N",
"=",
"X",
".",
"shape",
"[",
"0",
"]",
"-",
"int",
"(",
"np",
".",
"ceil",
"(",
"m",
")",
")",
"Y",
"=",
"np",
".",
"zeros",
"(",
"(",
"N",
",",
"int",
"(... | 9dbb57d77a1310465a65cc40f1641d083ca74385 |
test | Segmenter.processFlat | Main process.
Returns
-------
est_idxs : np.array(N)
Estimated times for the segment boundaries in frame indeces.
est_labels : np.array(N-1)
Estimated labels for the segments. | msaf/algorithms/sf/segmenter.py | def processFlat(self):
"""Main process.
Returns
-------
est_idxs : np.array(N)
Estimated times for the segment boundaries in frame indeces.
est_labels : np.array(N-1)
Estimated labels for the segments.
"""
# Structural Features params
... | def processFlat(self):
"""Main process.
Returns
-------
est_idxs : np.array(N)
Estimated times for the segment boundaries in frame indeces.
est_labels : np.array(N-1)
Estimated labels for the segments.
"""
# Structural Features params
... | [
"Main",
"process",
".",
"Returns",
"-------",
"est_idxs",
":",
"np",
".",
"array",
"(",
"N",
")",
"Estimated",
"times",
"for",
"the",
"segment",
"boundaries",
"in",
"frame",
"indeces",
".",
"est_labels",
":",
"np",
".",
"array",
"(",
"N",
"-",
"1",
")"... | urinieto/msaf | python | https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/algorithms/sf/segmenter.py#L116-L209 | [
"def",
"processFlat",
"(",
"self",
")",
":",
"# Structural Features params",
"Mp",
"=",
"self",
".",
"config",
"[",
"\"Mp_adaptive\"",
"]",
"# Size of the adaptive threshold for",
"# peak picking",
"od",
"=",
"self",
".",
"config",
"[",
"\"offset_thres\"",
"]",
"# O... | 9dbb57d77a1310465a65cc40f1641d083ca74385 |
test | _plot_formatting | Formats the plot with the correct axis labels, title, ticks, and
so on. | msaf/plotting.py | def _plot_formatting(title, est_file, algo_ids, last_bound, N, output_file):
"""Formats the plot with the correct axis labels, title, ticks, and
so on."""
import matplotlib.pyplot as plt
if title is None:
title = os.path.basename(est_file).split(".")[0]
plt.title(title)
plt.yticks(np.ara... | def _plot_formatting(title, est_file, algo_ids, last_bound, N, output_file):
"""Formats the plot with the correct axis labels, title, ticks, and
so on."""
import matplotlib.pyplot as plt
if title is None:
title = os.path.basename(est_file).split(".")[0]
plt.title(title)
plt.yticks(np.ara... | [
"Formats",
"the",
"plot",
"with",
"the",
"correct",
"axis",
"labels",
"title",
"ticks",
"and",
"so",
"on",
"."
] | urinieto/msaf | python | https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/plotting.py#L28-L43 | [
"def",
"_plot_formatting",
"(",
"title",
",",
"est_file",
",",
"algo_ids",
",",
"last_bound",
",",
"N",
",",
"output_file",
")",
":",
"import",
"matplotlib",
".",
"pyplot",
"as",
"plt",
"if",
"title",
"is",
"None",
":",
"title",
"=",
"os",
".",
"path",
... | 9dbb57d77a1310465a65cc40f1641d083ca74385 |
test | plot_boundaries | Plots all the boundaries.
Parameters
----------
all_boundaries: list
A list of np.arrays containing the times of the boundaries, one array
for each algorithm.
est_file: str
Path to the estimated file (JSON file)
algo_ids : list
List of algorithm ids to to read bounda... | msaf/plotting.py | def plot_boundaries(all_boundaries, est_file, algo_ids=None, title=None,
output_file=None):
"""Plots all the boundaries.
Parameters
----------
all_boundaries: list
A list of np.arrays containing the times of the boundaries, one array
for each algorithm.
est_file:... | def plot_boundaries(all_boundaries, est_file, algo_ids=None, title=None,
output_file=None):
"""Plots all the boundaries.
Parameters
----------
all_boundaries: list
A list of np.arrays containing the times of the boundaries, one array
for each algorithm.
est_file:... | [
"Plots",
"all",
"the",
"boundaries",
"."
] | urinieto/msaf | python | https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/plotting.py#L46-L85 | [
"def",
"plot_boundaries",
"(",
"all_boundaries",
",",
"est_file",
",",
"algo_ids",
"=",
"None",
",",
"title",
"=",
"None",
",",
"output_file",
"=",
"None",
")",
":",
"import",
"matplotlib",
".",
"pyplot",
"as",
"plt",
"N",
"=",
"len",
"(",
"all_boundaries"... | 9dbb57d77a1310465a65cc40f1641d083ca74385 |
test | plot_labels | Plots all the labels.
Parameters
----------
all_labels: list
A list of np.arrays containing the labels of the boundaries, one array
for each algorithm.
gt_times: np.array
Array with the ground truth boundaries.
est_file: str
Path to the estimated file (JSON file)
... | msaf/plotting.py | def plot_labels(all_labels, gt_times, est_file, algo_ids=None, title=None,
output_file=None):
"""Plots all the labels.
Parameters
----------
all_labels: list
A list of np.arrays containing the labels of the boundaries, one array
for each algorithm.
gt_times: np.array... | def plot_labels(all_labels, gt_times, est_file, algo_ids=None, title=None,
output_file=None):
"""Plots all the labels.
Parameters
----------
all_labels: list
A list of np.arrays containing the labels of the boundaries, one array
for each algorithm.
gt_times: np.array... | [
"Plots",
"all",
"the",
"labels",
"."
] | urinieto/msaf | python | https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/plotting.py#L88-L144 | [
"def",
"plot_labels",
"(",
"all_labels",
",",
"gt_times",
",",
"est_file",
",",
"algo_ids",
"=",
"None",
",",
"title",
"=",
"None",
",",
"output_file",
"=",
"None",
")",
":",
"import",
"matplotlib",
".",
"pyplot",
"as",
"plt",
"N",
"=",
"len",
"(",
"al... | 9dbb57d77a1310465a65cc40f1641d083ca74385 |
test | plot_one_track | Plots the results of one track, with ground truth if it exists. | msaf/plotting.py | def plot_one_track(file_struct, est_times, est_labels, boundaries_id, labels_id,
title=None):
"""Plots the results of one track, with ground truth if it exists."""
import matplotlib.pyplot as plt
# Set up the boundaries id
bid_lid = boundaries_id
if labels_id is not None:
... | def plot_one_track(file_struct, est_times, est_labels, boundaries_id, labels_id,
title=None):
"""Plots the results of one track, with ground truth if it exists."""
import matplotlib.pyplot as plt
# Set up the boundaries id
bid_lid = boundaries_id
if labels_id is not None:
... | [
"Plots",
"the",
"results",
"of",
"one",
"track",
"with",
"ground",
"truth",
"if",
"it",
"exists",
"."
] | urinieto/msaf | python | https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/plotting.py#L147-L202 | [
"def",
"plot_one_track",
"(",
"file_struct",
",",
"est_times",
",",
"est_labels",
",",
"boundaries_id",
",",
"labels_id",
",",
"title",
"=",
"None",
")",
":",
"import",
"matplotlib",
".",
"pyplot",
"as",
"plt",
"# Set up the boundaries id",
"bid_lid",
"=",
"boun... | 9dbb57d77a1310465a65cc40f1641d083ca74385 |
test | plot_tree | Plots a given tree, containing hierarchical segmentation.
Parameters
----------
T: mir_eval.segment.tree
A tree object containing the hierarchical segmentation.
res: float
Frame-rate resolution of the tree (None to use seconds).
title: str
Title for the plot. `None` for no t... | msaf/plotting.py | def plot_tree(T, res=None, title=None, cmap_id="Pastel2"):
"""Plots a given tree, containing hierarchical segmentation.
Parameters
----------
T: mir_eval.segment.tree
A tree object containing the hierarchical segmentation.
res: float
Frame-rate resolution of the tree (None to use se... | def plot_tree(T, res=None, title=None, cmap_id="Pastel2"):
"""Plots a given tree, containing hierarchical segmentation.
Parameters
----------
T: mir_eval.segment.tree
A tree object containing the hierarchical segmentation.
res: float
Frame-rate resolution of the tree (None to use se... | [
"Plots",
"a",
"given",
"tree",
"containing",
"hierarchical",
"segmentation",
"."
] | urinieto/msaf | python | https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/plotting.py#L205-L262 | [
"def",
"plot_tree",
"(",
"T",
",",
"res",
"=",
"None",
",",
"title",
"=",
"None",
",",
"cmap_id",
"=",
"\"Pastel2\"",
")",
":",
"import",
"matplotlib",
".",
"pyplot",
"as",
"plt",
"def",
"round_time",
"(",
"t",
",",
"res",
"=",
"0.1",
")",
":",
"v"... | 9dbb57d77a1310465a65cc40f1641d083ca74385 |
test | get_feat_segments | Returns a set of segments defined by the bound_idxs.
Parameters
----------
F: np.ndarray
Matrix containing the features, one feature vector per row.
bound_idxs: np.ndarray
Array with boundary indeces.
Returns
-------
feat_segments: list
List of segments, one for eac... | msaf/algorithms/fmc2d/segmenter.py | def get_feat_segments(F, bound_idxs):
"""Returns a set of segments defined by the bound_idxs.
Parameters
----------
F: np.ndarray
Matrix containing the features, one feature vector per row.
bound_idxs: np.ndarray
Array with boundary indeces.
Returns
-------
feat_segment... | def get_feat_segments(F, bound_idxs):
"""Returns a set of segments defined by the bound_idxs.
Parameters
----------
F: np.ndarray
Matrix containing the features, one feature vector per row.
bound_idxs: np.ndarray
Array with boundary indeces.
Returns
-------
feat_segment... | [
"Returns",
"a",
"set",
"of",
"segments",
"defined",
"by",
"the",
"bound_idxs",
"."
] | urinieto/msaf | python | https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/algorithms/fmc2d/segmenter.py#L17-L46 | [
"def",
"get_feat_segments",
"(",
"F",
",",
"bound_idxs",
")",
":",
"# Make sure bound_idxs are not empty",
"assert",
"len",
"(",
"bound_idxs",
")",
">",
"0",
",",
"\"Boundaries can't be empty\"",
"# Make sure that boundaries are sorted",
"bound_idxs",
"=",
"np",
".",
"s... | 9dbb57d77a1310465a65cc40f1641d083ca74385 |
test | feat_segments_to_2dfmc_max | From a list of feature segments, return a list of 2D-Fourier Magnitude
Coefs using the maximum segment size as main size and zero pad the rest.
Parameters
----------
feat_segments: list
List of segments, one for each boundary interval.
offset: int >= 0
Number of frames to ignore fro... | msaf/algorithms/fmc2d/segmenter.py | def feat_segments_to_2dfmc_max(feat_segments, offset=4):
"""From a list of feature segments, return a list of 2D-Fourier Magnitude
Coefs using the maximum segment size as main size and zero pad the rest.
Parameters
----------
feat_segments: list
List of segments, one for each boundary inter... | def feat_segments_to_2dfmc_max(feat_segments, offset=4):
"""From a list of feature segments, return a list of 2D-Fourier Magnitude
Coefs using the maximum segment size as main size and zero pad the rest.
Parameters
----------
feat_segments: list
List of segments, one for each boundary inter... | [
"From",
"a",
"list",
"of",
"feature",
"segments",
"return",
"a",
"list",
"of",
"2D",
"-",
"Fourier",
"Magnitude",
"Coefs",
"using",
"the",
"maximum",
"segment",
"size",
"as",
"main",
"size",
"and",
"zero",
"pad",
"the",
"rest",
"."
] | urinieto/msaf | python | https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/algorithms/fmc2d/segmenter.py#L49-L93 | [
"def",
"feat_segments_to_2dfmc_max",
"(",
"feat_segments",
",",
"offset",
"=",
"4",
")",
":",
"if",
"len",
"(",
"feat_segments",
")",
"==",
"0",
":",
"return",
"[",
"]",
"# Get maximum segment size",
"max_len",
"=",
"max",
"(",
"[",
"feat_segment",
".",
"sha... | 9dbb57d77a1310465a65cc40f1641d083ca74385 |
test | compute_similarity | Main function to compute the segment similarity of file file_struct.
Parameters
----------
F: np.ndarray
Matrix containing one feature vector per row.
bound_idxs: np.ndarray
Array with the indeces of the segment boundaries.
dirichlet: boolean
Whether to use the dirichlet est... | msaf/algorithms/fmc2d/segmenter.py | def compute_similarity(F, bound_idxs, dirichlet=False, xmeans=False, k=5,
offset=4):
"""Main function to compute the segment similarity of file file_struct.
Parameters
----------
F: np.ndarray
Matrix containing one feature vector per row.
bound_idxs: np.ndarray
... | def compute_similarity(F, bound_idxs, dirichlet=False, xmeans=False, k=5,
offset=4):
"""Main function to compute the segment similarity of file file_struct.
Parameters
----------
F: np.ndarray
Matrix containing one feature vector per row.
bound_idxs: np.ndarray
... | [
"Main",
"function",
"to",
"compute",
"the",
"segment",
"similarity",
"of",
"file",
"file_struct",
"."
] | urinieto/msaf | python | https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/algorithms/fmc2d/segmenter.py#L115-L168 | [
"def",
"compute_similarity",
"(",
"F",
",",
"bound_idxs",
",",
"dirichlet",
"=",
"False",
",",
"xmeans",
"=",
"False",
",",
"k",
"=",
"5",
",",
"offset",
"=",
"4",
")",
":",
"# Get the feature segments",
"feat_segments",
"=",
"get_feat_segments",
"(",
"F",
... | 9dbb57d77a1310465a65cc40f1641d083ca74385 |
test | Segmenter.processFlat | Main process.
Returns
-------
est_idx : np.array(N)
Estimated indeces for the segment boundaries in frames.
est_labels : np.array(N-1)
Estimated labels for the segments. | msaf/algorithms/fmc2d/segmenter.py | def processFlat(self):
"""Main process.
Returns
-------
est_idx : np.array(N)
Estimated indeces for the segment boundaries in frames.
est_labels : np.array(N-1)
Estimated labels for the segments.
"""
# Preprocess to obtain features, times, ... | def processFlat(self):
"""Main process.
Returns
-------
est_idx : np.array(N)
Estimated indeces for the segment boundaries in frames.
est_labels : np.array(N-1)
Estimated labels for the segments.
"""
# Preprocess to obtain features, times, ... | [
"Main",
"process",
".",
"Returns",
"-------",
"est_idx",
":",
"np",
".",
"array",
"(",
"N",
")",
"Estimated",
"indeces",
"for",
"the",
"segment",
"boundaries",
"in",
"frames",
".",
"est_labels",
":",
"np",
".",
"array",
"(",
"N",
"-",
"1",
")",
"Estima... | urinieto/msaf | python | https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/algorithms/fmc2d/segmenter.py#L181-L209 | [
"def",
"processFlat",
"(",
"self",
")",
":",
"# Preprocess to obtain features, times, and input boundary indeces",
"F",
"=",
"self",
".",
"_preprocess",
"(",
")",
"# Normalize",
"F",
"=",
"U",
".",
"normalize",
"(",
"F",
",",
"norm_type",
"=",
"self",
".",
"conf... | 9dbb57d77a1310465a65cc40f1641d083ca74385 |
test | OLDA.fit | Fit the OLDA model
Parameters
----------
X : array-like, shape [n_samples]
Training data: each example is an n_features-by-* data array
Y : array-like, shape [n_samples]
Training labels: each label is an array of change-points
(eg, a... | msaf/algorithms/olda/OLDA.py | def fit(self, X, Y):
'''Fit the OLDA model
Parameters
----------
X : array-like, shape [n_samples]
Training data: each example is an n_features-by-* data array
Y : array-like, shape [n_samples]
Training labels: each label is an array of change-points
... | def fit(self, X, Y):
'''Fit the OLDA model
Parameters
----------
X : array-like, shape [n_samples]
Training data: each example is an n_features-by-* data array
Y : array-like, shape [n_samples]
Training labels: each label is an array of change-points
... | [
"Fit",
"the",
"OLDA",
"model"
] | urinieto/msaf | python | https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/algorithms/olda/OLDA.py#L26-L50 | [
"def",
"fit",
"(",
"self",
",",
"X",
",",
"Y",
")",
":",
"# Re-initialize the scatter matrices",
"self",
".",
"scatter_ordinal_",
"=",
"None",
"self",
".",
"scatter_within_",
"=",
"None",
"# Reduce to partial-fit",
"self",
".",
"partial_fit",
"(",
"X",
",",
"Y... | 9dbb57d77a1310465a65cc40f1641d083ca74385 |
test | OLDA.partial_fit | Partial-fit the OLDA model
Parameters
----------
X : array-like, shape [n_samples]
Training data: each example is an n_features-by-* data array
Y : array-like, shape [n_samples]
Training labels: each label is an array of change-points
... | msaf/algorithms/olda/OLDA.py | def partial_fit(self, X, Y):
'''Partial-fit the OLDA model
Parameters
----------
X : array-like, shape [n_samples]
Training data: each example is an n_features-by-* data array
Y : array-like, shape [n_samples]
Training labels: each label is an array of c... | def partial_fit(self, X, Y):
'''Partial-fit the OLDA model
Parameters
----------
X : array-like, shape [n_samples]
Training data: each example is an n_features-by-* data array
Y : array-like, shape [n_samples]
Training labels: each label is an array of c... | [
"Partial",
"-",
"fit",
"the",
"OLDA",
"model"
] | urinieto/msaf | python | https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/algorithms/olda/OLDA.py#L52-L114 | [
"def",
"partial_fit",
"(",
"self",
",",
"X",
",",
"Y",
")",
":",
"for",
"(",
"xi",
",",
"yi",
")",
"in",
"itertools",
".",
"izip",
"(",
"X",
",",
"Y",
")",
":",
"prev_mean",
"=",
"None",
"prev_length",
"=",
"None",
"if",
"self",
".",
"scatter_wit... | 9dbb57d77a1310465a65cc40f1641d083ca74385 |
test | CQT.compute_features | Actual implementation of the features.
Returns
-------
cqt: np.array(N, F)
The features, each row representing a feature vector for a give
time frame/beat. | msaf/features.py | def compute_features(self):
"""Actual implementation of the features.
Returns
-------
cqt: np.array(N, F)
The features, each row representing a feature vector for a give
time frame/beat.
"""
linear_cqt = np.abs(librosa.cqt(
self._audio... | def compute_features(self):
"""Actual implementation of the features.
Returns
-------
cqt: np.array(N, F)
The features, each row representing a feature vector for a give
time frame/beat.
"""
linear_cqt = np.abs(librosa.cqt(
self._audio... | [
"Actual",
"implementation",
"of",
"the",
"features",
"."
] | urinieto/msaf | python | https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/features.py#L82-L96 | [
"def",
"compute_features",
"(",
"self",
")",
":",
"linear_cqt",
"=",
"np",
".",
"abs",
"(",
"librosa",
".",
"cqt",
"(",
"self",
".",
"_audio",
",",
"sr",
"=",
"self",
".",
"sr",
",",
"hop_length",
"=",
"self",
".",
"hop_length",
",",
"n_bins",
"=",
... | 9dbb57d77a1310465a65cc40f1641d083ca74385 |
test | MFCC.compute_features | Actual implementation of the features.
Returns
-------
mfcc: np.array(N, F)
The features, each row representing a feature vector for a give
time frame/beat. | msaf/features.py | def compute_features(self):
"""Actual implementation of the features.
Returns
-------
mfcc: np.array(N, F)
The features, each row representing a feature vector for a give
time frame/beat.
"""
S = librosa.feature.melspectrogram(self._audio,
... | def compute_features(self):
"""Actual implementation of the features.
Returns
-------
mfcc: np.array(N, F)
The features, each row representing a feature vector for a give
time frame/beat.
"""
S = librosa.feature.melspectrogram(self._audio,
... | [
"Actual",
"implementation",
"of",
"the",
"features",
"."
] | urinieto/msaf | python | https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/features.py#L152-L168 | [
"def",
"compute_features",
"(",
"self",
")",
":",
"S",
"=",
"librosa",
".",
"feature",
".",
"melspectrogram",
"(",
"self",
".",
"_audio",
",",
"sr",
"=",
"self",
".",
"sr",
",",
"n_fft",
"=",
"self",
".",
"n_fft",
",",
"hop_length",
"=",
"self",
".",... | 9dbb57d77a1310465a65cc40f1641d083ca74385 |
test | PCP.compute_features | Actual implementation of the features.
Returns
-------
pcp: np.array(N, F)
The features, each row representing a feature vector for a give
time frame/beat. | msaf/features.py | def compute_features(self):
"""Actual implementation of the features.
Returns
-------
pcp: np.array(N, F)
The features, each row representing a feature vector for a give
time frame/beat.
"""
audio_harmonic, _ = self.compute_HPSS()
pcp_cqt ... | def compute_features(self):
"""Actual implementation of the features.
Returns
-------
pcp: np.array(N, F)
The features, each row representing a feature vector for a give
time frame/beat.
"""
audio_harmonic, _ = self.compute_HPSS()
pcp_cqt ... | [
"Actual",
"implementation",
"of",
"the",
"features",
"."
] | urinieto/msaf | python | https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/features.py#L216-L237 | [
"def",
"compute_features",
"(",
"self",
")",
":",
"audio_harmonic",
",",
"_",
"=",
"self",
".",
"compute_HPSS",
"(",
")",
"pcp_cqt",
"=",
"np",
".",
"abs",
"(",
"librosa",
".",
"hybrid_cqt",
"(",
"audio_harmonic",
",",
"sr",
"=",
"self",
".",
"sr",
","... | 9dbb57d77a1310465a65cc40f1641d083ca74385 |
test | Tonnetz.compute_features | Actual implementation of the features.
Returns
-------
tonnetz: np.array(N, F)
The features, each row representing a feature vector for a give
time frame/beat. | msaf/features.py | def compute_features(self):
"""Actual implementation of the features.
Returns
-------
tonnetz: np.array(N, F)
The features, each row representing a feature vector for a give
time frame/beat.
"""
pcp = PCP(self.file_struct, self.feat_type, self.sr,... | def compute_features(self):
"""Actual implementation of the features.
Returns
-------
tonnetz: np.array(N, F)
The features, each row representing a feature vector for a give
time frame/beat.
"""
pcp = PCP(self.file_struct, self.feat_type, self.sr,... | [
"Actual",
"implementation",
"of",
"the",
"features",
"."
] | urinieto/msaf | python | https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/features.py#L286-L298 | [
"def",
"compute_features",
"(",
"self",
")",
":",
"pcp",
"=",
"PCP",
"(",
"self",
".",
"file_struct",
",",
"self",
".",
"feat_type",
",",
"self",
".",
"sr",
",",
"self",
".",
"hop_length",
",",
"self",
".",
"n_bins",
",",
"self",
".",
"norm",
",",
... | 9dbb57d77a1310465a65cc40f1641d083ca74385 |
test | Tempogram.compute_features | Actual implementation of the features.
Returns
-------
tempogram: np.array(N, F)
The features, each row representing a feature vector for a give
time frame/beat. | msaf/features.py | def compute_features(self):
"""Actual implementation of the features.
Returns
-------
tempogram: np.array(N, F)
The features, each row representing a feature vector for a give
time frame/beat.
"""
return librosa.feature.tempogram(self._audio, sr=s... | def compute_features(self):
"""Actual implementation of the features.
Returns
-------
tempogram: np.array(N, F)
The features, each row representing a feature vector for a give
time frame/beat.
"""
return librosa.feature.tempogram(self._audio, sr=s... | [
"Actual",
"implementation",
"of",
"the",
"features",
"."
] | urinieto/msaf | python | https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/features.py#L336-L347 | [
"def",
"compute_features",
"(",
"self",
")",
":",
"return",
"librosa",
".",
"feature",
".",
"tempogram",
"(",
"self",
".",
"_audio",
",",
"sr",
"=",
"self",
".",
"sr",
",",
"hop_length",
"=",
"self",
".",
"hop_length",
",",
"win_length",
"=",
"self",
"... | 9dbb57d77a1310465a65cc40f1641d083ca74385 |
test | read_estimations | Reads the estimations (boundaries and/or labels) from a jams file
containing the estimations of an algorithm.
Parameters
----------
est_file : str
Path to the estimated file (JAMS file).
boundaries_id : str
Identifier of the algorithm used to compute the boundaries.
labels_id : ... | msaf/input_output.py | def read_estimations(est_file, boundaries_id, labels_id=None, **params):
"""Reads the estimations (boundaries and/or labels) from a jams file
containing the estimations of an algorithm.
Parameters
----------
est_file : str
Path to the estimated file (JAMS file).
boundaries_id : str
... | def read_estimations(est_file, boundaries_id, labels_id=None, **params):
"""Reads the estimations (boundaries and/or labels) from a jams file
containing the estimations of an algorithm.
Parameters
----------
est_file : str
Path to the estimated file (JAMS file).
boundaries_id : str
... | [
"Reads",
"the",
"estimations",
"(",
"boundaries",
"and",
"/",
"or",
"labels",
")",
"from",
"a",
"jams",
"file",
"containing",
"the",
"estimations",
"of",
"an",
"algorithm",
"."
] | urinieto/msaf | python | https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/input_output.py#L53-L101 | [
"def",
"read_estimations",
"(",
"est_file",
",",
"boundaries_id",
",",
"labels_id",
"=",
"None",
",",
"*",
"*",
"params",
")",
":",
"# Open file and read jams",
"jam",
"=",
"jams",
".",
"load",
"(",
"est_file",
")",
"# Find correct estimation",
"est",
"=",
"fi... | 9dbb57d77a1310465a65cc40f1641d083ca74385 |
test | read_references | Reads the boundary times and the labels.
Parameters
----------
audio_path : str
Path to the audio file
Returns
-------
ref_times : list
List of boundary times
ref_labels : list
List of labels
Raises
------
IOError: if `audio_path` doesn't exist. | msaf/input_output.py | def read_references(audio_path, annotator_id=0):
"""Reads the boundary times and the labels.
Parameters
----------
audio_path : str
Path to the audio file
Returns
-------
ref_times : list
List of boundary times
ref_labels : list
List of labels
Raises
--... | def read_references(audio_path, annotator_id=0):
"""Reads the boundary times and the labels.
Parameters
----------
audio_path : str
Path to the audio file
Returns
-------
ref_times : list
List of boundary times
ref_labels : list
List of labels
Raises
--... | [
"Reads",
"the",
"boundary",
"times",
"and",
"the",
"labels",
"."
] | urinieto/msaf | python | https://github.com/urinieto/msaf/blob/9dbb57d77a1310465a65cc40f1641d083ca74385/msaf/input_output.py#L104-L138 | [
"def",
"read_references",
"(",
"audio_path",
",",
"annotator_id",
"=",
"0",
")",
":",
"# Dataset path",
"ds_path",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"audio_path",
")",
")",
"# Read references",
"jam_path",
... | 9dbb57d77a1310465a65cc40f1641d083ca74385 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.