Exemplo n.º 1
0
    def test_prep_template_post_req(self):
        obs = prep_template_post_req(1, '*****@*****.**', 'update.txt',
                                     '16S', name="  ")
        exp = {'status': 'warning',
               'message': [
                    ('Some columns required to generate a QIIME-compliant '
                     'mapping file are not present in the template. A '
                     'placeholder value (XXQIITAXX) has been used to populate '
                     'these columns. Missing columns: BarcodeSequence, '
                     'LinkerPrimerSequence'),
                    ('Some functionality will be disabled due to missing '
                     'columns:'),
                    ('\tDemultiplexing with multiple input files disabled.: '
                     'barcode, primer, run_prefix;'),
                    '\tDemultiplexing disabled.: barcode;',
                    ('\tEBI submission disabled: center_name, '
                     'experiment_design_description, instrument_model, '
                     'library_construction_protocol, platform.'),
                    ('See the Templates tutorial for a description of these '
                     'fields.')],
               'file': 'update.txt',
               'id': 'ignored in test'}

        self.assertItemsEqual(obs['message'].split('\n'), exp['message'])
        self.assertEqual(obs['status'], exp['status'])
        self.assertEqual(obs['file'], exp['file'])
        self.assertIsInstance(obs['id'], int)

        # Make sure new prep template added
        prep = PrepTemplate(obs['id'])
        self.assertEqual(prep.data_type(), '16S')
        self.assertEqual([x for x in prep.keys()], ['1.SKD6.640190'])
        self.assertEqual([x._to_dict() for x in prep.values()],
                         [{'new_col': 'new_value'}])
        self.assertEqual(prep.name, "Prep information %s" % prep.id)
Exemplo n.º 2
0
    def test_prep_template_post_req(self):
        obs = prep_template_post_req(1, '*****@*****.**', 'update.txt',
                                     '16S')
        exp = {'status': 'warning',
               'message': [
                    'Sample names were already prefixed with the study id.',
                    ('Some columns required to generate a QIIME-compliant '
                     'mapping file are not present in the template. A '
                     'placeholder value (XXQIITAXX) has been used to populate '
                     'these columns. Missing columns: BarcodeSequence, '
                     'LinkerPrimerSequence'),
                    ('Some functionality will be disabled due to missing '
                     'columns:'),
                    ('\tDemultiplexing with multiple input files disabled.: '
                     'barcode, primer, run_prefix;'),
                    '\tDemultiplexing disabled.: barcode, primer;',
                    ('\tEBI submission disabled: center_name, '
                     'experiment_design_description, instrument_model, '
                     'library_construction_protocol, platform, primer.'),
                    ('See the Templates tutorial for a description of these '
                     'fields.')],
               'file': 'update.txt',
               'id': 'ignored in test'}

        self.assertItemsEqual(obs['message'].split('\n'), exp['message'])
        self.assertEqual(obs['status'], exp['status'])
        self.assertEqual(obs['file'], exp['file'])
        self.assertIsInstance(obs['id'], int)

        # Make sure new prep template added
        prep = PrepTemplate(obs['id'])
        self.assertEqual(prep.data_type(), '16S')
        self.assertEqual([x for x in prep.keys()], ['1.SKD6.640190'])
        self.assertEqual([x._to_dict() for x in prep.values()],
                         [{'new_col': 'new_value'}])
Exemplo n.º 3
0
    def test_prep_template_post_req(self):
        obs = prep_template_post_req(1,
                                     '*****@*****.**',
                                     'update.txt',
                                     '16S',
                                     name="  ")
        exp = {
            'status':
            'warning',
            'message': [
                'Both a converter and dtype were specified for column '
                'sample_name - only the converter will be used', 'Some '
                'functionality will be disabled due to missing columns:',
                '\tEBI submission disabled: center_name, '
                'experiment_design_description, instrument_model, '
                'library_construction_protocol, platform;',
                '\tDemultiplexing disabled.: barcode;', '\tDemultiplexing '
                'with multiple input files disabled.: barcode, primer, '
                'run_prefix.', 'See the Templates tutorial for a '
                'description of these fields.', 'Some columns required to '
                'generate a QIIME-compliant mapping file are not present '
                'in the template. A placeholder value (XXQIITAXX) '
                'has been used to populate these columns. Missing columns: '
                'BarcodeSequence, LinkerPrimerSequence'
            ],
            'file':
            'update.txt',
            'id':
            'ignored in test'
        }

        self.assertCountEqual(obs['message'].split('\n'), exp['message'])
        self.assertEqual(obs['status'], exp['status'])
        self.assertEqual(obs['file'], exp['file'])
        self.assertIsInstance(obs['id'], int)

        # Make sure new prep template added
        prep = PrepTemplate(obs['id'])
        self.assertEqual(prep.data_type(), '16S')
        self.assertEqual([x for x in prep.keys()], ['1.SKD6.640190'])
        self.assertEqual([x._to_dict() for x in prep.values()],
                         [{
                             'new_col': 'new_value'
                         }])
        self.assertEqual(prep.name, "Prep information %s" % prep.id)
Exemplo n.º 4
0
    def test_prep_template_post_req(self):
        new_id = get_count('qiita.prep_template') + 1
        obs = prep_template_post_req(1, '*****@*****.**', 'update.txt',
                                     '16S')
        exp = {'status': 'warning',
               'message': 'Sample names were already prefixed with the study '
                          'id.\nSome functionality will be disabled due to '
                          'missing columns:\n\tDemultiplexing with multiple '
                          'input files disabled. If your raw data includes '
                          'multiple raw input files, you will not be able to '
                          'preprocess your raw data: barcode, primer, '
                          'run_prefix;\n\tDemultiplexing disabled. You will '
                          'not be able to preprocess your raw data: barcode, '
                          'primer;\n\tEBI submission disabled: center_name, '
                          'experiment_design_description, instrument_model, '
                          'library_construction_protocol, platform, primer.'
                          '\nSee the Templates tutorial for a description of '
                          'these fields.\nSome columns required to generate a '
                          'QIIME-compliant mapping file are not present in the'
                          ' template. A placeholder value (XXQIITAXX) has been'
                          ' used to populate these columns. Missing columns: '
                          'BarcodeSequence, LinkerPrimerSequence',
               'file': 'update.txt',
               'id': new_id}
        self.assertItemsEqual(obs['message'].split('\n'),
                              exp['message'].split('\n'))
        self.assertEqual(obs['status'], exp['status'])
        self.assertEqual(obs['file'], exp['file'])
        self.assertEqual(obs['id'], exp['id'])

        # Make sure new prep template added
        prep = PrepTemplate(new_id)
        self.assertEqual(prep.data_type(), '16S')
        self.assertEqual([x for x in prep.keys()], ['1.SKD6.640190'])
        self.assertEqual([x._to_dict() for x in prep.values()],
                         [{'new_col': 'new_value'}])