Skip to content
Snippets Groups Projects
Commit bc25810e authored by aknecht2's avatar aknecht2
Browse files

Removed duplicate unnecessary _make_call_pairs function.

parent 8e1fceff
No related branches found
No related tags found
No related merge requests found
......@@ -125,52 +125,6 @@ class PeakCallGenerator(ModuleGenerator):
additional_inputs = {}
return (self.get_markers(run), inputs, additional_inputs)
def _make_call_pairs(self, run, file_list):
"""
:param run: The run currently being processed.
:type run: dict
:param file_list: A list of bed files and associated metadata.
:type file_list: list
Construct a list of file tuples where the first file is the treatment
and the second is a control. This function is a little gross,
but makes our lives easier later. We need to randomly pair up control
and treatment samples that are from the same experiment. Each run
has two different experiments so we keep them separate from each other.
If an experiment has the same number of control and treatment samples
we pair them up 1-1. If an experiment has more controls than
treatments, we randomly select from the controls for the treatment
files. If an experiment has less controls than treatments, we use
all controls, then randomly select duplicates to match to the other
treatment files.
"""
experiment_files = []
control_files = []
peak_data = {}
for output_file in file_list:
for experiment_id in run["experiments"]:
if experiment_id not in peak_data:
peak_data[experiment_id] = {
"control": [],
"experiment": []
}
if output_file["prefix"][:len(experiment_id)] == experiment_id:
if output_file["control_sample_ids"]:
peak_data[experiment_id]["control"].append(output_file)
else:
peak_data[experiment_id]["experiment"].append(output_file)
for experiment_id in peak_data:
experiment_files += peak_data[experiment_id]["experiment"]
if len(peak_data[experiment_id]["experiment"]) < len(peak_data[experiment_id]["control"]):
control_files += [random.choice(peak_data[experiment_id]["control"]) for i in range(len(peak_data[experiment_id]["experiment"]))]
elif len(peak_data[experiment_id]["experiment"]) > len(peak_data[experiment_id]["control"]):
control_files += peak_data[experiment_id]["control"]
control_files += [random.choice(peak_data[experiment_id]["control"]) for i in
range(len(peak_data[experiment_id]["experiment"]) - len(peak_data[experiment_id]["control"]))]
else:
control_files += peak_data[experiment_id]["control"]
return zip(experiment_files, control_files)
def _make_call_pairs(self, run, result_list):
"""
:param run: The run currently being processed.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment