|
| 1 | +Recipe creation guidelines |
| 2 | +=========================== |
| 3 | + |
| 4 | +Recipes are pre-made pipeline strings that may be associated with specific |
| 5 | +parameters and directives and are used to rapidly build a certain type of |
| 6 | +pipeline. |
| 7 | + |
| 8 | +Instead of building a pipeline like:: |
| 9 | + |
| 10 | + -t "integrity_coverage fastqc_trimmomatic fastqc spades pilon" |
| 11 | + |
| 12 | +The user simply can specific a recipe with that pipeline:: |
| 13 | + |
| 14 | + -r assembly |
| 15 | + |
| 16 | +Recipe creation |
| 17 | +--------------- |
| 18 | + |
| 19 | +The creation of new recipes is a very simple and straightforward process. |
| 20 | +You need to create a new file in the ``flowcraft/generator/recipes`` folder |
| 21 | +with any name and create a basic class with three attributes:: |
| 22 | + |
| 23 | + try: |
| 24 | + from generator.recipe import Recipe |
| 25 | + except ImportError: |
| 26 | + from flowcraft.generator.recipe import Recipe |
| 27 | + |
| 28 | + |
| 29 | + class Innuca(Recipe): |
| 30 | + |
| 31 | + def __init__(self): |
| 32 | + super().__init__() |
| 33 | + |
| 34 | + # Recipe name |
| 35 | + self.name = "innuca" |
| 36 | + |
| 37 | + # Recipe pipeline |
| 38 | + self.pipeline_str = <pipeline string> |
| 39 | + |
| 40 | + # Recipe parameters and directives |
| 41 | + self.directives = { <directives> } |
| 42 | + |
| 43 | +And that's it! Now there is a new recipe available with the ``innuca`` name and |
| 44 | +we can build this pipeline using the option ``-r innuca``. |
| 45 | + |
| 46 | +Name |
| 47 | +^^^^ |
| 48 | + |
| 49 | +This is the name of the recipe, which is used to make a match with the recipe |
| 50 | +name provided by the user via the ``-r`` option. |
| 51 | + |
| 52 | +Pipeline_str |
| 53 | +^^^^^^^^^^^^ |
| 54 | + |
| 55 | +The pipeline string as if provided via the ``-t`` option. |
| 56 | + |
| 57 | +Directives |
| 58 | +^^^^^^^^^^ |
| 59 | + |
| 60 | +A dictionary containing the parameters and directives for each process in the |
| 61 | +pipeline string. **Setting this attribute is optional and components |
| 62 | +that are not specified here will assume their default values**. In general, each |
| 63 | +element in this dictionary should have the following format:: |
| 64 | + |
| 65 | + self.directives = { |
| 66 | + "component_name": { |
| 67 | + "params": { |
| 68 | + "paramA": "value" |
| 69 | + }, |
| 70 | + "directives": { |
| 71 | + "directiveA": "value" |
| 72 | + } |
| 73 | + } |
| 74 | + } |
| 75 | + |
| 76 | +This will set the provided parameters and directives to the component, but it is |
| 77 | +possible to provide only one. |
| 78 | + |
| 79 | +A more concrete example of a real component and directives follows:: |
| 80 | + |
| 81 | + self.pipeline_str = "integrity_coverage fastqc" |
| 82 | + |
| 83 | + # Set parameters and directives only for integrity_coverage |
| 84 | + # and leave fastqc with the defaults |
| 85 | + self.directives = { |
| 86 | + "integrity_coverage": { |
| 87 | + "params": { |
| 88 | + "minCoverage": 20 |
| 89 | + }, |
| 90 | + "directives": { |
| 91 | + "memory": "1GB" |
| 92 | + } |
| 93 | + } |
| 94 | + } |
| 95 | + |
| 96 | +Duplicate components |
| 97 | +~~~~~~~~~~~~~~~~~~~~ |
| 98 | + |
| 99 | +In some cases, the same component may be present multiple times in the pipeline |
| 100 | +string of a recipe. In these cases, directives can be assigned to each individual |
| 101 | +component by adding a ``#<id>`` suffix to the component:: |
| 102 | + |
| 103 | + self.pipeline_str = "integrity_coverage ( trimmomatic spades#1 | spades#2)" |
| 104 | + |
| 105 | + self.directives = { |
| 106 | + "spades#1": { |
| 107 | + "directives": { |
| 108 | + "memory": "10GB" |
| 109 | + } |
| 110 | + }, |
| 111 | + "spades#2": { |
| 112 | + "directives": { |
| 113 | + "version": "3.7.0" |
| 114 | + } |
| 115 | + } |
| 116 | + } |
0 commit comments