예제 #1
0
 def test_pool_composition_attributes_is_plate_pool(self):
     obs1 = PoolComposition(1)  # of 16s
     self.assertTrue(obs1.is_plate_pool)
     obs2 = PoolComposition(2)  # of pools
     self.assertFalse(obs2.is_plate_pool)
     obs3 = PoolComposition(3)  # of shotgun
     self.assertTrue(obs3.is_plate_pool)
예제 #2
0
 def post(self):
     pool_name = self.get_argument('pool_name')
     pools_info = json_decode(self.get_argument('pools_info'))
     concentrations = []
     input_compositions = []
     for p_info in pools_info:
         pool_comp = PoolComposition(p_info['pool_id'])
         concentrations.append({
             'composition': pool_comp,
             'concentration': p_info['concentration']
         })
         input_compositions.append({
             'composition':
             pool_comp,
             'input_volume':
             p_info['volume'],
             'percentage_of_output':
             p_info['percentage']
         })
     # Create the quantification process (DNA conc)
     q_process = QuantificationProcess.create_manual(
         self.current_user, concentrations)
     # Create the pool - Magic number 5 - > the volume for this poolings
     # is always 5 according to the wet lab.
     p_process = PoolingProcess.create(self.current_user, q_process,
                                       pool_name, 5, input_compositions, {
                                           "function": "amplicon_pool",
                                           "parameters": {}
                                       })
     self.write({'process': p_process.id})
예제 #3
0
 def get(self):
     res = {"data": [
         [p.id, p.container.external_id, p.is_plate_pool,
          p.upstream_process.id, ]
         for p in PoolComposition.get_pools()
     ]}
     self.write(res)
예제 #4
0
 def test_properties(self):
     tester = Tube(7)
     self.assertEqual(tester.external_id, 'Test Pool from Plate 1')
     self.assertFalse(tester.discarded)
     self.assertEqual(tester.remaining_volume, 96)
     self.assertIsNone(tester.notes)
     self.assertEqual(tester.latest_process, PoolingProcess(1))
     self.assertEqual(tester.container_id, 3079)
     self.assertEqual(tester.composition, PoolComposition(1))
예제 #5
0
 def test_pool_composition_pools(self):
     obs = PoolComposition.list_pools()
     exp = [{'pool_composition_id': 1,
             'external_id': 'Test Pool from Plate 1'},
            {'pool_composition_id': 2,
             'external_id': 'Test sequencing pool 1'},
            {'pool_composition_id': 3,
             'external_id': 'Test pool from Shotgun plate 1'}]
     self.assertEqual(obs, exp)
예제 #6
0
    def get(self, pool_id):
        try:
            pool = PoolComposition(int(pool_id))
        except LabmanUnknownIdError:
            raise HTTPError(404, 'Pool %s doesn\'t exist' % pool_id)

        result = {'pool_id': pool.id,
                  'pool_name': pool.container.external_id,
                  'num_components': len(pool.components)}
        self.write(result)
        self.finish()
예제 #7
0
 def test_pool_composition_attributes(self):
     obs = PoolComposition(1)
     self.assertEqual(obs.container, Tube(6))
     self.assertEqual(obs.total_volume, 96)
     self.assertIsNone(obs.notes)
     self.assertEqual(obs.composition_id, 3078)
     obs_comp = obs.components
     self.assertEqual(len(obs_comp), 96)
     exp = {'composition': LibraryPrep16SComposition(1),
            'input_volume': 1.0, 'percentage_of_output': 0}
     self.assertEqual(obs_comp[0], exp)
     self.assertEqual(obs.raw_concentration, 1.5)
예제 #8
0
 def test_composition_factory(self):
     self.assertEqual(Composition.factory(3073), ReagentComposition(1))
     self.assertEqual(Composition.factory(1537), PrimerComposition(1))
     self.assertEqual(Composition.factory(1), PrimerSetComposition(1))
     self.assertEqual(Composition.factory(3081), SampleComposition(1))
     self.assertEqual(Composition.factory(3082), GDNAComposition(1))
     self.assertEqual(Composition.factory(3083),
                      LibraryPrep16SComposition(1))
     self.assertEqual(Composition.factory(3085),
                      NormalizedGDNAComposition(1))
     self.assertEqual(Composition.factory(3086),
                      LibraryPrepShotgunComposition(1))
     self.assertEqual(Composition.factory(3078), PoolComposition(1))
예제 #9
0
 def post(self):
     pool_id = self.get_argument('pool')
     run_name = self.get_argument('run_name')
     sequencer_id = self.get_argument('sequencer')
     fwd_cycles = int(self.get_argument('fwd_cycles'))
     rev_cycles = int(self.get_argument('rev_cycles'))
     assay = self.get_argument('assay')
     pi = self.get_argument('principal_investigator')
     c0 = self.get_argument('contact_0')
     c1 = self.get_argument('contact_1')
     c2 = self.get_argument('contact_2')
     process = SequencingProcess.create(
         self.current_user, PoolComposition(pool_id), run_name,
         Equipment(sequencer_id), fwd_cycles, rev_cycles, assay,
         User(pi), User(c0), User(c1), User(c2))
     self.write({'process': process.id})
예제 #10
0
    def post(self):
        pools = self.get_argument('pools')
        run_name = self.get_argument('run_name')
        experiment = self.get_argument('experiment')
        sequencer_id = self.get_argument('sequencer')
        fwd_cycles = int(self.get_argument('fwd_cycles'))
        rev_cycles = int(self.get_argument('rev_cycles'))
        pi = self.get_argument('principal_investigator')
        contacts = self.get_argument('additional_contacts')

        pools = [PoolComposition(x) for x in json_decode(pools)]
        contacts = [User(x) for x in json_decode(contacts)]

        process = SequencingProcess.create(self.current_user, pools,
                                           run_name, experiment,
                                           Equipment(sequencer_id), fwd_cycles,
                                           rev_cycles, User(pi), contacts)
        self.write({'process': process.id})
예제 #11
0
 def test_pool_composition_pools(self):
     obs = PoolComposition.get_pools()
     obs_ids = [x.id for x in obs]
     exp_ids = [1, 2, 3, 4, 5, 6]
     self.assertEqual(obs_ids, exp_ids)
예제 #12
0
 def test_pool_composition_get_components_type(self):
     obs1 = PoolComposition.get_components_type([PoolComposition(1)])
     self.assertEqual(obs1, PoolComposition)
     obs2 = PoolComposition.get_components_type(
         [LibraryPrep16SComposition(1)])
     self.assertEqual(obs2, LibraryPrep16SComposition)
예제 #13
0
 def test_pool_composition_get_components_type_multiple_raises(self):
     with self.assertRaises(ValueError):
         PoolComposition.get_components_type(
             [LibraryPrep16SComposition(1),
              PoolComposition(1)])
예제 #14
0
 def get(self):
     res = {"data": [[p['pool_composition_id'], p['external_id']]
                     for p in PoolComposition.list_pools()]}
     self.write(res)
예제 #15
0
 def get(self):
     pools = [[p['pool_composition_id'], p['external_id']]
              for p in PoolComposition.list_pools()]
     sequencers = Equipment.list_equipment('miseq')
     self.render('sequencing.html', users=User.list_users(), pools=pools,
                 sequencers=sequencers)