-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathoconnor-0.000-23.000.sql
More file actions
2180 lines (1581 loc) · 64.3 KB
/
oconnor-0.000-23.000.sql
File metadata and controls
2180 lines (1581 loc) · 64.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Copyright (c) 2014 LabKey Corporation
*
* Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
*/
/* oconnor-0.00-1.07.sql */
CREATE SCHEMA oconnor;
CREATE FUNCTION oconnor.add_order_number() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
--check to see if any purchases exist in container, assign first order number 1. if orders already exist in container, assign next order number
IF
(SELECT
COUNT(*) as row_count
FROM
oconnor.purchases p
WHERE
p.container=NEW.container
) = 0
THEN
NEW.order_number :=1;
ELSE
NEW.order_number :=
(SELECT
p.order_number+1 as test
FROM
oconnor.purchases p
WHERE
p.container=NEW.container
ORDER by p.order_number DESC
LIMIT 1);
END IF;
RETURN NEW;
END;
$$;
--
-- Name: add_quote_number(); Type: FUNCTION; Schema: oconnor; Owner: oconnor
--
CREATE FUNCTION oconnor.add_quote_number() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
--check to see if any quotes exist in container, assign first quote number 1. if quotes already exist in container, assign next quote number
IF
(SELECT
COUNT(*) as row_count
FROM
oconnor.quotes p
WHERE
p.container=NEW.container
) = 0
THEN
NEW.quote_number :=1;
ELSE
NEW.quote_number :=
(SELECT
p.quote_number+1 as test
FROM
oconnor.quotes p
WHERE
p.container=NEW.container
ORDER by p.quote_number DESC
LIMIT 1);
END IF;
RETURN NEW;
END;
$$;
CREATE FUNCTION oconnor.acreate_miseq_mhc_genotypes() RETURNS trigger
LANGUAGE plpgsql
AS $$BEGIN
DROP TABLE IF EXISTS miseq_mhc_genotypes;
--CREATE TABLE oconnor.to hold miseq_mhc_genotypes from query. note there is no pkey on this table as per rules with 'CREATE TABLE oconnor.as'
CREATE TABLE oconnor.miseq_mhc_genotypes
AS
(SELECT
--extract run name from each read. use regular expression to find run name, which is second component of header
SUBSTRING(read from '^\\w{6}\\+(\\d{1,5})\\\+') AS run,
--get multiplex identifier
mid,
--get allele lineage
lineage,
--count instances of lineage
COUNT(read) as read_ct
FROM
oconnor.miseq_mhc_reads
GROUP BY
--extract run name from read name using regexp. then group by run name, mid, and lineage.
--this will create a row for each run,mid,lineage combination.
--to get back to indvidual reads, use sql query to find reads with these combinations
SUBSTRING(read from '^\\w{6}\\+(\\d{1,5})\\\+'),mid,lineage);
--this statement exits out of the trigger function
RETURN OLD;
END;
$$;
CREATE FUNCTION oconnor.inventory_audit_deleted() RETURNS trigger
LANGUAGE plpgsql
AS $$BEGIN
DROP TABLE IF EXISTS emp;
--set values for status and removed_date
OLD.status='removed';
OLD.removed_date=NOW();
--add records to inventory_removed table
INSERT INTO oconnor.inventory_removed VALUES (OLD.*);
RETURN OLD;
END;$$;
CREATE FUNCTION oconnor.inventory_duplicate_check() RETURNS trigger
LANGUAGE plpgsql
AS $$--set variable quantity to 0. will update when the query runs. if the query finds one or more rows (indicating existing sample), it errors out
DECLARE
quantity INTEGER := 0;
BEGIN
SELECT
COUNT(*)
INTO quantity
FROM
oconnor.inventory i
WHERE
i.freezer=NEW.freezer
AND
i.cane=NEW.cane
AND
i.box=NEW.box
AND
i.box_row=NEW.box_row
AND
i.box_column=NEW.box_column
AND
i.status='available';
IF quantity > 0 THEN
RAISE EXCEPTION 'Sample already exists in freezer: %, cane: %, box: %, row: %, column: %. Please check your coordinates and try again.', NEW.freezer, NEW.cane, NEW.box, NEW.box_row, NEW.box_column;
END IF;
RETURN NEW;
END;
$$;
--
-- Name: alabrity_sequence; Type: SEQUENCE; Schema: oconnor; Owner: oconnor
--
CREATE SEQUENCE oconnor.alabrity_sequence
START WITH 30770
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: SEQUENCE alabrity_sequence; Type: COMMENT; Schema: oconnor; Owner: oconnor
--
COMMENT ON SEQUENCE oconnor.alabrity_sequence IS 'sequence used for primary key throughout entire alabrity system';
-- Name: grants; Type: TABLE; Schema: oconnor; Owner: oconnor; Tablespace:
--
CREATE TABLE oconnor.grants (
key integer DEFAULT nextval('oconnor.alabrity_sequence'::regclass) NOT NULL,
container character varying(36) NOT NULL,
created timestamp without time zone NOT NULL,
modified timestamp without time zone NOT NULL,
createdby public.userid NOT NULL,
modifiedby public.userid NOT NULL,
id character varying(255) NOT NULL,
enabled boolean DEFAULT true NOT NULL,
title text NOT NULL,
funding_source text,
grant_type character varying(255),
grant_unit character varying(255),
expiration_date timestamp without time zone NOT NULL,
budget numeric,
comments text
);
--
-- Name: oc_sequence; Type: SEQUENCE; Schema: oconnor; Owner: oconnor
--
CREATE SEQUENCE oconnor.oc_sequence
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: all_species; Type: TABLE; Schema: oconnor; Owner: oconnor; Tablespace:
--
CREATE TABLE oconnor.all_species (
specimen_species character varying(255) NOT NULL,
species_common_name character varying(255) NOT NULL,
species_short_name character varying(255) NOT NULL,
rowid integer DEFAULT nextval('oconnor.oc_sequence'::regclass) NOT NULL
);
--
-- Name: TABLE all_species; Type: COMMENT; Schema: oconnor; Owner: oconnor
--
COMMENT ON TABLE oconnor.all_species IS 'used as lookup in inventory app';
--
-- Name: all_specimens; Type: TABLE; Schema: oconnor; Owner: oconnor; Tablespace:
--
CREATE TABLE oconnor.all_specimens (
specimen_type character varying(255) NOT NULL,
rowid integer DEFAULT nextval('oconnor.oc_sequence'::regclass) NOT NULL
);
--
-- Name: TABLE all_specimens; Type: COMMENT; Schema: oconnor; Owner: oconnor
--
COMMENT ON TABLE oconnor.all_specimens IS 'used as lookup in inventory app';
--
-- Name: animals; Type: TABLE; Schema: oconnor; Owner: oconnor; Tablespace:
--
CREATE TABLE oconnor.animals (
id character varying(255) NOT NULL,
gs_id character varying(255),
cr_id character varying(255),
mhc_haplotype character varying(255),
study character varying(255),
current_use character varying(255),
challenge_type character varying(255),
challenge_date timestamp without time zone,
vaccine_type character varying(255),
vaccine_date timestamp without time zone,
comments character varying(255),
kir_haplotype character varying(255)
);
--
-- Name: TABLE animals; Type: COMMENT; Schema: oconnor; Owner: oconnor
--
COMMENT ON TABLE oconnor.animals IS 'animals intensively studied by the O''Connor lab. Used to store data on commonly used fields like SIV infection date and MHC genotype.';
--
-- Name: availability; Type: TABLE; Schema: oconnor; Owner: oconnor; Tablespace:
--
CREATE TABLE oconnor.availability (
availability character varying(25) NOT NULL,
rowid integer DEFAULT nextval('oconnor.oc_sequence'::regclass) NOT NULL
);
--
-- Name: TABLE availability; Type: COMMENT; Schema: oconnor; Owner: oconnor
--
COMMENT ON TABLE oconnor.availability IS 'lookup used by inventory system';
--
-- Name: cell_type; Type: TABLE; Schema: oconnor; Owner: oconnor; Tablespace:
--
CREATE TABLE oconnor.cell_type (
cell_type character varying(255) NOT NULL,
rowid integer DEFAULT nextval('oconnor.oc_sequence'::regclass) NOT NULL
);
--
-- Name: TABLE cell_type; Type: COMMENT; Schema: oconnor; Owner: oconnor
--
COMMENT ON TABLE oconnor.cell_type IS 'lookup used by inventory system';
--
-- Name: diff_snp; Type: TABLE; Schema: oconnor; Owner: oconnor; Tablespace:
--
CREATE TABLE oconnor.diff_snp (
key integer DEFAULT nextval('oconnor.oc_sequence'::regclass) NOT NULL,
uploaded_variation character varying(100) NOT NULL,
location character varying(100) NOT NULL,
allele character varying(100) NOT NULL,
gene character varying(100) NOT NULL,
transcript character varying(100) NOT NULL,
consequence character varying(100) NOT NULL,
cdna_position character varying(100) NOT NULL,
cds_position character varying(100) NOT NULL,
protein_position character varying(100) NOT NULL,
amino_acids character varying(100) NOT NULL,
codons character varying(100) NOT NULL,
existing_variation character varying(100) NOT NULL,
extra character varying(255) NOT NULL,
gene_common_name character varying(100) NOT NULL,
created timestamp without time zone DEFAULT now() NOT NULL,
modified timestamp without time zone
);
--
-- Name: TABLE diff_snp; Type: COMMENT; Schema: oconnor; Owner: oconnor
--
COMMENT ON TABLE oconnor.diff_snp IS 'comparison of differential SNPs in genome sequencing data from CY0165 and CY0166. intended for data browsing, not long-term data storage. ';
--
-- Name: dna_sequences; Type: TABLE; Schema: oconnor; Owner: oconnor; Tablespace:
--
CREATE TABLE oconnor.dna_sequences (
allele_name character varying(255) NOT NULL,
initials character varying(255) NOT NULL,
file_active integer NOT NULL,
genbank_id character varying(255) NOT NULL,
expt_number character varying(255) NOT NULL,
comments character varying(255) NOT NULL,
locus character varying(255) NOT NULL,
species character varying(255) NOT NULL,
origin character varying(255) NOT NULL,
sequence text NOT NULL,
previous_name character varying(255) NOT NULL,
last_edit timestamp without time zone NOT NULL,
version integer NOT NULL,
modified_by character varying(255) NOT NULL,
translation text NOT NULL,
type character varying(255) NOT NULL,
ipd_accession character varying(255) NOT NULL,
reference integer NOT NULL,
region character varying(255) NOT NULL,
id integer NOT NULL,
variant integer NOT NULL,
upload_id character varying(255) NOT NULL,
full_length integer NOT NULL,
uid integer NOT NULL,
allele_family character varying(255) NOT NULL
);
--
-- Name: dna_sequences_draft_2013; Type: TABLE; Schema: oconnor; Owner: oconnor; Tablespace:
--
CREATE TABLE oconnor.dna_sequences_draft_2013 (
allele_name character varying(255) NOT NULL,
initials character varying(255) NOT NULL,
file_active integer DEFAULT 1 NOT NULL,
genbank_id character varying(255),
expt_number character varying(255),
comments character varying(255),
locus character varying(255),
species character varying(255) NOT NULL,
origin character varying(255),
sequence text NOT NULL,
previous_name character varying(255),
last_edit timestamp without time zone,
version integer,
modified_by character varying(255),
translation text,
type character varying(255),
ipd_accession character varying(255),
reference integer,
region character varying(255),
id integer NOT NULL,
variant integer,
upload_id character varying(255),
full_length integer,
uid integer NOT NULL,
allele_family character varying(255)
);
--
-- Name: dna_type; Type: TABLE; Schema: oconnor; Owner: oconnor; Tablespace:
--
CREATE TABLE oconnor.dna_type (
dna_type character varying(255) NOT NULL,
rowid integer DEFAULT nextval('oconnor.oc_sequence'::regclass) NOT NULL
);
--
-- Name: TABLE dna_type; Type: COMMENT; Schema: oconnor; Owner: oconnor
--
COMMENT ON TABLE oconnor.dna_type IS 'lookup used in inventory system';
--
-- Name: elispot_matrix; Type: TABLE; Schema: oconnor; Owner: oconnor; Tablespace:
--
CREATE TABLE oconnor.elispot_matrix (
pool character varying(255) NOT NULL,
id integer NOT NULL,
"500-587" integer,
"588-684" integer,
"685-762" integer,
"763-850" integer,
"851-946" integer,
"947-1024" integer,
"1025-1111" integer,
"1112-1189" integer,
"1190-1267" integer,
"1169-1254" integer,
"1255-1321" integer,
"1149" integer
);
--
-- Name: TABLE elispot_matrix; Type: COMMENT; Schema: oconnor; Owner: oconnor
--
COMMENT ON TABLE oconnor.elispot_matrix IS 'used to deconvolute elispot pools. written by paul hines.';
--
-- Name: experiment_db; Type: TABLE; Schema: oconnor; Owner: oconnor; Tablespace:
--
CREATE TABLE oconnor.experiment_db (
experiment_number integer NOT NULL,
created timestamp without time zone,
createdby public.userid,
description text,
type character varying(255) DEFAULT NULL::character varying,
parents character varying(255) DEFAULT NULL::character varying,
workbook integer,
container public.entityid,
modifiedby public.userid,
modified timestamp without time zone,
comments character varying(255),
oc_comments character varying(2555)
);
--
-- Name: TABLE experiment_db; Type: COMMENT; Schema: oconnor; Owner: oconnor
--
COMMENT ON TABLE oconnor.experiment_db IS 'oconnor lab experiment log.';
--
-- Name: experiment_db_experiment_number_seq; Type: SEQUENCE; Schema: oconnor; Owner: oconnor
--
CREATE SEQUENCE oconnor.experiment_db_experiment_number_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: experiment_db_experiment_number_seq; Type: SEQUENCE OWNED BY; Schema: oconnor; Owner: oconnor
--
ALTER SEQUENCE oconnor.experiment_db_experiment_number_seq OWNED BY oconnor.experiment_db.experiment_number;
--
-- Name: experiment_types; Type: TABLE; Schema: oconnor; Owner: oconnor; Tablespace:
--
CREATE TABLE oconnor.experiment_types (
type character varying(255) NOT NULL,
container public.entityid,
createdby public.userid,
created timestamp without time zone,
modifiedby public.userid,
modified timestamp without time zone
);
--
-- Name: TABLE experiment_types; Type: COMMENT; Schema: oconnor; Owner: oconnor
--
COMMENT ON TABLE oconnor.experiment_types IS 'lookup used in experiment system';
--
-- Name: flow_markers; Type: TABLE; Schema: oconnor; Owner: oconnor; Tablespace:
--
CREATE TABLE oconnor.flow_markers (
surfacemarkers character varying(255) NOT NULL,
subsetname character varying(255) NOT NULL
);
--
-- Name: flow_markers_copy; Type: TABLE; Schema: oconnor; Owner: oconnor; Tablespace:
--
CREATE TABLE oconnor.flow_markers_copy (
surfacemarkers character varying(255) NOT NULL,
subsetname character varying(255) NOT NULL
);
--
-- Name: freezer_id; Type: TABLE; Schema: oconnor; Owner: oconnor; Tablespace:
--
CREATE TABLE oconnor.freezer_id (
freezer_id character varying(25) NOT NULL,
rowid integer DEFAULT nextval('oconnor.oc_sequence'::regclass) NOT NULL
);
--
-- Name: TABLE freezer_id; Type: COMMENT; Schema: oconnor; Owner: oconnor
--
COMMENT ON TABLE oconnor.freezer_id IS 'lookup used by inventory system';
--
-- Name: inventory; Type: TABLE; Schema: oconnor; Owner: oconnor; Tablespace:
--
CREATE TABLE oconnor.inventory (
key integer DEFAULT nextval('oconnor.oc_sequence'::regclass) NOT NULL,
status character varying(255) DEFAULT NULL::character varying NOT NULL,
experiment integer,
sample_number character varying(255) DEFAULT NULL::character varying,
sample_type character varying(255) DEFAULT NULL::character varying,
initials character varying(255) DEFAULT NULL::character varying,
lab_name character varying(255) DEFAULT NULL::character varying,
comments text,
freezer character varying(255) DEFAULT NULL::character varying,
cane character varying(255) DEFAULT NULL::character varying,
coordinate character varying(255) DEFAULT NULL::character varying,
box character varying(255) DEFAULT NULL::character varying,
box_row character varying(255) DEFAULT NULL::character varying,
box_column character varying(255) DEFAULT NULL::character varying,
specimen_id character varying(255) DEFAULT NULL::character varying,
specimen_type character varying(255) DEFAULT NULL::character varying,
specimen_species character varying(255) DEFAULT NULL::character varying,
specimen_geographic_origin character varying(255) DEFAULT NULL::character varying,
specimen_institution character varying(255) DEFAULT NULL::character varying,
specimen_collaborator character varying(255) DEFAULT NULL::character varying,
specimen_quantity character varying(255) DEFAULT NULL::character varying,
specimen_additive character varying(255) DEFAULT NULL::character varying,
shipped_recipient_name character varying(255) DEFAULT NULL::character varying,
shipped_recipient_institution character varying(255) DEFAULT NULL::character varying,
shipped_notes text,
removed_name character varying(255) DEFAULT NULL::character varying,
dna_vector character varying(255) DEFAULT NULL::character varying,
dna_insert character varying(255) DEFAULT NULL::character varying,
dna_type character varying(255) DEFAULT NULL::character varying,
dna_sequence text,
oligo_number integer,
oligo_name character varying(255) DEFAULT NULL::character varying,
oligo_sequence character varying(255) DEFAULT NULL::character varying,
oligo_type character varying(255) DEFAULT NULL::character varying,
oligo_modifications character varying(255) DEFAULT NULL::character varying,
oligo_target character varying(255) DEFAULT NULL::character varying,
oligo_cognate character varying(255) DEFAULT NULL::character varying,
oligo_purification character varying(255) DEFAULT NULL::character varying,
oligo_melting numeric(20,2) DEFAULT NULL::numeric,
cell_type character varying(255) DEFAULT NULL::character varying,
cell_source character varying(255) DEFAULT NULL::character varying,
cell_concentration character varying(255) DEFAULT NULL::character varying,
cell_mhc_restriction character varying(255) DEFAULT NULL::character varying,
cell_peptide_stimulation character varying(255) DEFAULT NULL::character varying,
cell_passage_number character varying(255) DEFAULT NULL::character varying,
cell_transforming_virus character varying(255) DEFAULT NULL::character varying,
virus_strain character varying(255) DEFAULT NULL::character varying,
virus_vl numeric(20,2) DEFAULT NULL::numeric,
virus_tcid50 numeric(20,2) DEFAULT NULL::numeric,
virus_grown_on character varying(255) DEFAULT NULL::character varying,
nucleic_extraction character varying(255) DEFAULT NULL::character varying,
nucleic_purity character varying(20) DEFAULT NULL::numeric,
gs_id character varying(255) DEFAULT NULL::character varying,
cohort_id character varying(255),
container character varying(36) NOT NULL,
sample_date timestamp without time zone,
shipped_date timestamp without time zone,
removed_date timestamp without time zone,
oligo_date timestamp without time zone,
cell_freeze_date timestamp without time zone,
virus_freeze_date timestamp without time zone,
modified timestamp without time zone,
created timestamp without time zone
);
--
-- Name: TABLE inventory; Type: COMMENT; Schema: oconnor; Owner: oconnor
--
COMMENT ON TABLE oconnor.inventory IS 'samples in oconnor inventory';
--
-- Name: COLUMN inventory.container; Type: COMMENT; Schema: oconnor; Owner: oconnor
--
COMMENT ON COLUMN oconnor.inventory.container IS 'container default is for ''oconnor'' folder on Labkey';
--
-- Name: inventory_removed; Type: TABLE; Schema: oconnor; Owner: oconnor; Tablespace:
--
CREATE TABLE oconnor.inventory_removed (
key integer DEFAULT nextval('oconnor.oc_sequence'::regclass) NOT NULL,
status character varying(255) NOT NULL,
experiment integer,
sample_number character varying(255),
sample_type character varying(255),
initials character varying(255),
lab_name character varying(255),
comments text,
freezer character varying(255),
cane character varying(255),
coordinate character varying(255),
box character varying(255),
box_row character varying(255),
box_column character varying(255),
specimen_id character varying(255),
specimen_type character varying(255),
specimen_species character varying(255),
specimen_geographic_origin character varying(255),
specimen_institution character varying(255),
specimen_collaborator character varying(255),
specimen_quantity character varying(255),
specimen_additive character varying(255),
shipped_recipient_name character varying(255),
shipped_recipient_institution character varying(255),
shipped_notes text,
removed_name character varying(255),
dna_vector character varying(255),
dna_insert character varying(255),
dna_type character varying(255),
dna_sequence text,
oligo_number integer,
oligo_name character varying(255),
oligo_sequence character varying(255),
oligo_type character varying(255),
oligo_modifications character varying(255),
oligo_target character varying(255),
oligo_cognate character varying(255),
oligo_purification character varying(255),
oligo_melting numeric(20,2),
cell_type character varying(255),
cell_source character varying(255),
cell_concentration character varying(255),
cell_mhc_restriction character varying(255),
cell_peptide_stimulation character varying(255),
cell_passage_number character varying(255),
cell_transforming_virus character varying(255),
virus_strain character varying(255),
virus_vl numeric(20,2),
virus_tcid50 numeric(20,2),
virus_grown_on character varying(255),
nucleic_extraction character varying(255),
nucleic_purity character varying(20),
gs_id character varying(255),
cohort_id character varying(255),
container character varying(36) NOT NULL,
sample_date timestamp without time zone,
shipped_date timestamp without time zone,
removed_date timestamp without time zone,
oligo_date timestamp without time zone,
cell_freeze_date timestamp without time zone,
virus_freeze_date timestamp without time zone,
created timestamp without time zone,
modified timestamp without time zone
);
--
-- Name: TABLE inventory_removed; Type: COMMENT; Schema: oconnor; Owner: oconnor
--
COMMENT ON TABLE oconnor.inventory_removed IS 'samples removed from oconnor inventory. automatically populated using a trigger that runs when a sample is deleted from the inventory table.';
--
-- Name: COLUMN inventory_removed.container; Type: COMMENT; Schema: oconnor; Owner: oconnor
--
COMMENT ON COLUMN oconnor.inventory_removed.container IS 'defaults to container id for oconnor folder on labkey';
--
-- Name: jr_read_length; Type: TABLE; Schema: oconnor; Owner: oconnor; Tablespace:
--
CREATE TABLE oconnor.jr_read_length (
rowid integer NOT NULL,
run integer NOT NULL,
length integer NOT NULL,
count integer NOT NULL
);
--
-- Name: TABLE jr_read_length; Type: COMMENT; Schema: oconnor; Owner: oconnor
--
COMMENT ON TABLE oconnor.jr_read_length IS 'apparently used as part of 454 sequence manger. not entirely sure how it is used.
';
--
-- Name: jr_read_length_rowid_seq; Type: SEQUENCE; Schema: oconnor; Owner: oconnor
--
CREATE SEQUENCE oconnor.jr_read_length_rowid_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: jr_read_length_rowid_seq; Type: SEQUENCE OWNED BY; Schema: oconnor; Owner: oconnor
--
ALTER SEQUENCE oconnor.jr_read_length_rowid_seq OWNED BY oconnor.jr_read_length.rowid;
--
-- Name: laboratory; Type: TABLE; Schema: oconnor; Owner: oconnor; Tablespace:
--
CREATE TABLE oconnor.laboratory (
laboratory character varying(25) NOT NULL,
rowid integer DEFAULT nextval('oconnor.oc_sequence'::regclass) NOT NULL
);
--
-- Name: TABLE laboratory; Type: COMMENT; Schema: oconnor; Owner: oconnor
--
COMMENT ON TABLE oconnor.laboratory IS 'lookup used in inventory system';
--
-- Name: virus_challenges; Type: TABLE; Schema: oconnor; Owner: oconnor; Tablespace:
--
CREATE TABLE oconnor.virus_challenges (
id character varying(255) NOT NULL,
challenge_date timestamp(6) without time zone NOT NULL,
code character varying(255) NOT NULL,
meaning character varying(255) NOT NULL,
remark character varying(255) NOT NULL,
challenge_type character varying(255) NOT NULL
);
--
-- Name: mcm_cd8_tcell_epitopes; Type: TABLE; Schema: oconnor; Owner: oconnor; Tablespace:
--
CREATE TABLE oconnor.mcm_cd8_tcell_epitopes (
official_name character varying(255) NOT NULL,
confirmed boolean NOT NULL,
allele_specificity character varying(255) NOT NULL,
sequence character varying(255) NOT NULL,
"tetramer " boolean,
viral_suppression integer,
"viral_escape " integer,
response_stage character varying(255),
present_in_m3ko boolean
);
--
-- Name: TABLE mcm_cd8_tcell_epitopes; Type: COMMENT; Schema: oconnor; Owner: oconnor
--
COMMENT ON TABLE oconnor.mcm_cd8_tcell_epitopes IS 'not sure who is using or maintaining this.';
--
-- Name: mhc_haplotypes; Type: TABLE; Schema: oconnor; Owner: oconnor; Tablespace:
--
CREATE TABLE oconnor.mhc_haplotypes (
key integer DEFAULT nextval('oconnor.oc_sequence'::regclass) NOT NULL,
container character varying(36) NOT NULL,
created timestamp without time zone NOT NULL,
modified timestamp without time zone NOT NULL,
"createdBy" integer NOT NULL,
"modifiedBy" integer NOT NULL,
id character varying(10) NOT NULL,
haplotype character varying(10) NOT NULL,
reads integer,
run character varying(20),
comments text,
experiment integer,
initials character varying(20) NOT NULL,
enabled boolean DEFAULT true NOT NULL
);
--
-- Name: mhc_haplotypes_dictionary; Type: TABLE; Schema: oconnor; Owner: oconnor; Tablespace:
--
CREATE TABLE oconnor.mhc_haplotypes_dictionary (
key integer DEFAULT nextval('oconnor.oc_sequence'::regclass) NOT NULL,
container character varying(36) NOT NULL,
created timestamp without time zone NOT NULL,
modified timestamp without time zone NOT NULL,
"createdBy" integer NOT NULL,
"modifiedBy" integer NOT NULL,
haplotype character varying(50) NOT NULL,
allele character varying(50) NOT NULL,
locus character varying(10) NOT NULL,
major boolean NOT NULL,
comments text,
initials character varying(50) NOT NULL,
enabled boolean NOT NULL
);
--
-- Name: miseq_mhc_genotypes; Type: TABLE; Schema: oconnor; Owner: oconnor; Tablespace:
--
CREATE TABLE oconnor.miseq_mhc_genotypes (
run text,
mid smallint,
lineage character varying(50),
read_ct bigint
);
--
-- Name: miseq_mhc_reads; Type: TABLE; Schema: oconnor; Owner: oconnor; Tablespace:
--
CREATE TABLE oconnor.miseq_mhc_reads (
key integer DEFAULT nextval('oconnor.alabrity_sequence'::regclass),
container character varying(36) NOT NULL,
created timestamp without time zone DEFAULT now() NOT NULL,
modified timestamp without time zone DEFAULT now() NOT NULL,
"createdBy" public.userid DEFAULT 1001 NOT NULL,
"modifiedBy" public.userid DEFAULT 1001 NOT NULL,
mid smallint NOT NULL,
read character varying(50) NOT NULL,
lineage character varying(50) NOT NULL
);
--
-- Name: miseq_mhc_samples; Type: TABLE; Schema: oconnor; Owner: oconnor; Tablespace:
--
CREATE TABLE oconnor.miseq_mhc_samples (
key integer DEFAULT nextval('oconnor.oc_sequence'::regclass) NOT NULL,
container character varying(36) NOT NULL,
created timestamp without time zone NOT NULL,
modified timestamp without time zone NOT NULL,
"createdBy" public.userid NOT NULL,
"modifiedBy" public.userid NOT NULL,
run smallint NOT NULL,
mid smallint NOT NULL,
sample_id character varying(255),
sample_name character varying(255)
);
--
-- Name: oligo_purification; Type: TABLE; Schema: oconnor; Owner: oconnor; Tablespace:
--
CREATE TABLE oconnor.oligo_purification (
oligo_purification character varying(25) NOT NULL,
rowid integer DEFAULT nextval('oconnor.oc_sequence'::regclass) NOT NULL
);
--
-- Name: TABLE oligo_purification; Type: COMMENT; Schema: oconnor; Owner: oconnor
--
COMMENT ON TABLE oconnor.oligo_purification IS 'lookup used in inventory system.';
--
-- Name: oligo_type; Type: TABLE; Schema: oconnor; Owner: oconnor; Tablespace:
--
CREATE TABLE oconnor.oligo_type (
oligo_type character varying(255) NOT NULL,
rowid integer DEFAULT nextval('oconnor.oc_sequence'::regclass) NOT NULL
);
--
-- Name: TABLE oligo_type; Type: COMMENT; Schema: oconnor; Owner: oconnor
--
COMMENT ON TABLE oconnor.oligo_type IS 'lookup used in inventory system.';
--
-- Name: peptide_vendor; Type: TABLE; Schema: oconnor; Owner: oconnor; Tablespace:
--
CREATE TABLE oconnor.peptide_vendor (
peptide_vendor character varying(255) NOT NULL,
rowid integer DEFAULT nextval('oconnor.oc_sequence'::regclass) NOT NULL
);
--
-- Name: TABLE peptide_vendor; Type: COMMENT; Schema: oconnor; Owner: oconnor
--
COMMENT ON TABLE oconnor.peptide_vendor IS 'lookup used in inventory system';
--
-- Name: peptides; Type: TABLE; Schema: oconnor; Owner: oconnor; Tablespace:
--
CREATE TABLE oconnor.peptides (
peptide_number smallint NOT NULL,
pool_contents character varying(255),
peptide_virus_strain character varying(255),
peptide_protein character varying(255),
peptide_alias character varying(255),
target_sequence character varying(255),
sequence_length smallint,
amino_acid_sequence character varying(255),
concentration character varying(255),
molecular_weight real,
comments character varying(255),
container character varying(36) NOT NULL
);
--
-- Name: TABLE peptides; Type: COMMENT; Schema: oconnor; Owner: oconnor
--
COMMENT ON TABLE oconnor.peptides IS 'synthetic peptides used in immunology experiments. separated from inventory in 2011 by Paul Hines to support ELISPOT data analysis within labkey';
--
-- Name: purchases; Type: TABLE; Schema: oconnor; Owner: oconnor; Tablespace:
--
CREATE TABLE oconnor.purchases (
key integer DEFAULT nextval('oconnor.alabrity_sequence'::regclass) NOT NULL,
container character varying(36) NOT NULL,
created timestamp without time zone NOT NULL,
modified timestamp without time zone NOT NULL,
"createdBy" public.userid NOT NULL,
"modifiedBy" public.userid NOT NULL,
order_number integer,
item character varying(255) NOT NULL,
item_unit character varying(255),
placed_by character varying(255) NOT NULL,