Skip to content

Commit 1b800d2

Browse files
committed
Merge pull request #1168 from josenavas/missing-bits-of-patch-23
Removing any instance of required_sample_info and common_prep_info. …
2 parents 227e002 + 818e7d6 commit 1b800d2

File tree

6 files changed

+59
-48
lines changed

6 files changed

+59
-48
lines changed

qiita_db/metadata_template/prep_template.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ def delete(cls, id_):
232232
conn_handler.execute(
233233
"DROP TABLE qiita.{0}".format(table_name))
234234

235-
# Remove the rows from common_prep_info
235+
# Remove the rows from prep_template_samples
236236
conn_handler.execute(
237237
"DELETE FROM qiita.{0} where {1} = %s".format(cls._table,
238238
cls._id_column),

qiita_db/metadata_template/sample_template.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,6 @@ def metadata_headers():
8484
return [x[0] for x in
8585
conn_handler.execute_fetchall(
8686
"SELECT DISTINCT column_name FROM qiita.study_sample_columns "
87-
"UNION SELECT column_name FROM information_schema.columns "
88-
"WHERE table_name = 'required_sample_info' "
8987
"ORDER BY column_name")]
9088

9189
@classmethod

qiita_db/metadata_template/test/test_sample_template.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,19 @@ class TestSampleTemplateReadOnly(BaseTestSampleTemplate):
574574
def setUp(self):
575575
self._set_up()
576576

577+
def test_metadata_headers(self):
578+
obs = SampleTemplate.metadata_headers()
579+
exp = {'physical_specimen_location', 'physical_specimen_remaining',
580+
'dna_extracted', 'sample_type', 'collection_timestamp',
581+
'host_subject_id', 'description', 'season_environment',
582+
'assigned_from_geo', 'texture', 'taxon_id', 'depth',
583+
'host_taxid', 'common_name', 'water_content_soil', 'elevation',
584+
'temp', 'tot_nitro', 'samp_salinity', 'altitude', 'env_biome',
585+
'country', 'ph', 'anonymized_name', 'tot_org_carb',
586+
'description_duplicate', 'env_feature', 'latitude', 'longitude',
587+
'sample_id'}
588+
self.assertEqual(set(obs), exp)
589+
577590
def test_study_id(self):
578591
"""Ensure that the correct study ID is returned"""
579592
self.assertEqual(self.tester.study_id, 1)
@@ -1113,7 +1126,7 @@ def test_create_int_prefix(self):
11131126
# The returned object has the correct id
11141127
self.assertEqual(st.id, new_id)
11151128

1116-
# The relevant rows to required_sample_info have been added.
1129+
# The relevant rows to study_sample have been added.
11171130
obs = self.conn_handler.execute_fetchall(
11181131
"SELECT * FROM qiita.study_sample WHERE study_id=%s", (new_id,))
11191132
exp = [["%s.12.Sample1" % new_id, new_id],

qiita_db/metadata_template/util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,13 +221,13 @@ def load_template_to_dataframe(fn, strip_whitespace=True):
221221
parse_dates=True, index_col=False, comment='\t',
222222
mangle_dupe_cols=False, converters={
223223
'sample_name': lambda x: str(x).strip(),
224-
# required_sample_info
224+
# required sample template information
225225
'physical_location': str,
226226
'sample_type': str,
227227
# collection_timestamp is not added here
228228
'host_subject_id': str,
229229
'description': str,
230-
# common_prep_info
230+
# common prep template information
231231
'center_name': str,
232232
'center_projct_name': str})
233233

qiita_db/support_files/populate_test_db.sql

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -107,26 +107,26 @@ INSERT INTO qiita.study_sample (study_id, sample_id) VALUES
107107
-- Add the study sample columns for study 1
108108
INSERT INTO qiita.study_sample_columns (study_id, column_name, column_type) VALUES
109109
(1, 'sample_id', 'varchar'),
110-
(1, 'SEASON_ENVIRONMENT', 'varchar'),
111-
(1, 'ASSIGNED_FROM_GEO', 'varchar'),
112-
(1, 'TEXTURE', 'varchar'),
113-
(1, 'TAXON_ID', 'varchar'),
114-
(1, 'DEPTH', 'float8'),
115-
(1, 'HOST_TAXID', 'varchar'),
116-
(1, 'COMMON_NAME', 'varchar'),
117-
(1, 'WATER_CONTENT_SOIL', 'float8'),
118-
(1, 'ELEVATION', 'float8'),
119-
(1, 'TEMP', 'float8'),
120-
(1, 'TOT_NITRO', 'float8'),
121-
(1, 'SAMP_SALINITY', 'float8'),
122-
(1, 'ALTITUDE', 'float8'),
123-
(1, 'ENV_BIOME', 'varchar'),
124-
(1, 'COUNTRY', 'varchar'),
125-
(1, 'PH', 'float8'),
126-
(1, 'ANONYMIZED_NAME', 'varchar'),
127-
(1, 'TOT_ORG_CARB', 'float8'),
128-
(1, 'Description_duplicate', 'varchar'),
129-
(1, 'ENV_FEATURE', 'varchar'),
110+
(1, 'season_environment', 'varchar'),
111+
(1, 'assigned_from_geo', 'varchar'),
112+
(1, 'texture', 'varchar'),
113+
(1, 'taxon_id', 'varchar'),
114+
(1, 'depth', 'float8'),
115+
(1, 'host_taxid', 'varchar'),
116+
(1, 'common_name', 'varchar'),
117+
(1, 'water_content_soil', 'float8'),
118+
(1, 'elevation', 'float8'),
119+
(1, 'temp', 'float8'),
120+
(1, 'tot_nitro', 'float8'),
121+
(1, 'samp_salinity', 'float8'),
122+
(1, 'altitude', 'float8'),
123+
(1, 'env_biome', 'varchar'),
124+
(1, 'country', 'varchar'),
125+
(1, 'ph', 'float8'),
126+
(1, 'anonymized_name', 'varchar'),
127+
(1, 'tot_org_carb', 'float8'),
128+
(1, 'description_duplicate', 'varchar'),
129+
(1, 'env_feature', 'varchar'),
130130
(1, 'physical_specimen_location', 'varchar'),
131131
(1, 'physical_specimen_remaining', 'bool'),
132132
(1, 'dna_extracted', 'bool'),
@@ -140,26 +140,26 @@ INSERT INTO qiita.study_sample_columns (study_id, column_name, column_type) VALU
140140
-- Crate the sample_1 dynamic table
141141
CREATE TABLE qiita.sample_1 (
142142
sample_id varchar,
143-
SEASON_ENVIRONMENT varchar,
144-
ASSIGNED_FROM_GEO varchar,
145-
TEXTURE varchar,
146-
TAXON_ID varchar,
147-
DEPTH float8,
148-
HOST_TAXID varchar,
149-
COMMON_NAME varchar,
150-
WATER_CONTENT_SOIL float8,
151-
ELEVATION float8,
152-
TEMP float8,
153-
TOT_NITRO float8,
154-
SAMP_SALINITY float8,
155-
ALTITUDE float8,
156-
ENV_BIOME varchar,
157-
COUNTRY varchar,
158-
PH float8,
159-
ANONYMIZED_NAME varchar,
160-
TOT_ORG_CARB float8,
161-
Description_duplicate varchar,
162-
ENV_FEATURE varchar,
143+
season_environment varchar,
144+
assigned_from_geo varchar,
145+
texture varchar,
146+
taxon_id varchar,
147+
depth float8,
148+
host_taxid varchar,
149+
common_name varchar,
150+
water_content_soil float8,
151+
elevation float8,
152+
temp float8,
153+
tot_nitro float8,
154+
samp_salinity float8,
155+
altitude float8,
156+
env_biome varchar,
157+
country varchar,
158+
ph float8,
159+
anonymized_name varchar,
160+
tot_org_carb float8,
161+
description_duplicate varchar,
162+
env_feature varchar,
163163
physical_specimen_location varchar,
164164
physical_specimen_remaining bool,
165165
dna_extracted bool,
@@ -173,7 +173,7 @@ CREATE TABLE qiita.sample_1 (
173173
);
174174

175175
-- Populates the sample_1 dynamic table
176-
INSERT INTO qiita.sample_1 (sample_id, SEASON_ENVIRONMENT, ASSIGNED_FROM_GEO, TEXTURE, TAXON_ID, DEPTH, HOST_TAXID, COMMON_NAME, WATER_CONTENT_SOIL, ELEVATION, TEMP, TOT_NITRO, SAMP_SALINITY, ALTITUDE, ENV_BIOME, COUNTRY, PH, ANONYMIZED_NAME, TOT_ORG_CARB, Description_duplicate, ENV_FEATURE, physical_specimen_location, physical_specimen_remaining, dna_extracted, sample_type, collection_timestamp, host_subject_id, description, latitude, longitude) VALUES
176+
INSERT INTO qiita.sample_1 (sample_id, season_environment, assigned_from_geo, texture, taxon_id, depth, host_taxid, common_name, water_content_soil, elevation, temp, tot_nitro, samp_salinity, altitude, env_biome, country, ph, anonymized_name, tot_org_carb, description_duplicate, env_feature, physical_specimen_location, physical_specimen_remaining, dna_extracted, sample_type, collection_timestamp, host_subject_id, description, latitude, longitude) VALUES
177177
('1.SKM7.640188', 'winter', 'n', '63.1 sand, 17.7 silt, 19.2 clay', '1118232', 0.15, '3483', 'root metagenome', 0.101, 114, 15, 1.3, 7.44, 0, 'ENVO:Temperate grasslands, savannas, and shrubland biome', 'GAZ:United States of America', 6.82, 'SKM7', 3.31, 'Bucu Roots', 'ENVO:plant-associated habitat', 'ANL', TRUE, TRUE, 'ENVO:soil', '2011-11-11 13:00', '1001:B6', 'Cannabis Soil Microbiome', 60.1102854322, 74.7123248382),
178178
('1.SKD9.640182', 'winter', 'n', '66 sand, 16.3 silt, 17.7 clay', '1118232', 0.15, '3483', 'root metagenome', 0.178, 114, 15, 1.51, 7.1, 0, 'ENVO:Temperate grasslands, savannas, and shrubland biome', 'GAZ:United States of America', 6.82, 'SKD9', 4.32, 'Diesel Root', 'ENVO:plant-associated habitat', 'ANL', TRUE, TRUE, 'ENVO:soil', '2011-11-11 13:00', '1001:D3', 'Cannabis Soil Microbiome', 23.1218032799, 42.838497795),
179179
('1.SKM8.640201', 'winter', 'n', '63.1 sand, 17.7 silt, 19.2 clay', '1118232', 0.15, '3483', 'root metagenome', 0.101, 114, 15, 1.3, 7.44, 0, 'ENVO:Temperate grasslands, savannas, and shrubland biome', 'GAZ:United States of America', 6.82, 'SKM8', 3.31, 'Bucu Roots', 'ENVO:plant-associated habitat', 'ANL', TRUE, TRUE, 'ENVO:soil', '2011-11-11 13:00', '1001:D8', 'Cannabis Soil Microbiome', 3.21190859967, 26.8138925876),

qiita_db/test/test_setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def test_sample_1(self):
6565
def test_prep_template(self):
6666
self.assertEqual(get_count("qiita.prep_template"), 1)
6767

68-
def test_common_prep_info(self):
68+
def test_prep_template_sample(self):
6969
self.assertEqual(get_count("qiita.prep_template_sample"), 27)
7070

7171
def test_prep_columns(self):

0 commit comments

Comments
 (0)