Mercurial > repos > tduigou > cloning_simulation
comparison cloning_simulation.py @ 1:2655e08cd61a draft default tip
planemo upload for repository https://github.com/Edinburgh-Genome-Foundry/DnaCauldron/tree/master commit db4ac861e1d03fcdfe94321d858839124e493930-dirty
| author | tduigou |
|---|---|
| date | Wed, 23 Jul 2025 09:46:59 +0000 |
| parents | 3a3b0f7cb5c2 |
| children |
comparison
equal
deleted
inserted
replaced
| 0:3a3b0f7cb5c2 | 1:2655e08cd61a |
|---|---|
| 1 import argparse | 1 import argparse |
| 2 import os | 2 import os |
| 3 import json | |
| 3 import zipfile | 4 import zipfile |
| 4 import pandas | 5 import pandas |
| 5 import dnacauldron | 6 import dnacauldron |
| 6 | 7 |
| 7 | 8 |
| 141 help="List of GenBank files (Comma-separated)") | 142 help="List of GenBank files (Comma-separated)") |
| 142 parser.add_argument("--domesticated_seq", required=True, | 143 parser.add_argument("--domesticated_seq", required=True, |
| 143 help="output of domestication (ganbank list)") | 144 help="output of domestication (ganbank list)") |
| 144 parser.add_argument("--assembly_csv", required=True, | 145 parser.add_argument("--assembly_csv", required=True, |
| 145 help="csv assembly") | 146 help="csv assembly") |
| 146 parser.add_argument('--assembly_plan_name', type=str, | 147 parser.add_argument('--assembly_plan_name', type=str, required=False, |
| 147 help='type of assembly') | 148 help='type of assembly') |
| 148 parser.add_argument('--topology', type=str, | 149 parser.add_argument('--topology', type=str, required=False, |
| 149 help='"circular" or "linear"') | 150 help='"circular" or "linear"') |
| 150 parser.add_argument('--file_name_mapping', type=str, | 151 parser.add_argument('--file_name_mapping', type=str, |
| 151 help='Mapping of Galaxy filenames to original filenames') | 152 help='Mapping of Galaxy filenames to original filenames') |
| 152 parser.add_argument('--file_name_mapping_dom', type=str, | 153 parser.add_argument('--file_name_mapping_dom', type=str, |
| 153 help='Mapping of Galaxy filenames to original domestication filenames') | 154 help='Mapping of Galaxy filenames to original domestication filenames') |
| 155 help="Use file names as IDs (True/False)") | 156 help="Use file names as IDs (True/False)") |
| 156 parser.add_argument("--outdir_simulation", required=True, | 157 parser.add_argument("--outdir_simulation", required=True, |
| 157 help="dir output for cloning simulation results") | 158 help="dir output for cloning simulation results") |
| 158 parser.add_argument("--output_simulation", required=True, | 159 parser.add_argument("--output_simulation", required=True, |
| 159 help="zip output for cloning simulation results") | 160 help="zip output for cloning simulation results") |
| 160 parser.add_argument('--enzyme', type=str, | 161 parser.add_argument('--enzyme', type=str,required=False, |
| 161 help='enzyme to use') | 162 help='enzyme to use') |
| 162 parser.add_argument("--outdir_gb", required=True, | 163 parser.add_argument("--outdir_gb", required=True, |
| 163 help="dir output constructs gb files") | 164 help="dir output constructs gb files") |
| 165 parser.add_argument("--use_json_paramers", required=True, | |
| 166 help="Use parameters from JSON: true/false") | |
| 167 parser.add_argument("--json_conf", required=False, | |
| 168 help="JSON config file with DB parameters") | |
| 164 | 169 |
| 165 return parser.parse_args() | 170 return parser.parse_args() |
| 166 | 171 |
| 167 | 172 |
| 168 if __name__ == "__main__": | 173 if __name__ == "__main__": |
| 169 args = parse_command_line_args() | 174 args = parse_command_line_args() |
| 170 | 175 |
| 176 #json param checking | |
| 177 config_params = {} | |
| 178 use_json = args.use_json_paramers == 'true' | |
| 179 if use_json: | |
| 180 if not args.json_conf: | |
| 181 raise ValueError("You must provide --json_conf when --use_json_paramers is 'true'") | |
| 182 with open(args.json_conf, "r") as f: | |
| 183 config_params = json.load(f) | |
| 184 else: | |
| 185 config_params = { | |
| 186 "assembly_plan_name": args.assembly_plan_name, | |
| 187 "topology": args.topology, | |
| 188 "enzyme": args.enzyme | |
| 189 } | |
| 190 assembly_plan_name = config_params["assembly_plan_name"] | |
| 191 topology = config_params["topology"] | |
| 192 enzyme = config_params["enzyme"] | |
| 193 | |
| 171 cloning_simulation( | 194 cloning_simulation( |
| 172 args.parts_files, args.domesticated_seq, | 195 args.parts_files, args.domesticated_seq, |
| 173 args.assembly_csv, args.assembly_plan_name, args.topology, | 196 args.assembly_csv, assembly_plan_name, topology, |
| 174 args.file_name_mapping, args.file_name_mapping_dom, | 197 args.file_name_mapping, args.file_name_mapping_dom, |
| 175 args.use_file_names_as_id, args.outdir_simulation, | 198 args.use_file_names_as_id, args.outdir_simulation, |
| 176 args.output_simulation, args.enzyme, args.outdir_gb | 199 args.output_simulation, enzyme, args.outdir_gb |
| 177 ) | 200 ) |
