MCPcopy Create free account
hub / github.com/assemblerflow/flowcraft / build

Method build

flowcraft/generator/engine.py:1589–1643  ·  view source on GitHub ↗

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 ch

(self)

Source from the content-addressed store, hash-verified

1587 terminal_width + 3))
1588
1589 def build(self):
1590 """Main pipeline builder
1591
1592 This method is responsible for building the
1593 :py:attr:`NextflowGenerator.template` attribute that will contain
1594 the nextflow code of the pipeline.
1595
1596 First it builds the header, then sets the main channels, the
1597 secondary inputs, secondary channels and finally the
1598 status channels. When the pipeline is built, is writes the code
1599 to a nextflow file.
1600 """
1601
1602 logger.info(colored_print(
1603 "\tSuccessfully connected {} process(es) with {} "
1604 "fork(s) across {} lane(s) \u2713".format(
1605 len(self.processes[1:]), len(self._fork_tree), self.lanes)))
1606
1607 # Generate regular nextflow header that sets up the shebang, imports
1608 # and all possible initial channels
1609 self._build_header()
1610
1611 self._set_channels()
1612
1613 self._set_init_process()
1614
1615 self._set_secondary_channels()
1616
1617 logger.info(colored_print(
1618 "\tSuccessfully set {} secondary channel(s) \u2713".format(
1619 len(self.secondary_channels))))
1620
1621 self._set_compiler_channels()
1622
1623 self._set_configurations()
1624
1625 logger.info(colored_print(
1626 "\tFinished configurations \u2713"))
1627
1628 for p in self.processes:
1629 self.template += "\n{}".format(p.template_str)
1630
1631 self._build_footer()
1632
1633 project_root = dirname(self.nf_file)
1634
1635 # Write configs
1636 self.write_configs(project_root)
1637
1638 # Write pipeline file
1639 with open(self.nf_file, "w") as fh:
1640 fh.write(self.template)
1641
1642 logger.info(colored_print(
1643 "\tPipeline written into {} \u2713".format(self.nf_file)))

Callers 8

buildFunction · 0.95
test_checkFunction · 0.80
test_check_invalidFunction · 0.80
test_build_fileFunction · 0.80
test_build_file_2Function · 0.80
test_build_recipeFunction · 0.80
test_buildFunction · 0.80

Calls 9

_build_headerMethod · 0.95
_set_channelsMethod · 0.95
_set_init_processMethod · 0.95
_set_configurationsMethod · 0.95
_build_footerMethod · 0.95
write_configsMethod · 0.95
colored_printFunction · 0.90

Tested by 7

test_checkFunction · 0.64
test_check_invalidFunction · 0.64
test_build_fileFunction · 0.64
test_build_file_2Function · 0.64
test_build_recipeFunction · 0.64
test_buildFunction · 0.64