Skip to content

Commit 2d3df08

Browse files
committed
Reducing the rename_cols dict
1 parent 1cc26e9 commit 2d3df08

File tree

3 files changed

+23
-25
lines changed

3 files changed

+23
-25
lines changed

qiita_db/metadata_template/prep_template.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,9 +417,7 @@ def create_qiime_mapping_file(self):
417417
"""
418418
rename_cols = {
419419
'barcode': 'BarcodeSequence',
420-
'barcodesequence': 'BarcodeSequence',
421420
'primer': 'LinkerPrimerSequence',
422-
'linkerprimersequence': 'LinkerPrimerSequence',
423421
'description': 'Description',
424422
}
425423

qiita_db/metadata_template/test/test_prep_template.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ def setUp(self):
4141
self.sample_id = '1.SKB8.640193'
4242
self.tester = PrepSample(self.sample_id, self.prep_template)
4343
self.exp_categories = {'center_name', 'center_project_name',
44-
'emp_status', 'barcodesequence',
44+
'emp_status', 'barcode',
4545
'library_construction_protocol',
46-
'linkerprimersequence', 'target_subfragment',
46+
'primer', 'target_subfragment',
4747
'target_gene', 'run_center', 'run_prefix',
4848
'run_date', 'experiment_center',
4949
'experiment_design_description',
@@ -83,11 +83,11 @@ def test_add_setitem_queries_dynamic(self):
8383
conn_handler.create_queue(queue)
8484

8585
self.tester.add_setitem_queries(
86-
'barcodesequence', 'AAAAAAAAAAAA', conn_handler, queue)
86+
'barcode', 'AAAAAAAAAAAA', conn_handler, queue)
8787

8888
obs = conn_handler.queues[queue]
8989
sql = """UPDATE qiita.prep_1
90-
SET barcodesequence=%s
90+
SET barcode=%s
9191
WHERE sample_id=%s"""
9292
exp = [(sql, ('AAAAAAAAAAAA', '1.SKB8.640193'))]
9393
self.assertEqual(obs, exp)
@@ -156,7 +156,7 @@ def test_getitem_dynamic(self):
156156
"""
157157
self.assertEqual(self.tester['pcr_primers'],
158158
'FWD:GTGCCAGCMGCCGCGGTAA; REV:GGACTACHVGGGTWTCTAAT')
159-
self.assertEqual(self.tester['barcodesequence'], 'AGCGCTCACATC')
159+
self.assertEqual(self.tester['barcode'], 'AGCGCTCACATC')
160160

