From 28418e06ed2fc9fbbcca17cea3de0edf03e3f0f6 Mon Sep 17 00:00:00 2001
From: aknecht2 <aknecht2@unl.edu>
Date: Tue, 30 Aug 2016 00:32:26 -0500
Subject: [PATCH] Updated check_result to match file_name instead of just
 checking for existence.

---
 chipathlon/db.py       | 4 ++--
 chipathlon/workflow.py | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/chipathlon/db.py b/chipathlon/db.py
index f9f485d..643a0f0 100644
--- a/chipathlon/db.py
+++ b/chipathlon/db.py
@@ -39,13 +39,13 @@ class MongoDB(object):
             print "result_id %s doesn't exist." % (result_id,)
         return
 
-    def check_result(self, control_sample_ids, experiment_sample_ids, ref_genome, result_type, params, debug=False):
+    def check_result(self, file_name, control_sample_ids, experiment_sample_ids, ref_genome, result_type, params, debug=False):
         try:
             query = {
                 "result_type": result_type,
                 "ref_genome": ref_genome,
                 "timestamp": {"$exists": True},
-                "file_name": {"$exists": True}
+                "file_name": file_name
             }
             # In the case that there are 0 samples we just want to check for existence.
             query["control_sample_ids"] = {"$all": control_sample_ids} if (len(control_sample_ids) > 0) else {"$exists": True}
diff --git a/chipathlon/workflow.py b/chipathlon/workflow.py
index a7ab31a..4e3ccd2 100644
--- a/chipathlon/workflow.py
+++ b/chipathlon/workflow.py
@@ -265,6 +265,7 @@ class Workflow(object):
                     params[job_name] = job_arg_dict
                 result_list.append(
                     self.mdb.check_result(
+                        name,
                         outputs[name]["control_sample_ids"],
                         outputs[name]["experiment_sample_ids"],
                         ref_genome,
@@ -321,7 +322,7 @@ class Workflow(object):
             # The output returned from the generator is more complex than
             # what the module needs
             module_outputs = {mod_file_name : outputs[mod_file_name]["file_name"] for mod_file_name in outputs}
-            
+
             download_gen.module.add_jobs(self.dax, self.jobs, self.files, markers, inputs, additional_inputs, module_outputs)
             self._save_results(outputs, ref_genome)
         return
-- 
GitLab