Attempt to estimate how long it will take to run a flowcell
"""
- # (3600 seconds * 1.5 hours per cycle )
- sequencing_seconds_per_cycle= 3600 * 1.5
- # 800 is a rough guess
- pipeline_seconds_per_cycle = 800
-
cycles = flowcell.read_length
if flowcell.paired_end:
cycles *= 2
- sequencing_time = timedelta(0, cycles * sequencing_seconds_per_cycle)
- analysis_time = timedelta(0, cycles * pipeline_seconds_per_cycle)
+ sequencing_time = timedelta(0, cycles * flowcell.flowcell_model.per_cycle_time)
+ analysis_time = timedelta(0, flowcell.flowcell_model.fixed_time)
estimate_mid = sequencing_time + analysis_time
return estimate_mid
"lane_number": 8,
"pM": "7"
}
- }
+ },
+ {"pk": 300, "model": "experiments.flowcell",
+ "fields": {
+ "paired_end": true,
+ "run_date": "2014-01-01T01:23:45-0800",
+ "read_length": 50,
+ "notes": "",
+ "advanced_run": false,
+ "control_lane": 2,
+ "cluster_station": 3,
+ "sequencer": 2,
+ "flowcell_id": "12345ACXX",
+ "flowcell_model": 2
+ }
+ }
]
import json
except ImportError, e:
import simplejson as json
+from datetime import timedelta
import os
import shutil
import sys
self.assertTrue(library_id in expected[lane_id])
self.assertEqual(count, 10)
+ def test_flowcell_estimates(self):
+ classic_flowcell = models.FlowCell.objects.get(pk=153)
+ classic_mid = experiments.estimateFlowcellDuration(classic_flowcell)
+
+ self.assertEqual(classic_mid, timedelta(4, 44000))
+
+ rapid_flowcell = models.FlowCell.objects.get(pk=300)
+ rapid_mid = experiments.estimateFlowcellDuration(rapid_flowcell)
+ self.assertEqual(rapid_mid, timedelta(seconds=60800))
+
+ def test_round_to_days(self):
+ data = [
+ [timedelta(2, 12345), (timedelta(days=2), timedelta(days=3))],
+ [timedelta(0, 345), (timedelta(days=0), timedelta(days=1))],
+ ]
+
+ for estimate, expected in data:
+ rounded = experiments.roundToDays(estimate)
+ self.assertEqual(rounded, expected)
class TestFileType(TestCase):
fixtures = ['initial_data.json',