Skip to content

Commit

Permalink
added manifest information to the nextflow.config file to allow for…
Browse files Browse the repository at this point in the history
… remote execution (#204) - Partial solve to #194 issue

- Deprecation of the `manifest.config´ file
- Add the manifest information to the `nextflow.config` file
  • Loading branch information
cimendes committed Jun 11, 2019
1 parent e9ea39f commit a50e0ae
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 40 deletions.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
- `Concoct`: Clustering metagenomic assembled comtigs with coverage and composition
- `MetaBAT2`: A robust statistical framework for reconstructing genomes from metagenomic data

### Minor/Other changes

- added manifest information to the `nextflow.config` file to allow for remote execution

## 1.4.1

### New features
Expand Down
4 changes: 0 additions & 4 deletions flowcraft/flowcraft.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,6 @@ def copy_project(path):
# Copy bin scripts
copy_tree(join(repo_dir, "bin"), join(target_dir, "bin"))

# Copy default config file
shutil.copy(join(repo_dir, "nextflow.config"),
join(target_dir, "nextflow.config"))

# Copy static profiles file
shutil.copy(join(repo_dir, "profiles.config"),
join(target_dir, "profiles.config"))
Expand Down
39 changes: 10 additions & 29 deletions flowcraft/generator/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,10 @@ class of the component.
See :func:`NextflowGenerator._get_params_string`
"""

self.manifest = ""
self.config = ""
"""
str: Stores de manifest directives string for the nextflow pipeline.
See :func:`NextflowGenerator._get_manifest_string`
str: Stores de configuration for the nextflow pipeline.
See :func:`NextflowGenerator._get_config_string`
"""

self.user_config = ""
Expand Down Expand Up @@ -1234,24 +1234,6 @@ def _get_merged_params_help(self):

return help_list

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 += '\n\tname = "{}"'.format(self.pipeline_name)
config_str += '\n\tmainScript = "{}"'.format(self.nf_file)

return config_str


@staticmethod
def _render_config(template, context):

Expand All @@ -1277,7 +1259,7 @@ def _set_configurations(self):
resources = ""
containers = ""
params = ""
manifest = ""
config = ""

if self.merge_params:
params += self._get_merged_params_string()
Expand All @@ -1297,8 +1279,6 @@ def _set_configurations(self):
resources += self._get_resources_string(p.directives, p.pid)
containers += self._get_container_string(p.directives, p.pid)

manifest = self._get_manifest_string()

self.resources = self._render_config("resources.config", {
"process_info": resources
})
Expand All @@ -1308,8 +1288,9 @@ def _set_configurations(self):
self.params = self._render_config("params.config", {
"params_info": params
})
self.manifest = self._render_config("manifest.config", {
"manifest_info": manifest
self.config = self._render_config("nextflow.config", {
"pipeline_name": self.pipeline_name,
"nf_file": self.nf_file
})
self.help = self._render_config("Helper.groovy", {
"nf_file": basename(self.nf_file),
Expand Down Expand Up @@ -1426,9 +1407,9 @@ def write_configs(self, project_root):
with open(join(project_root, "params.config"), "w") as fh:
fh.write(self.params)

# Write manifest config
with open(join(project_root, "manifest.config"), "w") as fh:
fh.write(self.manifest)
# Write nextflow config
with open(join(project_root, "nextflow.config"), "w") as fh:
fh.write(self.config)

# Write user config if not present in the project directory
if not exists(join(project_root, "user.config")):
Expand Down
5 changes: 0 additions & 5 deletions flowcraft/generator/templates/manifest.config

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
manifest {
name = "{{ pipeline_name }}"
mainScript = "{{ nf_file }}"
}

params {
platformHTTP = null
reportHTTP = null
Expand Down Expand Up @@ -172,5 +177,4 @@ includeConfig "profiles.config"
includeConfig "resources.config"
includeConfig "containers.config"
includeConfig "params.config"
includeConfig "manifest.config"
includeConfig "user.config"
2 changes: 1 addition & 1 deletion flowcraft/tests/test_assemblerflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def test_build_file_2(tmp):

assert sorted(os.listdir(tmp)) == [".forkTree.json", ".treeDag.json",
"containers.config",
"lib", "manifest.config", "params.config",
"lib", "nextflow.config", "params.config",
"resources.config", "teste.html",
"teste.nf", "user.config"]

Expand Down

0 comments on commit a50e0ae

Please sign in to comment.