diff --git a/chipathlon/db.py b/chipathlon/db.py
index 2eeef6ed5b2ed46aa58512cca020fc08fbb65fde..8846474043b07172c58640b027bd6b9f03ae776d 100644
--- a/chipathlon/db.py
+++ b/chipathlon/db.py
@@ -22,6 +22,33 @@ class MongoDB(object):
 
         return
 
+    def check_valid_samples(self):
+        cursor = self.db.experiments.aggregate([
+            {
+                "$match": {
+                    "target": {"$exists": True},
+                    "revoked_files.0": {"$exists": False},
+                    "assembly.0": {"$exists": True},
+                    "assembly.1": {"$exists": False}
+                }
+            },
+            {
+                "$lookup": {
+                    "from": "samples",
+                    "localField": "_id",
+                    "foreignField": "experiment_id",
+                    "as": "samples"
+                }
+            }
+        ])
+        total = 0
+        has_samples = 0
+        for document in cursor:
+            total += 1
+            if len(document["samples"]) > 0:
+                has_samples += 1
+        return (has_samples, total)
+
     def get_samples(self, experiment_id):
         valid = True
         msg = ""
diff --git a/chipathlon/tester.py b/chipathlon/tester.py
index ad969382a4f3bc4c5a07f06d272465b361f0d39a..389cac6ea298fe0b28040950be7311f762cd50b8 100644
--- a/chipathlon/tester.py
+++ b/chipathlon/tester.py
@@ -75,12 +75,23 @@ def exp_files_test_3():
     print_test("Exp_Files_Test_3", not valid and msg == "Experiment with id 'ENCSR329RIP' does not have all required metadata (assembly, target, no revoked_files).")
     return
 
-# Test8, multiple control experiments, no possible control_inputs
+# Test8, multiple control experiments
 def exp_files_test_4():
     valid, msg, data = mdb.get_samples("ENCSR000CWZ")
     print_test("Exp_Files_Test_4", valid and msg == "Succesfully retrieved input files for experiment with id 'ENCSR000CWZ'." and len(data["control"]) == 4 and len(data["experiment"]) == 2)
     return
 
+# Test9, multiple control experiments, no possible control_inputs
+def exp_files_test_5():
+    valid, msg, data = mdb.get_samples("ENCSR000DKB")
+    print_test("Exp_Files_Test_5", not valid and msg == "Experiment with id 'ENCSR000DKB' has '0' possible control inputs, and '3' possible experiment inputs.")
+    return
+
+def valid_samples():
+    has_samples, total = mdb.check_valid_samples()
+    print_test("Verify_All_Samples", has_samples == total)
+    return
+
 
 
 tests = [
@@ -91,7 +102,9 @@ tests = [
     exp_files_test_1,
     exp_files_test_2,
     exp_files_test_3,
-    exp_files_test_4
+    exp_files_test_4,
+    exp_files_test_5,
+    valid_samples
 ]
 for test in tests:
     test()