<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Dual CRISPR Screen Analysis
Step 4
Step1:  Automated Set-Up
Step2:  Count Combination Functions
Step3:  Input Count Filenames
Step4:  Count Combination Execution
<ASSISTANT_TASK:>
Python Code:
g_dataset_name = "Notebook4Test"
g_fastq_counts_run_prefix = "TestSet4"
g_fastq_counts_dir = '~/dual_crispr/test_data/test_set_4'
g_collapsed_counts_run_prefix = ""
g_collapsed_counts_dir = '~/dual_crispr/test_outputs/test_set_4'
g_combined_counts_dir = ""
g_combined_counts_run_prefix = ""
Explanation: Dual CRISPR Screen Analysis
Step 4: Count Combination
Amanda Birmingham, CCBB, UCSD (abirmingham@ucsd.edu)
Instructions
To run this notebook reproducibly, follow these steps:
1. Click Kernel > Restart & Clear Output
2. When prompted, click the red Restart & clear all outputs button
3. Fill in the values for your analysis for each of the variables in the Input Parameters section
4. Click Cell > Run All
Input Parameters
End of explanation
import inspect
import ccbb_pyutils.analysis_run_prefixes as ns_runs
import ccbb_pyutils.files_and_paths as ns_files
import ccbb_pyutils.notebook_logging as ns_logs
def describe_var_list(input_var_name_list):
    description_list =  ["{0}: {1}\n".format(name, eval(name)) for name in input_var_name_list]
    return "".join(description_list)
ns_logs.set_stdout_info_logger()
g_fastq_counts_dir = ns_files.expand_path(g_fastq_counts_dir)
g_collapsed_counts_run_prefix = ns_runs.check_or_set(g_collapsed_counts_run_prefix, 
                                                     ns_runs.generate_run_prefix(g_dataset_name))
g_collapsed_counts_dir = ns_files.expand_path(ns_runs.check_or_set(g_collapsed_counts_dir, g_fastq_counts_dir))
g_combined_counts_run_prefix = ns_runs.check_or_set(g_combined_counts_run_prefix, g_collapsed_counts_run_prefix)
g_combined_counts_dir = ns_files.expand_path(ns_runs.check_or_set(g_combined_counts_dir, g_collapsed_counts_dir))
print(describe_var_list(['g_fastq_counts_dir','g_collapsed_counts_run_prefix','g_collapsed_counts_dir',
                         'g_combined_counts_run_prefix','g_combined_counts_dir']))
ns_files.verify_or_make_dir(g_collapsed_counts_dir)
ns_files.verify_or_make_dir(g_combined_counts_dir)
Explanation: Automated Set-Up
End of explanation
import dual_crispr.construct_counter as ns_counter
print(inspect.getsource(ns_counter.get_counts_file_suffix))
import dual_crispr.count_combination as ns_combine
print(inspect.getsource(ns_combine))
Explanation: Count Combination Functions
End of explanation
print(ns_files.summarize_filenames_for_prefix_and_suffix(g_fastq_counts_dir, g_fastq_counts_run_prefix, 
                                                         ns_counter.get_counts_file_suffix()))
Explanation: Input Count Filenames
End of explanation
ns_combine.write_collapsed_count_files(g_fastq_counts_dir, g_collapsed_counts_dir, g_collapsed_counts_run_prefix, 
                            g_fastq_counts_run_prefix, ns_counter.get_counts_file_suffix(), 
                            ns_combine.get_collapsed_counts_file_suffix())
print(ns_files.check_file_presence(g_collapsed_counts_dir, g_collapsed_counts_run_prefix, 
                                   ns_combine.get_collapsed_counts_file_suffix(),
                                   check_failure_msg="Count combination failed to produce collapsed count file(s)."))
ns_combine.write_combined_count_file(g_collapsed_counts_dir, g_combined_counts_dir, g_collapsed_counts_run_prefix, 
                          g_combined_counts_run_prefix, ns_combine.get_collapsed_counts_file_suffix(), 
                          ns_combine.get_combined_counts_file_suffix())
print(ns_files.check_file_presence(g_combined_counts_dir, g_collapsed_counts_run_prefix, 
                                   ns_combine.get_collapsed_counts_file_suffix(), 
                                   check_failure_msg="Count combination failed to produce combined count file."))
Explanation: Count Combination Execution
End of explanation
<END_TASK>