161161
def test_getitem_id_column(self):
162162
"""Get item returns the correct metadata value from the changed column
@@ -176,8 +176,8 @@ def test_iter(self):
176176

177177
def test_contains_true(self):
178178
"""contains returns true if the category header exists"""
179-
self.assertTrue('BarcodeSequence' in self.tester)
180-
self.assertTrue('barcodesequence' in self.tester)
179+
self.assertTrue('Barcode' in self.tester)
180+
self.assertTrue('barcode' in self.tester)
181181

182182
def test_contains_false(self):
183183
"""contains returns false if the category header does not exists"""
@@ -218,7 +218,7 @@ def test_items(self):
218218
obs = self.tester.items()
219219
self.assertTrue(isinstance(obs, Iterable))
220220
exp = {('center_name', 'ANL'), ('center_project_name', None),
221-
('emp_status', 'EMP'), ('barcodesequence', 'AGCGCTCACATC'),
221+
('emp_status', 'EMP'), ('barcode', 'AGCGCTCACATC'),
222222
('library_construction_protocol',
223223
'This analysis was done as in Caporaso et al 2011 Genome '
224224
'research. The PCR primers (F515/R806) were developed against '
@@ -231,7 +231,7 @@ def test_items(self):
231231
'PCR primer is barcoded with a 12-base error-correcting Golay '
232232
'code to facilitate multiplexing of up to 1,500 samples per '
233233
'lane, and both PCR primers contain sequencer adapter '
234-
'regions.'), ('linkerprimersequence', 'GTGCCAGCMGCCGCGGTAA'),
234+
'regions.'), ('primer', 'GTGCCAGCMGCCGCGGTAA'),
235235
('target_subfragment', 'V4'), ('target_gene', '16S rRNA'),
236236
('run_center', 'ANL'), ('run_prefix', 's_G1_L001_sequences'),
237237
('run_date', '8/1/12'), ('experiment_center', 'ANL'),
@@ -248,7 +248,7 @@ def test_items(self):
248248

249249
def test_get(self):
250250
"""get returns the correct sample object"""
251-
self.assertEqual(self.tester.get('barcodesequence'), 'AGCGCTCACATC')
251+
self.assertEqual(self.tester.get('barcode'), 'AGCGCTCACATC')
252252

253253
def test_get_none(self):
254254
"""get returns none if the sample id is not present"""
@@ -567,8 +567,8 @@ def test_to_dataframe(self):
567567

568568
self.assertEqual(set(obs.columns), {
569569
u'center_name', u'center_project_name',
570-
u'emp_status', u'barcodesequence',
571-
u'library_construction_protocol', u'linkerprimersequence',
570+
u'emp_status', u'barcode',
571+
u'library_construction_protocol', u'primer',
572572
u'target_subfragment', u'target_gene', u'run_center',
573573
u'run_prefix', u'run_date', u'experiment_center',
574574
u'experiment_design_description', u'experiment_title', u'platform',
@@ -1260,23 +1260,23 @@ def test_status(self):
12601260

12611261
def test_update_category(self):
12621262
with self.assertRaises(QiitaDBUnknownIDError):
1263-
self.tester.update_category('barcodesequence', {"foo": "bar"})
1263+
self.tester.update_category('barcode', {"foo": "bar"})
12641264

12651265
with self.assertRaises(QiitaDBColumnError):
12661266
self.tester.update_category('missing column',
12671267
{'1.SKB7.640196': 'bar'})
12681268

1269-
neg_test = self.tester['1.SKB7.640196']['barcodesequence']
1269+
neg_test = self.tester['1.SKB7.640196']['barcode']
12701270
mapping = {'1.SKB8.640193': 'AAAAAAAAAAAA',
12711271
'1.SKD8.640184': 'CCCCCCCCCCCC'}
12721272

1273-
self.tester.update_category('barcodesequence', mapping)
1273+
self.tester.update_category('barcode', mapping)
12741274

1275-
self.assertEqual(self.tester['1.SKB7.640196']['barcodesequence'],
1275+
self.assertEqual(self.tester['1.SKB7.640196']['barcode'],
12761276
neg_test)
1277-
self.assertEqual(self.tester['1.SKB8.640193']['barcodesequence'],
1277+
self.assertEqual(self.tester['1.SKB8.640193']['barcode'],
12781278
'AAAAAAAAAAAA')
1279-
self.assertEqual(self.tester['1.SKD8.640184']['barcodesequence'],
1279+
self.assertEqual(self.tester['1.SKD8.640184']['barcode'],
12801280
'CCCCCCCCCCCC')
12811281

12821282
neg_test = self.tester['1.SKB7.640196']['center_name']

qiita_db/support_files/populate_test_db.sql

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,9 @@ INSERT INTO qiita.prep_template_sample (prep_template_id, sample_id) VALUES
238238
-- Add raw data prep columns
239239
INSERT INTO qiita.prep_columns (prep_template_id, column_name, column_type) VALUES
240240
(1, 'sample_id', 'varchar'),
241-
(1, 'BarcodeSequence', 'varchar'),
241+
(1, 'barcode', 'varchar'),
242242
(1, 'LIBRARY_CONSTRUCTION_PROTOCOL', 'varchar'),
243-
(1, 'LinkerPrimerSequence', 'varchar'),
243+
(1, 'primer', 'varchar'),
244244
(1, 'TARGET_SUBFRAGMENT', 'varchar'),
245245
(1, 'target_gene', 'varchar'),
246246
(1, 'RUN_CENTER', 'varchar'),
@@ -263,9 +263,9 @@ INSERT INTO qiita.prep_columns (prep_template_id, column_name, column_type) VALU
263263
-- Crate the prep_1 dynamic table
264264
CREATE TABLE qiita.prep_1 (
265265
sample_id varchar,
266-
BarcodeSequence varchar,
266+
barcode varchar,
267267
LIBRARY_CONSTRUCTION_PROTOCOL varchar,
268-
LinkerPrimerSequence varchar,
268+
primer varchar,
269269
TARGET_SUBFRAGMENT varchar,
270270
target_gene varchar,
271271
RUN_CENTER varchar,
@@ -288,7 +288,7 @@ CREATE TABLE qiita.prep_1 (
288288
);
289289

290290
-- Populates the prep_1 dynamic table
291-
INSERT INTO qiita.prep_1 (sample_id, BarcodeSequence, LIBRARY_CONSTRUCTION_PROTOCOL, LinkerPrimerSequence, TARGET_SUBFRAGMENT, target_gene, RUN_CENTER, RUN_PREFIX, RUN_DATE, EXPERIMENT_CENTER, EXPERIMENT_DESIGN_DESCRIPTION, EXPERIMENT_TITLE, PLATFORM, SAMP_SIZE, SEQUENCING_METH, illumina_technology, SAMPLE_CENTER, pcr_primers, STUDY_CENTER, center_name, center_project_name, emp_status) VALUES
291+
INSERT INTO qiita.prep_1 (sample_id, barcode, LIBRARY_CONSTRUCTION_PROTOCOL, primer, TARGET_SUBFRAGMENT, target_gene, RUN_CENTER, RUN_PREFIX, RUN_DATE, EXPERIMENT_CENTER, EXPERIMENT_DESIGN_DESCRIPTION, EXPERIMENT_TITLE, PLATFORM, SAMP_SIZE, SEQUENCING_METH, illumina_technology, SAMPLE_CENTER, pcr_primers, STUDY_CENTER, center_name, center_project_name, emp_status) VALUES
292292
('1.SKB1.640202', 'GTCCGCAAGTTA', 'This analysis was done as in Caporaso et al 2011 Genome research. The PCR primers (F515/R806) were developed against the V4 region of the 16S rRNA (both bacteria and archaea), which we determined would yield optimal community clustering with reads of this length using a procedure similar to that of ref. 15. [For reference, this primer pair amplifies the region 533_786 in the Escherichia coli strain 83972 sequence (greengenes accession no. prokMSA_id:470367).] The reverse PCR primer is barcoded with a 12-base error-correcting Golay code to facilitate multiplexing of up to 1,500 samples per lane, and both PCR primers contain sequencer adapter regions.', 'GTGCCAGCMGCCGCGGTAA', 'V4', '16S rRNA', 'ANL', 's_G1_L001_sequences', '8/1/12', 'ANL', 'micro biome of soil and rhizosphere of cannabis plants from CA', 'Cannabis Soil Microbiome', 'Illumina', '.25,g', 'Sequencing by synthesis', 'MiSeq', 'ANL', 'FWD:GTGCCAGCMGCCGCGGTAA; REV:GGACTACHVGGGTWTCTAAT', 'CCME', 'ANL', NULL, 'EMP'),
293293
('1.SKB2.640194', 'CGTAGAGCTCTC', 'This analysis was done as in Caporaso et al 2011 Genome research. The PCR primers (F515/R806) were developed against the V4 region of the 16S rRNA (both bacteria and archaea), which we determined would yield optimal community clustering with reads of this length using a procedure similar to that of ref. 15. [For reference, this primer pair amplifies the region 533_786 in the Escherichia coli strain 83972 sequence (greengenes accession no. prokMSA_id:470367).] The reverse PCR primer is barcoded with a 12-base error-correcting Golay code to facilitate multiplexing of up to 1,500 samples per lane, and both PCR primers contain sequencer adapter regions.', 'GTGCCAGCMGCCGCGGTAA', 'V4', '16S rRNA', 'ANL', 's_G1_L001_sequences', '8/1/12', 'ANL', 'micro biome of soil and rhizosphere of cannabis plants from CA', 'Cannabis Soil Microbiome', 'Illumina', '.25,g', 'Sequencing by synthesis', 'MiSeq', 'ANL', 'FWD:GTGCCAGCMGCCGCGGTAA; REV:GGACTACHVGGGTWTCTAAT', 'CCME', 'ANL', NULL, 'EMP'),
294294
('1.SKB3.640195', 'CCTCTGAGAGCT', 'This analysis was done as in Caporaso et al 2011 Genome research. The PCR primers (F515/R806) were developed against the V4 region of the 16S rRNA (both bacteria and archaea), which we determined would yield optimal community clustering with reads of this length using a procedure similar to that of ref. 15. [For reference, this primer pair amplifies the region 533_786 in the Escherichia coli strain 83972 sequence (greengenes accession no. prokMSA_id:470367).] The reverse PCR primer is barcoded with a 12-base error-correcting Golay code to facilitate multiplexing of up to 1,500 samples per lane, and both PCR primers contain sequencer adapter regions.', 'GTGCCAGCMGCCGCGGTAA', 'V4', '16S rRNA', 'ANL', 's_G1_L001_sequences', '8/1/12', 'ANL', 'micro biome of soil and rhizosphere of cannabis plants from CA', 'Cannabis Soil Microbiome', 'Illumina', '.25,g', 'Sequencing by synthesis', 'MiSeq', 'ANL', 'FWD:GTGCCAGCMGCCGCGGTAA; REV:GGACTACHVGGGTWTCTAAT', 'CCME', 'ANL', NULL, 'EMP'),

0 commit comments

Comments
 (0)