Skip to content
Permalink
Browse files
updates
  • Loading branch information
xperthunter committed Feb 3, 2023
1 parent 85e8517 commit 3fdc2879cf13f5fde00f5570a9b40aad0587c0a8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
@@ -146,14 +146,15 @@ if sdb.command == 'create':
print('Aborting')
sys.exit()

if not sdb.backup.endswith('.db'):
print(f'{sdb.backup} does not end in .db')
print('change database name with .db at the end')
print('Aborting')
sys.exit()
if sdb.backup:
if not sdb.backup.endswith('.db'):
print(f'{sdb.backup} does not end in .db')
print('change database name with .db at the end')
print('Aborting')
sys.exit()

specdb_path = os.path.abspath(sdb.db)
backup_path = os.path.abspath(sdb.backup)
if sdb.backup: backup_path = os.path.abspath(sdb.backup)

if os.path.isfile(specdb_path):
print(f'db file {sdb.db} already exists')
@@ -169,7 +170,7 @@ if sdb.command == 'create':

# initial SQLite database at SPECDB_DB location
Create.init(location=specdb_path)
Create.init(location=backup_path)
if sdb.backup: Create.init(location=backup_path)
print('db configured and initialized')
print('Done')

@@ -136,7 +136,7 @@ CREATE TABLE buffer_components ( -- describe the component(s) of a buffer, REQUI
buffer_id TEXT NOT NULL, -- `buffer_id` this component goes to, must already be in buffer table, Ex: hn4071
buffer_component TEXT CHECK( length(buffer_component) <= 64 ) NOT NULL, -- name of the component, len <= 64, Ex: NaCl
buffer_component_value FLOAT NOT NULL, -- the numeric concentration value of the component, Ex: 100.0
buffer_component_unit TEXT CHECK( buffer_component_unit in ('mM', '% (v/v)', 'mg/mL') ) NOT NULL, -- unit of concentration, one of (`mM`, `% (v/v)`, `mg/mL`), Ex: mM
buffer_component_unit TEXT CHECK( buffer_component_unit in ('mM', 'uM', 'x', '% (v/v)', 'mg/mL') ) NOT NULL, -- unit of concentration, one of (`mM`, `% (v/v)`, `mg/mL`), Ex: mM
isotopic_labeling TEXT DEFAULT "natural abundance",
UNIQUE(buffer_id, buffer_component),
FOREIGN KEY ([buffer_id]) REFERENCES "buffer" ([buffer_id]) ON DELETE NO ACTION ON UPDATE CASCADE
@@ -211,6 +211,10 @@ CREATE TABLE batch_components ( -- describe the purification batches in a pst, R
FOREIGN KEY ([batch_id]) REFERENCES "purification_batch" ([batch_id]) ON DELETE NO ACTION ON UPDATE CASCADE
);

INSERT INTO batch_components (pst_id, batch_id, conc, conc_unit)
VALUES
("NONE", "NONE", "0.0", "mM");

CREATE TABLE spectrometer ( -- spectrometer information, REQUIRED: `spectrometer_id`, `manufacturer``, `field_strength`
id INTEGER PRIMARY KEY NOT NULL,
spectrometer_id TEXT CHECK( spectrometer_id NOT LIKE '% %' and length(spectrometer_id) <= 32 ) NOT NULL, -- text identifier for spectrometer, must be unique, no spaces, len <= 32, EX: HU800

0 comments on commit 3fdc287

Please sign in to comment.