def customize(self, config, reference, input_files, output_file, directory, dependencies=()): input_files = safe_coerce_to_tuple(input_files) stats_out_fname = "Stats_out_MCMC_correct_prob.csv" command = AtomicCmdBuilder(["mapDamage", "--rescale-only", "-i", "%(TEMP_IN_BAM)s", "-d", "%(TEMP_DIR)s", "-r", "%(IN_REFERENCE)s", "--rescale-out", "%(OUT_BAM)s"], TEMP_IN_BAM=MultiBAMInputNode.PIPE_FILE, IN_REFERENCE=reference, TEMP_OUT_LOG="Runtime_log.txt", TEMP_OUT_CSV=stats_out_fname, OUT_BAM=output_file, CHECK_VERSION=MAPDAMAGE_VERSION) command.add_multiple_kwargs(input_files) return {"command": command, "config": config, "input_files": input_files, "directory": directory, "dependencies": dependencies}
def customize(self, config, reference, input_files, output_file, directory, dependencies=()): input_files = safe_coerce_to_tuple(input_files) stats_out_fname = "Stats_out_MCMC_correct_prob.csv" command = AtomicCmdBuilder([ "mapDamage", "--rescale-only", "-i", "%(TEMP_IN_BAM)s", "-d", "%(TEMP_DIR)s", "-r", "%(IN_REFERENCE)s", "--rescale-out", "%(OUT_BAM)s" ], TEMP_IN_BAM=MultiBAMInputNode.PIPE_FILE, IN_REFERENCE=reference, TEMP_OUT_LOG="Runtime_log.txt", TEMP_OUT_CSV=stats_out_fname, OUT_BAM=output_file, CHECK_VERSION=MAPDAMAGE_VERSION) command.add_multiple_kwargs(input_files) return { "command": command, "config": config, "input_files": input_files, "directory": directory, "dependencies": dependencies }
def test_builder__add_multiple_kwargs_multiple_times(): expected = {"IN_FILE_01": "file_a", "IN_FILE_02": "file_b"} builder = AtomicCmdBuilder("ls") kwargs = builder.add_multiple_kwargs(("file_a",)) assert_equal(kwargs, {"IN_FILE_01": "file_a"}) kwargs = builder.add_multiple_kwargs(("file_b",)) assert_equal(kwargs, {"IN_FILE_02": "file_b"}) assert_equal(builder.kwargs, expected) assert_equal(builder.call, ["ls"])
def test_builder__add_multiple_kwargs_multiple_times(): expected = {"IN_FILE_01": "file_a", "IN_FILE_02": "file_b"} builder = AtomicCmdBuilder("ls") kwargs = builder.add_multiple_kwargs(("file_a", )) assert_equal(kwargs, {"IN_FILE_01": "file_a"}) kwargs = builder.add_multiple_kwargs(("file_b", )) assert_equal(kwargs, {"IN_FILE_02": "file_b"}) assert_equal(builder.kwargs, expected) assert_equal(builder.call, ["ls"])
def customize(self, config, reference, input_files, output_directory, title="mapDamage", dependencies=()): input_files = safe_coerce_to_tuple(input_files) command = AtomicCmdBuilder( [ "mapDamage", "--no-stats", # Prevent references with many contigs from using excessive # amounts of memory, at the cost of per-contig statistics: "--merge-reference-sequences", "-t", title, "-i", "%(TEMP_IN_BAM)s", "-d", "%(TEMP_DIR)s", "-r", "%(IN_REFERENCE)s" ], TEMP_IN_BAM=MultiBAMInputNode.PIPE_FILE, IN_REFERENCE=reference, OUT_FREQ_3p=os.path.join(output_directory, "3pGtoA_freq.txt"), OUT_FREQ_5p=os.path.join(output_directory, "5pCtoT_freq.txt"), OUT_COMP_USER=os.path.join(output_directory, "dnacomp.txt"), OUT_PLOT_FRAG=os.path.join(output_directory, "Fragmisincorporation_plot.pdf"), OUT_PLOT_LEN=os.path.join(output_directory, "Length_plot.pdf"), OUT_LENGTH=os.path.join(output_directory, "lgdistribution.txt"), OUT_MISINCORP=os.path.join(output_directory, "misincorporation.txt"), OUT_LOG=os.path.join(output_directory, "Runtime_log.txt"), TEMP_OUT_STDOUT="pipe_mapDamage.stdout", TEMP_OUT_STDERR="pipe_mapDamage.stderr", CHECK_RSCRIPT=RSCRIPT_VERSION, CHECK_MAPDAMAGE=MAPDAMAGE_VERSION) command.add_multiple_kwargs(input_files) return { "command": command, "config": config, "input_files": input_files, "dependencies": dependencies }
def test_builder__add_multiple_kwargs_with_template(): values = ("file_a", "file_b") expected = {"OUT_BAM_1": "file_a", "OUT_BAM_2": "file_b"} builder = AtomicCmdBuilder("ls") kwargs = builder.add_multiple_kwargs(values, template="OUT_BAM_%i") assert_equal(kwargs, expected) assert_equal(builder.kwargs, expected) assert_equal(builder.call, ["ls"])
def test_builder__add_multiple_kwargs(): values = ("file_a", "file_b") expected = {"IN_FILE_01": "file_a", "IN_FILE_02": "file_b"} builder = AtomicCmdBuilder("ls") kwargs = builder.add_multiple_kwargs(values) assert_equal(kwargs, expected) assert_equal(builder.kwargs, expected) assert_equal(builder.call, ["ls"])
def customize(self, config, reference, input_files, output_directory, title="mapDamage", dependencies=()): input_files = safe_coerce_to_tuple(input_files) command = AtomicCmdBuilder( ["mapDamage", "--no-stats", # Prevent references with many contigs from using excessive # amounts of memory, at the cost of per-contig statistics: "--merge-reference-sequences", "-t", title, "-i", "%(TEMP_IN_BAM)s", "-d", "%(TEMP_DIR)s", "-r", "%(IN_REFERENCE)s"], TEMP_IN_BAM=MultiBAMInputNode.PIPE_FILE, IN_REFERENCE=reference, OUT_FREQ_3p=os.path.join(output_directory, "3pGtoA_freq.txt"), OUT_FREQ_5p=os.path.join(output_directory, "5pCtoT_freq.txt"), OUT_COMP_USER=os.path.join(output_directory, "dnacomp.txt"), OUT_PLOT_FRAG=os.path.join(output_directory, "Fragmisincorporation_plot.pdf"), OUT_PLOT_LEN=os.path.join(output_directory, "Length_plot.pdf"), OUT_LENGTH=os.path.join(output_directory, "lgdistribution.txt"), OUT_MISINCORP=os.path.join(output_directory, "misincorporation.txt"), OUT_LOG=os.path.join(output_directory, "Runtime_log.txt"), TEMP_OUT_STDOUT="pipe_mapDamage.stdout", TEMP_OUT_STDERR="pipe_mapDamage.stderr", CHECK_RSCRIPT=RSCRIPT_VERSION, CHECK_MAPDAMAGE=MAPDAMAGE_VERSION) command.add_multiple_kwargs(input_files) return {"command": command, "config": config, "input_files": input_files, "dependencies": dependencies}