2 This renames avg_lib_size to gel_cut_size and adds an insert length field
10 def main(cmdline=None):
12 dest='/tmp/fctracker.db'
15 shutil.copy(cmdline[0], dest)
16 conn = sqlite3.connect(dest)
20 c.execute("""alter table samples_library rename to samples_library_temp;""")
21 c.execute("""CREATE TABLE "samples_library" (
22 "id" varchar(10) NOT NULL PRIMARY KEY,
23 "library_name" varchar(100) NOT NULL UNIQUE,
24 "library_species_id" integer NOT NULL REFERENCES "samples_species" ("id"),
25 "hidden" bool NOT NULL,
26 "account_number" varchar(100) NULL,
27 "cell_line_id" integer NULL REFERENCES "samples_cellline" ("id"),
28 "condition_id" integer NULL REFERENCES "samples_condition" ("id"),
29 "antibody_id" integer NULL REFERENCES "samples_antibody" ("id"),
30 "replicate" smallint unsigned NOT NULL,
31 "experiment_type_id" integer NOT NULL REFERENCES "samples_experimenttype" ("id"),
32 "library_type_id" integer NULL REFERENCES "samples_librarytype" ("id"),
33 "creation_date" date NULL,
34 "made_for" varchar(50) NOT NULL,
35 "made_by" varchar(50) NOT NULL,
36 "stopping_point" varchar(25) NOT NULL,
37 "amplified_from_sample_id" varchar(10) NULL,
38 "undiluted_concentration" decimal NULL,
39 "successful_pM" decimal NULL,
40 "ten_nM_dilution" bool NOT NULL,
41 "gel_cut_size" integer NULL,
42 "insert_size" integer NULL,
45 c.execute("""INSERT INTO samples_library
46 ( id, library_name, library_species_id, hidden, account_number,
47 cell_line_id, condition_id, antibody_id, replicate,
48 experiment_type_id, library_type_id, creation_date, made_for,
49 made_by, stopping_point, amplified_from_sample_id,
50 undiluted_concentration, successful_pM, ten_nM_dilution,
53 id, library_name, library_species_id, hidden, account_number,
54 cell_line_id, condition_id, antibody_id, replicate,
55 experiment_type_id, library_type_id, creation_date, made_for,
56 made_by, stopping_point, amplified_from_sample_id,
57 undiluted_concentration, successful_pM, ten_nM_dilution,
59 FROM samples_library_temp;
61 c.execute('DROP TABLE samples_library_temp;')
64 # modify experiments_lane
65 c.execute("""alter table experiments_lane rename to experiments_lane_temp;""")
67 CREATE TABLE "experiments_lane" (
68 "id" integer NOT NULL PRIMARY KEY,
69 "flowcell_id" integer NOT NULL REFERENCES "experiments_flowcell" ("id"),
70 "lane_number" integer NOT NULL,
71 "library_id" varchar(10) NOT NULL REFERENCES "samples_library" ("id"),
72 "pM" decimal NOT NULL,
73 "cluster_estimate" integer,
79 INSERT INTO experiments_lane
80 ( id, flowcell_id, lane_number, library_id, pM, cluster_estimate, comment)
82 id, flowcell_id, lane_number, library_id, pM, cluster_estimate, comment
83 FROM experiments_lane_temp;
85 c.execute('DROP TABLE experiments_lane_temp;')
88 if __name__ == "__main__":