diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 5aeb7c0..0000000 --- a/.gitattributes +++ /dev/null @@ -1,47 +0,0 @@ -# Convert text files to OS line-endings on checkout, and LF on check-in -* text=auto !eol - -# Text files to convert -*.css text diff=css -*.htm text diff=html -*.html text diff=html -*.java text diff=java -*.js text -*.json text -*.jsp text -*.jspf text -*.jspx text -*.properties text -*.py text diff=python -*.sql text -*.tld text -*.ts text -*.txt text -*.xml text -*.yml text - -# Keep unix endings -*.bash text eol=lf -*.sh text eol=lf - -# Keep Windows endings -*.bat text eol=crlf -*.cmd text eol=crlf - -# Known binary files -- Don't change (binary is a macro for -text -diff) -*.bin binary -*.class binary -*.dll binary -*.ear binary -*.exe binary -*.gif binary -*.gz binary -*.ico binary -*.jar binary -*.jpg binary -*.jpeg binary -*.png binary -*.so binary -*.tar binary -*.war binary -*.zip binary diff --git a/README.md b/README.md new file mode 100644 index 0000000..d5a44cf --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +Module moved to [LabKey/customModules](https://github.com/LabKey/customModules) in 25.3 diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 405ae24..0000000 --- a/build.gradle +++ /dev/null @@ -1,3 +0,0 @@ -plugins { - id 'org.labkey.build.module' -} diff --git a/module.properties b/module.properties deleted file mode 100644 index 3d06d5f..0000000 --- a/module.properties +++ /dev/null @@ -1,2 +0,0 @@ -ModuleClass: org.scharp.atlas.pepdb.PepDBModule -ManageVersion: false diff --git a/pull_request_template.md b/pull_request_template.md deleted file mode 100644 index 2a1c8ac..0000000 --- a/pull_request_template.md +++ /dev/null @@ -1,8 +0,0 @@ -#### Rationale - - -#### Related Pull Requests -* - -#### Changes -* diff --git a/resources/schemas/dbscripts/postgresql/pepdb-0.00-0.02.sql b/resources/schemas/dbscripts/postgresql/pepdb-0.00-0.02.sql deleted file mode 100644 index a29b815..0000000 --- a/resources/schemas/dbscripts/postgresql/pepdb-0.00-0.02.sql +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Copyright (c) 2003-2005 Fred Hutchinson Cancer Research Center - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -BEGIN; - -CREATE SCHEMA pepdb; - -CREATE TABLE pepdb.clade ( - clade_id serial NOT NULL, - clade_desc text, - - CONSTRAINT PK_clade PRIMARY KEY (clade_id) -); - -CREATE TABLE pepdb.pathogen ( - pathogen_id serial NOT NULL, - pathogen_desc text, - - CONSTRAINT PK_pathogen PRIMARY KEY (pathogen_id) -); - -CREATE TABLE pepdb.group_type ( - group_type_id serial NOT NULL, - group_type_desc text, - - CONSTRAINT PK_group_type PRIMARY KEY (group_type_id) -); - -CREATE TABLE pepdb.pep_align_ref ( - pep_align_ref_id serial NOT NULL, - pep_align_ref_desc text, - - CONSTRAINT PK_pep_align_ref PRIMARY KEY (pep_align_ref_id) -); - -CREATE TABLE pepdb.peptide_group ( - _ts TIMESTAMP DEFAULT now(), - CreatedBy USERID, - Created TIMESTAMP, - ModifiedBy USERID, - Modified TIMESTAMP, - - peptide_group_id serial NOT NULL, - peptide_group_name text NOT NULL UNIQUE, - pathogen_id integer, - seq_ref text, - clade_id integer, - pep_align_ref_id integer, - group_type_id integer, - - CONSTRAINT PK_peptide_group PRIMARY KEY (peptide_group_id), - CONSTRAINT FK_peptide_group1 FOREIGN KEY(pathogen_id) REFERENCES pepdb.pathogen(pathogen_id), - CONSTRAINT FK_peptide_group2 FOREIGN KEY(clade_id) REFERENCES pepdb.clade(clade_id), - CONSTRAINT FK_peptide_group3 FOREIGN KEY(group_type_id) REFERENCES pepdb.group_type(group_type_id), - CONSTRAINT FK_peptide_group4 FOREIGN KEY(pep_align_ref_id) REFERENCES pepdb.pep_align_ref(pep_align_ref_id) -); - -CREATE TABLE pepdb.protein_category ( - protein_cat_id serial NOT NULL, - protein_cat_desc text, - - CONSTRAINT PK_protein_category PRIMARY KEY (protein_cat_id) -); - -CREATE TABLE pepdb.optimal_epitope_list( - optimal_epitope_list_id serial NOT NULL, - optimal_epitope_list_desc text, - - CONSTRAINT PK_optimal_epitope_list PRIMARY KEY (optimal_epitope_list_id) -); - - -CREATE TABLE pepdb.peptides ( - _ts TIMESTAMP DEFAULT now(), - CreatedBy USERID, - Created TIMESTAMP, - ModifiedBy USERID, - Modified TIMESTAMP, - - peptide_id serial NOT NULL, - peptide_sequence text NOT NULL UNIQUE, - protein_cat_id integer, - amino_acid_start_pos integer, - amino_acid_end_pos integer, - sequence_length integer, - child boolean, - parent boolean DEFAULT false NOT NULL, - src_file_name text, - storage_location text, - optimal_epitope_list_id integer, - hla_restriction text, - - CONSTRAINT PK_peptides PRIMARY KEY (peptide_id), - CONSTRAINT FK_peptides1 FOREIGN KEY(protein_cat_id) REFERENCES pepdb.protein_category(protein_cat_id), - CONSTRAINT FK_peptides2 FOREIGN KEY(optimal_epitope_list_id) REFERENCES pepdb.optimal_epitope_list(optimal_epitope_list_id) -); - - -CREATE TABLE pepdb.peptide_group_assignment ( - _ts TIMESTAMP DEFAULT now(), - CreatedBy USERID, - Created TIMESTAMP, - ModifiedBy USERID, - Modified TIMESTAMP, - - peptide_group_assignment_id serial NOT NULL UNIQUE, - peptide_id integer NOT NULL, - peptide_group_id integer NOT NULL, - peptide_id_in_group integer, - frequency_number float, - frequency_number_date date, - in_current_file boolean DEFAULT false, - - CONSTRAINT PK_peptide_group_assignment PRIMARY KEY (peptide_id,peptide_group_id), - CONSTRAINT FK_peptide_group_assignment1 FOREIGN KEY(peptide_id) REFERENCES pepdb.peptides(peptide_id), - CONSTRAINT FK_peptide_group_assignment2 FOREIGN KEY(peptide_group_id) REFERENCES pepdb.peptide_group(peptide_group_id) -); - -CREATE TABLE pepdb.parent ( - _ts TIMESTAMP DEFAULT now(), - CreatedBy USERID, - Created TIMESTAMP, - ModifiedBy USERID, - Modified TIMESTAMP, - - peptide_id integer NOT NULL, - linked_parent integer NOT NULL, - - CONSTRAINT PK_parent PRIMARY KEY (peptide_id,linked_parent), - CONSTRAINT FK_parent1 FOREIGN KEY(peptide_id) REFERENCES pepdb.peptides(peptide_id), - CONSTRAINT FK_parent2 FOREIGN KEY(linked_parent) REFERENCES pepdb.peptides(peptide_id) -); - -CREATE TABLE pepdb.pool_type ( - pool_type_id serial NOT NULL, - pool_type_desc text, - - CONSTRAINT PK_pool_type PRIMARY KEY (pool_type_id) -); - -CREATE TABLE pepdb.peptide_pool ( - _ts TIMESTAMP DEFAULT now(), - CreatedBy USERID, - Created TIMESTAMP, - ModifiedBy USERID, - Modified TIMESTAMP, - - peptide_pool_id serial NOT NULL, - peptide_pool_name text, - pool_type_id integer, - comment text, - - CONSTRAINT PK_peptide_pool PRIMARY KEY (peptide_pool_id), - CONSTRAINT FK_peptide_pool1 FOREIGN KEY(pool_type_id) REFERENCES pepdb.pool_type(pool_type_id) -); - - -CREATE TABLE pepdb.peptide_pool_assignment ( - _ts TIMESTAMP DEFAULT now(), - CreatedBy USERID, - Created TIMESTAMP, - ModifiedBy USERID, - Modified TIMESTAMP, - - peptide_pool_assignment_id serial NOT NULL UNIQUE, - peptide_pool_id integer NOT NULL, - peptide_id integer NOT NULL, - - CONSTRAINT PK_peptide_pool_assignment PRIMARY KEY (peptide_pool_id,peptide_id), - CONSTRAINT FK_peptide_pool_assignment1 FOREIGN KEY(peptide_pool_id) REFERENCES pepdb.peptide_pool(peptide_pool_id), - CONSTRAINT FK_peptide_pool_assignment2 FOREIGN KEY(peptide_id) REFERENCES pepdb.peptides(peptide_id) -); - -CREATE VIEW pepdb.parent_child_details AS -select par.peptide_id AS child_id,pchild.peptide_sequence AS child_sequence, -pchild.protein_cat_id AS child_protein,pchild.sequence_length AS child_seq_length, -pchild.amino_acid_start_pos AS child_AAStart,pchild.amino_acid_end_pos AS child_AAEnd, -pchild.optimal_epitope_list_id AS child_optimal_epitope_list_id,pchild.hla_restriction AS child_hla_restriction, -par.linked_parent AS parent_id,pparent.peptide_sequence AS parent_sequence, -pparent.protein_cat_id AS parent_protein,pparent.sequence_length AS parent_seq_length, -pparent.amino_acid_start_pos AS parent_AAStart,pparent.amino_acid_end_pos AS parent_AAEnd -from pepdb.parent par LEFT JOIN pepdb.peptides pchild ON (par.peptide_id = pchild.peptide_id) -LEFT JOIN pepdb.peptides pparent ON(par.linked_parent = pparent.peptide_id); - -CREATE VIEW pepdb.group_peptides AS -SELECT src.peptide_id, src.peptide_group_id, src.peptide_id_in_group, - pgroup.peptide_group_name,pgroup.pathogen_id, - p.peptide_sequence,p.protein_cat_id, - p.sequence_length,p.amino_acid_start_pos,p.amino_acid_end_pos, - p.child, p.parent,p.optimal_epitope_list_id,p.hla_restriction, - src.frequency_number,src.frequency_number_date,src.in_current_file -FROM ((pepdb.peptide_group_assignment src LEFT JOIN pepdb.peptide_group pgroup ON ((src.peptide_group_id - = pgroup.peptide_group_id))) LEFT JOIN pepdb.peptides p ON ((src.peptide_id = - p.peptide_id))); - -CREATE VIEW pepdb.pool_peptides AS -SELECT src.peptide_id, p.peptide_sequence, src.peptide_pool_id, pp.pool_type_id, pp.peptide_pool_name, pt.pool_type_desc -FROM -pepdb.peptides p, -pepdb.peptide_pool_assignment src -LEFT JOIN pepdb.peptide_pool pp -LEFT JOIN pepdb.pool_type pt ON(pp.pool_type_id = pt.pool_type_id) ON (src.peptide_pool_id = pp.peptide_pool_id) -WHERE (src.peptide_id = p.peptide_id); - -SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('pepdb.peptides', 'peptide_id'), 500000, true); -SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('pepdb.peptide_pool', 'peptide_pool_id'), 500000, true); - -COMMIT; - - - - - - - diff --git a/resources/schemas/dbscripts/postgresql/pepdb-0.00-2.21.sql b/resources/schemas/dbscripts/postgresql/pepdb-0.00-2.21.sql deleted file mode 100644 index 3d37bdc..0000000 --- a/resources/schemas/dbscripts/postgresql/pepdb-0.00-2.21.sql +++ /dev/null @@ -1,226 +0,0 @@ -CREATE SCHEMA pepdb; - -CREATE TABLE pepdb.clade ( - clade_id SERIAL NOT NULL, - clade_desc text -); - -CREATE TABLE pepdb.peptide_group ( - _ts timestamp without time zone DEFAULT now(), - createdby public.userid, - created timestamp without time zone, - modifiedby public.userid, - modified timestamp without time zone, - peptide_group_id SERIAL NOT NULL, - peptide_group_name text NOT NULL, - pathogen_id integer, - seq_ref text, - clade_id integer, - pep_align_ref_id integer, - group_type_id integer -); - -CREATE TABLE pepdb.peptide_group_assignment ( - _ts timestamp without time zone DEFAULT now(), - createdby public.userid, - created timestamp without time zone, - modifiedby public.userid, - modified timestamp without time zone, - peptide_group_assignment_id SERIAL NOT NULL, - peptide_id integer NOT NULL, - peptide_group_id integer NOT NULL, - peptide_id_in_group character varying, - frequency_number double precision, - frequency_number_date date, - in_current_file boolean DEFAULT false -); - -CREATE TABLE pepdb.peptides ( - _ts timestamp without time zone DEFAULT now(), - createdby public.userid, - created timestamp without time zone, - modifiedby public.userid, - modified timestamp without time zone, - peptide_id SERIAL NOT NULL, - peptide_sequence text NOT NULL, - protein_cat_id integer, - amino_acid_start_pos integer, - amino_acid_end_pos integer, - sequence_length integer, - child boolean, - parent boolean DEFAULT false NOT NULL, - src_file_name text, - storage_location text, - optimal_epitope_list_id integer, - hla_restriction text, - peptide_flag boolean DEFAULT false, - peptide_notes text -); - -CREATE TABLE pepdb.group_type ( - group_type_id SERIAL NOT NULL, - group_type_desc text -); - -CREATE TABLE pepdb.optimal_epitope_list ( - optimal_epitope_list_id SERIAL NOT NULL, - optimal_epitope_list_desc text -); - -CREATE TABLE pepdb.parent ( - _ts timestamp without time zone DEFAULT now(), - createdby public.userid, - created timestamp without time zone, - modifiedby public.userid, - modified timestamp without time zone, - peptide_id integer NOT NULL, - linked_parent integer NOT NULL -); - -CREATE TABLE pepdb.pathogen ( - pathogen_id SERIAL NOT NULL, - pathogen_desc text -); - -CREATE TABLE pepdb.pep_align_ref ( - pep_align_ref_id SERIAL NOT NULL, - pep_align_ref_desc text -); - -CREATE TABLE pepdb.peptide_pool ( - _ts timestamp without time zone DEFAULT now(), - createdby public.userid, - created timestamp without time zone, - modifiedby public.userid, - modified timestamp without time zone, - peptide_pool_id SERIAL NOT NULL, - peptide_pool_name text, - pool_type_id integer, - comment text, - archived boolean DEFAULT false, - parent_pool_id integer, - matrix_peptide_pool_id text -); - -CREATE TABLE pepdb.peptide_pool_assignment ( - _ts timestamp without time zone DEFAULT now(), - createdby public.userid, - created timestamp without time zone, - modifiedby public.userid, - modified timestamp without time zone, - peptide_pool_assignment_id SERIAL NOT NULL, - peptide_pool_id integer NOT NULL, - peptide_id integer NOT NULL, - peptide_group_assignment_id integer -); - -CREATE TABLE pepdb.pool_type ( - pool_type_id SERIAL NOT NULL, - pool_type_desc text -); - -CREATE TABLE pepdb.protein_category ( - protein_cat_id SERIAL NOT NULL, - protein_cat_desc text -); - -CREATE TABLE pepdb.temp_peppoolgroupassign ( - peptide_pool_assignment_id integer, - peptide_group_assignment_id integer -); - -ALTER TABLE ONLY pepdb.peptide_group_assignment - ADD CONSTRAINT peptide_group_assignment_peptide_group_assignment_id_key UNIQUE (peptide_group_assignment_id); - -ALTER TABLE ONLY pepdb.peptide_group - ADD CONSTRAINT peptide_group_peptide_group_name_key UNIQUE (peptide_group_name); - -ALTER TABLE ONLY pepdb.peptide_pool_assignment - ADD CONSTRAINT peptide_pool_assignment_peptide_pool_assignment_id_key UNIQUE (peptide_pool_assignment_id); - -ALTER TABLE ONLY pepdb.peptides - ADD CONSTRAINT peptides_peptide_sequence_key UNIQUE (peptide_sequence); - -ALTER TABLE ONLY pepdb.clade - ADD CONSTRAINT pk_clade PRIMARY KEY (clade_id); - -ALTER TABLE ONLY pepdb.group_type - ADD CONSTRAINT pk_group_type PRIMARY KEY (group_type_id); - -ALTER TABLE ONLY pepdb.optimal_epitope_list - ADD CONSTRAINT pk_optimal_epitope_list PRIMARY KEY (optimal_epitope_list_id); - -ALTER TABLE ONLY pepdb.parent - ADD CONSTRAINT pk_parent PRIMARY KEY (peptide_id, linked_parent); - -ALTER TABLE ONLY pepdb.pathogen - ADD CONSTRAINT pk_pathogen PRIMARY KEY (pathogen_id); - -ALTER TABLE ONLY pepdb.pep_align_ref - ADD CONSTRAINT pk_pep_align_ref PRIMARY KEY (pep_align_ref_id); - -ALTER TABLE ONLY pepdb.peptide_group - ADD CONSTRAINT pk_peptide_group PRIMARY KEY (peptide_group_id); - -ALTER TABLE ONLY pepdb.peptide_group_assignment - ADD CONSTRAINT pk_peptide_group_assignment PRIMARY KEY (peptide_id, peptide_group_id); - -ALTER TABLE ONLY pepdb.peptide_pool - ADD CONSTRAINT pk_peptide_pool PRIMARY KEY (peptide_pool_id); - -ALTER TABLE ONLY pepdb.peptide_pool_assignment - ADD CONSTRAINT pk_peptide_pool_assignment PRIMARY KEY (peptide_pool_id, peptide_id); - -ALTER TABLE ONLY pepdb.peptides - ADD CONSTRAINT pk_peptides PRIMARY KEY (peptide_id); - -ALTER TABLE ONLY pepdb.pool_type - ADD CONSTRAINT pk_pool_type PRIMARY KEY (pool_type_id); - -ALTER TABLE ONLY pepdb.protein_category - ADD CONSTRAINT pk_protein_category PRIMARY KEY (protein_cat_id); - -ALTER TABLE ONLY pepdb.parent - ADD CONSTRAINT fk_parent1 FOREIGN KEY (peptide_id) REFERENCES pepdb.peptides(peptide_id); - -ALTER TABLE ONLY pepdb.parent - ADD CONSTRAINT fk_parent2 FOREIGN KEY (linked_parent) REFERENCES pepdb.peptides(peptide_id); - -ALTER TABLE ONLY pepdb.peptide_group - ADD CONSTRAINT fk_peptide_group1 FOREIGN KEY (pathogen_id) REFERENCES pepdb.pathogen(pathogen_id); - -ALTER TABLE ONLY pepdb.peptide_group - ADD CONSTRAINT fk_peptide_group2 FOREIGN KEY (clade_id) REFERENCES pepdb.clade(clade_id); - -ALTER TABLE ONLY pepdb.peptide_group - ADD CONSTRAINT fk_peptide_group3 FOREIGN KEY (group_type_id) REFERENCES pepdb.group_type(group_type_id); - -ALTER TABLE ONLY pepdb.peptide_group - ADD CONSTRAINT fk_peptide_group4 FOREIGN KEY (pep_align_ref_id) REFERENCES pepdb.pep_align_ref(pep_align_ref_id); - -ALTER TABLE ONLY pepdb.peptide_group_assignment - ADD CONSTRAINT fk_peptide_group_assignment1 FOREIGN KEY (peptide_id) REFERENCES pepdb.peptides(peptide_id); - -ALTER TABLE ONLY pepdb.peptide_group_assignment - ADD CONSTRAINT fk_peptide_group_assignment2 FOREIGN KEY (peptide_group_id) REFERENCES pepdb.peptide_group(peptide_group_id); - -ALTER TABLE ONLY pepdb.peptide_pool - ADD CONSTRAINT fk_peptide_pool1 FOREIGN KEY (pool_type_id) REFERENCES pepdb.pool_type(pool_type_id); - -ALTER TABLE ONLY pepdb.peptide_pool - ADD CONSTRAINT fk_peptide_pool2 FOREIGN KEY (parent_pool_id) REFERENCES pepdb.peptide_pool(peptide_pool_id); - -ALTER TABLE ONLY pepdb.peptide_pool_assignment - ADD CONSTRAINT fk_peptide_pool_assignment1 FOREIGN KEY (peptide_pool_id) REFERENCES pepdb.peptide_pool(peptide_pool_id); - -ALTER TABLE ONLY pepdb.peptide_pool_assignment - ADD CONSTRAINT fk_peptide_pool_assignment2 FOREIGN KEY (peptide_id) REFERENCES pepdb.peptides(peptide_id); - -ALTER TABLE ONLY pepdb.peptide_pool_assignment - ADD CONSTRAINT fk_peptide_pool_assignment3 FOREIGN KEY (peptide_group_assignment_id) REFERENCES pepdb.peptide_group_assignment(peptide_group_assignment_id); - -ALTER TABLE ONLY pepdb.peptides - ADD CONSTRAINT fk_peptides1 FOREIGN KEY (protein_cat_id) REFERENCES pepdb.protein_category(protein_cat_id); - -ALTER TABLE ONLY pepdb.peptides - ADD CONSTRAINT fk_peptides2 FOREIGN KEY (optimal_epitope_list_id) REFERENCES pepdb.optimal_epitope_list(optimal_epitope_list_id); diff --git a/resources/schemas/dbscripts/postgresql/pepdb-0.02-0.05.sql b/resources/schemas/dbscripts/postgresql/pepdb-0.02-0.05.sql deleted file mode 100644 index 8fe103f..0000000 --- a/resources/schemas/dbscripts/postgresql/pepdb-0.02-0.05.sql +++ /dev/null @@ -1,90 +0,0 @@ - -INSERT INTO pepdb.clade VALUES (1, 'A'); -INSERT INTO pepdb.clade VALUES (2, 'B'); -INSERT INTO pepdb.clade VALUES (3, 'C'); -INSERT INTO pepdb.clade VALUES (4, 'D'); -INSERT INTO pepdb.clade VALUES (5, 'E'); -INSERT INTO pepdb.clade VALUES (6, 'G'); -INSERT INTO pepdb.clade VALUES (7, 'M'); -INSERT INTO pepdb.clade VALUES (8, 'Other'); -INSERT INTO pepdb.clade VALUES (9, 'Unknown'); -INSERT INTO pepdb.clade VALUES (10, 'A1'); -INSERT INTO pepdb.clade VALUES (11, 'C/A1/D'); -INSERT INTO pepdb.clade VALUES (12, 'D/A1'); - -SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('pepdb.clade', 'clade_id'), 12, true); - -INSERT INTO pepdb.pathogen VALUES (1, 'HIV-1'); -INSERT INTO pepdb.pathogen VALUES (2, 'HIV-2'); -INSERT INTO pepdb.pathogen VALUES (3, 'TB'); -INSERT INTO pepdb.pathogen VALUES (4, 'Malaria'); -INSERT INTO pepdb.pathogen VALUES (5, 'Flu'); -INSERT INTO pepdb.pathogen VALUES (6, 'FEC'); -INSERT INTO pepdb.pathogen VALUES (7, 'EBV'); -INSERT INTO pepdb.pathogen VALUES (8, 'Other'); -INSERT INTO pepdb.pathogen VALUES (9, 'CMV'); -INSERT INTO pepdb.pathogen VALUES (10, 'AD5'); - -SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('pepdb.pathogen', 'pathogen_id'), 10, true); - -INSERT INTO pepdb.group_type VALUES (1, 'Consensus'); -INSERT INTO pepdb.group_type VALUES (2, 'Autologous'); -INSERT INTO pepdb.group_type VALUES (3, 'Mosaic'); -INSERT INTO pepdb.group_type VALUES (4, 'Toggle'); -INSERT INTO pepdb.group_type VALUES (5, 'LABL CTL Epitope'); -INSERT INTO pepdb.group_type VALUES (6, 'Other'); -INSERT INTO pepdb.group_type VALUES (7, 'Vaccine-matched'); -INSERT INTO pepdb.group_type VALUES (8, 'PTE'); - -SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('pepdb.group_type', 'group_type_id'), 8, true); - -INSERT INTO pepdb.pep_align_ref VALUES (1,'HXB2'); - -SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('pepdb.pep_align_ref', 'pep_align_ref_id'), 1, true); - -INSERT INTO pepdb.protein_category VALUES (1, 'GAG'); -INSERT INTO pepdb.protein_category VALUES (2, 'POL'); -INSERT INTO pepdb.protein_category VALUES (3, 'VIF'); -INSERT INTO pepdb.protein_category VALUES (4, 'VPR'); -INSERT INTO pepdb.protein_category VALUES (5, 'TAT'); -INSERT INTO pepdb.protein_category VALUES (6, 'REV'); -INSERT INTO pepdb.protein_category VALUES (7, 'VPU'); -INSERT INTO pepdb.protein_category VALUES (8, 'ENV'); -INSERT INTO pepdb.protein_category VALUES (9, 'NEF'); -INSERT INTO pepdb.protein_category VALUES (10, 'gp160'); -INSERT INTO pepdb.protein_category VALUES (11, 'Integrase'); -INSERT INTO pepdb.protein_category VALUES (12, 'p17'); -INSERT INTO pepdb.protein_category VALUES (13, 'Antigen 85A'); -INSERT INTO pepdb.protein_category VALUES (14, 'BZLF 1'); -INSERT INTO pepdb.protein_category VALUES (15, 'CFP10'); -INSERT INTO pepdb.protein_category VALUES (16, 'EBNA3A'); -INSERT INTO pepdb.protein_category VALUES (17, 'ESAT-6'); -INSERT INTO pepdb.protein_category VALUES (18, 'IE1'); -INSERT INTO pepdb.protein_category VALUES (19, 'p24'); -INSERT INTO pepdb.protein_category VALUES (20, 'p2p7p1p6'); -INSERT INTO pepdb.protein_category VALUES (21, 'pp65'); -INSERT INTO pepdb.protein_category VALUES (22, 'Protease'); -INSERT INTO pepdb.protein_category VALUES (23, 'RT-Integrase'); -INSERT INTO pepdb.protein_category VALUES (24, 'Other'); -INSERT INTO pepdb.protein_category VALUES (25, 'Gag_Pol_TF'); -INSERT INTO pepdb.protein_category VALUES (26, 'RT'); -INSERT INTO pepdb.protein_category VALUES (27, 'Protease-RT'); -INSERT INTO pepdb.protein_category VALUES (28, 'p17-p24'); -INSERT INTO pepdb.protein_category VALUES (29, 'p24-p2p7p1p6'); -INSERT INTO pepdb.protein_category VALUES (30, 'Gag_Pol_TF-Protease'); - - -SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('pepdb.protein_category', 'protein_cat_id'), 30, true); - -INSERT INTO pepdb.pool_type VALUES (1, 'Pool'); -INSERT INTO pepdb.pool_type VALUES (2, 'Sub-Pool'); -INSERT INTO pepdb.pool_type VALUES (3, 'Matrix'); -INSERT INTO pepdb.pool_type VALUES (4, 'Other'); - -SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('pepdb.pool_type', 'pool_type_id'), 4, true); - -INSERT INTO pepdb.optimal_epitope_list VALUES (1, 'A'); -INSERT INTO pepdb.optimal_epitope_list VALUES (2, 'B'); -INSERT INTO pepdb.optimal_epitope_list VALUES (3, 'None'); - -SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('pepdb.optimal_epitope_list', 'optimal_epitope_list_id'), 3, true); diff --git a/resources/schemas/dbscripts/postgresql/pepdb-0.05-0.08.sql b/resources/schemas/dbscripts/postgresql/pepdb-0.05-0.08.sql deleted file mode 100644 index e356af5..0000000 --- a/resources/schemas/dbscripts/postgresql/pepdb-0.05-0.08.sql +++ /dev/null @@ -1,23 +0,0 @@ -DROP VIEW pepdb.group_peptides; -ALTER TABLE pepdb.peptide_group_assignment ALTER COLUMN peptide_id_in_group TYPE float; -CREATE VIEW pepdb.group_peptides AS -SELECT src.peptide_group_assignment_id,src.peptide_id, src.peptide_group_id, src.peptide_id_in_group, - pgroup.peptide_group_name,pgroup.pathogen_id, - p.peptide_sequence,p.protein_cat_id, - p.sequence_length,p.amino_acid_start_pos,p.amino_acid_end_pos, - p.child, p.parent,p.optimal_epitope_list_id,p.hla_restriction, - src.frequency_number,src.frequency_number_date,src.in_current_file -FROM ((pepdb.peptide_group_assignment src LEFT JOIN pepdb.peptide_group pgroup ON ((src.peptide_group_id - = pgroup.peptide_group_id))) LEFT JOIN pepdb.peptides p ON ((src.peptide_id = - p.peptide_id))); - -DROP VIEW pepdb.pool_peptides; -CREATE VIEW pepdb.pool_peptides AS -SELECT src.peptide_pool_assignment_id,src.peptide_id,src.peptide_pool_id, -p.peptide_sequence,p.protein_cat_id, -p.sequence_length,p.amino_acid_start_pos,p.amino_acid_end_pos, -p.child, p.parent, - pp.pool_type_id,pp.peptide_pool_name,pt.pool_type_desc -FROM pepdb.peptide_pool_assignment src LEFT JOIN pepdb.peptide_pool pp LEFT JOIN pepdb.pool_type pt ON(pp.pool_type_id = pt.pool_type_id) ON (src.peptide_pool_id = pp.peptide_pool_id), pepdb.peptides p -WHERE (src.peptide_id = p.peptide_id); - diff --git a/resources/schemas/dbscripts/postgresql/pepdb-0.08-1.00.sql b/resources/schemas/dbscripts/postgresql/pepdb-0.08-1.00.sql deleted file mode 100644 index cd52d9c..0000000 --- a/resources/schemas/dbscripts/postgresql/pepdb-0.08-1.00.sql +++ /dev/null @@ -1,27 +0,0 @@ -DROP VIEW pepdb.pool_peptides; -CREATE VIEW pepdb.pool_peptides AS -SELECT src.peptide_pool_assignment_id,src.peptide_id,src.peptide_pool_id, -p.peptide_sequence,p.protein_cat_id,pg.peptide_group_id,pg.peptide_id_in_group, -p.sequence_length,p.amino_acid_start_pos,p.amino_acid_end_pos, -p.child, p.parent, - pp.pool_type_id,pp.peptide_pool_name,pt.pool_type_desc -FROM pepdb.peptide_pool_assignment src LEFT JOIN pepdb.peptide_pool pp -LEFT JOIN pepdb.pool_type pt ON(pp.pool_type_id = pt.pool_type_id) -ON (src.peptide_pool_id = pp.peptide_pool_id), pepdb.peptides p, pepdb.peptide_group_assignment pg -WHERE (src.peptide_id = p.peptide_id) and (pg.peptide_id = p.peptide_id); - -DROP VIEW pepdb.parent_child_details; -CREATE VIEW pepdb.parent_child_details AS -select par.peptide_id AS child_id,pchild.peptide_sequence AS child_sequence, -pchild.protein_cat_id AS child_protein,pgchild.peptide_group_id AS child_group, -pgchild.peptide_id_in_group AS child_lab_id,pchild.sequence_length AS child_seq_length, -pchild.amino_acid_start_pos AS child_AAStart,pchild.amino_acid_end_pos AS child_AAEnd, -pchild.optimal_epitope_list_id AS child_optimal_epitope_list_id,pchild.hla_restriction AS child_hla_restriction, -par.linked_parent AS parent_id,pparent.peptide_sequence AS parent_sequence, -pparent.protein_cat_id AS parent_protein,pgparent.peptide_group_id AS parent_group, -pgparent.peptide_id_in_group AS parent_lab_id,pparent.sequence_length AS parent_seq_length, -pparent.amino_acid_start_pos AS parent_AAStart,pparent.amino_acid_end_pos AS parent_AAEnd -from pepdb.parent par LEFT JOIN pepdb.peptides pchild ON (par.peptide_id = pchild.peptide_id) -LEFT JOIN pepdb.peptides pparent ON(par.linked_parent = pparent.peptide_id) -LEFT JOIN pepdb.peptide_group_assignment pgchild ON(par.peptide_id = pgchild.peptide_id) -LEFT JOIN pepdb.peptide_group_assignment pgparent ON(par.linked_parent = pgparent.peptide_id); \ No newline at end of file diff --git a/resources/schemas/dbscripts/postgresql/pepdb-1.00-1.50.sql b/resources/schemas/dbscripts/postgresql/pepdb-1.00-1.50.sql deleted file mode 100644 index 1cc4082..0000000 --- a/resources/schemas/dbscripts/postgresql/pepdb-1.00-1.50.sql +++ /dev/null @@ -1,5 +0,0 @@ -ALTER TABLE pepdb.peptide_pool ADD COLUMN archived boolean default false; -ALTER TABLE pepdb.peptide_pool_assignment ADD COLUMN peptide_group_assignment_id integer; -ALTER TABLE pepdb.peptide_pool_assignment ADD CONSTRAINT FK_peptide_pool_assignment3 FOREIGN KEY(peptide_group_assignment_id) REFERENCES pepdb.peptide_group_assignment(peptide_group_assignment_id); -ALTER TABLE pepdb.peptides ADD COLUMN peptide_flag boolean default false; -ALTER TABLE pepdb.peptides ADD COLUMN peptide_notes text; diff --git a/resources/schemas/dbscripts/postgresql/pepdb-1.50-1.75.sql b/resources/schemas/dbscripts/postgresql/pepdb-1.50-1.75.sql deleted file mode 100644 index 62b4ef2..0000000 --- a/resources/schemas/dbscripts/postgresql/pepdb-1.50-1.75.sql +++ /dev/null @@ -1,29 +0,0 @@ -DROP VIEW pepdb.group_peptides; -CREATE VIEW pepdb.group_peptides AS -SELECT src.peptide_group_assignment_id,src.peptide_id, src.peptide_group_id, src.peptide_id_in_group, - pgroup.peptide_group_name,pgroup.pathogen_id, - p.peptide_sequence,p.protein_cat_id, - p.sequence_length,p.amino_acid_start_pos,p.amino_acid_end_pos, - p.child, p.parent,p.optimal_epitope_list_id,p.hla_restriction,p.peptide_flag,p.peptide_notes, - src.frequency_number,src.frequency_number_date,src.in_current_file -FROM ((pepdb.peptide_group_assignment src LEFT JOIN pepdb.peptide_group pgroup ON ((src.peptide_group_id - = pgroup.peptide_group_id))) LEFT JOIN pepdb.peptides p ON ((src.peptide_id = - p.peptide_id))); - -DROP VIEW pepdb.parent_child_details; -CREATE VIEW pepdb.parent_child_details AS -select par.peptide_id AS child_id,pchild.peptide_sequence AS child_sequence, -pchild.protein_cat_id AS child_protein,pgchild.peptide_group_id AS child_group, -pgchild.peptide_id_in_group AS child_lab_id,pchild.sequence_length AS child_seq_length, -pchild.amino_acid_start_pos AS child_AAStart,pchild.amino_acid_end_pos AS child_AAEnd, -pchild.optimal_epitope_list_id AS child_optimal_epitope_list_id,pchild.hla_restriction AS child_hla_restriction, -pchild.peptide_flag AS child_peptide_flag,pchild.peptide_notes AS child_peptide_notes, -par.linked_parent AS parent_id,pparent.peptide_sequence AS parent_sequence, -pparent.protein_cat_id AS parent_protein,pgparent.peptide_group_id AS parent_group, -pgparent.peptide_id_in_group AS parent_lab_id,pparent.sequence_length AS parent_seq_length, -pparent.amino_acid_start_pos AS parent_AAStart,pparent.amino_acid_end_pos AS parent_AAEnd, -pparent.peptide_flag AS parent_peptide_flag,pparent.peptide_notes AS parent_peptide_notes -from pepdb.parent par LEFT JOIN pepdb.peptides pchild ON (par.peptide_id = pchild.peptide_id) -LEFT JOIN pepdb.peptides pparent ON(par.linked_parent = pparent.peptide_id) -LEFT JOIN pepdb.peptide_group_assignment pgchild ON(par.peptide_id = pgchild.peptide_id) -LEFT JOIN pepdb.peptide_group_assignment pgparent ON(par.linked_parent = pgparent.peptide_id); \ No newline at end of file diff --git a/resources/schemas/dbscripts/postgresql/pepdb-1.75-2.00.sql b/resources/schemas/dbscripts/postgresql/pepdb-1.75-2.00.sql deleted file mode 100644 index 227659a..0000000 --- a/resources/schemas/dbscripts/postgresql/pepdb-1.75-2.00.sql +++ /dev/null @@ -1,12 +0,0 @@ -DROP VIEW pepdb.pool_peptides; -CREATE VIEW pepdb.pool_peptides AS -SELECT src.peptide_pool_assignment_id,src.peptide_id,src.peptide_pool_id, -p.peptide_sequence,p.protein_cat_id,pg.peptide_group_id,pg.peptide_id_in_group, -p.sequence_length,p.amino_acid_start_pos,p.amino_acid_end_pos, -p.child, p.parent,p.peptide_flag,p.peptide_notes, - pp.pool_type_id,pp.peptide_pool_name,pt.pool_type_desc,pp.archived -FROM pepdb.peptide_pool_assignment src -LEFT JOIN pepdb.peptide_pool pp LEFT JOIN pepdb.pool_type pt ON(pp.pool_type_id = pt.pool_type_id) ON (src.peptide_pool_id = pp.peptide_pool_id) -LEFT JOIN pepdb.peptide_group_assignment pg ON(src.peptide_group_assignment_id = pg.peptide_group_assignment_id), -pepdb.peptides p -WHERE (src.peptide_id = p.peptide_id); \ No newline at end of file diff --git a/resources/schemas/dbscripts/postgresql/pepdb-2.00-2.10.sql b/resources/schemas/dbscripts/postgresql/pepdb-2.00-2.10.sql deleted file mode 100644 index 5d92cbc..0000000 --- a/resources/schemas/dbscripts/postgresql/pepdb-2.00-2.10.sql +++ /dev/null @@ -1,4 +0,0 @@ - -ALTER TABLE pepdb.peptide_pool ADD COLUMN parent_pool_id integer; -ALTER TABLE pepdb.peptide_pool ADD CONSTRAINT FK_peptide_pool2 FOREIGN KEY(parent_pool_id) REFERENCES pepdb.peptide_pool(peptide_pool_id); -ALTER TABLE pepdb.peptide_pool ADD COLUMN matrix_peptide_pool_id text; diff --git a/resources/schemas/dbscripts/postgresql/pepdb-2.10-2.20.sql b/resources/schemas/dbscripts/postgresql/pepdb-2.10-2.20.sql deleted file mode 100644 index 08b42fc..0000000 --- a/resources/schemas/dbscripts/postgresql/pepdb-2.10-2.20.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE OR REPLACE VIEW pepdb.pool_details AS -SELECT peptide_pool._ts,peptide_pool.createdby,peptide_pool.created,peptide_pool.modifiedby,peptide_pool.modified, -peptide_pool.peptide_pool_id,peptide_pool.peptide_pool_name, -peptide_pool.pool_type_id,pt.pool_type_desc, -peptide_pool.comment,peptide_pool.archived, -peptide_pool.parent_pool_id,peptide_pool.matrix_peptide_pool_id,p.peptide_pool_name AS parent_pool_name -from pepdb.peptide_pool LEFT JOIN pepdb.peptide_pool p ON(peptide_pool.parent_pool_id = p.peptide_pool_id) -LEFT JOIN pepdb.pool_type pt ON (peptide_pool.pool_type_id = pt.pool_type_id); \ No newline at end of file diff --git a/resources/schemas/dbscripts/postgresql/pepdb-2.20-2.21.sql b/resources/schemas/dbscripts/postgresql/pepdb-2.20-2.21.sql deleted file mode 100644 index 2237cde..0000000 --- a/resources/schemas/dbscripts/postgresql/pepdb-2.20-2.21.sql +++ /dev/null @@ -1,33 +0,0 @@ -BEGIN; - -DROP VIEW IF EXISTS pepdb.parent_child_details; -DROP VIEW IF EXISTS pepdb.pool_peptides; -DROP VIEW IF EXISTS pepdb.group_peptides; - --- RT #103413. Modify peptide_id_in_group's column type to varchar because the underlying data source --- (an uploaded text file) changed format. -ALTER TABLE pepdb.peptide_group_assignment ALTER COLUMN peptide_id_in_group SET DATA TYPE varchar; - -CREATE OR REPLACE VIEW pepdb.parent_child_details AS - SELECT par.peptide_id AS child_id, pchild.peptide_sequence AS child_sequence, pchild.protein_cat_id AS child_protein, pgchild.peptide_group_id AS child_group, pgchild.peptide_id_in_group AS child_lab_id, pchild.sequence_length AS child_seq_length, pchild.amino_acid_start_pos AS child_aastart, pchild.amino_acid_end_pos AS child_aaend, pchild.optimal_epitope_list_id AS child_optimal_epitope_list_id, pchild.hla_restriction AS child_hla_restriction, pchild.peptide_flag AS child_peptide_flag, pchild.peptide_notes AS child_peptide_notes, par.linked_parent AS parent_id, pparent.peptide_sequence AS parent_sequence, pparent.protein_cat_id AS parent_protein, pgparent.peptide_group_id AS parent_group, pgparent.peptide_id_in_group AS parent_lab_id, pparent.sequence_length AS parent_seq_length, pparent.amino_acid_start_pos AS parent_aastart, pparent.amino_acid_end_pos AS parent_aaend, pparent.peptide_flag AS parent_peptide_flag, pparent.peptide_notes AS parent_peptide_notes - FROM pepdb.parent par - LEFT JOIN pepdb.peptides pchild ON par.peptide_id = pchild.peptide_id - LEFT JOIN pepdb.peptides pparent ON par.linked_parent = pparent.peptide_id - LEFT JOIN pepdb.peptide_group_assignment pgchild ON par.peptide_id = pgchild.peptide_id - LEFT JOIN pepdb.peptide_group_assignment pgparent ON par.linked_parent = pgparent.peptide_id; - -CREATE OR REPLACE VIEW pepdb.pool_peptides AS - SELECT src.peptide_pool_assignment_id, src.peptide_id, src.peptide_pool_id, p.peptide_sequence, p.protein_cat_id, pg.peptide_group_id, pg.peptide_id_in_group, p.sequence_length, p.amino_acid_start_pos, p.amino_acid_end_pos, p.child, p.parent, p.peptide_flag, p.peptide_notes, pp.pool_type_id, pp.peptide_pool_name, pt.pool_type_desc, pp.archived - FROM pepdb.peptide_pool_assignment src - LEFT JOIN (pepdb.peptide_pool pp - LEFT JOIN pepdb.pool_type pt ON pp.pool_type_id = pt.pool_type_id) ON src.peptide_pool_id = pp.peptide_pool_id - LEFT JOIN pepdb.peptide_group_assignment pg ON src.peptide_group_assignment_id = pg.peptide_group_assignment_id, pepdb.peptides p - WHERE src.peptide_id = p.peptide_id; - -CREATE OR REPLACE VIEW pepdb.group_peptides AS - SELECT src.peptide_group_assignment_id, src.peptide_id, src.peptide_group_id, src.peptide_id_in_group, pgroup.peptide_group_name, pgroup.pathogen_id, p.peptide_sequence, p.protein_cat_id, p.sequence_length, p.amino_acid_start_pos, p.amino_acid_end_pos, p.child, p.parent, p.optimal_epitope_list_id, p.hla_restriction, p.peptide_flag, p.peptide_notes, src.frequency_number, src.frequency_number_date, src.in_current_file - FROM pepdb.peptide_group_assignment src - LEFT JOIN pepdb.peptide_group pgroup ON src.peptide_group_id = pgroup.peptide_group_id - LEFT JOIN pepdb.peptides p ON src.peptide_id = p.peptide_id; - -COMMIT; diff --git a/resources/schemas/dbscripts/postgresql/pepdb-2.21-2.22.sql b/resources/schemas/dbscripts/postgresql/pepdb-2.21-2.22.sql deleted file mode 100644 index 011f603..0000000 --- a/resources/schemas/dbscripts/postgresql/pepdb-2.21-2.22.sql +++ /dev/null @@ -1,92 +0,0 @@ - -INSERT INTO pepdb.clade VALUES (1, 'A'); -INSERT INTO pepdb.clade VALUES (2, 'B'); -INSERT INTO pepdb.clade VALUES (3, 'C'); -INSERT INTO pepdb.clade VALUES (4, 'D'); -INSERT INTO pepdb.clade VALUES (5, 'E'); -INSERT INTO pepdb.clade VALUES (6, 'G'); -INSERT INTO pepdb.clade VALUES (7, 'M'); -INSERT INTO pepdb.clade VALUES (8, 'Other'); -INSERT INTO pepdb.clade VALUES (9, 'Unknown'); -INSERT INTO pepdb.clade VALUES (10, 'A1'); -INSERT INTO pepdb.clade VALUES (11, 'C/A1/D'); -INSERT INTO pepdb.clade VALUES (12, 'D/A1'); - -SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('pepdb.clade', 'clade_id'), 12, true); - -INSERT INTO pepdb.pathogen VALUES (1, 'HIV-1'); -INSERT INTO pepdb.pathogen VALUES (2, 'HIV-2'); -INSERT INTO pepdb.pathogen VALUES (3, 'TB'); -INSERT INTO pepdb.pathogen VALUES (4, 'Malaria'); -INSERT INTO pepdb.pathogen VALUES (5, 'Flu'); -INSERT INTO pepdb.pathogen VALUES (6, 'FEC'); -INSERT INTO pepdb.pathogen VALUES (7, 'EBV'); -INSERT INTO pepdb.pathogen VALUES (8, 'Other'); -INSERT INTO pepdb.pathogen VALUES (9, 'CMV'); -INSERT INTO pepdb.pathogen VALUES (10, 'AD5'); -INSERT INTO pepdb.pathogen VALUES (11, 'Pneumococcal'); -INSERT INTO pepdb.pathogen VALUES (12, 'EBOV'); - -SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('pepdb.pathogen', 'pathogen_id'), 12, true); - -INSERT INTO pepdb.group_type VALUES (1, 'Consensus'); -INSERT INTO pepdb.group_type VALUES (2, 'Autologous'); -INSERT INTO pepdb.group_type VALUES (3, 'Mosaic'); -INSERT INTO pepdb.group_type VALUES (4, 'Toggle'); -INSERT INTO pepdb.group_type VALUES (5, 'LABL CTL Epitope'); -INSERT INTO pepdb.group_type VALUES (6, 'Other'); -INSERT INTO pepdb.group_type VALUES (7, 'Vaccine-matched'); -INSERT INTO pepdb.group_type VALUES (8, 'PTE'); - -SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('pepdb.group_type', 'group_type_id'), 8, true); - -INSERT INTO pepdb.pep_align_ref VALUES (1,'HXB2'); - -SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('pepdb.pep_align_ref', 'pep_align_ref_id'), 1, true); - -INSERT INTO pepdb.protein_category VALUES (1, 'GAG'); -INSERT INTO pepdb.protein_category VALUES (2, 'POL'); -INSERT INTO pepdb.protein_category VALUES (3, 'VIF'); -INSERT INTO pepdb.protein_category VALUES (4, 'VPR'); -INSERT INTO pepdb.protein_category VALUES (5, 'TAT'); -INSERT INTO pepdb.protein_category VALUES (6, 'REV'); -INSERT INTO pepdb.protein_category VALUES (7, 'VPU'); -INSERT INTO pepdb.protein_category VALUES (8, 'ENV'); -INSERT INTO pepdb.protein_category VALUES (9, 'NEF'); -INSERT INTO pepdb.protein_category VALUES (10, 'gp160'); -INSERT INTO pepdb.protein_category VALUES (11, 'Integrase'); -INSERT INTO pepdb.protein_category VALUES (12, 'p17'); -INSERT INTO pepdb.protein_category VALUES (13, 'Antigen 85A'); -INSERT INTO pepdb.protein_category VALUES (14, 'BZLF 1'); -INSERT INTO pepdb.protein_category VALUES (15, 'CFP10'); -INSERT INTO pepdb.protein_category VALUES (16, 'EBNA3A'); -INSERT INTO pepdb.protein_category VALUES (17, 'ESAT-6'); -INSERT INTO pepdb.protein_category VALUES (18, 'IE1'); -INSERT INTO pepdb.protein_category VALUES (19, 'p24'); -INSERT INTO pepdb.protein_category VALUES (20, 'p2p7p1p6'); -INSERT INTO pepdb.protein_category VALUES (21, 'pp65'); -INSERT INTO pepdb.protein_category VALUES (22, 'Protease'); -INSERT INTO pepdb.protein_category VALUES (23, 'RT-Integrase'); -INSERT INTO pepdb.protein_category VALUES (24, 'Other'); -INSERT INTO pepdb.protein_category VALUES (25, 'Gag_Pol_TF'); -INSERT INTO pepdb.protein_category VALUES (26, 'RT'); -INSERT INTO pepdb.protein_category VALUES (27, 'Protease-RT'); -INSERT INTO pepdb.protein_category VALUES (28, 'p17-p24'); -INSERT INTO pepdb.protein_category VALUES (29, 'p24-p2p7p1p6'); -INSERT INTO pepdb.protein_category VALUES (30, 'Gag_Pol_TF-Protease'); - - -SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('pepdb.protein_category', 'protein_cat_id'), 30, true); - -INSERT INTO pepdb.pool_type VALUES (1, 'Pool'); -INSERT INTO pepdb.pool_type VALUES (2, 'Sub-Pool'); -INSERT INTO pepdb.pool_type VALUES (3, 'Matrix'); -INSERT INTO pepdb.pool_type VALUES (4, 'Other'); - -SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('pepdb.pool_type', 'pool_type_id'), 4, true); - -INSERT INTO pepdb.optimal_epitope_list VALUES (1, 'A'); -INSERT INTO pepdb.optimal_epitope_list VALUES (2, 'B'); -INSERT INTO pepdb.optimal_epitope_list VALUES (3, 'None'); - -SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('pepdb.optimal_epitope_list', 'optimal_epitope_list_id'), 3, true); diff --git a/resources/schemas/dbscripts/postgresql/pepdb-create.sql b/resources/schemas/dbscripts/postgresql/pepdb-create.sql deleted file mode 100644 index a1bcfa3..0000000 --- a/resources/schemas/dbscripts/postgresql/pepdb-create.sql +++ /dev/null @@ -1,70 +0,0 @@ -CREATE VIEW pepdb.group_peptides AS - SELECT src.peptide_group_assignment_id, src.peptide_id, src.peptide_group_id, src.peptide_id_in_group, pgroup.peptide_group_name, pgroup.pathogen_id, p.peptide_sequence, p.protein_cat_id, p.sequence_length, p.amino_acid_start_pos, p.amino_acid_end_pos, p.child, p.parent, p.optimal_epitope_list_id, p.hla_restriction, p.peptide_flag, p.peptide_notes, src.frequency_number, src.frequency_number_date, src.in_current_file FROM ((pepdb.peptide_group_assignment src LEFT JOIN pepdb.peptide_group pgroup ON ((src.peptide_group_id = pgroup.peptide_group_id))) LEFT JOIN pepdb.peptides p ON ((src.peptide_id = p.peptide_id))); - -CREATE VIEW pepdb.parent_child_details AS - SELECT par.peptide_id AS child_id, pchild.peptide_sequence AS child_sequence, pchild.protein_cat_id AS child_protein, pgchild.peptide_group_id AS child_group, pgchild.peptide_id_in_group AS child_lab_id, pchild.sequence_length AS child_seq_length, pchild.amino_acid_start_pos AS child_aastart, pchild.amino_acid_end_pos AS child_aaend, pchild.optimal_epitope_list_id AS child_optimal_epitope_list_id, pchild.hla_restriction AS child_hla_restriction, pchild.peptide_flag AS child_peptide_flag, pchild.peptide_notes AS child_peptide_notes, par.linked_parent AS parent_id, pparent.peptide_sequence AS parent_sequence, pparent.protein_cat_id AS parent_protein, pgparent.peptide_group_id AS parent_group, pgparent.peptide_id_in_group AS parent_lab_id, pparent.sequence_length AS parent_seq_length, pparent.amino_acid_start_pos AS parent_aastart, pparent.amino_acid_end_pos AS parent_aaend, pparent.peptide_flag AS parent_peptide_flag, pparent.peptide_notes AS parent_peptide_notes FROM ((((pepdb.parent par LEFT JOIN pepdb.peptides pchild ON ((par.peptide_id = pchild.peptide_id))) LEFT JOIN pepdb.peptides pparent ON ((par.linked_parent = pparent.peptide_id))) LEFT JOIN pepdb.peptide_group_assignment pgchild ON ((par.peptide_id = pgchild.peptide_id))) LEFT JOIN pepdb.peptide_group_assignment pgparent ON ((par.linked_parent = pgparent.peptide_id))); - -CREATE VIEW pepdb.pool_details AS - SELECT peptide_pool._ts, peptide_pool.createdby, peptide_pool.created, peptide_pool.modifiedby, peptide_pool.modified, peptide_pool.peptide_pool_id, peptide_pool.peptide_pool_name, peptide_pool.pool_type_id, pt.pool_type_desc, peptide_pool.comment, peptide_pool.archived, peptide_pool.parent_pool_id, peptide_pool.matrix_peptide_pool_id, p.peptide_pool_name AS parent_pool_name FROM ((pepdb.peptide_pool LEFT JOIN pepdb.peptide_pool p ON ((peptide_pool.parent_pool_id = p.peptide_pool_id))) LEFT JOIN pepdb.pool_type pt ON ((peptide_pool.pool_type_id = pt.pool_type_id))); - -CREATE VIEW pepdb.pool_peptides AS - SELECT src.peptide_pool_assignment_id, src.peptide_id, src.peptide_pool_id, p.peptide_sequence, p.protein_cat_id, pg.peptide_group_id, pg.peptide_id_in_group, p.sequence_length, p.amino_acid_start_pos, p.amino_acid_end_pos, p.child, p.parent, p.peptide_flag, p.peptide_notes, pp.pool_type_id, pp.peptide_pool_name, pt.pool_type_desc, pp.archived FROM ((pepdb.peptide_pool_assignment src LEFT JOIN (pepdb.peptide_pool pp LEFT JOIN pepdb.pool_type pt ON ((pp.pool_type_id = pt.pool_type_id))) ON ((src.peptide_pool_id = pp.peptide_pool_id))) LEFT JOIN pepdb.peptide_group_assignment pg ON ((src.peptide_group_assignment_id = pg.peptide_group_assignment_id))), pepdb.peptides p WHERE (src.peptide_id = p.peptide_id); - -CREATE VIEW pepdb.peptideGroupRollup AS - SELECT - pg.created, - pg.createdBy, - pg.modified, - pg.modifiedBy, - pg.peptide_group_id, - pg.peptide_group_name AS name, - seq_ref, - p.pathogen_desc AS Pathogen, - c.clade_desc AS Clade, - gt.group_type_desc AS GroupType, - ar.pep_align_ref_desc AS AlignRef - FROM pepdb.peptide_group pg - LEFT JOIN pepdb.pathogen p ON pg.pathogen_id = p.pathogen_id - LEFT JOIN pepdb.clade c ON pg.clade_id = c.clade_id - LEFT JOIN pepdb.group_type gt ON pg.group_type_id = gt.group_type_id - LEFT JOIN pepdb.pep_align_ref ar ON pg.pep_align_ref_id = ar.pep_align_ref_id; - -CREATE VIEW pepdb.peptidePoolRollup AS - SELECT - pp.created, - pp.createdBy, - pp.modified, - pp.modifiedBy, - pp.peptide_pool_id, - pp.peptide_pool_name AS Name, - comment, - pt.pool_type_desc AS PoolType, - archived, - parent_pool_id, - matrix_peptide_pool_id - FROM pepdb.peptide_pool pp - JOIN pepdb.pool_type pt ON pp.pool_type_id = pt.pool_type_id; - -CREATE VIEW pepdb.peptideRollup AS - SELECT - p.created, - p.createdBy, - p.modified, - p.modifiedBy, - p.peptide_id, - peptide_sequence, - protein_cat_desc AS ProteinCategory, - amino_acid_start_pos, - amino_acid_end_pos, - sequence_length, - child, - parent, - src_file_name, - storage_location, - optimal_epitope_list_desc AS OptimalEpitopeList, - hla_restriction, - peptide_flag, - peptide_notes - FROM pepdb.peptides p - LEFT JOIN pepdb.protein_category pc ON p.protein_cat_id = pc.protein_cat_id - LEFT JOIN pepdb.optimal_epitope_list el ON p.optimal_epitope_list_id = el.optimal_epitope_list_id; diff --git a/resources/schemas/dbscripts/postgresql/pepdb-drop.sql b/resources/schemas/dbscripts/postgresql/pepdb-drop.sql deleted file mode 100644 index bac42b4..0000000 --- a/resources/schemas/dbscripts/postgresql/pepdb-drop.sql +++ /dev/null @@ -1,11 +0,0 @@ -DROP VIEW IF EXISTS pepdb.group_peptides; - -DROP VIEW IF EXISTS pepdb.parent_child_details; - -DROP VIEW IF EXISTS pepdb.pool_details; - -DROP VIEW IF EXISTS pepdb.pool_peptides; - -DROP VIEW IF EXISTS pepdb.peptideGroupRollup; -DROP VIEW IF EXISTS pepdb.peptidePoolRollup; -DROP VIEW IF EXISTS pepdb.peptideRollup; \ No newline at end of file diff --git a/resources/schemas/dbscripts/sqlserver/pepdb-0.00-0.01.sql b/resources/schemas/dbscripts/sqlserver/pepdb-0.00-0.01.sql deleted file mode 100644 index d6f510d..0000000 --- a/resources/schemas/dbscripts/sqlserver/pepdb-0.00-0.01.sql +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) 2013 Fred Hutchinson Cancer Research Center - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - --- Tables and views used for Peptide module -CREATE SCHEMA pepdb; -GO \ No newline at end of file diff --git a/resources/schemas/pepdb.xml b/resources/schemas/pepdb.xml deleted file mode 100644 index 2151116..0000000 --- a/resources/schemas/pepdb.xml +++ /dev/null @@ -1,644 +0,0 @@ - - - - - - - -
- - - - - -
- - - - - Peptide Id - - - Peptide Group Id - - - Peptide Number - - - Peptide Group Name - - - Pathogen - - pathogen_id - pathogen - pepdb - - - - Peptide Sequence - - - Protein Category - - protein_cat_id - protein_category - pepdb - - - - Sequence Length - - - AA Start - - - AA End - - - Is Child - - - Is Parent - - - Optimal Epitope List - - optimal_epitope_list_id - optimal_epitope_list - pepdb - - - - HLA Restriction - - - Peptide Flag - - - Peptide Flag Reason - - - Frequency Number - - - Frequency Update Date - - - -
- - - - - Created By - - UserId - Users - core - - - - dd-MMM-yy - - - Modified By - - UserId - Users - core - - - - dd-MMM-yy - - - - 1 - true - - - Pool Type - - pool_type_id - pool_type - pepdb - - true - - - 1 - - - - - -
- - - - - Created By - - UserId - Users - core - - - - dd-MMM-yy - - - Modified By - - UserId - Users - core - - - - dd-MMM-yy - - - - 1 - true - - - Pool Type - - pool_type_id - pool_type - pepdb - - true - - - - 1 - - - - - - -
- - - - - -
- - - - - - - - - - -
- - - - - -
- - - - - - - - - - - - - - - -
- - - - - - - - - - - - -
- - - - Child ID - - - Child Sequence - - - Child Protein Category - - protein_cat_id - protein_category - pepdb - - - - Child Peptide Group - - peptide_group_id - peptide_group - pepdb - - - - Child Peptide Number - - - Child Sequence Length - - - Child AAStart - - - Child AAEnd - - - Child Optimal Epitope List - - optimal_epitope_list_id - optimal_epitope_list - pepdb - - - - Child HLA Restriction - - - Child Peptide Flag - - - Child Flag Reason - - - Parent ID - - - Parent Sequence - - - Parent Protein Category - - protein_cat_id - protein_category - pepdb - - - - Parent Peptide Group - - peptide_group_id - peptide_group - pepdb - - - - Parent Peptide Number - - - Parent Sequence Length - - - Parent AAStart - - - Parent AAEnd - - - Parent Peptide Flagged - - - Parent Flag Reason - 2 - - -
- - - - - Created By - - UserId - Users - core - - - - dd-MMM-yy - - - Modified By - - UserId - Users - core - - - - dd-MMM-yy - - - - 1 - true - - - Protein Category - true - - protein_cat_id - protein_category - pepdb - - - - AAStart - true - - - AAEnd - true - - - true - - - Is Child - true - - - Is Parent - true - - - Source File Name - 1 - true - - - 1 - - - Optimal Epitope List - - optimal_epitope_list_id - optimal_epitope_list - pepdb - - - - 1 - - - Peptide Is Flagged - - - Peptide Flag Reason - 2 - - -
- - - - - Peptide ID - - - Peptide Pool ID - - - Peptide Sequence - - - Protein Category - - protein_cat_id - protein_category - pepdb - - - - Peptide Group - - peptide_group_id - peptide_group - pepdb - - - - Peptide Number - - - Sequence Length - - - AAStart - - - AAEnd - - - Is Child - - - Is Parent - - - Peptide Flag - - - Flag Reason - 2 - - - Pool Type - - pool_type_id - pool_type - pepdb - - - - Peptide Pool Name - - - Pool Type - - - Archived - - -
- - - - - -
- - - - - Created By - true - - UserId - Users - core - - - - true - dd-MMM-yy - - - true - Modified By - - UserId - Users - core - - - - true - dd-MMM-yy - - - - 1 - Peptide Group Name - - - Pathogen - - pathogen_id - pathogen - pepdb - - - - 1 - - - Clade - - clade_id - clade - pepdb - - - - Pep Align Ref - - pep_align_ref_id - pep_align_ref - pepdb - - - - Group Type - - group_type_id - group_type - pepdb - - - - peptide_group_id -
- - - - - -
- - - - - -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- diff --git a/src/org/scharp/atlas/pepdb/PepDBBaseController.java b/src/org/scharp/atlas/pepdb/PepDBBaseController.java deleted file mode 100644 index 57d01f8..0000000 --- a/src/org/scharp/atlas/pepdb/PepDBBaseController.java +++ /dev/null @@ -1,697 +0,0 @@ -package org.scharp.atlas.pepdb; - -import org.apache.commons.beanutils.ConversionException; -import org.apache.commons.lang3.StringUtils; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.jetbrains.annotations.NotNull; -import org.labkey.api.action.SpringActionController; -import org.labkey.api.attachments.AttachmentFile; -import org.labkey.api.data.BeanViewForm; -import org.labkey.api.data.ColumnInfo; -import org.labkey.api.data.DataColumn; -import org.labkey.api.data.RenderContext; -import org.labkey.api.data.SimpleFilter; -import org.labkey.api.data.Sort; -import org.labkey.api.data.TableInfo; -import org.labkey.api.util.DateUtil; -import org.labkey.api.util.HtmlString; -import org.labkey.api.util.HtmlStringBuilder; -import org.labkey.api.util.Link; -import org.labkey.api.view.ActionURL; -import org.scharp.atlas.pepdb.model.PeptideGroup; -import org.scharp.atlas.pepdb.model.PeptidePool; -import org.scharp.atlas.pepdb.model.Peptides; -import org.scharp.atlas.pepdb.model.ProteinCategory; -import org.springframework.validation.Errors; - -import java.io.IOException; -import java.io.Writer; -import java.sql.SQLException; -import java.util.List; -import java.util.Map; - -/** - * Created by IntelliJ IDEA. - * User: sravani - * Date: Jul 6, 2009 - * Time: 12:43:07 PM - * To change this template use File | Settings | File Templates. - */ -public class PepDBBaseController extends SpringActionController -{ - private final static Logger _log = LogManager.getLogger(PepDBBaseController.class); - - private static final String VIEW_DISPLAY_PEPTIDE = "displayPeptide.view"; - protected static final String QRY_STRING_PEPTIDE_ID = "peptideId"; - - public static class PeptideQueryForm - { - private String queryKey; - private String queryValue; - private String message; - private TableInfo tInfo; - private SimpleFilter filter; - private List cInfo; - private Sort sort; - private String AAStart; - private String AAEnd; - private String labId; - - public String getMessage() - { - return message; - } - - public void setMessage(String message) - { - this.message = message; - } - - public List getCInfo() - { - return cInfo; - } - - public void setCInfo(List cInfo) - { - this.cInfo = cInfo; - } - - public String getQueryValue() - { - return queryValue; - } - - public void setQueryValue(String queryValue) - { - this.queryValue = queryValue; - } - - public TableInfo getTInfo() - { - return tInfo; - } - - public void setTInfo(TableInfo tInfo) - { - this.tInfo = tInfo; - } - - public SimpleFilter getFilter() - { - return filter; - } - - public void setFilter(SimpleFilter filter) - { - this.filter = filter; - } - - public Sort getSort() - { - return sort; - } - - public void setSort(Sort sort) - { - this.sort = sort; - } - - public String getQueryKey() - { - return queryKey; - } - - public void setQueryKey(String queryKey) - { - this.queryKey = queryKey; - } - - public String getAAStart() - { - return AAStart; - } - - public void setAAStart(String AAStart) - { - this.AAStart = AAStart; - } - - public String getAAEnd() - { - return AAEnd; - } - - public void setAAEnd(String AAEnd) - { - this.AAEnd = AAEnd; - } - - public String getLabId() - { - return labId; - } - - public void setLabId(String labId) - { - this.labId = labId; - } - - public boolean validate(Errors errors) throws SQLException - { - if(getQueryKey() == null || StringUtils.trimToNull(getQueryKey()) == null) - errors.reject(null, "The Search Criteria must be entered."); - String qValue = getQueryValue(); - if (getQueryKey() != null && getQueryKey().equals(PepDBSchema.COLUMN_PARENT_SEQUENCE)) - { - if (StringUtils.trimToNull(qValue) == null) - errors.reject(null, "The Parent Sequence must be entered."); - } - if (getQueryKey() != null && getQueryKey().equals(PepDBSchema.COLUMN_CHILD_SEQUENCE)) - { - if (StringUtils.trimToNull(qValue) == null) - errors.reject(null, "The Child Sequence must be entered."); - } - if (getQueryKey() != null && getQueryKey().equals(PepDBSchema.COLUMN_PEPTIDE_GROUP_ID)) - { - if (StringUtils.trimToNull(qValue) == null) - errors.reject(null, "Peptide Group must be selected to get peptides in a group."); - /* - if(StringUtils.trimToNull(getLabId()) == null) - errors.reject(null, "Peptide Number must be entered."); - */ - } - if (getQueryKey() != null && getQueryKey().equals(PepDBSchema.COLUMN_PEPTIDE_POOL_ID)) - { - if (StringUtils.trimToNull(qValue) == null) - errors.reject(null, "Peptide Pool Name must be selected to get peptides in a pool."); - } - if (getQueryKey() != null && getQueryKey().equals(PepDBSchema.COLUMN_PROTEIN_CAT_ID)) - { - if (StringUtils.trimToNull(qValue) == null) - errors.reject(null, "Protein Category must be selected to get peptides in a protein category."); - else - { - ProteinCategory pc = PepDBManager.getProCatByID(Integer.parseInt(getQueryValue())); - if(pc.getProtein_cat_desc().trim().contains("-")) - { - if(StringUtils.trimToNull(getAAStart()) != null || StringUtils.trimToNull(getAAEnd()) != null) - errors.reject(null,"When you select a hyphanated Protein Category : "+pc.getProtein_cat_desc()+" AAStart & AAEnd values are not allowed."); - } - else - { - if(StringUtils.trimToNull(getAAStart()) != null && validateInteger(getAAStart().trim()) == null) - errors.reject(null, "AAStart must be an Integer."); - if(StringUtils.trimToNull(getAAEnd()) != null && validateInteger(getAAEnd().trim()) == null) - errors.reject(null, "AAEnd must be an Integer."); - if(StringUtils.trimToNull(getAAStart()) != null && validateInteger(getAAStart().trim()) != null - && StringUtils.trimToNull(getAAEnd()) != null && validateInteger(getAAEnd().trim()) != null - && validateInteger(getAAStart().trim()) > validateInteger(getAAEnd().trim())) - errors.reject(null, "AAStart must be less than or equal to AAEnd."); - } - } - } - if (getQueryKey() != null && getQueryKey().equals(PepDBSchema.COLUMN_PEPTIDE_ID)) - { - if (StringUtils.trimToNull(qValue) == null) - errors.reject(null, "The Peptide Id range must be entered."); - if (qValue != null && qValue.length() > 0) - { - if (!(qValue.matches("\\d+-\\d+"))) - { - errors.reject(null, "To get the peptides in the range you should specify the Range of numbers.\n" + - "The format for specify the range of peptide is - Example would be 30-100"); - } - else - { - String[] range = qValue.split("-"); - if (Integer.parseInt(range[0]) > Integer.parseInt(range[1])) - { - errors.reject(null, "The minimum value which is before '-' should be less than the max value which is after '-'.\n"); - - } - } - } - } - if(errors != null && errors.getErrorCount() >0) - return false; - return true; - } - - } - - public static class DisplayPeptideForm - { - private String peptide_id; - private boolean modify = false; - private String manufactureStatus; - - public String getPeptide_id() - { - return peptide_id; - } - - public void setPeptide_id(String peptide_id) - { - this.peptide_id = peptide_id; - } - - public void setModify(boolean modify) - { - this.modify = modify; - } - - public boolean getModify() - { - return this.modify; - } - - public String getManufactureStatus() - { - return manufactureStatus; - } - - public void setManufactureStatus(String manufactureStatus) - { - this.manufactureStatus = manufactureStatus; - } - - public String toString() - { - return "DisplayPeptideForm [peptideId:" + this.peptide_id + - ", modify:" + this.modify + - ", manufactureStatus:" + this.manufactureStatus + "]"; - } - } - - public static class PeptideAndGroupForm extends DisplayPeptideForm - { - - private String peptide_group_id; - - public String getPeptide_group_id() - { - return peptide_group_id; - } - - public void setPeptide_group_id(String peptide_group_id) - { - this.peptide_group_id = peptide_group_id; - } - - public String toString() - { - return "PeptideAndGroupForm [peptideGroup:" + this.peptide_group_id + "] - " + super.toString(); - } - - } - - public static class PeptideAndPoolForm extends DisplayPeptideForm - { - private String peptide_pool_id; - - public String getPeptide_pool_id() - { - return peptide_pool_id; - } - - public void setPeptide_pool_id(String peptide_pool_id) - { - this.peptide_pool_id = peptide_pool_id; - } - - public String toString() - { - return "PeptideAndPoolForm [peptidePool:" + this.peptide_pool_id + "] - " + super.toString(); - } - } - - public static class PeptideForm extends BeanViewForm { - public PeptideForm() - { - super(Peptides.class, PepDBSchema.getInstance().getTableInfoPeptides()); - - } - public PeptideForm(String peptideID) - { - this(); - set("peptide_id", String.valueOf(peptideID)); - } - } - - public static class PeptidePoolForm extends BeanViewForm { - public PeptidePoolForm() - { - super(PeptidePool.class, PepDBSchema.getInstance().getTableInfoPeptidePools()); - - } - public PeptidePoolForm(String peptidePoolID) - { - this(); - set("peptide_pool_id", String.valueOf(peptidePoolID)); - } - - } - - public static class PeptideGroupForm extends BeanViewForm { - public PeptideGroupForm() - { - super(PeptideGroup.class, PepDBSchema.getInstance().getTableInfoPeptideGroups()); - - } - public PeptideGroupForm(String peptideGroupID) - { - this(); - set("peptide_group_id", String.valueOf(peptideGroupID)); - } - - public void validate(Errors errors) - { - PeptideGroup bean = getBean(); - if(bean.getPathogen_id() == null || StringUtils.trimToNull(bean.getPathogen_id().toString())==null) - errors.reject(null,"Pathogen is Required"); - if(bean.getClade_id() == null || StringUtils.trimToNull(bean.getClade_id().toString())==null) - errors.reject(null,"Clade is Required"); - if(bean.getGroup_type_id() == null || StringUtils.trimToNull(bean.getGroup_type_id().toString())==null) - errors.reject(null,"Group Type is Required"); - if (StringUtils.trimToNull(bean.getPeptide_group_name()) == null) - errors.reject(null, "Peptide Group Name is required."); - } - - public void validateName(Errors errors) throws SQLException - { - PeptideGroup bean = getBean(); - PeptideGroup pg = PepDBManager.getPeptideGroupByName(bean); - if(pg != null) - errors.reject(null, "Peptide Group with the name : "+bean.getPeptide_group_name()+" with a different ID already exists in the database."); - } - } - - public static class FileForm - { - private String message; - private String actionType; - - public String getMessage() - { - return message; - } - - public void setMessage(String message) - { - this.message = message; - } - - public String getActionType() - { - return actionType; - } - - public void setActionType(String actionType) - { - this.actionType = actionType; - } - - public boolean validate(Errors errors, AttachmentFile file) throws Exception - { - if (file == null || file.getSize() == 0) - errors.reject(null, "File is required.File should be tab delimited text file and the number of field vary depending on file type."); - else - { - if (!(file.getFilename().endsWith(".txt"))) - { - errors.reject(null, "File name must end with in .txt.\nFile should be tab delimited text file and the number of field vary depending on file type."); - } - } - if (getActionType() == null || getActionType().length() == 0) - errors.reject(null, "File Type is required"); - if(errors.getErrorCount() > 0) - return false; - return true; - } - } - - public class DCpeptideId extends DataColumn - { - public DCpeptideId(ColumnInfo col) - { - super(col); - } - - @Override - public void renderGridCellContents(RenderContext ctx, Writer out) throws IOException - { - ColumnInfo c = getColumnInfo(); - Map rowMap = ctx.getRow(); - if (!PepDBSchema.COLUMN_PEPTIDE_ID.equals(c.getName()) && !PepDBSchema.COLUMN_PARENT_ID.equals(c.getName()) && !PepDBSchema.COLUMN_CHILD_ID.equals(c.getName())) - super.renderGridCellContents(ctx, out); - else - { - Integer peptideId = (Integer) rowMap.get(c.getName()); - try - { - new Link.LinkBuilder("P" + peptideId).clearClasses() - .target("_self") - .href(new ActionURL(PepDBController.DisplayPeptideAction.class, getContainer()) - .addParameter(PepDBSchema.COLUMN_PEPTIDE_ID, peptideId)) - .build() - .appendTo(out); - } - catch (Exception e) - { - e.printStackTrace(); - } - - } - } - - @Override - @NotNull - public HtmlString getFormattedHtml(RenderContext ctx) { - HtmlStringBuilder hsb = HtmlStringBuilder.of("P"); - hsb.append(super.getFormattedHtml(ctx)); - return hsb.getHtmlString(); - } - - @Override - public Object getDisplayValue(RenderContext ctx) - { - ColumnInfo c = getColumnInfo(); - Map rowMap = ctx.getRow(); - if (!PepDBSchema.COLUMN_PEPTIDE_ID.equals(c.getName()) && !PepDBSchema.COLUMN_PARENT_ID.equals(c.getName()) && !PepDBSchema.COLUMN_CHILD_ID.equals(c.getName())) - return super.getValue(ctx); - else - { - Integer peptideId = (Integer) rowMap.get(c.getName()); - try - { - return ("P"+peptideId); - } - catch (Exception e) - { - e.printStackTrace(); - return "EXPORT/OUTPUT ERROR"; - } - } - } - - @Override - public Class getValueClass() - { - return Integer.class; - } - - @Override - public Class getDisplayValueClass() - { - return String.class; - } - } - - public class DCpeptidePoolId extends DataColumn - { - public DCpeptidePoolId(ColumnInfo col) - { - super(col); - } - - @Override - public void renderGridCellContents(RenderContext ctx, Writer out) throws IOException - { - ColumnInfo c = getColumnInfo(); - Map rowMap = ctx.getRow(); - if (!PepDBSchema.COLUMN_PEPTIDE_POOL_ID.equals(c.getName())) - super.renderGridCellContents(ctx, out); - else - { - Integer peptidePoolId = (Integer) rowMap.get(c.getName()); - try - { - new Link.LinkBuilder("PP" + peptidePoolId).clearClasses() - .target("_self") - .href(new ActionURL(PepDBController.DisplayPeptidePoolInformationAction.class, getContainer()) - .addParameter(PepDBSchema.COLUMN_PEPTIDE_POOL_ID, peptidePoolId)) - .build() - .appendTo(out); - } - catch (Exception e) - { - e.printStackTrace(); - } - } - } - - @Override - @NotNull - public HtmlString getFormattedHtml(RenderContext ctx) { - HtmlStringBuilder hsb = HtmlStringBuilder.of("PP"); - hsb.append(super.getFormattedHtml(ctx)); - return hsb.getHtmlString(); - } - - @Override - public Object getDisplayValue(RenderContext ctx) - { - ColumnInfo c = getColumnInfo(); - Map rowMap = ctx.getRow(); - if (!PepDBSchema.COLUMN_PEPTIDE_POOL_ID.equals(c.getName())) - return super.getValue(ctx); - else - { - Integer peptidePoolId = (Integer) rowMap.get(c.getName()); - try - { - return ("PP" + peptidePoolId); - } - catch (Exception e) - { - e.printStackTrace(); - return "EXPORT/OUTPUT ERROR"; - } - } - } - - @Override - public Class getValueClass() - { - return Integer.class; - } - - @Override - public Class getDisplayValueClass() - { - return String.class; - } - } - - public class DCparentPoolId extends DataColumn - { - public DCparentPoolId(ColumnInfo col) - { - super(col); - } - - @Override - public void renderGridCellContents(RenderContext ctx, Writer out) throws IOException - { - ColumnInfo c = getColumnInfo(); - Map rowMap = ctx.getRow(); - if (!PepDBSchema.COLUMN_PARENT_POOL_ID.equals(c.getName())) - super.renderGridCellContents(ctx, out); - else - { - Integer parentPoolId = (Integer) rowMap.get(c.getName()); - try - { - if(parentPoolId != null) - { - new Link.LinkBuilder("PP" + parentPoolId).clearClasses() - .target("_self") - .href(new ActionURL(PepDBController.DisplayPeptidePoolInformationAction.class, getContainer()) - .addParameter(PepDBSchema.COLUMN_PEPTIDE_POOL_ID, parentPoolId)) - .build() - .appendTo(out); - } - } - catch (Exception e) - { - e.printStackTrace(); - } - } - } - - @Override - public Object getDisplayValue(RenderContext ctx) - { - ColumnInfo c = getColumnInfo(); - Map rowMap = ctx.getRow(); - if (!PepDBSchema.COLUMN_PARENT_POOL_ID.equals(c.getName())) - return super.getValue(ctx); - else - { - Integer parentPoolId = (Integer) rowMap.get(c.getName()); - try - { - if (parentPoolId != null) - return ("PP" + parentPoolId); - else - return null; - } - catch (Exception e) - { - e.printStackTrace(); - return "EXPORT/OUTPUT ERROR"; - } - } - } - - @Override - public Class getValueClass() - { - return Integer.class; - } - - @Override - public Class getDisplayValueClass() - { - return String.class; - } - } - - public static Integer validateInteger(String value) - { - try - { - return Integer.valueOf(value); - } - catch(NumberFormatException e){return null;} - } - - public static String toLZ(String s) - { - if (s.length() > 6) return s.substring(0, 6); - else if (s.length() < 6) // pad on left with zeros - return "000000000000000000000000000".substring(0, 6 - s.length()) + s; - else return s; - } - - public static java.util.Date isValidDate(String sDateIn) { - - try { - java.util.Date dDate = new java.util.Date(DateUtil.parseDateTime(sDateIn)); - return dDate; - } catch (ConversionException x) { - return null; - } - } - - public static Float validateFloat(String value) - { - try - { - return Float.valueOf(value); - } - catch(NumberFormatException e){return null;} - } -} diff --git a/src/org/scharp/atlas/pepdb/PepDBContainerListener.java b/src/org/scharp/atlas/pepdb/PepDBContainerListener.java deleted file mode 100644 index 8802713..0000000 --- a/src/org/scharp/atlas/pepdb/PepDBContainerListener.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.scharp.atlas.pepdb; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.jetbrains.annotations.NotNull; -import org.labkey.api.data.Container; -import org.labkey.api.data.ContainerManager.ContainerListener; -import org.labkey.api.security.User; - -import java.beans.PropertyChangeEvent; -import java.util.Collection; -import java.util.Collections; - -/** - * Created by IntelliJ IDEA. - * User: sravani - * Date: Mar 16, 2009 - * Time: 10:18:45 AM - * To change this template use File | Settings | File Templates. - */ -public class PepDBContainerListener implements ContainerListener -{ - - private static final Logger _log = LogManager.getLogger(PepDBContainerListener.class); - - @Override - public void containerCreated(Container c, User user) - { - } - - @Override - public void containerDeleted(Container c, User user) - { - } - - @Override - public void containerMoved(Container c, Container oldParent, User user) - { - } - - @NotNull - @Override - public Collection canMove(Container c, Container newParent, User user) - { - return Collections.emptyList(); - } - - @Override - public void propertyChange(PropertyChangeEvent evt) - { - } - -} diff --git a/src/org/scharp/atlas/pepdb/PepDBController.java b/src/org/scharp/atlas/pepdb/PepDBController.java deleted file mode 100644 index c0998ff..0000000 --- a/src/org/scharp/atlas/pepdb/PepDBController.java +++ /dev/null @@ -1,1400 +0,0 @@ -package org.scharp.atlas.pepdb; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.labkey.api.action.ExportAction; -import org.labkey.api.action.FormViewAction; -import org.labkey.api.action.SimpleViewAction; -import org.labkey.api.attachments.AttachmentFile; -import org.labkey.api.data.ActionButton; -import org.labkey.api.data.Aggregate; -import org.labkey.api.data.ButtonBar; -import org.labkey.api.data.ColumnInfo; -import org.labkey.api.data.CompareType; -import org.labkey.api.data.Container; -import org.labkey.api.data.DataRegion; -import org.labkey.api.data.DisplayColumn; -import org.labkey.api.data.ExcelWriter; -import org.labkey.api.data.RenderContext; -import org.labkey.api.data.SimpleFilter; -import org.labkey.api.data.Sort; -import org.labkey.api.data.TSVGridWriter; -import org.labkey.api.data.Table; -import org.labkey.api.data.TableInfo; -import org.labkey.api.query.FieldKey; -import org.labkey.api.query.QuerySettings; -import org.labkey.api.security.RequiresPermission; -import org.labkey.api.security.permissions.ReadPermission; -import org.labkey.api.security.permissions.UpdatePermission; -import org.labkey.api.view.ActionURL; -import org.labkey.api.view.DetailsView; -import org.labkey.api.view.GridView; -import org.labkey.api.view.HttpView; -import org.labkey.api.view.InsertView; -import org.labkey.api.view.JspView; -import org.labkey.api.view.NavTree; -import org.labkey.api.view.UpdateView; -import org.labkey.api.view.VBox; -import org.labkey.api.view.ViewContext; -import org.scharp.atlas.pepdb.model.PeptideGroup; -import org.scharp.atlas.pepdb.model.PeptidePool; -import org.scharp.atlas.pepdb.model.Peptides; -import org.scharp.atlas.pepdb.model.ProteinCategory; -import org.springframework.beans.PropertyValues; -import org.springframework.validation.BindException; -import org.springframework.validation.Errors; -import org.springframework.web.servlet.ModelAndView; - -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; -import jakarta.servlet.http.HttpSession; -import java.io.IOException; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; - -/** - * User: sravani - * Date: Jul 6, 2009 - * Time: 12:19:21 PM - */ -public class PepDBController extends PepDBBaseController -{ - private static final Logger _log = LogManager.getLogger(PepDBController.class); - private static final DefaultActionResolver _actionResolver = new DefaultActionResolver(PepDBController.class); - - private static final String PAGE_INDEX = "/org/scharp/atlas/pepdb/view/index.jsp"; - private static final String PAGE_PEPTIDE_GROUP_SELECT = "/org/scharp/atlas/pepdb/view/peptideGroupSelect.jsp"; - private static final String PAGE_IMPORT_PEPTIDES = "/org/scharp/atlas/pepdb/view/importPeptides.jsp"; - - // Maximum number of rows to display on a web page at once. Specifying Table.ALL_ROWS was causing a JavaScript timeout. - private static final int MAX_ROWS = 1000; - - public PepDBController() - { - setActionResolver(_actionResolver); - } - - public ActionURL peptideURL(String action) - { - Container c = getViewContext().getContainer(); - return new ActionURL("PepDB", action, c); - } - - protected HttpServletRequest getRequest() - { - return getViewContext().getRequest(); - } - - protected HttpServletResponse getResponse() - { - return getViewContext().getResponse(); - } - - @RequiresPermission(ReadPermission.class) - public class BeginAction extends SimpleViewAction - { - @Override - public ModelAndView getView(DisplayPeptideForm form, BindException errors) throws Exception - { - JspView v = new JspView(PAGE_INDEX, form, errors); - return v; - } - - @Override - public void addNavTrail(NavTree root) - { - root.addChild("Begin", peptideURL("begin")); - } - } - - @RequiresPermission(ReadPermission.class) - public class SearchForPeptidesAction extends FormViewAction - { - @Override - public ModelAndView getView(PeptideQueryForm form, boolean reshow, BindException errors) throws Exception - { - ViewContext ctx = getViewContext(); - HttpSession session = ctx.getRequest().getSession(true); - PeptideQueryForm form1 = (PeptideQueryForm) session.getAttribute("QUERY_FORM"); - if (form1 != null && form.getQueryKey() == null) - form = form1; - JspView v = new JspView(PAGE_PEPTIDE_GROUP_SELECT, form, errors); - return v; - } - - @Override - public boolean handlePost(PeptideQueryForm form, BindException errors) throws Exception - { - String actionType = getRequest().getParameter("action_type"); - if (actionType != null && actionType.equals("Get Peptides")) - return true; - else - return false; - } - - @Override - public void validateCommand(PeptideQueryForm form, Errors errors) - { - return; - } - - @Override - public ActionURL getSuccessURL(PeptideQueryForm form) - { - ActionURL urlTest = new ActionURL(GetPeptidesAction.class, getContainer()); - urlTest.addParameter("queryKey", form.getQueryKey()); - urlTest.addParameter("queryValue", form.getQueryValue()); - if (form.getQueryKey() != null && form.getQueryKey().equals(PepDBSchema.COLUMN_PROTEIN_CAT_ID)) - { - if (form.getAAStart() != null) - urlTest.addParameter("AAStart", form.getAAStart()); - if (form.getAAEnd() != null) - urlTest.addParameter("AAEnd", form.getAAEnd()); - } - if (form.getQueryKey() != null && form.getQueryKey().equals(PepDBSchema.COLUMN_PEPTIDE_GROUP_ID)) - { - if (form.getLabId() != null) - urlTest.addParameter("labId", form.getLabId()); - } - return urlTest; - } - - @Override - public void addNavTrail(NavTree root) - { - root.addChild("Search For Peptides By Criteria", peptideURL("searchForPeptides")); - } - } - - @RequiresPermission(ReadPermission.class) - public class GetPeptidesAction extends SimpleViewAction - { - @Override - public ModelAndView getView(PeptideQueryForm form, BindException errors) throws Exception - { - if (!form.validate(errors)) - { - return new JspView<>(PAGE_PEPTIDE_GROUP_SELECT, form, errors); - } - PropertyValues pv = this.getPropertyValues(); - ViewContext ctx = getViewContext(); - HttpSession session = ctx.getRequest().getSession(true); - session.setAttribute("QUERY_FORM", form); - GridView gridView = new GridView(new DataRegion(), (BindException) null); - if (form.getQueryKey().equals(PepDBSchema.COLUMN_PEPTIDE_GROUP_ID)) - { - gridView = getGridViewByGroup(form, pv); - } - if (form.getQueryKey().equals(PepDBSchema.COLUMN_PEPTIDE_POOL_ID)) - { - gridView = getGridViewByPool(form, pv); - } - if (form.getQueryKey().equals(PepDBSchema.COLUMN_PROTEIN_CAT_ID)) - { - gridView = getGridViewByProtein(form, pv); - } - if (form.getQueryKey().equals(PepDBSchema.COLUMN_PEPTIDE_SEQUENCE)) - { - gridView = getGridViewBySequence(form, pv); - } - if (form.getQueryKey().equals(PepDBSchema.COLUMN_PARENT_SEQUENCE)) - { - gridView = getGridViewByParent(form, pv); - } - if (form.getQueryKey().equals(PepDBSchema.COLUMN_CHILD_SEQUENCE)) - { - gridView = getGridViewByChild(form, pv); - } - if (gridView == null) - { - HttpView.redirect(new ActionURL(SearchForPeptidesAction.class, getContainer())); - } - return gridView; - } - - @Override - public void addNavTrail(NavTree root) - { - root.addChild("Get Peptides By Criteria", peptideURL("getPeptides")); - } - } - - @RequiresPermission(ReadPermission.class) - public class DisplayPeptideAction extends SimpleViewAction - { - @Override - public ModelAndView getView(DisplayPeptideForm form, BindException errors) throws Exception - { - String pepId = form.getPeptide_id(); - if (pepId == null || pepId.length() == 0 - || (!pepId.trim().toUpperCase().startsWith("P") && validateInteger(pepId.trim()) == null) - || (pepId.trim().toUpperCase().startsWith("P") && validateInteger(pepId.trim().substring(1)) == null)) - { - errors.reject(null, "Peptide Id is required and It has to be an Integer with or without prefix 'P'."); - JspView v = new JspView(PAGE_INDEX, form, errors); - return v; - } - if (pepId.trim().toUpperCase().startsWith("P") && validateInteger(pepId.trim().substring(1)) != null) - pepId = pepId.trim().substring(1); - Peptides p = PepDBManager.getPeptideById(Integer.parseInt(pepId)); - if (p == null) - { - errors.reject(null, "Peptide Id not found in the database."); - JspView v = new JspView(PAGE_INDEX, form, errors); - return v; - } - _log.debug("DisplayPeptideForm: " + form.toString()); - VBox box = new VBox(); - PeptideQueryForm queryform = new PeptideQueryForm(); - queryform.setQueryValue(pepId); - DetailsView dataView = getPeptideDetailsView(queryform, p); - if (!p.isChild()) - { - dataView.getDataRegion().getDisplayColumn("optimal_epitope_list_id").setVisible(false); - dataView.getDataRegion().getDisplayColumn("hla_restriction").setVisible(false); - } - box.addView(dataView); - JspView detailsView = new JspView("/org/scharp/atlas/pepdb/view/peptideDetails.jsp", queryform, errors); - box.addView(detailsView); - PropertyValues pv = this.getPropertyValues(); - if (p.isParent()) - { - PeptideQueryForm parentform = new PeptideQueryForm(); - parentform.setQueryValue((pepId)); - GridView gvChildren = getGridViewByParentId(parentform, pv); - box.addView(gvChildren); - } - if (p.isChild()) - { - PeptideQueryForm childform = new PeptideQueryForm(); - childform.setQueryValue((pepId)); - GridView gvParents = getGridViewByChildId(childform, pv); - box.addView(gvParents); - } - return box; - } - - @Override - public void addNavTrail(NavTree root) - { - root.addChild("Display Peptide Details", peptideURL("displayPeptide")); - } - } - - @RequiresPermission(UpdatePermission.class) - public class EditPeptideAction extends FormViewAction - { - @Override - public ModelAndView getView(PeptideForm form, boolean reshow, BindException errors) - { - Peptides p = PepDBManager.getPeptideById(form.getBean().getPeptide_id()); - UpdateView uView = new UpdateView(form, errors); - ButtonBar bb = new ButtonBar(); - //bb.add(new ActionButton("editPeptide.post","Save Changes")); - //ActionURL editPeptideUrl = new ActionURL(EditPeptideAction.class, getContainer()); - - bb.add(new ActionButton(new ActionURL(EditPeptideAction.class, getContainer()), "Save Changes")); - - ActionURL backURL = new ActionURL(DisplayPeptideAction.class, getContainer()); - backURL.addParameter(PepDBSchema.COLUMN_PEPTIDE_ID, form.getBean().getPeptide_id()); - ActionButton cancelButton = new ActionButton(backURL, "Cancel"); - cancelButton.setActionType(ActionButton.Action.LINK); - bb.add(cancelButton); - uView.getDataRegion().setButtonBar(bb); - if (!p.isChild()) - { - uView.getDataRegion().getDisplayColumn("optimal_epitope_list_id").setVisible(false); - uView.getDataRegion().getDisplayColumn("hla_restriction").setVisible(false); - } - uView.setTitle("Update Peptide data for : P" + form.getBean().getPeptide_id()); - return uView; - } - - @Override - public boolean handlePost(PeptideForm form, BindException errors) throws Exception - { - Peptides oldBean = PepDBManager.getPeptideById(form.getBean().getPeptide_id()); - form.setOldValues(oldBean); - Peptides bean = form.getBean(); - PepDBManager.updatePeptide(getUser(), bean); - return true; - } - - @Override - public void validateCommand(PeptideForm form, Errors errors) - { - Peptides bean = form.getBean(); - if (bean.isPeptide_flag() && (bean.getPeptide_notes() == null || bean.getPeptide_notes().length() == 0)) - errors.reject(null, "If a peptide is flagged then you must enter Peptide Flag Reason."); - if (!bean.isPeptide_flag() && bean.getPeptide_notes() != null && bean.getPeptide_notes().trim().length() != 0) - errors.reject(null, "If a peptide is not flagged then Peptide Flag Reason must be blank."); - } - - @Override - public ActionURL getSuccessURL(PeptideForm form) - { - ActionURL url = new ActionURL(DisplayPeptideAction.class, getContainer()); - url.addParameter(PepDBSchema.COLUMN_PEPTIDE_ID, form.getBean().getPeptide_id()); - return url; - } - - @Override - public void addNavTrail(NavTree root) - { - root.addChild("Edit Peptide", peptideURL("editPeptide")); - } - } - - @RequiresPermission(UpdatePermission.class) - public class EditPeptidePoolAction extends FormViewAction - { - @Override - public ModelAndView getView(PeptidePoolForm form, boolean reshow, BindException errors) - { - PeptidePool p = PepDBManager.getPeptidePoolByID(form.getBean().getPeptide_pool_id()); - UpdateView uView = new UpdateView(form, errors); - ButtonBar bb = new ButtonBar(); - bb.add(new ActionButton(new ActionURL(EditPeptidePoolAction.class, getContainer()), "Save Changes")); - //bb.add(new ActionButton("editPeptidePool.post","Save Changes")); - ActionURL backURL = new ActionURL(DisplayPeptidePoolInformationAction.class, getContainer()); - backURL.addParameter(PepDBSchema.COLUMN_PEPTIDE_POOL_ID, form.getBean().getPeptide_pool_id()); - ActionButton cancelButton = new ActionButton(backURL, "Cancel"); - cancelButton.setActionType(ActionButton.Action.LINK); - bb.add(cancelButton); - uView.getDataRegion().setButtonBar(bb); - uView.setTitle("Update Peptide Pool data for : PP" + form.getBean().getPeptide_pool_id()); - return uView; - } - - @Override - public boolean handlePost(PeptidePoolForm form, BindException errors) throws Exception - { - PeptidePool bean = form.getBean(); - PeptidePool dbBean = PepDBManager.getPeptidePoolByID(bean.getPeptide_pool_id()); - bean.setCreated(dbBean.getCreated()); - bean.setCreatedBy(dbBean.getCreatedBy()); - PepDBManager.updatePeptidePool(getUser(), bean); - return true; - } - - @Override - public void validateCommand(PeptidePoolForm form, Errors errors) - { - - } - - @Override - public ActionURL getSuccessURL(PeptidePoolForm form) - { - ActionURL url = new ActionURL(DisplayPeptidePoolInformationAction.class, getContainer()); - url.addParameter(PepDBSchema.COLUMN_PEPTIDE_POOL_ID, form.getBean().getPeptide_pool_id()); - return url; - } - - @Override - public void addNavTrail(NavTree root) - { - root.addChild("Edit Peptide Pool", peptideURL("editPeptidePool")); - } - } - - @RequiresPermission(ReadPermission.class) - public class ShowAllPeptideGroupsAction extends SimpleViewAction - { - @Override - public ModelAndView getView(PeptideQueryForm form, BindException errors) throws Exception - { - TableInfo tableInfo = PepDBSchema.getInstance().getTableInfoPeptideGroups(); - PropertyValues pv = this.getPropertyValues(); - form.setTInfo(tableInfo); - List columns = tableInfo.getColumns("peptide_group_name,pathogen_id,seq_ref,clade_id,pep_align_ref_id,group_type_id,createdby,created,modifiedby,modified"); - form.setCInfo(columns); - form.setSort(new Sort(PepDBSchema.COLUMN_PEPTIDE_GROUP_ID)); - form.setMessage("AllPeptideGroups"); - DataRegion rgn = getDataRegion(getContainer(), form, Table.ALL_ROWS); - rgn.setButtonBar(getGridButtonbar(pv), DataRegion.MODE_GRID); - ActionURL insertUrl = new ActionURL(InsertPeptideGroupAction.class, getContainer()); - ActionButton insert = new ActionButton(insertUrl, "Insert New Group"); - insert.setActionType(ActionButton.Action.LINK); - rgn.getButtonBar(DataRegion.MODE_GRID).add(insert); - DisplayColumn col = rgn.getDisplayColumn(PepDBSchema.COLUMN_PEPTIDE_GROUP_NAME); - ActionURL displayAction = new ActionURL(DisplayPeptideGroupInformationAction.class, getContainer()); - displayAction.addParameter(PepDBSchema.COLUMN_PEPTIDE_GROUP_ID,"${" + PepDBSchema.COLUMN_PEPTIDE_GROUP_ID + "}"); - col.setURL(displayAction); - GridView gridView = new GridView(rgn, errors); - gridView.setTitle("All the Peptide Groups in the System are : "); - return gridView; - } - - @Override - public void addNavTrail(NavTree root) - { - root.addChild("Display All Peptide Groups", peptideURL("showAllPeptideGroups")); - } - } - - @RequiresPermission(ReadPermission.class) - public class DisplayPeptideGroupInformationAction extends SimpleViewAction - { - @Override - public ModelAndView getView(PeptideAndGroupForm form, BindException errors) throws Exception - { - _log.debug("PeptideAndGroupForm: " + form.toString()); - PeptideGroup pg = PepDBManager.getPeptideGroupByID(Integer.parseInt(form.getPeptide_group_id())); - DataRegion rgn1 = new DataRegion(); - TableInfo tableInfo1 = PepDBSchema.getInstance().getTableInfoPeptideGroups(); - rgn1.setColumns(tableInfo1.getColumns("peptide_group_id,peptide_group_name,pathogen_id,seq_ref,clade_id,pep_align_ref_id,group_type_id,createdby,created,modifiedby,modified")); - ButtonBar buttonBar1 = getButtonBar(); - ActionURL backUrl = new ActionURL(ShowAllPeptideGroupsAction.class, getContainer()); - ActionButton goBack = new ActionButton("List All Groups", backUrl); - buttonBar1.add(goBack); - if (getContainer().hasPermission(getUser(), UpdatePermission.class)) - { - ActionURL updateGroupUrl = new ActionURL(UpdatePeptideGroupAction.class, getContainer()); - updateGroupUrl.addParameter(PepDBSchema.COLUMN_PEPTIDE_GROUP_ID, form.getPeptide_group_id()); - ActionButton updateGroupButton = new ActionButton("Update Group Data", updateGroupUrl); - buttonBar1.add(updateGroupButton); - } - rgn1.setButtonBar(buttonBar1, DataRegion.MODE_DETAILS); - DetailsView dataView = new DetailsView(rgn1, form.getPeptide_group_id()); - dataView.setTitle("Group Information from peptide_group table for group : " + pg.getPeptide_group_name()); - VBox vBox = new VBox(); - vBox.addView(dataView); - PropertyValues pv = this.getPropertyValues(); - PeptideQueryForm form2 = new PeptideQueryForm(); - form2.setQueryValue(form.getPeptide_group_id()); - GridView gv = getGridViewByGroup(form2, pv); - vBox.addView(gv); - return vBox; - } - - @Override - public void addNavTrail(NavTree root) - { - root.addChild("Display Peptide Group Details", peptideURL("displayPeptideGroupInformation")); - } - } - - @RequiresPermission(ReadPermission.class) - public class ShowAllPeptidePoolsAction extends SimpleViewAction - { - @Override - public ModelAndView getView(PeptideQueryForm form, BindException errors) throws Exception - { - TableInfo tableInfo = PepDBSchema.getInstance().getTableInfoViewPoolDetails(); - PropertyValues pv = this.getPropertyValues(); - form.setTInfo(tableInfo); - List columns = tableInfo.getColumns("peptide_pool_id,peptide_pool_name,pool_type_desc,parent_pool_id,parent_pool_name,matrix_peptide_pool_id,comment,archived,createdby,created,modifiedby,modified"); - form.setCInfo(columns); - form.setSort(new Sort(PepDBSchema.COLUMN_PEPTIDE_POOL_ID)); - form.setMessage("AllPeptidePools"); - DataRegion rgn = getDataRegion(getContainer(), form, Table.ALL_ROWS); - rgn.setButtonBar(getGridButtonbar(pv), DataRegion.MODE_GRID); - ActionURL importUrl = new ActionURL(ImportPeptidePoolsAction.class, getContainer()); - ActionButton importB = new ActionButton(importUrl, "Import New Pools"); - importB.setActionType(ActionButton.Action.LINK); - rgn.getButtonBar(DataRegion.MODE_GRID).add(importB); - GridView gridView = new GridView(rgn, errors); - gridView.setTitle("All the Peptide Pools in the System are : "); - return gridView; - } - - @Override - public void addNavTrail(NavTree root) - { - root.addChild("Display All Peptide Pools", peptideURL("showAllPeptidePools")); - } - } - - @RequiresPermission(ReadPermission.class) - public class DisplayPeptidePoolInformationAction extends SimpleViewAction - { - @Override - public ModelAndView getView(PeptideAndPoolForm form, BindException errors) throws Exception - { - _log.debug("PeptideAndPoolForm: " + form.toString()); - PeptideQueryForm queryform = new PeptideQueryForm(); - TableInfo tableInfo = PepDBSchema.getInstance().getTableInfoPeptidePools(); - PropertyValues pv = this.getPropertyValues(); - queryform.setTInfo(tableInfo); - queryform.setCInfo(tableInfo.getColumns("peptide_pool_id,peptide_pool_name,pool_type_id,parent_pool_id,matrix_peptide_pool_id,comment,archived,createdby,created,modifiedby,modified")); - DataRegion rgn = getDataRegion(getContainer(), queryform, Table.ALL_ROWS); - rgn.setShowBorders(true); - rgn.setShadeAlternatingRows(true); - ButtonBar buttonBar = getButtonBar(); - ActionURL editUrl = new ActionURL(EditPeptidePoolAction.class, getContainer()); - editUrl.addParameter(PepDBSchema.COLUMN_PEPTIDE_POOL_ID, form.getPeptide_pool_id()); - ActionButton editButton = new ActionButton("Edit Peptide Pool", editUrl); - buttonBar.add(editButton); - rgn.setButtonBar(buttonBar, DataRegion.MODE_DETAILS); - DetailsView dataView = new DetailsView(rgn, form.getPeptide_pool_id()); - dataView.setTitle("Pool Information from peptide_pool table for pool : PP" + form.getPeptide_pool_id()); - queryform.setQueryValue(form.getPeptide_pool_id()); - GridView gv = getGridViewByPool(queryform, pv); - - // Because this page has potentially two data grids, we must give each grid a different - // action url (in order to distinguish the two tables). - gv.getDataRegion().setButtonBar(getGridButtonbarPeptidesInPool(pv)); - VBox box = new VBox(); - box.addView(dataView); - box.addView(gv); - if (PepDBManager.getChildrenPools(form.getPeptide_pool_id()) != null) - { - GridView childPools = getGridViewByParentPool(queryform, pv); - childPools.getDataRegion().setButtonBar(getGridButtonbarPoolsInPool(pv)); - box.addView(childPools); - } - return box; - - } - - @Override - public void addNavTrail(NavTree root) - { - root.addChild("Display Peptide Pool Details", peptideURL("displayPeptidePoolInformation")); - } - } - - @RequiresPermission(UpdatePermission.class) - public class UpdatePeptideGroupAction extends FormViewAction - { - @Override - public ModelAndView getView(PeptideGroupForm form, boolean reshow, BindException errors) throws Exception - { - PeptideGroup pg = PepDBManager.getPeptideGroupByID(form.getBean().getPeptide_group_id()); - UpdateView uView = new UpdateView(form, errors); - ButtonBar bb = new ButtonBar(); - //bb.add(new ActionButton("updatePeptideGroup.post","Save Changes")); - bb.add(new ActionButton(new ActionURL(UpdatePeptideGroupAction.class, getContainer()), "Save Changes")); - ActionURL backURL = new ActionURL(DisplayPeptideGroupInformationAction.class, getContainer()); - backURL.addParameter(PepDBSchema.COLUMN_PEPTIDE_GROUP_ID, form.getBean().getPeptide_group_id()); - ActionButton cancelButton = new ActionButton(backURL, "Cancel"); - cancelButton.setActionType(ActionButton.Action.LINK); - bb.add(cancelButton); - uView.getDataRegion().setButtonBar(bb); - if (pg.getPeptide_group_name().equalsIgnoreCase("Optimal Epitopes")) - uView.getDataRegion().getDisplayColumn("peptide_group_name").setVisible(false); - uView.setTitle("Update Peptide Group data for : " + pg.getPeptide_group_name()); - return uView; - } - - @Override - public boolean handlePost(PeptideGroupForm form, BindException errors) throws Exception - { - PeptideGroup bean = form.getBean(); - PeptideGroup dbBean = PepDBManager.getPeptideGroupByID(bean.getPeptide_group_id()); - bean.setCreated(dbBean.getCreated()); - bean.setCreatedBy(dbBean.getCreatedBy()); - PepDBManager.updatePeptideGroup(getUser(), bean); - return true; - } - - @Override - public void validateCommand(PeptideGroupForm form, Errors errors) - { - try - { - form.validate(errors); - form.validateName(errors); - } - catch (SQLException e) - { - errors.reject(null, "There's something wrong with database when trying to get all the existing groups."); - } - } - - @Override - public ActionURL getSuccessURL(PeptideGroupForm form) - { - ActionURL url = new ActionURL(DisplayPeptideGroupInformationAction.class, getContainer()); - url.addParameter(PepDBSchema.COLUMN_PEPTIDE_GROUP_ID, form.getBean().getPeptide_group_id()); - return url; - } - - @Override - public void addNavTrail(NavTree root) - { - root.addChild("Update Peptide Group", peptideURL("updatePeptideGroup")); - } - } - - @RequiresPermission(UpdatePermission.class) - public class InsertPeptideGroupAction extends FormViewAction - { - @Override - public ModelAndView getView(PeptideGroupForm form, boolean reshow, BindException errors) throws Exception - { - ButtonBar bb = new ButtonBar(); - //bb.add(new ActionButton("insertPeptideGroup.post","Add New Peptide Group")); - bb.add(new ActionButton(new ActionURL(InsertPeptideGroupAction.class, getContainer()), "Add New Peptide Group")); - ActionURL backURL = new ActionURL(BeginAction.class, getContainer()); - ActionButton goBack = new ActionButton(backURL, "Cancel"); - goBack.setActionType(ActionButton.Action.LINK); - bb.add(goBack); - PeptideQueryForm qForm = new PeptideQueryForm(); - TableInfo tInfo = PepDBSchema.getInstance().getTableInfoPeptideGroups(); - qForm.setTInfo(tInfo); - qForm.setCInfo(tInfo.getColumns()); - DataRegion rgn = getDataRegion(getContainer(), qForm, Table.ALL_ROWS); - rgn.setButtonBar(bb); - InsertView iView = new InsertView(rgn, form, errors); - return iView; - } - - @Override - public boolean handlePost(PeptideGroupForm form, BindException errors) throws Exception - { - PeptideGroup group = form.getBean(); - group = PepDBManager.insertGroup(getContainer(), getUser(), group); - group.setContainerId(getContainer().getId()); - form.setBean(group); - return true; - } - - @Override - public void validateCommand(PeptideGroupForm form, Errors errors) - { - try - { - form.validate(errors); - form.validateName(errors); - } - catch (SQLException e) - { - errors.reject(null, "There's something wrong with database when trying to get all the existing groups."); - } - } - - @Override - public ActionURL getSuccessURL(PeptideGroupForm form) - { - ActionURL url = new ActionURL(DisplayPeptideGroupInformationAction.class, getContainer()); - url.addParameter(PepDBSchema.COLUMN_PEPTIDE_GROUP_ID, form.getBean().getPeptide_group_id().toString()); - return url; - } - - @Override - public void addNavTrail(NavTree root) - { - root.addChild("Insert Peptide Group", peptideURL("insertPeptideGroup")); - } - } - - @RequiresPermission(UpdatePermission.class) - public class ImportPeptidesAction extends FormViewAction - { - private List resultPeptides = new LinkedList(); - - @Override - public ModelAndView getView(FileForm form, boolean reshow, BindException errors) throws Exception - { - JspView v = new JspView(PAGE_IMPORT_PEPTIDES, form, errors); - return v; - } - - @Override - public boolean handlePost(FileForm form, BindException errors) throws Exception - { - try - { - List importFiles = getAttachmentFileList(); - AttachmentFile importFile = null; - for (AttachmentFile a : importFiles) - { - if (a != null && a.getSize() != 0) - importFile = a; - } - if (!form.validate(errors, importFile)) - return false; - if (isPost() && form.getActionType().equalsIgnoreCase(("PEPTIDES"))) - { - PeptideImporter importer = new PeptideImporter(); - if (!importer.process(getViewContext().getUser(), importFile, errors, resultPeptides)) - return false; - return true; - } - } - catch (Exception e) - { - e.printStackTrace(); - _log.error(e.getMessage(), e); - errors.reject(null, "There was a problem uploading File: " + e.getMessage()); - return false; - } - return true; - } - - @Override - public void validateCommand(FileForm form, Errors errors) - { - - } - - @Override - public ActionURL getSuccessURL(FileForm form) - { - ActionURL url = new ActionURL(DisplayResultAction.class, getContainer()); - url.addParameter("message", "The file has been successfully imported."); - return url; - } - - @Override - public void addNavTrail(NavTree root) - { - root.addChild("Import Peptides", peptideURL("importPeptides")); - } - } - - @RequiresPermission(UpdatePermission.class) - public class DisplayResultAction extends SimpleViewAction - { - @Override - public ModelAndView getView(FileForm form, BindException errors) throws Exception - { - PeptideQueryForm form1 = new PeptideQueryForm(); - PropertyValues pv = this.getPropertyValues(); - GridView v = getGridViewByLastImport(form1, pv); - return v; - } - - @Override - public void addNavTrail(NavTree root) - { - root.addChild("Display Results Page", peptideURL("displayResult")); - } - } - - @RequiresPermission(UpdatePermission.class) - public class ImportPeptidePoolsAction extends FormViewAction - { - ActionURL url = null; - - @Override - public ModelAndView getView(FileForm form, boolean reshow, BindException errors) throws Exception - { - JspView v = new JspView("/org/scharp/atlas/pepdb/view/importPools.jsp", form, errors); - return v; - } - - @Override - public boolean handlePost(FileForm form, BindException errors) throws Exception - { - try - { - List importFiles = getAttachmentFileList(); - AttachmentFile importFile = null; - for (AttachmentFile a : importFiles) - { - if (a != null && a.getSize() != 0) - importFile = a; - } - if (!form.validate(errors, importFile)) - return false; - - PoolImporter importer = new PoolImporter(); - if (!importer.process(getViewContext().getUser(), form, importFile, errors)) - return false; - url = new ActionURL(BeginAction.class, getContainer()); - return true; - } - catch (Exception e) - { - e.printStackTrace(); - _log.error(e.getMessage(), e); - errors.reject(null, "There was a problem uploading File: " + e.getMessage()); - return false; - } - } - - @Override - public void validateCommand(FileForm form, Errors errors) - { - - } - - @Override - public ActionURL getSuccessURL(FileForm form) - { - ActionURL url = new ActionURL(ImportPeptidePoolsAction.class, getContainer()); - url.addParameter("message", "The file has been successfully imported."); - return url; - } - - @Override - public void addNavTrail(NavTree root) - { - root.addChild("Import Peptide Pools", peptideURL("importPeptidePools")); - } - } - - - @RequiresPermission(ReadPermission.class) - public abstract class PeptideExcelExportAction extends ExportAction - { - public void printExcel(Object bean, HttpServletResponse response, BindException errors, PeptideQueryForm form) throws Exception - { - try - { - RenderContext context = new RenderContext(getViewContext()); - DataRegion rgn = getDataRegion(getContainer(), form, Table.ALL_ROWS); - context.setBaseFilter(form.getFilter()); - context.setBaseSort(form.getSort()); - ExcelWriter ew = new ExcelWriter(()->rgn.getResults(context), rgn.getDisplayColumns()); - ew.setAutoSize(true); - ew.setFilenamePrefix(form.getMessage()); - ew.setSheetName(form.getMessage()); - ew.setFooter(form.getMessage()); - ew.renderWorkbook(getResponse()); - } - catch (SQLException e) - { - _log.error("export: " + e); - } - catch (IOException e) - { - _log.error("export: " + e); - } - catch (Exception e) - { - _log.error("export: " + e); - } - } - } - - @RequiresPermission(ReadPermission.class) - public class PeptidesInPoolExcelExportAction extends PeptideExcelExportAction - { - @Override - public void export(Object bean, HttpServletResponse response, BindException errors) throws Exception - { - PeptideQueryForm form = new PeptideQueryForm(); - PropertyValues pv = this.getPropertyValues(); - form.setQueryValue((String)pv.getPropertyValue("peptide_pool_id").getValue()); - getGridViewByPool(form, pv); - printExcel(bean, response, errors, form); - } - } - - @RequiresPermission(ReadPermission.class) - public class PoolsInPoolExcelExportAction extends PeptideExcelExportAction - { - @Override - public void export(Object bean, HttpServletResponse response, BindException errors) throws Exception - { - PeptideQueryForm form = new PeptideQueryForm(); - PropertyValues pv = this.getPropertyValues(); - form.setQueryValue((String)pv.getPropertyValue("peptide_pool_id").getValue()); - getGridViewByParentPool(form, pv); - printExcel(bean, response, errors, form); - } - } - - @RequiresPermission(ReadPermission.class) - public class PeptideDefaultExcelExportAction extends PeptideExcelExportAction - { - @Override - public void export(Object bean, HttpServletResponse response, BindException errors) throws Exception - { - ViewContext ctx = getViewContext(); - HttpSession session = ctx.getRequest().getSession(); - PeptideQueryForm form = (PeptideQueryForm) session.getAttribute("PEPTIDE_QUERY_FORM"); - _log.error("Form " + form.getMessage() + " had filter : " + form.getFilter()); - printExcel(bean, response, errors, form); - } - } - - - - @RequiresPermission(ReadPermission.class) - public abstract class PeptideTextExportAction extends ExportAction - { - public void printText(Object bean, HttpServletResponse response, BindException errors, PeptideQueryForm form) throws Exception - { - try - { - RenderContext context = new RenderContext(getViewContext()); - DataRegion rgn = getDataRegion(getContainer(), form, Table.ALL_ROWS); - context.setBaseFilter(form.getFilter()); - context.setBaseSort(form.getSort()); - - try (TSVGridWriter tsv = new TSVGridWriter(()->rgn.getResults(context), rgn.getDisplayColumns())) - { - tsv.setFilenamePrefix(form.getMessage()); - tsv.write(getResponse()); - } - } - catch (Exception e) - { - _log.error("export: " + e); - } - } - } - - @RequiresPermission(ReadPermission.class) - public class PeptidesInPoolTextExportAction extends PeptideTextExportAction - { - @Override - public void export(Object bean, HttpServletResponse response, BindException errors) throws Exception - { - PeptideQueryForm form = new PeptideQueryForm(); - PropertyValues pv = this.getPropertyValues(); - form.setQueryValue((String)pv.getPropertyValue("peptide_pool_id").getValue()); - getGridViewByPool(form, pv); - printText(bean, response, errors, form); - } - } - - @RequiresPermission(ReadPermission.class) - public class PoolsInPoolTextExportAction extends PeptideTextExportAction - { - @Override - public void export(Object bean, HttpServletResponse response, BindException errors) throws Exception - { - PeptideQueryForm form = new PeptideQueryForm(); - PropertyValues pv = this.getPropertyValues(); - form.setQueryValue((String)pv.getPropertyValue("peptide_pool_id").getValue()); - getGridViewByParentPool(form, pv); - printText(bean, response, errors, form); - } - } - - @RequiresPermission(ReadPermission.class) - public class PeptideDefaultTextExportAction extends PeptideTextExportAction - { - @Override - public void export(Object bean, HttpServletResponse response, BindException errors) throws Exception - { - ViewContext ctx = getViewContext(); - HttpSession session = ctx.getRequest().getSession(); - PeptideQueryForm form = (PeptideQueryForm) session.getAttribute("PEPTIDE_QUERY_FORM"); - printText(bean, response, errors, form); - } - } - - - - protected GridView getGridViewByLastImport(PeptideQueryForm form, PropertyValues pv) throws Exception - { - //PeptideGroup pg = PepDBManager.getPeptideGroupByID(Integer.parseInt(form.getQueryValue())); - TableInfo tableInfo = PepDBSchema.getInstance() - .getTableInfoViewGroupPeptides(); - form.setTInfo(tableInfo); - //_log.debug("Creating a Filter for peptideGroup." + PepDBSchema.COLUMN_PEPTIDE_GROUP_ID + ": " + form); - SimpleFilter sFilter = new SimpleFilter(PepDBSchema.COLUMN_IN_CURRENT_FILE, true); - Sort sort = new Sort(PepDBSchema.COLUMN_PEPTIDE_GROUP_ASSIGNMENT_ID); - form.setFilter(sFilter); - form.setCInfo(tableInfo.getColumns("peptide_id,peptide_sequence,protein_cat_id,peptide_group_name,peptide_id_in_group,pathogen_id," + - "sequence_length,amino_acid_start_pos,amino_acid_end_pos,child,parent,optimal_epitope_list_id,hla_restriction,frequency_number,frequency_number_date")); - - form.setSort(sort); - form.setMessage("Peptides_IN_Last_File"); - DataRegion rgn = getDataRegion(getContainer(), form, Table.ALL_ROWS); - rgn.setButtonBar(getGridButtonbar(pv), DataRegion.MODE_GRID); - GridView gridView = new GridView(rgn, (BindException) null); - gridView.setFilter(sFilter); - gridView.setSort(sort); - return gridView; - } - - protected GridView getGridViewByGroup(PeptideQueryForm form, PropertyValues pv) throws Exception - { - PeptideGroup pg = PepDBManager.getPeptideGroupByID(Integer.parseInt(form.getQueryValue())); - TableInfo tableInfo = PepDBSchema.getInstance() - .getTableInfoViewGroupPeptides(); - form.setTInfo(tableInfo); - _log.debug("Creating a Filter for peptideGroup." + PepDBSchema.COLUMN_PEPTIDE_GROUP_ID + ": " + form); - SimpleFilter sFilter = new SimpleFilter(PepDBSchema.COLUMN_PEPTIDE_GROUP_ID, Integer.parseInt(form.getQueryValue())); - if (form.getLabId() != null) - sFilter.addCondition(PepDBSchema.COLUMN_PEPTIDE_ID_IN_GROUP, form.getLabId()); - Sort sort = new Sort(PepDBSchema.COLUMN_PEPTIDE_ID_IN_GROUP); - form.setFilter(sFilter); - if (pg.getPeptide_group_name().equalsIgnoreCase("Optimal Epitopes")) - form.setCInfo(tableInfo.getColumns("peptide_id,peptide_sequence,protein_cat_id,peptide_group_name,peptide_id_in_group,pathogen_id," + - "sequence_length,amino_acid_start_pos,amino_acid_end_pos,child,parent,peptide_flag,peptide_notes,optimal_epitope_list_id,hla_restriction,frequency_number,frequency_number_date")); - else - form.setCInfo(tableInfo.getColumns("peptide_id,peptide_sequence,protein_cat_id,peptide_group_name,peptide_id_in_group,pathogen_id," + - "sequence_length,amino_acid_start_pos,amino_acid_end_pos,child,parent,peptide_flag,peptide_notes,frequency_number,frequency_number_date")); - form.setSort(sort); - form.setMessage("Peptides_IN_Group_" + pg.getPeptide_group_name()); - DataRegion rgn = getDataRegion(getContainer(), form, Table.ALL_ROWS); - rgn.setButtonBar(getGridButtonbar(pv), DataRegion.MODE_GRID); - GridView gridView = new GridView(rgn, (BindException) null); - gridView.setFilter(sFilter); - gridView.setSort(sort); - gridView.setTitle( - "There are (" + - PepDBManager.getCount(Integer.parseInt(form.getQueryValue())) + - ") peptides in the '" + pg.getPeptide_group_name() + "' peptide group."); - return gridView; - } - - protected GridView getGridViewByPool(PeptideQueryForm form, PropertyValues pv) throws Exception - { - PeptidePool pp = PepDBManager.getPeptidePoolByID(Integer.parseInt(form.getQueryValue())); - TableInfo tableInfo = PepDBSchema.getInstance() - .getTableInfoViewPoolPeptides(); - form.setTInfo(tableInfo); - _log.debug("Creating a Filter for peptidePool." + PepDBSchema.COLUMN_PEPTIDE_POOL_ID + ": " + form); - SimpleFilter sFilter = new SimpleFilter(PepDBSchema.COLUMN_PEPTIDE_POOL_ID, Integer.parseInt(form.getQueryValue())); - Sort sort = new Sort(PepDBSchema.COLUMN_PEPTIDE_ID); - form.setFilter(sFilter); - form.setCInfo(tableInfo.getColumns("peptide_id,peptide_sequence,protein_cat_id,peptide_pool_id,peptide_pool_name,pool_type_id," + - "peptide_group_id,peptide_id_in_group,sequence_length,amino_acid_start_pos,amino_acid_end_pos,child,parent,peptide_flag,peptide_notes")); - form.setSort(sort); - form.setMessage("Peptides_IN_Pool_PP" + pp.getPeptide_pool_name()); - DataRegion rgn = getDataRegion(getContainer(), form, Table.ALL_ROWS); - ButtonBar bb = getGridButtonbar(pv); - rgn.setButtonBar(bb, DataRegion.MODE_GRID); - GridView gridView = new GridView(rgn, (BindException) null); - gridView.setFilter(sFilter); - gridView.setSort(sort); - gridView.setTitle( - "The Peptides in the pool " + pp.getPeptide_pool_name() + "(PP" + form.getQueryValue() + ") are : "); - return gridView; - } - - protected GridView getGridViewByParentPool(PeptideQueryForm form, PropertyValues pv) throws Exception - { - PeptidePool pp = PepDBManager.getPeptidePoolByID(Integer.parseInt(form.getQueryValue())); - TableInfo tableInfo = PepDBSchema.getInstance() - .getTableInfoViewPoolDetails(); - form.setTInfo(tableInfo); - _log.debug("Creating a Filter for parent peptidePool." + PepDBSchema.COLUMN_PARENT_POOL_ID + ": " + form); - SimpleFilter sFilter = new SimpleFilter(PepDBSchema.COLUMN_PARENT_POOL_ID, Integer.parseInt(form.getQueryValue())); - Sort sort = new Sort(PepDBSchema.COLUMN_PEPTIDE_POOL_ID); - form.setFilter(sFilter); - form.setCInfo(tableInfo.getColumns("peptide_pool_id,peptide_pool_name,pool_type_desc,parent_pool_id,parent_pool_name,matrix_peptide_pool_id,comment,archived,createdby,created,modifiedby,modified")); - form.setSort(sort); - form.setMessage("Peptides_WITH_Parent_Pool_PP" + form.getQueryValue()); - DataRegion rgn = getDataRegion(getContainer(), form, Table.ALL_ROWS); - rgn.setButtonBar(getGridButtonbar(pv), DataRegion.MODE_GRID); - GridView gridView = new GridView(rgn, (BindException) null); - gridView.setFilter(sFilter); - gridView.setSort(sort); - gridView.setTitle( - "The Sub-Pools of Parent Pool " + pp.getPeptide_pool_name() + "(PP" + form.getQueryValue() + ") are : "); - return gridView; - } - - protected GridView getGridViewBySequence(PeptideQueryForm form, PropertyValues pv) throws Exception - { - TableInfo tableInfo = PepDBSchema.getInstance() - .getTableInfoViewGroupPeptides(); - form.setTInfo(tableInfo); - _log.debug("Creating a Filter for peptideSequence." + PepDBSchema.COLUMN_PEPTIDE_SEQUENCE + ": " + form); - SimpleFilter sFilter = new SimpleFilter(); - - boolean sequenceIsEmpty = true; - String sequence = form.getQueryValue(); - if((sequence != null) && (!sequence.trim().isEmpty())){ - sequenceIsEmpty = false; - } - if(!sequenceIsEmpty) - { - sequence = sequence.trim().toUpperCase(); - sFilter.addWhereClause(PepDBSchema.COLUMN_PEPTIDE_SEQUENCE + " LIKE ?", new Object[]{"%" + sequence + "%"}, - FieldKey.fromString(PepDBSchema.COLUMN_PEPTIDE_SEQUENCE)); - form.setFilter(sFilter); - } - Sort sort = new Sort(PepDBSchema.COLUMN_PEPTIDE_ID); - - form.setCInfo(tableInfo.getColumns("peptide_id,peptide_sequence,protein_cat_id,peptide_group_name,peptide_id_in_group,pathogen_id," + - "sequence_length,amino_acid_start_pos,amino_acid_end_pos,child,parent,peptide_flag,peptide_notes,optimal_epitope_list_id,hla_restriction")); - form.setSort(sort); - if(!sequenceIsEmpty) - { - form.setMessage("Peptides_WITH_Sequence_" + sequence); - } - else - { - form.setMessage("All_Peptides_In_DB"); - } - DataRegion rgn = getDataRegion(getContainer(), form, MAX_ROWS); - rgn.setButtonBar(getGridButtonbar(pv), DataRegion.MODE_GRID); - GridView gridView = new GridView(rgn, (BindException) null); - gridView.setSort(sort); - if(!sequenceIsEmpty) { - gridView.setFilter(sFilter); - gridView.setTitle( - "The Peptides Containing the Sequence string '" + sequence + "' are : "); - } - else - { - gridView.setTitle("All the Peptides in Peptide DB : "); - } - return gridView; - } - - protected GridView getGridViewByProtein(PeptideQueryForm form, PropertyValues pv) throws Exception - { - ProteinCategory pc = PepDBManager.getProCatByID(Integer.parseInt(form.getQueryValue())); - TableInfo tableInfo = PepDBSchema.getInstance() - .getTableInfoViewGroupPeptides(); - form.setTInfo(tableInfo); - String title = "Peptides in Protein Category " + pc.getProtein_cat_desc(); - _log.debug("Creating a Filter for proteinCategory." + PepDBSchema.COLUMN_PROTEIN_CAT_ID + ": " + form); - SimpleFilter sFilter = new SimpleFilter(PepDBSchema.COLUMN_PROTEIN_CAT_ID, Integer.parseInt(form.getQueryValue())); - if (form.getAAEnd() == null && form.getAAStart() != null) - { - sFilter.addCondition(PepDBSchema.COLUMN_AMINO_ACID_START_POS, Integer.parseInt(form.getAAStart()), CompareType.GTE); - title = "Peptides in Protein Category " + pc.getProtein_cat_desc() + " and after AAStart " + form.getAAStart(); - } - if (form.getAAEnd() != null && form.getAAStart() == null) - { - sFilter.addCondition(PepDBSchema.COLUMN_AMINO_ACID_END_POS, Integer.parseInt(form.getAAEnd()), CompareType.LTE); - title = "Peptides in Protein Category " + pc.getProtein_cat_desc() + " and before AAEnd " + form.getAAEnd(); - } - if (form.getAAStart() != null && form.getAAEnd() != null) - { - sFilter.addBetween(tableInfo.getColumn(PepDBSchema.COLUMN_AMINO_ACID_START_POS).getFieldKey(), Integer.parseInt(form.getAAStart()), Integer.parseInt(form.getAAEnd())); - sFilter.addBetween(tableInfo.getColumn(PepDBSchema.COLUMN_AMINO_ACID_END_POS).getFieldKey(), Integer.parseInt(form.getAAStart()), Integer.parseInt(form.getAAEnd())); - title = "Peptides in Protein Category " + pc.getProtein_cat_desc() + " and between AAStart " + form.getAAStart() + " and AAEnd " + form.getAAEnd(); - } - Sort sort = new Sort(PepDBSchema.COLUMN_PEPTIDE_ID); - form.setFilter(sFilter); - form.setCInfo(tableInfo.getColumns("peptide_id,peptide_sequence,protein_cat_id,peptide_group_name,peptide_id_in_group,pathogen_id," + - "sequence_length,amino_acid_start_pos,amino_acid_end_pos,child,parent,peptide_flag,peptide_notes,optimal_epitope_list_id,hla_restriction")); - form.setSort(sort); - form.setMessage("Peptides_IN_Protein_" + form.getQueryValue()); - DataRegion rgn = getDataRegion(getContainer(), form, Table.ALL_ROWS); - rgn.setButtonBar(getGridButtonbar(pv), DataRegion.MODE_GRID); - GridView gridView = new GridView(rgn, (BindException) null); - gridView.setFilter(sFilter); - gridView.setSort(sort); - gridView.setTitle(title); - return gridView; - } - - protected GridView getGridViewByParentId(PeptideQueryForm form, PropertyValues pv) throws Exception - { - TableInfo tableInfo = PepDBSchema.getInstance() - .getTableInfoViewParentChildDetails(); - form.setTInfo(tableInfo); - _log.debug("Creating a Filter for parentID. : " + form); - SimpleFilter sFilter = new SimpleFilter(PepDBSchema.COLUMN_PARENT_ID, Integer.parseInt(form.getQueryValue())); - Sort sort = new Sort(PepDBSchema.COLUMN_CHILD_ID); - form.setFilter(sFilter); - form.setCInfo(tableInfo.getColumns("child_id,child_sequence,child_protein,child_group,child_lab_id,child_seq_length," + - "child_aastart,child_aaend,child_peptide_flag,child_peptide_notes,child_optimal_epitope_list_id,child_hla_restriction")); - form.setSort(sort); - form.setMessage("CHILD_Peptides_WITH_Parent_P" + form.getQueryValue()); - DataRegion rgn = getDataRegion(getContainer(), form, Table.ALL_ROWS); - rgn.setButtonBar(getGridButtonbar(pv), DataRegion.MODE_GRID); - GridView gridView = new GridView(rgn, (BindException) null); - gridView.setFilter(sFilter); - gridView.setSort(sort); - gridView.setTitle( - "The Child Peptides of Parent peptide ID P" + form.getQueryValue() + " are : "); - return gridView; - } - - protected GridView getGridViewByParent(PeptideQueryForm form, PropertyValues pv) throws Exception - { - TableInfo tableInfo = PepDBSchema.getInstance() - .getTableInfoViewParentChildDetails(); - form.setTInfo(tableInfo); - _log.debug("Creating a Filter for parentSequence. : " + form); - SimpleFilter sFilter = new SimpleFilter(PepDBSchema.COLUMN_PARENT_SEQUENCE, form.getQueryValue().trim().toUpperCase()); - Sort sort = new Sort(PepDBSchema.COLUMN_CHILD_ID); - form.setFilter(sFilter); - form.setCInfo(tableInfo.getColumns("parent_id,child_id,child_sequence,child_protein,child_group,child_lab_id,child_seq_length," + - "child_aastart,child_aaend,child_peptide_flag,child_peptide_notes,child_optimal_epitope_list_id,child_hla_restriction")); - form.setSort(sort); - form.setMessage("CHILD_Peptides_WITH_Parent_Sequence_" + form.getQueryValue()); - DataRegion rgn = getDataRegion(getContainer(), form, Table.ALL_ROWS); - rgn.setButtonBar(getGridButtonbar(pv), DataRegion.MODE_GRID); - GridView gridView = new GridView(rgn, (BindException) null); - gridView.setFilter(sFilter); - gridView.setSort(sort); - gridView.setTitle( - "The Child Peptides of Parent Sequence " + form.getQueryValue() + " are : "); - return gridView; - } - - protected GridView getGridViewByChildId(PeptideQueryForm form, PropertyValues pv) throws Exception - { - TableInfo tableInfo = PepDBSchema.getInstance() - .getTableInfoViewParentChildDetails(); - form.setTInfo(tableInfo); - _log.debug("Creating a Filter for childID. : " + form); - SimpleFilter sFilter = new SimpleFilter(PepDBSchema.COLUMN_CHILD_ID, Integer.parseInt(form.getQueryValue())); - Sort sort = new Sort(PepDBSchema.COLUMN_PARENT_ID); - form.setFilter(sFilter); - form.setCInfo(tableInfo.getColumns("parent_id,parent_sequence,parent_protein,parent_group,parent_lab_id," + - "parent_seq_length,parent_aastart,parent_aaend,parent_peptide_flag,parent_peptide_notes")); - form.setSort(sort); - form.setMessage("PARENT_Peptides_WITH_Child_P" + form.getQueryValue()); - DataRegion rgn = getDataRegion(getContainer(), form, Table.ALL_ROWS); - rgn.setButtonBar(getGridButtonbar(pv), DataRegion.MODE_GRID); - GridView gridView = new GridView(rgn, (BindException) null); - gridView.setFilter(sFilter); - gridView.setSort(sort); - gridView.setTitle( - "The Parent Peptides of Child peptide ID P" + form.getQueryValue() + " are : "); - return gridView; - } - - protected GridView getGridViewByChild(PeptideQueryForm form, PropertyValues pv) throws Exception - { - TableInfo tableInfo = PepDBSchema.getInstance() - .getTableInfoViewParentChildDetails(); - form.setTInfo(tableInfo); - _log.debug("Creating a Filter for childID. : " + form); - SimpleFilter sFilter = new SimpleFilter(PepDBSchema.COLUMN_CHILD_SEQUENCE, form.getQueryValue().trim().toUpperCase()); - Sort sort = new Sort(PepDBSchema.COLUMN_PARENT_ID); - form.setFilter(sFilter); - form.setCInfo(tableInfo.getColumns("child_id,parent_id,parent_sequence,parent_protein,parent_group,parent_lab_id," + - "parent_seq_length,parent_aastart,parent_aaend,parent_peptide_flag,parent_peptide_notes")); - form.setSort(sort); - form.setMessage("PARENT_Peptides_WITH_Child_Sequence_" + form.getQueryValue()); - DataRegion rgn = getDataRegion(getContainer(), form, Table.ALL_ROWS); - rgn.setButtonBar(getGridButtonbar(pv), DataRegion.MODE_GRID); - GridView gridView = new GridView(rgn, (BindException) null); - gridView.setFilter(sFilter); - gridView.setSort(sort); - gridView.setTitle( - "The Parent Peptides of Child Sequence " + form.getQueryValue() + " are : "); - return gridView; - } - - protected DetailsView getPeptideDetailsView(PeptideQueryForm form, Peptides p) throws Exception - { - TableInfo tableInfo = PepDBSchema.getInstance().getTableInfoPeptides(); - form.setTInfo(tableInfo); - form.setCInfo(tableInfo.getColumns("peptide_id,peptide_sequence,protein_cat_id,sequence_length,amino_acid_start_pos," + - "amino_acid_end_pos,child,parent,optimal_epitope_list_id,hla_restriction,storage_location,src_file_name,peptide_flag,peptide_notes,createdby,created,modifiedby,modified")); - DataRegion rgn = getDataRegion(getContainer(), form, Table.ALL_ROWS); - rgn.setShowBorders(true); - rgn.setShadeAlternatingRows(true); - ButtonBar buttonBar = new ButtonBar(); - ActionURL homeUrl = new ActionURL(BeginAction.class, getContainer()); - ActionButton homeButton = new ActionButton("Peptide Home", homeUrl); - buttonBar.add(homeButton); - ActionURL editUrl = new ActionURL(EditPeptideAction.class, getContainer()); - editUrl.addParameter(PepDBSchema.COLUMN_PEPTIDE_ID, p.getPeptide_id()); - ActionButton editButton = new ActionButton("Edit Peptide", editUrl); - buttonBar.add(editButton); - rgn.setButtonBar(buttonBar, DataRegion.MODE_DETAILS); - DetailsView dataView = new DetailsView(rgn, p.getPeptide_id()); - dataView.setTitle("Peptide Detail Information from peptides table for peptide : P" + p.getPeptide_id()); - return dataView; - } - - private DataRegion getDataRegion(Container c, PeptideQueryForm form, int maxRows) throws Exception - { - DataRegion rgn = new DataRegion(); - List columnList = new ArrayList(); - List displayColumnList = new ArrayList(); - - for (ColumnInfo col : form.getCInfo()) - { - if (col != null) - { - columnList.add(col.getName()); - DisplayColumn dc; - - if (PepDBSchema.COLUMN_PEPTIDE_ID.equals(col.getName()) || PepDBSchema.COLUMN_PARENT_ID.equals(col.getName()) || PepDBSchema.COLUMN_CHILD_ID.equals(col.getName())) - { - dc = new DCpeptideId(col); - } - else if (PepDBSchema.COLUMN_PEPTIDE_POOL_ID.equals(col.getName())) - { - dc = new DCpeptidePoolId(col); - } - else if (PepDBSchema.COLUMN_PARENT_POOL_ID.equals(col.getName())) - { - dc = new DCparentPoolId(col); - } - else { - dc = col.getRenderer(); - } - displayColumnList.add(dc); - } - } - rgn.setColumns(form.getCInfo()); - rgn.setDisplayColumns(displayColumnList); - rgn.setShowBorders(true); - rgn.setShadeAlternatingRows(true); - rgn.setMaxRows(maxRows); - ViewContext ctx = getViewContext(); - HttpSession session = ctx.getRequest().getSession(true); - session.setAttribute("PEPTIDE_QUERY_FORM", form); - - - if (columnList.contains(PepDBSchema.COLUMN_PEPTIDE_ID)) - { - ColumnInfo ci = rgn.getTable().getColumn("peptide_id"); - QuerySettings qs = new QuerySettings(getViewContext(), rgn.getName()); - qs.addAggregates(new Aggregate(ci, Aggregate.BaseType.COUNT)); - qs.setMaxRows(Table.ALL_ROWS); - rgn.setSettings(qs); - // We want MOST of the query settings into our dataregion settings, but we still want to paginate the rows. - rgn.setMaxRows(maxRows); - - } - return rgn; - } - - private ButtonBar getButtonBar() - { - ButtonBar buttonBar = new ButtonBar(); - ActionURL homeUrl = new ActionURL(BeginAction.class, getContainer()); - ActionButton homeButton = new ActionButton("Peptide Home", homeUrl); - buttonBar.add(homeButton); - ActionURL searchURL = new ActionURL(SearchForPeptidesAction.class, getContainer()); - ActionButton searchButton = new ActionButton(searchURL, "Peptide Search Page"); - buttonBar.add(searchButton); - return buttonBar; - } - - /* - * Returns a ButtonBar whose excel and text buttons will - * render whatever grid view is set in the user's Session. - */ - private ButtonBar getGridButtonbar(PropertyValues pv) - { - return getGridButtonbarForClasses(pv, PeptideDefaultExcelExportAction.class,PeptideDefaultTextExportAction.class); - } - - /* - * Returns a ButtonBar whose excel and text buttons explicitly point to an - * action that will generate the Peptide Pools in Pool report. Use when - * multiple grids exist on the same view. - */ - private ButtonBar getGridButtonbarPoolsInPool(PropertyValues pv) - { - return getGridButtonbarForClasses(pv,PoolsInPoolExcelExportAction.class,PoolsInPoolTextExportAction.class); - } - - /* - * Returns a ButtonBar whose excel and text buttons explicitly point to an - * action that will generate the Peptides in Pool report. Use when - * multiple grids exist on the same view. - */ - private ButtonBar getGridButtonbarPeptidesInPool(PropertyValues pv) - { - return getGridButtonbarForClasses(pv,PeptidesInPoolExcelExportAction.class,PeptidesInPoolTextExportAction.class); - } - - private ButtonBar getGridButtonbarForClasses(PropertyValues pv, Class excelActionClass, Class textActionClass) - { - ButtonBar gridButtonBar = getButtonBar(); - //ActionURL exportUrl = new ActionURL(PeptideDefaultExcelExportAction.class, getContainer()); - ActionURL exportUrl = new ActionURL(excelActionClass, getContainer()); - exportUrl.setPropertyValues(pv); - ActionButton export = new ActionButton(exportUrl, "Export to Excel"); - export.setActionType(ActionButton.Action.LINK); - gridButtonBar.add(export); - - ActionURL exportTextURL = new ActionURL(textActionClass, getContainer()); - exportTextURL.setPropertyValues(pv); - ActionButton exportToText = new ActionButton(exportTextURL, "Export All To Text"); - exportToText.setActionType(ActionButton.Action.LINK); - gridButtonBar.add(exportToText); - - return gridButtonBar; - //rgn.setButtonBar(gridButtonBar, DataRegion.MODE_GRID); - } -} diff --git a/src/org/scharp/atlas/pepdb/PepDBManager.java b/src/org/scharp/atlas/pepdb/PepDBManager.java deleted file mode 100644 index 251e17a..0000000 --- a/src/org/scharp/atlas/pepdb/PepDBManager.java +++ /dev/null @@ -1,387 +0,0 @@ -package org.scharp.atlas.pepdb; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.labkey.api.data.Container; -import org.labkey.api.data.SQLFragment; -import org.labkey.api.data.SimpleFilter; -import org.labkey.api.data.Sort; -import org.labkey.api.data.SqlExecutor; -import org.labkey.api.data.SqlSelector; -import org.labkey.api.data.Table; -import org.labkey.api.data.TableInfo; -import org.labkey.api.data.TableSelector; -import org.labkey.api.query.FieldKey; -import org.labkey.api.security.User; -import org.scharp.atlas.pepdb.model.OptimalEpitopeList; -import org.scharp.atlas.pepdb.model.Parent; -import org.scharp.atlas.pepdb.model.PeptideGroup; -import org.scharp.atlas.pepdb.model.PeptidePool; -import org.scharp.atlas.pepdb.model.PeptidePoolAssignment; -import org.scharp.atlas.pepdb.model.Peptides; -import org.scharp.atlas.pepdb.model.PoolType; -import org.scharp.atlas.pepdb.model.ProteinCategory; -import org.scharp.atlas.pepdb.model.Source; - -import java.sql.SQLException; -import java.util.HashMap; - -/** - * Handles Data Operations. - * - * @version $Id: PeptideManager.java 34530 2009-08-10 20:06:30Z sravani $ - */ -public class PepDBManager -{ - - private static Logger log = LogManager.getLogger(PepDBManager.class); - private static PepDBSchema schema = PepDBSchema.getInstance(); - /** - * Static class - */ - private PepDBManager() - { - } - - public static PeptideGroup[] getPeptideGroups() - { - Sort sort = new Sort(PepDBSchema.COLUMN_PEPTIDE_GROUP_ID); - return new TableSelector(schema.getTableInfoPeptideGroups(), null, sort).getArray(PeptideGroup.class); - } - - public static PeptidePool[] getPeptidePools() - { - Sort sort = new Sort(PepDBSchema.COLUMN_PEPTIDE_POOL_ID); - return new TableSelector(schema.getTableInfoPeptidePools(), null, sort).getArray(PeptidePool.class); - } - - public static PoolType[] getPoolTypes() - { - Sort sort = new Sort(PepDBSchema.COLUMN_POOL_TYPE_ID); - return new TableSelector(schema.getTableInfoPoolType(), null, sort).getArray(PoolType.class); - } - - public static ProteinCategory[] getProteinCategory() - { - return new TableSelector(schema.getTableInfoProteinCat(), null, new Sort(PepDBSchema.COLUMN_PROTEIN_CAT_ID)).getArray(ProteinCategory.class); - } - - public static OptimalEpitopeList[] getOptimalEpitopeList() - { - return new TableSelector(schema.getTableInfoOptimalEpitopeList(), null, new Sort(PepDBSchema.COLUMN_OPTIMAL_EPITOPE_LIST_ID)).getArray(OptimalEpitopeList.class); - } - - public static Peptides[] getPeptides() - { - TableInfo tInfo = schema.getTableInfoPeptides(); - return new TableSelector(tInfo, null, new Sort("peptide_id")).getArray(Peptides.class); - } - - /** - * @param peptideGroup - * @return the number of peptides in a given group - */ - public static Integer getCount(Integer peptideGroup) - { - SimpleFilter containerFilter = new SimpleFilter(PepDBSchema.COLUMN_PEPTIDE_GROUP_ID, peptideGroup); - - return (int)new TableSelector(PepDBSchema.getInstance().getTableInfoViewGroupPeptides(), new SimpleFilter("peptide_group_id", peptideGroup), null).getRowCount(); - } - - public static Peptides insertPeptide(User user, Peptides p) throws Exception - { - TableInfo tInfo = PepDBSchema.getInstance().getTableInfoPeptides(); - Peptides dbPeptide = peptideExists(p, tInfo); - if(dbPeptide == null) - dbPeptide = Table.insert(user,tInfo,p); - return dbPeptide; - } - - public static Peptides updatePeptide(User user, Peptides p) throws Exception - { - TableInfo tInfo = PepDBSchema.getInstance().getTableInfoPeptides(); - return Table.update(user, tInfo, p, p.getPeptide_id()); - } - - public static PeptidePool updatePeptidePool(User user, PeptidePool p) throws Exception - { - TableInfo tInfo = PepDBSchema.getInstance().getTableInfoPeptidePools(); - return Table.update(user,tInfo,p,p.getPeptide_pool_id()); - } - - public static Parent insertParent(User user,Parent parent) throws Exception - { - TableInfo tInfo = PepDBSchema.getInstance().getTableInfoParent(); - return Table.insert(user,tInfo,parent); - } - - public static Parent parentExists(Parent p) - { - TableInfo tInfo = PepDBSchema.getInstance().getTableInfoParent(); - Parent dbParent = null; - SimpleFilter sFilter = new SimpleFilter(FieldKey.fromParts("peptide_id"), p.getPeptide_id()); - sFilter.addCondition(FieldKey.fromParts("linked_parent"), p.getLinked_parent()); - Parent[] dbParents = new TableSelector(tInfo, tInfo.getColumns("peptide_id,linked_parent"), sFilter, null).getArray(Parent.class); - if (dbParents.length > 0) - dbParent = dbParents[0]; - return dbParent; - } - - public static Peptides peptideExists(Peptides p, TableInfo tInfo) - { - Peptides dbPeptide = null; - SimpleFilter sFilter = new SimpleFilter(FieldKey.fromParts("peptide_sequence"), p.getPeptide_sequence()); - Peptides[] dbPeptides = new TableSelector(tInfo, sFilter, null).getArray(Peptides.class); - if(dbPeptides.length > 0) - dbPeptide = dbPeptides[0]; - return dbPeptide; - } - - public static Source insertSource(User user, Source src) throws Exception - { - TableInfo tInfo = PepDBSchema.getInstance().getTableInfoSource(); - SimpleFilter sFilter = new SimpleFilter(FieldKey.fromParts("peptide_group_id"), src.getPeptide_group_id()); - sFilter.addCondition(FieldKey.fromParts("peptide_id"), src.getPeptide_id()); - Source dbSrc ; - Source[] dbSrcs = new TableSelector(tInfo, sFilter, null).getArray(Source.class); - if(dbSrcs.length > 0) - dbSrc = dbSrcs[0]; - else - dbSrc = Table.insert(user,tInfo,src); - dbSrc.setIn_current_file(true); - java.sql.Timestamp date = new java.sql.Timestamp(System.currentTimeMillis()); - String sql = "UPDATE pepdb.peptide_group_assignment SET in_current_file = true,modified = ?,modifiedby = ? WHERE peptide_group_assignment_id=?"; - Object[] params = { date,user.getUserId(),dbSrc.getPeptide_group_assignment_id() }; - new SqlExecutor(schema.getSchema()).execute(sql, params); - return dbSrc; - } - - public static PeptidePool insertPeptidePool(User u,PeptidePool pPool) throws Exception - { - TableInfo tInfo = PepDBSchema.getInstance().getTableInfoPeptidePools(); - return Table.insert(u,tInfo,pPool); - } - - public static PeptidePoolAssignment insertPeptidesInPool(User user,PeptidePoolAssignment src) throws Exception - { - TableInfo tInfo = PepDBSchema.getInstance().getTableInfoPoolAssignment(); - SimpleFilter sFilter = new SimpleFilter(FieldKey.fromParts("peptide_pool_id"), src.getPeptide_pool_id()); - sFilter.addCondition(FieldKey.fromParts("peptide_id"), src.getPeptide_id()); - PeptidePoolAssignment dbSrc ; - PeptidePoolAssignment[] dbSrcs = new TableSelector(tInfo, sFilter, null).getArray(PeptidePoolAssignment.class); - if(dbSrcs.length > 0) - return null; - else - dbSrc = Table.insert(user,tInfo,src); - return dbSrc; - } - - public static Source[] getSourcesForPeptide(String peptideId) - { - Source[] sources = null; - try - { - SimpleFilter sfilter = new SimpleFilter(FieldKey.fromParts("peptide_id"), Integer.parseInt(peptideId)); - TableInfo tInfo = PepDBSchema.getInstance().getTableInfoViewGroupPeptides(); - sources = new TableSelector(tInfo, tInfo.getColumns("peptide_group_id,peptide_id_in_group,peptide_group_name,frequency_number,frequency_number_date"), sfilter, null).getArray(Source.class); - if (sources.length < 1) - return null; - } - catch (NumberFormatException e) - { - log.error(e.getMessage(), e); - } - return sources; - } - - public static PeptidePool[] getPoolsForPeptide(String peptideId) - { - SimpleFilter sfilter = new SimpleFilter(FieldKey.fromParts("peptide_id"), Integer.parseInt(peptideId)); - TableInfo tInfo = PepDBSchema.getInstance().getTableInfoViewPoolPeptides(); - PeptidePool[] pools = new TableSelector(tInfo, sfilter, null).getArray(PeptidePool.class); - if (pools.length < 1) - return null; - return pools; - } - - public static PeptideGroup insertGroup(Container c, User user, PeptideGroup pg) throws SQLException - { - PeptideGroup resultGroup = Table.insert(user, PepDBSchema.getInstance().getTableInfoPeptideGroups(), pg); - return resultGroup; - } - - public static PeptideGroup updatePeptideGroup(User user,PeptideGroup pg) throws SQLException - { - return Table.update(user, PepDBSchema.getInstance().getTableInfoPeptideGroups(),pg,pg.getPeptide_group_id()); - } - - public static HashMap getPeptideSequenceMap() - { - HashMap peptideSequenceMap = new HashMap<>(); - Peptides[] peptides = getPeptides(); - for(Peptides peptide : peptides) - peptideSequenceMap.put(peptide.getPeptide_sequence().trim().toUpperCase(), peptide); - return peptideSequenceMap; - } - - public static HashMap getPeptideGroupMap() - { - HashMap groupsMap = new HashMap<>(); - PeptideGroup[] peptideGroups = getPeptideGroups(); - for(PeptideGroup pGroup:peptideGroups) - groupsMap.put(pGroup.getPeptide_group_name().trim().toUpperCase(), pGroup); - return groupsMap; - } - - public static HashMap getPeptidePoolMap() - { - HashMap poolsMap = new HashMap<>(); - PeptidePool[] peptidePools = getPeptidePools(); - for(PeptidePool pPool:peptidePools) - poolsMap.put(pPool.getPeptide_pool_name().trim().toUpperCase(), pPool); - return poolsMap; - } - - public static HashMap getPoolTypeMap() - { - HashMap poolTypeMap = new HashMap<>(); - PoolType[] poolTypes = getPoolTypes(); - for(PoolType pType : poolTypes) - poolTypeMap.put(pType.getPool_type_desc().trim().toUpperCase(), pType); - return poolTypeMap; - } - - public static HashMap getProteinCatMap() - { - HashMap proCatMap = new HashMap<>(); - ProteinCategory[] proCats = getProteinCategory(); - for(ProteinCategory proCat : proCats) - proCatMap.put(proCat.getProtein_cat_desc().trim().toUpperCase(), proCat); - return proCatMap; - } - - public static HashMap getProteinCatIDMap() - { - HashMap proCatMap = new HashMap<>(); - ProteinCategory[] proCats = getProteinCategory(); - for(ProteinCategory proCat : proCats) - proCatMap.put(proCat.getProtein_cat_id(), proCat); - return proCatMap; - } - - public static HashMap getOptimalEpitopeListMap() - { - HashMap optListMap = new HashMap<>(); - OptimalEpitopeList[] optLists = getOptimalEpitopeList(); - for(OptimalEpitopeList optList : optLists) - optListMap.put(optList.getOptimal_epitope_list_desc().trim().toUpperCase(), optList); - return optListMap; - } - - public static Peptides getPeptideById(Integer peptideId) - { - TableInfo tInfo = schema.getTableInfoPeptides(); - SimpleFilter sFilter = new SimpleFilter(PepDBSchema.COLUMN_PEPTIDE_ID, peptideId); - return new TableSelector(tInfo, sFilter, null).getObject(Peptides.class); - } - - public static Peptides[] getParentPeptides(Peptides p) throws SQLException - { - TableInfo tInfo = schema.getTableInfoPeptides(); - String sql = "select * from pepdb.peptides where peptides.protein_cat_id = ? and ? between peptides.amino_acid_start_pos-2 and peptides.amino_acid_end_pos\n" + - "and ? between peptides.amino_acid_start_pos and peptides.amino_acid_end_pos+2 and child = false"; - Peptides[] peptides = new SqlSelector(schema.getSchema(), sql, new Object[]{p.getProtein_cat_id(),p.getAmino_acid_start_pos(),p.getAmino_acid_end_pos()}).getArray(Peptides.class); - return peptides; - } - - public static Peptides[] getHyphanatedParents(Peptides p) throws SQLException - { - String sql = "select * from "+schema.getTableInfoPeptides()+" where peptides.protein_cat_id = ? " + - " and peptides.peptide_sequence LIKE '%"+p.getPeptide_sequence()+"%' " + - " and child = false"; - Peptides[] peptides = new SqlSelector(schema.getSchema(), sql, new Object[]{p.getProtein_cat_id()}).getArray(Peptides.class); - return peptides; - } - - public static PeptideGroup getPeptideGroupByID(Integer groupId) - { - TableInfo tInfo = schema.getTableInfoPeptideGroups(); - SimpleFilter sFilter = new SimpleFilter(PepDBSchema.COLUMN_PEPTIDE_GROUP_ID,groupId); - return new TableSelector(tInfo, sFilter, null).getObject(PeptideGroup.class); - } - - public static ProteinCategory getProCatByID(Integer procatId) - { - TableInfo tInfo = schema.getTableInfoProteinCat(); - SimpleFilter sFilter = new SimpleFilter(PepDBSchema.COLUMN_PROTEIN_CAT_ID,procatId); - return new TableSelector(tInfo, sFilter, null).getObject(ProteinCategory.class); - } - - public static PeptideGroup getPeptideGroupByName(PeptideGroup pg) - { - PeptideGroup [] groups = null; - TableInfo tInfo = schema.getTableInfoPeptideGroups(); - SQLFragment sql = new SQLFragment("SELECT * FROM "+tInfo+" WHERE UPPER(peptide_group_name) = ? "); - sql.add(pg.getPeptide_group_name().trim().toUpperCase()); - if(pg.getPeptide_group_id() != null) - { - sql.append("AND peptide_group_id != ?"); - sql.add(pg.getPeptide_group_id()); - } - groups = new SqlSelector(schema.getSchema(), sql).getArray(PeptideGroup.class); - - if (groups.length > 0) - return groups[0]; - else - return null; - } - - public static PeptidePool getPeptidePoolByID(Integer poolId) - { - TableInfo tInfo = schema.getTableInfoPeptidePools(); - SimpleFilter sFilter = new SimpleFilter(PepDBSchema.COLUMN_PEPTIDE_POOL_ID,poolId); - return new TableSelector(tInfo, sFilter, null).getObject(PeptidePool.class); - } - - public static int updateInCurrentFile(User user) - { - java.sql.Timestamp date = new java.sql.Timestamp(System.currentTimeMillis()); - String sql = "UPDATE pepdb.peptide_group_assignment SET in_current_file = false,modified = ?,modifiedby = ?"; - Object[] params = { date,user.getUserId() }; - return new SqlExecutor(PepDBSchema.getInstance().getSchema()).execute(sql,params); - } - - public static Source getSource(Integer peptideId, Integer groupId) - { - TableInfo tInfo = PepDBSchema.getInstance().getTableInfoSource(); - SimpleFilter sFilter = new SimpleFilter(FieldKey.fromParts("peptide_group_id"), groupId); - sFilter.addCondition(FieldKey.fromParts("peptide_id"), peptideId); - Source dbSrc ; - Source[] dbSrcs = new TableSelector(tInfo, sFilter, null).getArray(Source.class); - if(dbSrcs.length > 0) - dbSrc = dbSrcs[0]; - else - dbSrc = null; - return dbSrc; - } - - public static PeptidePool[] getChildrenPools(String peptidePoolId) - { - SimpleFilter sfilter = new SimpleFilter(FieldKey.fromParts("parent_pool_id"), Integer.parseInt(peptidePoolId)); - TableInfo tInfo = PepDBSchema.getInstance().getTableInfoViewPoolDetails(); - PeptidePool[] pools = new TableSelector(tInfo, sfilter, null).getArray(PeptidePool.class); - if (pools.length < 1) - return null; - return pools; - } - - public static Integer[] getPeptidesInPool(Integer peptidePoolId) - { - SimpleFilter sfilter = new SimpleFilter(FieldKey.fromParts("peptide_pool_id"), peptidePoolId); - TableInfo tInfo = PepDBSchema.getInstance().getTableInfoPoolAssignment(); - Integer[] peptideIds = new TableSelector(tInfo.getColumn("peptide_id"), sfilter, null).getArray(Integer.class); - if (peptideIds.length < 1) - return null; - return peptideIds; - } -} \ No newline at end of file diff --git a/src/org/scharp/atlas/pepdb/PepDBModule.java b/src/org/scharp/atlas/pepdb/PepDBModule.java deleted file mode 100644 index 6296370..0000000 --- a/src/org/scharp/atlas/pepdb/PepDBModule.java +++ /dev/null @@ -1,100 +0,0 @@ -package org.scharp.atlas.pepdb; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.labkey.api.data.Container; -import org.labkey.api.data.ContainerManager; -import org.labkey.api.data.DbSchema; -import org.labkey.api.module.DefaultModule; -import org.labkey.api.module.ModuleContext; -import org.labkey.api.util.PageFlowUtil; -import org.labkey.api.view.BaseWebPartFactory; -import org.labkey.api.view.Portal; -import org.labkey.api.view.ViewContext; -import org.labkey.api.view.WebPartFactory; -import org.labkey.api.view.WebPartView; -import org.scharp.atlas.pepdb.query.PepDBQuerySchema; -import org.scharp.atlas.pepdb.view.PepDBWebPart; - -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.Set; - -public class PepDBModule extends DefaultModule -{ - private static final Logger _log = LogManager.getLogger(DefaultModule.class); - public static final String NAME = "PepDB"; - - @Override - public String getName() - { - return NAME; - } - - @Override - public @Nullable Double getSchemaVersion() - { - return 2.26; - } - - @Override - protected void init() - { - addController("pepdb", PepDBController.class); - PepDBQuerySchema.register(this); - } - - @Override - @NotNull - protected Collection createWebPartFactories() - { - return Arrays.asList(new BaseWebPartFactory("PepDB Summary", WebPartFactory.LOCATION_BODY, WebPartFactory.LOCATION_RIGHT) - { - { - addLegacyNames("Narrow PepDB Summary"); - } - - @Override - public WebPartView getWebPartView(@NotNull ViewContext portalCtx, @NotNull Portal.WebPart webPart) - { - return new PepDBWebPart(); - } - }); - } - - @Override - public boolean hasScripts() - { - return true; - } - - @Override - @NotNull - public Collection getSummary(Container c) - { - return Collections.emptyList(); - } - - @Override - public void doStartup(ModuleContext moduleContext) - { - // add a container listener so we'll know when our container is deleted: - ContainerManager.addContainerListener(new PepDBContainerListener()); - } - @Override - @NotNull - public Set getSchemaNames() - { - return PageFlowUtil.set(PepDBSchema.getInstance().getSchemaName()); - } - - @Override - @NotNull - public Set getSchemasToTest() - { - return PageFlowUtil.set(PepDBSchema.getInstance().getSchema()); - } -} diff --git a/src/org/scharp/atlas/pepdb/PepDBSchema.java b/src/org/scharp/atlas/pepdb/PepDBSchema.java deleted file mode 100644 index c7ef2d9..0000000 --- a/src/org/scharp/atlas/pepdb/PepDBSchema.java +++ /dev/null @@ -1,162 +0,0 @@ -package org.scharp.atlas.pepdb; - -import org.labkey.api.data.DbSchema; -import org.labkey.api.data.TableInfo; -import org.labkey.api.data.dialect.SqlDialect; - -/** - * Singleton for storing DB information - * - * @version $Id$ - */ -public class PepDBSchema -{ - - private static PepDBSchema _instance = null; - private static final String SCHEMA_NAME = "pepdb"; - - public static final String TABLE_PEPTIDE_GROUP = "peptide_group"; - public static final String TABLE_GROUP_TYPE = "group_type"; - public static final String TABLE_PROTEIN_CATEGORY = "protein_category"; - public static final String TABLE_PEPTIDES = "peptides"; - public static final String TABLE_PEPTIDE_POOL = "peptide_pool"; - public static final String TABLE_POOL_ASSIGNMENT = "peptide_pool_assignment"; - public static final String TABLE_SOURCE = "peptide_group_assignment"; - public static final String TABLE_PATHOGEN = "pathogen"; - public static final String TABLE_PARENT = "parent"; - public static final String TABLE_OPTIMAL_EPITOPE_LIST = "optimal_epitope_list"; - public static final String TABLE_POOL_TYPE = "pool_type"; - - public static final String VIEW_GROUP_PEPTIDES = "group_peptides"; - public static final String VIEW_POOL_PEPTIDES = "pool_peptides"; - public static final String VIEW_PARENT_CHILD_DETAILS = "parent_child_details"; - public static final String VIEW_POOL_DETAILS = "pool_details"; - - public static final String COLUMN_PEPTIDE_GROUP_ID = "peptide_group_id"; - public static final String COLUMN_PEPTIDE_GROUP_NAME = "peptide_group_name"; - public static final String COLUMN_PROTEIN_CAT_ID = "protein_cat_id"; - public static final String COLUMN_GROUP_TYPE_ID = "group_type_id"; - public static final String COLUMN_PEPTIDE_ID = "peptide_id"; - public static final String COLUMN_PEPTIDE_POOL_ID = "peptide_pool_id"; - public static final String COLUMN_PARENT_POOL_ID = "parent_pool_id"; - public static final String COLUMN_PEPTIDE_SEQUENCE = "peptide_sequence"; - public static final String COLUMN_OPTIMAL_EPITOPE_LIST_ID = "optimal_epitope_list_id"; - public static final String COLUMN_AMINO_ACID_START_POS = "amino_acid_start_pos"; - public static final String COLUMN_AMINO_ACID_END_POS = "amino_acid_end_pos"; - public static final String COLUMN_IS_CHILD = "child"; - public static final String COLUMN_PEPTIDE_ID_IN_GROUP = "peptide_id_in_group"; - public static final String COLUMN_POOL_TYPE_ID = "pool_type_id"; - public static final String COLUMN_PARENT_ID = "parent_id"; - public static final String COLUMN_PARENT_SEQUENCE = "parent_sequence"; - public static final String COLUMN_CHILD_ID = "child_id"; - public static final String COLUMN_CHILD_SEQUENCE = "child_sequence"; - public static final String COLUMN_IN_CURRENT_FILE = "in_current_file"; - public static final String COLUMN_PEPTIDE_GROUP_ASSIGNMENT_ID = "peptide_group_assignment_id"; - public static final String SEQUENCE_PEPTIDE_TABLE = SCHEMA_NAME + ".peptides_peptide_id_seq"; - - - /** - * Singleton - * - * @return the only instance allowed of this class - */ - public synchronized static PepDBSchema getInstance() - { - if (_instance == null) - _instance = new PepDBSchema(); - - return _instance; - } - - private PepDBSchema() - { - // private contructor to prevent instantiation from - // outside this class. - } - - public String getSchemaName() - { - return SCHEMA_NAME; - } - - public DbSchema getSchema() - { - return DbSchema.get(SCHEMA_NAME); - } - - public TableInfo getTableInfoParent() - { - return getSchema().getTable(PepDBSchema.TABLE_PARENT); - } - - public TableInfo getTableInfoPeptideGroups() - { - return getSchema().getTable(PepDBSchema.TABLE_PEPTIDE_GROUP); - } - - public TableInfo getTableInfoPeptideGroupTypes() - { - return getSchema().getTable(PepDBSchema.TABLE_GROUP_TYPE); - } - - public TableInfo getTableInfoPeptides() - { - return getSchema().getTable(PepDBSchema.TABLE_PEPTIDES); - } - - public TableInfo getTableInfoProteinCat() - { - return getSchema().getTable(PepDBSchema.TABLE_PROTEIN_CATEGORY); - } - - public TableInfo getTableInfoViewGroupPeptides() - { - return getSchema().getTable(PepDBSchema.VIEW_GROUP_PEPTIDES); - } - - public TableInfo getTableInfoPeptidePools() - { - return getSchema().getTable(PepDBSchema.TABLE_PEPTIDE_POOL); - } - public TableInfo getTableInfoPoolAssignment() { - return getSchema().getTable(PepDBSchema.TABLE_POOL_ASSIGNMENT); - } - public TableInfo getTableInfoViewPoolPeptides() - { - return getSchema().getTable(PepDBSchema.VIEW_POOL_PEPTIDES); - } - - public TableInfo getTableInfoSource() - { - return getSchema().getTable(PepDBSchema.TABLE_SOURCE); - } - - public TableInfo getTableInfoPathogen() - { - return getSchema().getTable(PepDBSchema.TABLE_PATHOGEN); - } - public SqlDialect getSqlDialect() - { - return getSchema().getSqlDialect(); - } - - public TableInfo getTableInfoOptimalEpitopeList() - { - return getSchema().getTable(PepDBSchema.TABLE_OPTIMAL_EPITOPE_LIST); - } - - public TableInfo getTableInfoViewParentChildDetails() - { - return getSchema().getTable(PepDBSchema.VIEW_PARENT_CHILD_DETAILS); - } - - public TableInfo getTableInfoPoolType() - { - return getSchema().getTable(PepDBSchema.TABLE_POOL_TYPE); - } - - public TableInfo getTableInfoViewPoolDetails() - { - return getSchema().getTable(PepDBSchema.VIEW_POOL_DETAILS); - } -} diff --git a/src/org/scharp/atlas/pepdb/PeptideImporter.java b/src/org/scharp/atlas/pepdb/PeptideImporter.java deleted file mode 100644 index 24ba9a9..0000000 --- a/src/org/scharp/atlas/pepdb/PeptideImporter.java +++ /dev/null @@ -1,356 +0,0 @@ -package org.scharp.atlas.pepdb; - -import org.labkey.api.attachments.AttachmentFile; -import org.labkey.api.security.User; -import org.scharp.atlas.pepdb.model.OptimalEpitopeList; -import org.scharp.atlas.pepdb.model.Parent; -import org.scharp.atlas.pepdb.model.PeptideGroup; -import org.scharp.atlas.pepdb.model.Peptides; -import org.scharp.atlas.pepdb.model.ProteinCategory; -import org.scharp.atlas.pepdb.model.Source; -import org.springframework.validation.Errors; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -/** - * Created by IntelliJ IDEA. - * User: sravani - * Date: Jan 8, 2010 - * Time: 10:51:10 AM - * To change this template use File | Settings | File Templates. - */ -public class PeptideImporter -{ - private HashMap peptideGroupMap; - private HashMap proteinCategoryMap; - private HashMap proteinCatIDMap; - private HashMap optimalElitopeListMap; - ArrayList peptideIdList; - - public HashMap getPeptideGroupMap() throws SQLException - { - if(peptideGroupMap == null) - peptideGroupMap = PepDBManager.getPeptideGroupMap(); - return peptideGroupMap; - } - - public void setPeptideGroupMap(HashMap peptideGroupMap) - { - this.peptideGroupMap = peptideGroupMap; - } - - public HashMap getProteinCategoryMap() throws SQLException - { - if(proteinCategoryMap == null) - proteinCategoryMap = PepDBManager.getProteinCatMap(); - return proteinCategoryMap; - } - - public void setProteinCategoryMap(HashMap proteinCategoryMap) - { - this.proteinCategoryMap = proteinCategoryMap; - } - - public HashMap getProteinCatIDMap() throws SQLException - { - if(proteinCatIDMap == null) - proteinCatIDMap = PepDBManager.getProteinCatIDMap(); - return proteinCatIDMap; - } - - public void setProteinCatIDMap(HashMap proteinCatIDMap) - { - this.proteinCatIDMap = proteinCatIDMap; - } - - public HashMap getOptimalElitopeListMap() throws SQLException - { - if(optimalElitopeListMap == null) - optimalElitopeListMap = PepDBManager.getOptimalEpitopeListMap(); - return optimalElitopeListMap; - } - - public void setOptimalElitopeListMap(HashMap optimalElitopeListMap) - { - this.optimalElitopeListMap = optimalElitopeListMap; - } - - public ArrayList getPeptideIdList() throws SQLException - { - if(peptideIdList == null) - { - peptideIdList = new ArrayList(); - Peptides[] peptides = PepDBManager.getPeptides(); - for(Peptides p: peptides) - { - peptideIdList.add(p); - } - } - return peptideIdList; - } - - public void setPeptideIdList(ArrayList peptideIdList) - { - this.peptideIdList = peptideIdList; - } - - public boolean process(User user, AttachmentFile peptideFile, Errors errors, List resultPeptides) throws SQLException - { - try{ - String fileName = peptideFile.getFilename(); - InputStreamReader inStream = new InputStreamReader(peptideFile.openInputStream()); - BufferedReader br = new BufferedReader(inStream); - String line = br.readLine(); - boolean validFile = validateFirstLine(line,errors); - if(!validFile) - return false; - getPeptideGroupMap(); - getProteinCategoryMap(); - getOptimalElitopeListMap(); - HashMap peptideSequenceMap = PepDBManager.getPeptideSequenceMap(); - int lineNo =1; - ArrayList newpeptidesList =new ArrayList(); - HashMap lineMap = new HashMap(); - while((line = br.readLine()) != null) - { - lineNo++; - if(line.length()>0) - { - if(validateLine(line,errors,lineNo)) - { - Peptides peptide = createPeptide(line,fileName); - if(peptide != null) - { - newpeptidesList.add(peptide); - lineMap.put(peptide.getPeptide_sequence(), line); - } - } - } - } - if(errors.getErrorCount() >0) - { - errors.reject(null,"File Import Failed.\nThere are "+errors.getErrorCount()+" errors in the file : "+fileName); - return false; - } - getPeptideIdList(); - PepDBManager.updateInCurrentFile(user); - for(Peptides p : newpeptidesList) - { - if(peptideSequenceMap.containsKey(p.getPeptide_sequence())) - { - if(p.getPeptide_id() == null || p.getPeptide_id().toString().length() == 0) - p.setPeptide_id(peptideSequenceMap.get(p.getPeptide_sequence()).getPeptide_id()); - insertGroups(p,user); - resultPeptides.add(p); - } - else - { - Peptides dbPep = PepDBManager.insertPeptide(user,p); - peptideSequenceMap.put(p.getPeptide_sequence(),dbPep); - peptideIdList.add(dbPep); - p.setPeptide_id(dbPep.getPeptide_id()); - insertGroups(p,user); - resultPeptides.add(p); - } - } - getProteinCatIDMap(); - for(Peptides p : peptideIdList) - { - if(p.isChild()) - { - Peptides[] parents; - if(proteinCatIDMap.get(p.getProtein_cat_id()).getProtein_cat_desc().contains("-")) - parents = PepDBManager.getHyphanatedParents(p); - else - parents = PepDBManager.getParentPeptides(p); - for(Peptides par : parents) - { - Parent parent = new Parent(); - parent.setLinked_parent(par.getPeptide_id()); - parent.setPeptide_id(p.getPeptide_id()); - Parent dbParent = PepDBManager.parentExists(parent); - if(dbParent == null) - dbParent = PepDBManager.insertParent(user,parent); - if(!par.isParent()) - { - par.setParent(true); - PepDBManager.updatePeptide(user,par); - } - } - } - } - - } - catch(Exception e) - { - errors.reject(null,e.getMessage()); - return false; - } - return true; - } - - private void insertGroups(Peptides p,User user) throws Exception - { - Source src = p.getSrc(); - src.setPeptide_id(p.getPeptide_id()); - PepDBManager.insertSource(user,src); - } - - private boolean validateLine(String line,Errors errors,int lineNo) - { - String [] fields = new String[10]; - for(int i =0;i0) - return false; - return true; - } - - private Peptides createPeptide(String line,String fileName) throws SQLException - { - String [] fields = new String[10]; - for(int i =0;i 0) - return false; - return true; - } -} diff --git a/src/org/scharp/atlas/pepdb/PoolImporter.java b/src/org/scharp/atlas/pepdb/PoolImporter.java deleted file mode 100644 index 21ec2fa..0000000 --- a/src/org/scharp/atlas/pepdb/PoolImporter.java +++ /dev/null @@ -1,407 +0,0 @@ -package org.scharp.atlas.pepdb; - -import org.labkey.api.attachments.AttachmentFile; -import org.labkey.api.security.User; -import org.scharp.atlas.pepdb.PepDBBaseController.FileForm; -import org.scharp.atlas.pepdb.model.PeptideGroup; -import org.scharp.atlas.pepdb.model.PeptidePool; -import org.scharp.atlas.pepdb.model.PeptidePoolAssignment; -import org.scharp.atlas.pepdb.model.Peptides; -import org.scharp.atlas.pepdb.model.PoolType; -import org.scharp.atlas.pepdb.model.Source; -import org.springframework.validation.Errors; - -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; - -/** - * Created by IntelliJ IDEA. - * User: sravani - * Date: Oct 16, 2007 - * Time: 8:30:05 AM - * To change this template use File | Settings | File Templates. - */ -public class PoolImporter -{ - private HashMap peptidePoolMap; - private HashMap poolTypeMap; - private HashMap peptideSequenceMap; - private HashMap peptideGroupMap; - public HashMap getPeptidePoolMap() throws SQLException - { - if(peptidePoolMap == null) - peptidePoolMap = PepDBManager.getPeptidePoolMap(); - return peptidePoolMap; - } - - public void setPeptidePoolMap(HashMap peptidePoolMap) - { - this.peptidePoolMap = peptidePoolMap; - } - - public HashMap getPoolTypeMap() throws SQLException - { - if(poolTypeMap == null) - poolTypeMap = PepDBManager.getPoolTypeMap(); - return poolTypeMap; - } - - public void setPoolTypeMap(HashMap poolTypeMap) - { - this.poolTypeMap = poolTypeMap; - } - - public HashMap getPeptideSequenceMap() throws SQLException - { - if(peptideSequenceMap == null) - peptideSequenceMap = PepDBManager.getPeptideSequenceMap(); - return peptideSequenceMap; - } - - public void setPeptideSequenceMap(HashMap peptideSequenceMap) - { - this.peptideSequenceMap = peptideSequenceMap; - } - - public HashMap getPeptideGroupMap() throws SQLException - { - if(peptideGroupMap == null) - peptideGroupMap = PepDBManager.getPeptideGroupMap(); - return peptideGroupMap; - } - - public void setPeptideGroupMap(HashMap peptideGroupMap) - { - this.peptideGroupMap = peptideGroupMap; - } - - public boolean process(User user, FileForm form, AttachmentFile poolFile,Errors errors) throws SQLException - { - String actionType = form.getActionType(); - PeptidePool [] peptidePools = PepDBManager.getPeptidePools(); - //HashMap peptidepoolMap = new HashMap(); - /*for(PeptidePool pPool : peptidePools) - { - peptidepoolMap.put(pPool.getPeptide_pool_id(),pPool); - }*/ - if(actionType.equalsIgnoreCase("POOLDESC")) - { - try{ - InputStreamReader inStream = new InputStreamReader(poolFile.openInputStream()); - BufferedReader br = new BufferedReader(inStream); - String line = br.readLine(); - boolean validFile = validateFirstLine(line,actionType,errors); - if(!validFile) - return false; - getPeptidePoolMap(); - getPoolTypeMap(); - ArrayList newPPools = new ArrayList(); - int lineNo =1; - while((line = br.readLine()) != null) - { - lineNo++; - if(line.trim().length()>0) - { - if(validateLine(line,errors,lineNo)) - { - PeptidePool pPool = createPeptidePool(line); - if(pPool != null) - newPPools.add(pPool); - } - } - } - if(errors.getErrorCount() >0) - { - errors.reject(null,"File Import Failed.\nThere are "+errors.getErrorCount()+" errors in the file : "+poolFile.getFilename()); - return false; - } - for(PeptidePool pPool : newPPools) - { - if(pPool.getPool_type_id() != poolTypeMap.get("POOL").getPool_type_id()) - pPool.setParent_pool_id(peptidePoolMap.get(pPool.getParent_pool_name()).getPeptide_pool_id()); - PeptidePool dbPeptidePool = null; - if(peptidePoolMap.get(pPool.getPeptide_pool_name().trim().toUpperCase()).getPeptide_pool_id() == null || peptidePoolMap.get(pPool.getPeptide_pool_name().trim().toUpperCase()).getPeptide_pool_id().toString().length() == 0) - dbPeptidePool= PepDBManager.insertPeptidePool(user,pPool); - if(dbPeptidePool != null) - peptidePoolMap.put(dbPeptidePool.getPeptide_pool_name().trim().toUpperCase(),dbPeptidePool); - } - } - catch(Exception e) - { - errors.reject(null,e.getMessage()); - return false; - } - } - if(actionType.equalsIgnoreCase("POOLPEPTIDES")) - { - try{ - InputStreamReader inStream = new InputStreamReader(poolFile.openInputStream()); - BufferedReader br = new BufferedReader(inStream); - String line = br.readLine(); - boolean validFile = validateFirstLine(line,form.getActionType(),errors); - if(!validFile) - return false; - int lineNo =1; - getPeptidePoolMap(); - getPeptideSequenceMap(); - getPeptideGroupMap(); - ArrayList newpeptidesInPools = new ArrayList(); - HashMap> newpoolPeptides = new HashMap>(); - while((line = br.readLine()) != null) - { - lineNo++; - if(line.length()>0) - { - if(validatePPLine(line,errors,lineNo,newpoolPeptides)) - { - PeptidePoolAssignment poolAssign = createPoolAssignment(line); - if(poolAssign != null) - { - newpeptidesInPools.add(poolAssign); - if(newpoolPeptides.containsKey(poolAssign.getPeptide_pool_id())) - newpoolPeptides.get(poolAssign.getPeptide_pool_id()).add(poolAssign.getPeptide_id()); - else - { - ArrayList peps = new ArrayList(); - peps.add(poolAssign.getPeptide_id()); - newpoolPeptides.put(poolAssign.getPeptide_pool_id(),peps); - } - - } - } - } - - } - if(errors.getErrorCount()>0) - { - errors.reject(null,"File Import Failed.\nThere are "+errors.getErrorCount()+" errors in the file : "+poolFile.getFilename()); - return false; - } - for(PeptidePoolAssignment pAssignment : newpeptidesInPools) - { - PepDBManager.insertPeptidesInPool(user,pAssignment); - } - } - catch(Exception e) - { - errors.reject(null,e.getMessage()); - return false; - } - } - return true; - } - - private PeptidePoolAssignment createPoolAssignment(String line) throws SQLException - { - String [] fields = new String[3]; - for(int i =0;i0) - return false; - return true; - } - - private boolean validatePPLine(String line,Errors errors,int lineNo,HashMap> newPoolPeptides) throws SQLException - { - String [] fields = new String[3]; - for(int i =0;i0) - return false; - return true; - } - - private boolean validateFirstLine(String line,String importType,Errors errors) - { - String [] fields = line.split("\t"); - if(importType.equalsIgnoreCase("POOLDESC")) - { - if(fields.length != 4) - errors.reject(null,"Line number : 1 must be tab delimited with the fields 'Pool Name','Pool Type','Parent Pool Name' and 'Matrix Pool Id' in the Pool Descriptions file.\n"+ - "The header line does not match this format. Please check the file and try to upload again."); - else - { - if(fields[0] ==null || fields[0].trim().length() == 0 - || fields[1] ==null || fields[1].trim().length() == 0 - || fields[2] ==null || fields[2].trim().length() == 0 - || fields[3] ==null || fields[3].trim().length() == 0) - errors.reject(null,"Line number : 1 must be tab delimited with the fields 'Pool Name','Pool Type','Parent Pool Name' and 'Matrix Pool Id' in the Pool Descriptions file.\n"+ - "One of the fields in header line is null or empty. Please check the file and try to upload again."); - else - { - if(fields[0] != null && !fields[0].trim().equalsIgnoreCase("POOL NAME")) - errors.reject(null,"Pool Descriptions File Import Failed.\nThe first field in the first line (Header) must be 'POOL NAME'"); - if(fields[1] != null && !fields[1].trim().equalsIgnoreCase("POOL TYPE")) - errors.reject(null,"Pool Descriptions File Import Failed.\nThe Second field in the first line (Header) must be 'POOL TYPE'"); - if(fields[2] != null && !fields[2].trim().equalsIgnoreCase("PARENT POOL NAME")) - errors.reject(null,"Pool Descriptions File Import Failed.\nThe Third field in the first line (Header) must be 'PARENT POOL NAME'"); - if(fields[2] != null && !fields[3].trim().equalsIgnoreCase("MATRIX POOL ID")) - errors.reject(null,"Pool Descriptions File Import Failed.\nThe Fourth field in the first line (Header) must be 'MATRIX POOL ID'"); - } - } - if(errors.getErrorCount() > 0) - return false; - return true; - } - if(importType.equalsIgnoreCase("POOLPEPTIDES")) - { - if(fields.length != 3) - errors.reject(null,"Line number : 1 must be tab delimited with the fields 'POOL NAME','PEPTIDE SEQUENCE'and 'PEPTIDE GROUP' in the Peptides in Pool file.\n"+ - "The header line does not match this format. Please check the file and try to upload again."); - else - { - if(fields[0] ==null || fields[0].trim().length() == 0 ||fields[1] ==null || fields[1].trim().length() == 0 || fields[2] ==null || fields[2].trim().length() == 0) - errors.reject(null,"Line number : 1 must be tab delimited with the fields 'POOL NAME','PEPTIDE SEQUENCE' and 'PEPTIDE GROUP'in the Peptides in Pool file.\n"+ - "One of the fields in header line is null or empty. Please check the file and try to upload again."); - else - { - if(fields[0] != null && !fields[0].trim().equalsIgnoreCase("POOL NAME")) - errors.reject(null,"Peptides in Pool File Import Failed.\nThe first field in the first line (Header) must be 'POOL NAME'"); - if(fields[1] != null && !fields[1].trim().equalsIgnoreCase("PEPTIDE SEQUENCE")) - errors.reject(null,"Peptides in Pool File Import Failed.\nThe Second field in the first line (Header) must be 'PEPTIDE SEQUENCE'"); - if(fields[2] != null && !fields[2].trim().equalsIgnoreCase("PEPTIDE GROUP")) - errors.reject(null,"Peptides in Pool File Import Failed.\nThe Second field in the first line (Header) must be 'PEPTIDE GROUP'"); - } - } - if(errors.getErrorCount() > 0) - return false; - return true; - } - return true; - } -} diff --git a/src/org/scharp/atlas/pepdb/model/GroupType.java b/src/org/scharp/atlas/pepdb/model/GroupType.java deleted file mode 100644 index 3e5be43..0000000 --- a/src/org/scharp/atlas/pepdb/model/GroupType.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.scharp.atlas.pepdb.model; - -/** - * Created by IntelliJ IDEA. - * User: slangley - * Date: Dec 21, 2007 - * Time: 1:08:27 PM - * To change this template use File | Settings | File Templates. - */ -public class GroupType -{ - private Integer group_type_id; - private String group_type_desc; - - public Integer getGroup_type_id() - { - return group_type_id; - } - - public void setGroup_type_id(Integer group_type_id) - { - this.group_type_id = group_type_id; - } - - public String getGroup_type_desc() - { - return group_type_desc; - } - - public void setGroup_type_desc(String group_type_desc) - { - this.group_type_desc = group_type_desc; - } -} diff --git a/src/org/scharp/atlas/pepdb/model/OptimalEpitopeList.java b/src/org/scharp/atlas/pepdb/model/OptimalEpitopeList.java deleted file mode 100644 index 108c63e..0000000 --- a/src/org/scharp/atlas/pepdb/model/OptimalEpitopeList.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.scharp.atlas.pepdb.model; - -/** - * Created by IntelliJ IDEA. - * User: sravani - * Date: Jan 20, 2010 - * Time: 2:10:36 PM - * To change this template use File | Settings | File Templates. - */ -public class OptimalEpitopeList -{ - private Integer optimal_epitope_list_id; - private String optimal_epitope_list_desc; - - public Integer getOptimal_epitope_list_id() - { - return optimal_epitope_list_id; - } - - public void setOptimal_epitope_list_id(Integer optimal_epitope_list_id) - { - this.optimal_epitope_list_id = optimal_epitope_list_id; - } - - public String getOptimal_epitope_list_desc() - { - return optimal_epitope_list_desc; - } - - public void setOptimal_epitope_list_desc(String optimal_epitope_list_desc) - { - this.optimal_epitope_list_desc = optimal_epitope_list_desc; - } -} diff --git a/src/org/scharp/atlas/pepdb/model/Parent.java b/src/org/scharp/atlas/pepdb/model/Parent.java deleted file mode 100644 index cc43e60..0000000 --- a/src/org/scharp/atlas/pepdb/model/Parent.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.scharp.atlas.pepdb.model; - -/** - * Created by IntelliJ IDEA. - * User: sravani - * Date: Nov 1, 2007 - * Time: 10:28:37 AM - * To change this template use File | Settings | File Templates. - */ -public class Parent -{ - private Integer peptide_id; - private Integer linked_parent; - - public Integer getPeptide_id() - { - return peptide_id; - } - - public void setPeptide_id(Integer peptide_id) - { - this.peptide_id = peptide_id; - } - - public Integer getLinked_parent() - { - return linked_parent; - } - - public void setLinked_parent(Integer linked_parent) - { - this.linked_parent = linked_parent; - } -} diff --git a/src/org/scharp/atlas/pepdb/model/Pathogen.java b/src/org/scharp/atlas/pepdb/model/Pathogen.java deleted file mode 100644 index c9fc291..0000000 --- a/src/org/scharp/atlas/pepdb/model/Pathogen.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.scharp.atlas.pepdb.model; - -/** - * Created by IntelliJ IDEA. - * User: sravani - * Date: Jul 12, 2007 - * Time: 1:19:11 PM - * To change this template use File | Settings | File Templates. - */ -public class Pathogen{ - private Integer pathogen_id; - private String pathogen_desc; - - public Pathogen() { - } - - public Integer getPathogen_id() { - return pathogen_id; - } - - public void setPathogen_id(Integer pathogen_id) { - this.pathogen_id = pathogen_id; - } - - public String getPathogen_desc() { - return pathogen_desc; - } - - public void setPathogen_desc(String pathogen_desc) { - this.pathogen_desc = pathogen_desc; - } -} diff --git a/src/org/scharp/atlas/pepdb/model/PeptideGroup.java b/src/org/scharp/atlas/pepdb/model/PeptideGroup.java deleted file mode 100644 index f05c552..0000000 --- a/src/org/scharp/atlas/pepdb/model/PeptideGroup.java +++ /dev/null @@ -1,84 +0,0 @@ -package org.scharp.atlas.pepdb.model; - -import org.labkey.api.data.Entity; - - -public class PeptideGroup extends Entity -{ - private Integer peptide_group_id; - private String peptide_group_name; - private Integer pathogen_id; - private String seq_ref; - private Integer clade_id; - private Integer pep_align_ref_id; - private Integer group_type_id; - - public Integer getPeptide_group_id() - { - return peptide_group_id; - } - - public void setPeptide_group_id(Integer peptide_group_id) - { - this.peptide_group_id = peptide_group_id; - } - - public PeptideGroup() { - } - - public Integer getPathogen_id() { - return pathogen_id; - } - - public void setPathogen_id(Integer pathogen_id) { - this.pathogen_id = pathogen_id; - } - - public String getPeptide_group_name() { - return peptide_group_name; - } - - public void setPeptide_group_name(String peptide_group_name) { - this.peptide_group_name = peptide_group_name; - } - - public String getSeq_ref() - { - return seq_ref; - } - - public void setSeq_ref(String seq_ref) - { - this.seq_ref = seq_ref; - } - - public Integer getClade_id() - { - return clade_id; - } - - public void setClade_id(Integer clade_id) - { - this.clade_id = clade_id; - } - - public Integer getPep_align_ref_id() - { - return pep_align_ref_id; - } - - public void setPep_align_ref_id(Integer pep_align_ref_id) - { - this.pep_align_ref_id = pep_align_ref_id; - } - - public Integer getGroup_type_id() - { - return group_type_id; - } - - public void setGroup_type_id(Integer group_type_id) - { - this.group_type_id = group_type_id; - } -} diff --git a/src/org/scharp/atlas/pepdb/model/PeptidePool.java b/src/org/scharp/atlas/pepdb/model/PeptidePool.java deleted file mode 100644 index 6d8fe14..0000000 --- a/src/org/scharp/atlas/pepdb/model/PeptidePool.java +++ /dev/null @@ -1,126 +0,0 @@ -package org.scharp.atlas.pepdb.model; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.labkey.api.data.Entity; - -/** - * Created by IntelliJ IDEA. - * User: sravani - * Date: Jun 7, 2007 - * Time: 12:23:53 PM - * Scott changed getDescription() - */ -public class PeptidePool extends Entity -{ - private Integer peptide_pool_id; - private String peptide_pool_name; - private String comment; - private Integer pool_type_id; - private String pool_type_desc; - private boolean archived; - private Integer parent_pool_id; - private String parent_pool_name; - private String matrix_peptide_pool_id; - private static Logger log = LogManager.getLogger(PeptidePool.class); - - public PeptidePool() - { - } - - public PeptidePool(Integer peptide_pool_id, String peptide_pool_name) - { - this.peptide_pool_id = peptide_pool_id; - this.peptide_pool_name = peptide_pool_name; - } - - public Integer getPeptide_pool_id() - { - return peptide_pool_id; - } - - public void setPeptide_pool_id(Integer peptide_pool_id) - { - this.peptide_pool_id = peptide_pool_id; - } - - public String getPeptide_pool_name() - { - return peptide_pool_name; - } - - public void setPeptide_pool_name(String peptide_pool_name) - { - this.peptide_pool_name = peptide_pool_name; - } - - public Integer getPool_type_id() - { - return pool_type_id; - } - - public void setPool_type_id(Integer pool_type_id) - { - this.pool_type_id = pool_type_id; - } - - public String getComment() - { - return comment; - } - - public void setComment(String comment) - { - this.comment = comment; - } - - public String getPool_type_desc() - { - return pool_type_desc; - } - - public void setPool_type_desc(String pool_type_desc) - { - this.pool_type_desc = pool_type_desc; - } - - public boolean getArchived() - { - return archived; - } - - public void setArchived(boolean archived) - { - this.archived = archived; - } - - public Integer getParent_pool_id() - { - return parent_pool_id; - } - - public void setParent_pool_id(Integer parent_pool_id) - { - this.parent_pool_id = parent_pool_id; - } - - public String getParent_pool_name() - { - return parent_pool_name; - } - - public void setParent_pool_name(String parent_pool_name) - { - this.parent_pool_name = parent_pool_name; - } - - public String getMatrix_peptide_pool_id() - { - return matrix_peptide_pool_id; - } - - public void setMatrix_peptide_pool_id(String matrix_peptide_pool_id) - { - this.matrix_peptide_pool_id = matrix_peptide_pool_id; - } -} diff --git a/src/org/scharp/atlas/pepdb/model/PeptidePoolAssignment.java b/src/org/scharp/atlas/pepdb/model/PeptidePoolAssignment.java deleted file mode 100644 index ca8d0db..0000000 --- a/src/org/scharp/atlas/pepdb/model/PeptidePoolAssignment.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.scharp.atlas.pepdb.model; - -import org.labkey.api.data.Entity; - -/** - * Created by IntelliJ IDEA. - * User: sravani - * Date: Nov 5, 2007 - * Time: 9:01:23 AM - * To change this template use File | Settings | File Templates. - */ -public class PeptidePoolAssignment extends Entity -{ - private Integer peptide_pool_id; - private Integer peptide_id; - private Integer peptide_group_assignment_id; - - public Integer getPeptide_pool_id() - { - return peptide_pool_id; - } - - public void setPeptide_pool_id(Integer peptide_pool_id) - { - this.peptide_pool_id = peptide_pool_id; - } - - public Integer getPeptide_id() - { - return peptide_id; - } - - public void setPeptide_id(Integer peptide_id) - { - this.peptide_id = peptide_id; - } - - public Integer getPeptide_group_assignment_id() - { - return peptide_group_assignment_id; - } - - public void setPeptide_group_assignment_id(Integer peptide_group_assignment_id) - { - this.peptide_group_assignment_id = peptide_group_assignment_id; - } -} diff --git a/src/org/scharp/atlas/pepdb/model/Peptides.java b/src/org/scharp/atlas/pepdb/model/Peptides.java deleted file mode 100644 index c70ad2c..0000000 --- a/src/org/scharp/atlas/pepdb/model/Peptides.java +++ /dev/null @@ -1,237 +0,0 @@ -package org.scharp.atlas.pepdb.model; - -import org.labkey.api.data.Entity; - -import java.util.List; - -/** - * Created by IntelliJ IDEA. - * User: sravani - * Date: Jul 12, 2007 - * Time: 1:11:40 PM - * To change this template use File | Settings | File Templates. - */ -public class Peptides extends Entity -{ - private Integer peptide_id; - private String peptide_sequence; - private Integer protein_cat_id; - private Integer amino_acid_start_pos; - private Integer amino_acid_end_pos; - private Integer sequence_length; - private boolean child; - private boolean parent; - private String src_file_name; - private String storage_location; - private Integer optimal_epitope_list_id; - private String hla_restriction; - private Source src; - private List peptideGroups; - private ProteinCategory proteinCat; - private Pathogen pathogen; - private Parent parentPep; - private List parents; - private boolean peptide_flag; - private String peptide_notes; - - public List getParents() - { - return parents; - } - - public void setParents(List parents) - { - this.parents = parents; - } - - - public Parent getParentPep() - { - return parentPep; - } - - public void setParentPep(Parent parentPep) - { - this.parentPep = parentPep; - } - - public ProteinCategory getProteinCat() - { - return proteinCat; - } - - public void setProteinCat(ProteinCategory proteinCat) - { - this.proteinCat = proteinCat; - } - - public Pathogen getPathogen() - { - return pathogen; - } - - public void setPathogen(Pathogen pathogen) - { - this.pathogen = pathogen; - } - - public Integer getPeptide_id() - { - return peptide_id; - } - - public void setPeptide_id(Integer peptide_id) - { - this.peptide_id = peptide_id; - } - - public String getPeptide_sequence() - { - return peptide_sequence; - } - - public void setPeptide_sequence(String peptide_sequence) - { - this.peptide_sequence = peptide_sequence; - } - - public Integer getProtein_cat_id() - { - return protein_cat_id; - } - - public void setProtein_cat_id(Integer protein_cat_id) - { - this.protein_cat_id = protein_cat_id; - } - - public boolean isChild() - { - return child; - } - - public void setChild(boolean child) - { - this.child = child; - } - - public List getPeptideGroups() - { - return peptideGroups; - } - - public void setPeptideGroups(List peptideGroups) - { - this.peptideGroups = peptideGroups; - } - - public boolean isParent() - { - return parent; - } - - public void setParent(boolean parent) - { - this.parent = parent; - } - - public String getSrc_file_name() - { - return src_file_name; - } - - public void setSrc_file_name(String src_file_name) - { - this.src_file_name = src_file_name; - } - - public Integer getAmino_acid_start_pos() - { - return amino_acid_start_pos; - } - - public void setAmino_acid_start_pos(Integer amino_acid_start_pos) - { - this.amino_acid_start_pos = amino_acid_start_pos; - } - - public Integer getAmino_acid_end_pos() - { - return amino_acid_end_pos; - } - - public void setAmino_acid_end_pos(Integer amino_acid_end_pos) - { - this.amino_acid_end_pos = amino_acid_end_pos; - } - - public Integer getSequence_length() - { - return sequence_length; - } - - public void setSequence_length(Integer sequence_length) - { - this.sequence_length = sequence_length; - } - - public String getStorage_location() - { - return storage_location; - } - - public void setStorage_location(String storage_location) - { - this.storage_location = storage_location; - } - - public Integer getOptimal_epitope_list_id() - { - return optimal_epitope_list_id; - } - - public void setOptimal_epitope_list_id(Integer optimal_epitope_list_id) - { - this.optimal_epitope_list_id = optimal_epitope_list_id; - } - - public String getHla_restriction() - { - return hla_restriction; - } - - public void setHla_restriction(String hla_restriction) - { - this.hla_restriction = hla_restriction; - } - - public Source getSrc() - { - return src; - } - - public void setSrc(Source src) - { - this.src = src; - } - - public boolean isPeptide_flag() - { - return peptide_flag; - } - - public void setPeptide_flag(boolean peptide_flag) - { - this.peptide_flag = peptide_flag; - } - - public String getPeptide_notes() - { - return peptide_notes; - } - - public void setPeptide_notes(String peptide_notes) - { - this.peptide_notes = peptide_notes; - } -} diff --git a/src/org/scharp/atlas/pepdb/model/PoolType.java b/src/org/scharp/atlas/pepdb/model/PoolType.java deleted file mode 100644 index 323d273..0000000 --- a/src/org/scharp/atlas/pepdb/model/PoolType.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.scharp.atlas.pepdb.model; - -/** - * Created by IntelliJ IDEA. - * User: sravani - * Date: Jan 25, 2010 - * Time: 2:13:19 PM - * To change this template use File | Settings | File Templates. - */ -public class PoolType -{ - private Integer pool_type_id; - private String pool_type_desc; - - public Integer getPool_type_id() - { - return pool_type_id; - } - - public void setPool_type_id(Integer pool_type_id) - { - this.pool_type_id = pool_type_id; - } - - public String getPool_type_desc() - { - return pool_type_desc; - } - - public void setPool_type_desc(String pool_type_desc) - { - this.pool_type_desc = pool_type_desc; - } -} diff --git a/src/org/scharp/atlas/pepdb/model/ProteinCategory.java b/src/org/scharp/atlas/pepdb/model/ProteinCategory.java deleted file mode 100644 index 7ffeb0a..0000000 --- a/src/org/scharp/atlas/pepdb/model/ProteinCategory.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.scharp.atlas.pepdb.model; - -/** - * Created by IntelliJ IDEA. - * User: sravani - * Date: Jan 9, 2007 - * Time: 1:34:16 PM - * To change this template use File | Settings | File Templates. - */ -public class ProteinCategory -{ - private Integer protein_cat_id; - private String protein_cat_desc; - - public ProteinCategory() - { - } - - public ProteinCategory(Integer protein_cat_id, String protein_cat_desc, String protein_cat_mnem, Integer protein_sort_value) - { - this.protein_cat_id = protein_cat_id; - this.protein_cat_desc = protein_cat_desc; - } - - public Integer getProtein_cat_id() - { - return protein_cat_id; - } - - public void setProtein_cat_id(Integer protein_cat_id) - { - this.protein_cat_id = protein_cat_id; - } - - public String getProtein_cat_desc() - { - return protein_cat_desc; - } - - public void setProtein_cat_desc(String protein_cat_desc) - { - this.protein_cat_desc = protein_cat_desc; - } -} diff --git a/src/org/scharp/atlas/pepdb/model/Source.java b/src/org/scharp/atlas/pepdb/model/Source.java deleted file mode 100644 index d14e163..0000000 --- a/src/org/scharp/atlas/pepdb/model/Source.java +++ /dev/null @@ -1,108 +0,0 @@ -package org.scharp.atlas.pepdb.model; - -import org.labkey.api.data.Entity; - -import java.sql.Date; - -/** - * Created by IntelliJ IDEA. - * User: sravani - * Date: Jun 21, 2007 - * Time: 11:49:31 AM - * To change this template use File | Settings | File Templates. - */ -public class Source extends Entity -{ - private Integer peptide_group_assignment_id; - private Integer peptide_id; - private Integer peptide_group_id; - private String peptide_group_name; - private String peptide_id_in_group; - private Float frequency_number; - private Date frequency_number_date; - private boolean in_current_file; - - public Source() - { - } - - public Integer getPeptide_group_assignment_id() - { - return peptide_group_assignment_id; - } - - public void setPeptide_group_assignment_id(Integer peptide_group_assignment_id) - { - this.peptide_group_assignment_id = peptide_group_assignment_id; - } - - public Integer getPeptide_id() - { - return peptide_id; - } - - public void setPeptide_id(Integer peptide_id) - { - this.peptide_id = peptide_id; - } - - public Integer getPeptide_group_id() - { - return peptide_group_id; - } - - public void setPeptide_group_id(Integer peptide_group_id) - { - this.peptide_group_id = peptide_group_id; - } - - public String getPeptide_id_in_group() - { - return peptide_id_in_group; - } - - public void setPeptide_id_in_group(String peptide_id_in_group) - { - this.peptide_id_in_group = peptide_id_in_group; - } - - public Float getFrequency_number() - { - return frequency_number; - } - - public void setFrequency_number(Float frequency_number) - { - this.frequency_number = frequency_number; - } - - public Date getFrequency_number_date() - { - return frequency_number_date; - } - - public void setFrequency_number_date(Date frequency_number_date) - { - this.frequency_number_date = frequency_number_date; - } - - public String getPeptide_group_name() - { - return peptide_group_name; - } - - public void setPeptide_group_name(String peptide_group_name) - { - this.peptide_group_name = peptide_group_name; - } - - public boolean isIn_current_file() - { - return in_current_file; - } - - public void setIn_current_file(boolean in_current_file) - { - this.in_current_file = in_current_file; - } -} diff --git a/src/org/scharp/atlas/pepdb/query/PepDBQuerySchema.java b/src/org/scharp/atlas/pepdb/query/PepDBQuerySchema.java deleted file mode 100644 index 44bf18d..0000000 --- a/src/org/scharp/atlas/pepdb/query/PepDBQuerySchema.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.scharp.atlas.pepdb.query; - -import org.jetbrains.annotations.NotNull; -import org.labkey.api.data.Container; -import org.labkey.api.data.ContainerFilter; -import org.labkey.api.data.DbSchema; -import org.labkey.api.data.TableInfo; -import org.labkey.api.module.Module; -import org.labkey.api.query.DefaultSchema; -import org.labkey.api.query.QuerySchema; -import org.labkey.api.query.SimpleUserSchema; -import org.labkey.api.security.User; - -/** - * Created by klum on 9/17/2014. - */ -public class PepDBQuerySchema extends SimpleUserSchema -{ - public static final String SCHEMA_NAME = "pepdb"; - public static final String SCHEMA_DESCR = "Provides peptide and peptide pool information."; - - static public void register(Module module) - { - DefaultSchema.registerProvider(SCHEMA_NAME, new DefaultSchema.SchemaProvider(module) - { - @Override - public QuerySchema createSchema(DefaultSchema schema, Module module) - { - return new PepDBQuerySchema(schema.getUser(), schema.getContainer()); - } - }); - } - - public PepDBQuerySchema(User user, Container container) - { - super(SCHEMA_NAME, SCHEMA_DESCR, user, container, DbSchema.get("pepdb")); - } - - @Override - protected TableInfo createWrappedTable(String name, @NotNull TableInfo sourceTable, ContainerFilter cf) - { - TableInfo table = super.createWrappedTable(name, sourceTable, cf); - if (table instanceof SimpleTable) - { - // Setting readOnly to false so that tests can reset the data tables via Remote API commands. S. Langley. - ((SimpleTable) table).setReadOnly(false); - //((SimpleTable)table).setReadOnly(true); - } - return table; - } -} diff --git a/src/org/scharp/atlas/pepdb/view/PepDBWebPart.java b/src/org/scharp/atlas/pepdb/view/PepDBWebPart.java deleted file mode 100644 index 64c16b1..0000000 --- a/src/org/scharp/atlas/pepdb/view/PepDBWebPart.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.scharp.atlas.pepdb.view; - -import org.labkey.api.view.JspView; - -public class PepDBWebPart extends JspView -{ - public PepDBWebPart() - { - super("/org/scharp/atlas/pepdb/view/pepDBWebPart.jsp", null); - setTitle("PepDB Web Part"); - } -} diff --git a/src/org/scharp/atlas/pepdb/view/importPeptides.jsp b/src/org/scharp/atlas/pepdb/view/importPeptides.jsp deleted file mode 100644 index 02dd4fa..0000000 --- a/src/org/scharp/atlas/pepdb/view/importPeptides.jsp +++ /dev/null @@ -1,48 +0,0 @@ -<%@ taglib prefix="labkey" uri="http://www.labkey.org/taglib" %> -<%@ page import="org.labkey.api.view.HttpView"%> -<%@ page import="org.labkey.api.view.JspView"%> -<%@ page import="org.scharp.atlas.pepdb.PepDBBaseController.FileForm" %> -<%@ page import="org.scharp.atlas.pepdb.PepDBController" %> -<%@ page import="org.scharp.atlas.pepdb.PepDBController.ImportPeptidesAction" %> -<%@ page extends="org.labkey.api.jsp.JspBase" %> -
- <% - JspView me = (JspView) HttpView.currentView(); - FileForm bean = me.getModelBean(); - %> - - - - - - - - - - - - - - - -
-

Import Peptides

-
File Type : -
- File : - -
- <%= button("Import Peptides").submit(true) %> <%= button("Back").href(urlFor(PepDBController.BeginAction.class)) %> -
-
- Note: The File must be .txt extension and It should be tab delimited.

-
-
-
diff --git a/src/org/scharp/atlas/pepdb/view/importPools.jsp b/src/org/scharp/atlas/pepdb/view/importPools.jsp deleted file mode 100644 index 86858df..0000000 --- a/src/org/scharp/atlas/pepdb/view/importPools.jsp +++ /dev/null @@ -1,49 +0,0 @@ -<%@ taglib prefix="labkey" uri="http://www.labkey.org/taglib" %> -<%@ page import="org.labkey.api.view.HttpView"%> -<%@ page import="org.labkey.api.view.JspView" %> -<%@ page import="org.scharp.atlas.pepdb.PepDBController" %> -<%@ page import="org.scharp.atlas.pepdb.PepDBController.ImportPeptidePoolsAction" %> -<%@ page extends="org.labkey.api.jsp.JspBase" %> -
- <% - JspView me = (JspView) HttpView.currentView(); - PepDBController.FileForm bean = me.getModelBean(); - %> - - <% if (null != bean.getMessage()) {%> - <%=h(bean.getMessage())%> - <%}%> - - - - - - - - - - - - - - - - -
-

Import Peptide Pools

-
File Type : -
- File : - -
- <%= button("Import Peptide Pools").submit(true) %> <%= button("Back").href(urlFor(PepDBController.BeginAction.class)) %> -
-
- Note: The File must be .txt extension and It should be tab delimited.

-
-
-
diff --git a/src/org/scharp/atlas/pepdb/view/index.jsp b/src/org/scharp/atlas/pepdb/view/index.jsp deleted file mode 100644 index dcd0a34..0000000 --- a/src/org/scharp/atlas/pepdb/view/index.jsp +++ /dev/null @@ -1,53 +0,0 @@ -<%@ taglib prefix="labkey" uri="http://www.labkey.org/taglib" %> -<%@ page import="org.labkey.api.security.User"%> -<%@ page import="org.labkey.api.security.permissions.UpdatePermission" %> -<%@ page import="org.labkey.api.view.HttpView" %> -<%@ page import="org.labkey.api.view.ViewContext" %> -<%@ page import="org.scharp.atlas.pepdb.PepDBBaseController.DisplayPeptideForm" %> -<%@ page import="org.scharp.atlas.pepdb.PepDBController" %> -<%@ page import="org.scharp.atlas.pepdb.PepDBController.DisplayPeptideAction" %> -<%@ page extends="org.labkey.api.jsp.JspBase" %> - -<% ViewContext ctx = getViewContext(); - User user = ctx.getUser(); - final var canUpdate = ctx.getContainer().hasPermission(user, UpdatePermission.class); -%> -

If you see some of the links disabled then you don't have permission to enter data. - If you need to enter any data contact Atlas Administrator.

-

Peptide Groups :

-
    -
  • <%= link("List Peptide Groups").href(urlFor(PepDBController.ShowAllPeptideGroupsAction.class)).clearClasses() %>
  • - <% - if(canUpdate){%> -
  • <%= link("Insert a New Group").href(urlFor(PepDBController.InsertPeptideGroupAction.class)).clearClasses() %>
  • - <%}else{%> -
  • Insert a New Group
  • - <%}%> -
-

Peptides :

-
    -
  • <%= link("Search for Peptides by Criteria").href(urlFor(PepDBController.SearchForPeptidesAction.class)).clearClasses() %>
  • - <%if(canUpdate){%> -
  • <%= link("Import Peptides").href(urlFor(PepDBController.ImportPeptidesAction.class)).clearClasses() %>
  • - <%}else{%> -
  • Import Peptides
  • - <%}%> -
  • <%= link("Peptides From Last Import").href(urlFor(PepDBController.DisplayResultAction.class)).clearClasses() %>
  • -
- -<% - DisplayPeptideForm form = (DisplayPeptideForm) (HttpView.currentModel()); -%> - -Lookup Peptide by Id:   <%= button("Find").submit(true) %> - -

-

Peptide Pools :

-
    - <%if(canUpdate){%> -
  • <%= link("Import Peptide Pools").href(urlFor(PepDBController.ImportPeptidePoolsAction.class)).clearClasses() %>
  • - <%}else{%> -
  • Import Peptide Pools
  • - <%}%> -
  • <%= link("List All Peptide Pools").href(urlFor(PepDBController.ShowAllPeptidePoolsAction.class)).clearClasses() %>
  • -
diff --git a/src/org/scharp/atlas/pepdb/view/pepDBWebPart.jsp b/src/org/scharp/atlas/pepdb/view/pepDBWebPart.jsp deleted file mode 100644 index e016a65..0000000 --- a/src/org/scharp/atlas/pepdb/view/pepDBWebPart.jsp +++ /dev/null @@ -1,9 +0,0 @@ -<%@ page import="org.scharp.atlas.pepdb.PepDBController"%> -<%@ page import="org.scharp.atlas.pepdb.PepDBManager"%> -<%@ page import="org.scharp.atlas.pepdb.model.PeptideGroup"%> -<%@ page extends="org.labkey.api.jsp.JspBase" %> -<% - PeptideGroup[] peptides = PepDBManager.getPeptideGroups(); -%> -This container contains <%= peptides.length %> peptide groups.
-<%= button("View Grid").href(urlFor(PepDBController.ShowAllPeptideGroupsAction.class)) %> diff --git a/src/org/scharp/atlas/pepdb/view/peptideDetails.jsp b/src/org/scharp/atlas/pepdb/view/peptideDetails.jsp deleted file mode 100644 index 120f8e9..0000000 --- a/src/org/scharp/atlas/pepdb/view/peptideDetails.jsp +++ /dev/null @@ -1,57 +0,0 @@ -<%@ taglib prefix="labkey" uri="http://www.labkey.org/taglib" %> -<%@ page import="org.labkey.api.view.HttpView"%> -<%@ page import="org.labkey.api.view.JspView" %> -<%@ page import="org.scharp.atlas.pepdb.PepDBBaseController.PeptideQueryForm" %> -<%@ page import="org.scharp.atlas.pepdb.PepDBController" %> -<%@ page import="org.scharp.atlas.pepdb.PepDBManager" %> -<%@ page import="org.scharp.atlas.pepdb.model.PeptidePool" %> -<%@ page import="org.scharp.atlas.pepdb.model.Source" %> -<%@ page extends="org.labkey.api.jsp.JspBase" %> -<% - JspView me = (JspView) HttpView.currentView(); - PeptideQueryForm bean = me.getModelBean(); -%> - - <% - Source[] sources = PepDBManager.getSourcesForPeptide(bean.getQueryValue()); - if (sources != null && sources.length > 0) - {%> -

Peptide P<%=h(bean.getQueryValue())%> is a member of these Peptide Groups:

- <% - for (Source source : sources) - { %> - - - - - - <% }} // end for loop %> -
- <%= link(source.getPeptide_group_name()).href(urlFor(PepDBController.DisplayPeptideGroupInformationAction.class) - .addParameter("peptide_group_id", source.getPeptide_group_id().toString())).clearClasses() %> - (PEPTIDE NUMBER =<%=h(source.getPeptide_id_in_group())%>) - <%if(source.getFrequency_number() != null){%> - - Frequency Number = - <%= source.getFrequency_number()%> - <%}if(source.getFrequency_number_date() != null){%> - - Frequency Update Date = <%=formatDateTime(source.getFrequency_number_date())%><%}%> -
- - <% - PeptidePool[] pools = PepDBManager.getPoolsForPeptide(bean.getQueryValue()); - if (pools != null && pools.length > 0) - { - %> -

Peptide P<%=h(bean.getQueryValue())%> is a member of these Peptide Pools:

- <% for (PeptidePool pool : pools) - {%> - - - - <% }} // end if statement %> -
- <%= link("PP"+pool.getPeptide_pool_id()).href(urlFor(PepDBController.DisplayPeptidePoolInformationAction.class) - .addParameter("peptide_pool_id", pool.getPeptide_pool_id())).clearClasses() %> - - <%=h(pool.getPeptide_pool_name())%> - <%=h(pool.getPool_type_desc())%> -
diff --git a/src/org/scharp/atlas/pepdb/view/peptideGroupSelect.jsp b/src/org/scharp/atlas/pepdb/view/peptideGroupSelect.jsp deleted file mode 100644 index b63268a..0000000 --- a/src/org/scharp/atlas/pepdb/view/peptideGroupSelect.jsp +++ /dev/null @@ -1,126 +0,0 @@ -<%@ taglib prefix="labkey" uri="http://www.labkey.org/taglib" %> -<%@ page import="org.labkey.api.view.HttpView"%> -<%@ page import="org.labkey.api.view.JspView" %> -<%@ page import="org.scharp.atlas.pepdb.PepDBBaseController.PeptideQueryForm" %> -<%@ page import="org.scharp.atlas.pepdb.PepDBController.SearchForPeptidesAction" %> -<%@ page import="org.scharp.atlas.pepdb.PepDBManager" %> -<%@ page import="org.scharp.atlas.pepdb.PepDBSchema" %> -<%@ page import="org.scharp.atlas.pepdb.model.PeptideGroup" %> -<%@ page import="org.scharp.atlas.pepdb.model.PeptidePool" %> -<%@ page import="org.scharp.atlas.pepdb.model.ProteinCategory" %> -<%@ page extends="org.labkey.api.jsp.JspBase" %> -<% - JspView me = (JspView) HttpView.currentView(); - PeptideQueryForm bean = me.getModelBean(); - if(bean.getMessage() != null){ -%> -<%=h(bean.getMessage())%><%}%> - - - -

Search for Peptides using different criteria :



- - - - - - - - - - - <%if(bean.getQueryKey() != null && bean.getQueryKey().equals(PepDBSchema.COLUMN_PROTEIN_CAT_ID)){%> - - - - - - - - - - - <%}%> - <%if(bean.getQueryKey() != null && bean.getQueryKey().equals(PepDBSchema.COLUMN_PEPTIDE_GROUP_ID)){%> - - - - - - <%}%> - - - - -
Search Criteria : - <%=select() - .id("queryKey") - .name("queryKey") - .onChange("selectOptions()") - .selected(bean.getQueryKey()) - .className(null) - .addOption("") - .addOption("Peptides in a Peptide Group", PepDBSchema.COLUMN_PEPTIDE_GROUP_ID) - .addOption("Peptides in a Peptide Pool", PepDBSchema.COLUMN_PEPTIDE_POOL_ID) - .addOption("Peptides in a Protein Category", PepDBSchema.COLUMN_PROTEIN_CAT_ID) - .addOption("Peptides contain Sequence", PepDBSchema.COLUMN_PEPTIDE_SEQUENCE) - .addOption("Child Peptides By Parent Sequence", PepDBSchema.COLUMN_PARENT_SEQUENCE) - .addOption("Parent Peptides By Child Sequence", PepDBSchema.COLUMN_CHILD_SEQUENCE) - %> -
- <%=h((bean.getQueryKey() != null && bean.getQueryKey().equals(PepDBSchema.COLUMN_PEPTIDE_SEQUENCE)) ? " Equals / Contains : " : " Equals : ")%> - - - <%if(bean.getQueryKey() == null || bean.getQueryKey().isEmpty()){ %> - - <%} - else if(bean.getQueryKey().equals(PepDBSchema.COLUMN_PEPTIDE_GROUP_ID)){ - PeptideGroup[] peptideGroups = PepDBManager.getPeptideGroups(); - %> - - <% } - else if (bean.getQueryKey().equals(PepDBSchema.COLUMN_PEPTIDE_POOL_ID)) { - PeptidePool[] peptidePools = PepDBManager.getPeptidePools(); - %> - - <% } - else if (bean.getQueryKey().equals(PepDBSchema.COLUMN_PROTEIN_CAT_ID)) { - ProteinCategory[] proteinCategories = PepDBManager.getProteinCategory(); - %> - - <%} - else if(bean.getQueryKey().equals(PepDBSchema.COLUMN_PEPTIDE_SEQUENCE) || bean.getQueryKey().equals(PepDBSchema.COLUMN_PARENT_SEQUENCE) || bean.getQueryKey().equals(PepDBSchema.COLUMN_CHILD_SEQUENCE)){%> -   - <%}%> -
- Amino Acid Start Position: - -
- Amino Acid End Position: - -
- PEPTIDE NUMBER: - -
- -
-
diff --git a/test/sampledata/test_import_files/peptide_file/gagptegprac.txt b/test/sampledata/test_import_files/peptide_file/gagptegprac.txt deleted file mode 100755 index bdbf80b..0000000 --- a/test/sampledata/test_import_files/peptide_file/gagptegprac.txt +++ /dev/null @@ -1,17 +0,0 @@ -PEPTIDE SEQUENCE IS CHILD PROTEIN CATEGORY PEPTIDE GROUP ID SEQUENCE LENGTH AASTART AAEND IN A LIST HLA RESTRICTION -WIILGLNKIVRMYSP FALSE p24 gagptegprac GAG1-1 15 133 147 -TLEEMMTACQGVGGP FALSE p24 gagptegprac GAG1-2 15 210 224 -RQGPKEPFRDYVDRF FALSE p24 gagptegprac GAG1-3 15 154 168 -REPRGSDIAGTTSTL FALSE p24 gagptegprac GAG1-4 15 97 111 -HQMKDCTERQANFLG FALSE p2p7p1p6 gagptegprac GAG1-5 15 58 72 -LNTVGGHQAAMQMLK FALSE p24 gagptegprac GAG1-6 15 56 70 -GEIYKRWIILGLNKI FALSE p24 gagptegprac GAG1-7 15 127 141 -ALSEGATPQDLNTML FALSE p24 gagptegprac GAG1-8 15 42 56 -KCGKEGHQMKDCTER FALSE p2p7p1p6 gagptegprac GAG2-1 15 52 66 -TLLVQNANPDCKTIL FALSE p24 gagptegprac GAG2-2 15 188 202 -TERQANFLGKIWPSH FALSE p2p7p1p6 gagptegprac GAG2-3 15 64 78 -NCRAPRKKGCWKCGK FALSE p2p7p1p6 gagptegprac GAG2-4 15 41 55 -NKIVRMYSPVSILDI FALSE p24 gagptegprac GAG2-5 15 139 153 -EEKAFSPEVIPMFSA FALSE p24 gagptegprac GAG2-6 15 28 42 -GPGHKARVLAEAMSQ FALSE p24-p2p7p1p6 gagptegprac GAG2-7 15 223 6 -TINEEAAEWDRLHPV FALSE p24 gagptegprac GAG2-8 15 72 86 diff --git a/test/sampledata/test_import_files/peptide_file/gagptegprac1.txt b/test/sampledata/test_import_files/peptide_file/gagptegprac1.txt deleted file mode 100755 index 22c44b8..0000000 --- a/test/sampledata/test_import_files/peptide_file/gagptegprac1.txt +++ /dev/null @@ -1,4 +0,0 @@ -PEPTIDE SEQUENCE IS CHILD PROTEIN CATEGORY PEPTIDE GROUP ID SEQUENCE LENGTH AASTART AAEND IN A LIST HLA RESTRICTION -WIILGLNKIVRMYSP FALSE p24 gagptegprac1 GAG1-1 15 133 147 -TLEEMMTACQGVGGP FALSE p24 gagptegprac1 GAG1-2 15 210 224 -RQGPKEPFRDYVDRF FALSE p24 gagptegprac1 GAG1-3 15 154 168 diff --git a/test/sampledata/test_import_files/pool_description_file/pool_description.txt b/test/sampledata/test_import_files/pool_description_file/pool_description.txt deleted file mode 100755 index ecd8112..0000000 --- a/test/sampledata/test_import_files/pool_description_file/pool_description.txt +++ /dev/null @@ -1,2 +0,0 @@ -Pool Name Pool Type Parent Pool Name Matrix Pool Id -Prac_Pool Pool diff --git a/test/sampledata/test_import_files/pool_detail_file/pool_details.txt b/test/sampledata/test_import_files/pool_detail_file/pool_details.txt deleted file mode 100755 index 03f732d..0000000 --- a/test/sampledata/test_import_files/pool_detail_file/pool_details.txt +++ /dev/null @@ -1,3 +0,0 @@ -POOL NAME PEPTIDE SEQUENCE PEPTIDE GROUP -Prac_Pool WIILGLNKIVRMYSP gagptegprac -Prac_Pool REPRGSDIAGTTSTL gagptegprac diff --git a/test/src/org/labkey/test/tests/pepdb/PepDBModuleTest.java b/test/src/org/labkey/test/tests/pepdb/PepDBModuleTest.java deleted file mode 100644 index 2b5ac55..0000000 --- a/test/src/org/labkey/test/tests/pepdb/PepDBModuleTest.java +++ /dev/null @@ -1,344 +0,0 @@ -/* - * Copyright (c) 2013-2015 LabKey Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.labkey.test.tests.pepdb; - -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.labkey.remoteapi.CommandException; -import org.labkey.remoteapi.Connection; -import org.labkey.remoteapi.query.ContainerFilter; -import org.labkey.remoteapi.query.DeleteRowsCommand; -import org.labkey.remoteapi.query.Row; -import org.labkey.remoteapi.query.RowMap; -import org.labkey.remoteapi.query.SelectRowsCommand; -import org.labkey.remoteapi.query.SelectRowsResponse; -import org.labkey.test.BaseWebDriverTest; -import org.labkey.test.Locator; -import org.labkey.test.TestFileUtils; -import org.labkey.test.TestTimeoutException; -import org.labkey.test.WebTestHelper; -import org.labkey.test.categories.External; -import org.labkey.test.util.LogMethod; -import org.labkey.test.util.PostgresOnlyTest; - -import java.io.File; -import java.io.IOException; -import java.util.Arrays; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -@Category({External.class}) -public class PepDBModuleTest extends BaseWebDriverTest implements PostgresOnlyTest -{ - - public static final String FOLDER_TYPE = "Custom"; - // Folder type defined in customFolder.foldertype.xml - public static final String MODULE_NAME = "PepDB"; - public static final String USER_SCHEMA_NAME = "pepdb"; - public static final String FOLDER_NAME = "PepDB"; - private int peptideStartIndex = 0; - - @Override - protected String getProjectName() - { - return getClass().getSimpleName() + " Project"; - } - - // Setup duplicates the folder structure and webparts used in production. - private void setupProject() - { - log("Starting setupProject()"); - assertModuleDeployed(MODULE_NAME); - _containerHelper.createProject(getProjectName(), FOLDER_TYPE); - - _containerHelper.enableModule(getProjectName(), MODULE_NAME); - _containerHelper.createSubfolder(getProjectName(), "Labs", FOLDER_TYPE); - _containerHelper.createSubfolder(getProjectName() + "/Labs", "Test", FOLDER_TYPE); - _containerHelper.createSubfolder(getProjectName() + "/Labs/Test", FOLDER_NAME, FOLDER_TYPE); - clickFolder("Labs"); - clickFolder("Test"); - clickFolder(FOLDER_NAME); - - _containerHelper.enableModules(Arrays.asList("Issues", "Wiki", "PepDB")); - _containerHelper.disableModules("Portal"); - setDefaultModule("PepDB"); - log("Finished setupProject()"); - } - - /** - * Set which view in this folder should be the default - * - * @param moduleName - */ - void setDefaultModule(String moduleName) - { - goToFolderManagement(); - clickAndWait(Locator.linkWithText("Folder Type")); - selectOptionByText(Locator.name("defaultModule"), moduleName); - clickButton("Update Folder"); - } - - @Test - public void testSteps() throws Exception - { - setupProject(); - assertModuleEnabled("Issues"); - assertModuleEnabled("Wiki"); - assertModuleEnabled("PepDB"); - log("Expected modules enabled."); - - beginAt(WebTestHelper.buildURL("pepdb", getProjectName() + "/Labs/Test/" + FOLDER_NAME, "begin")); - - /* Insert the Peptide Group" */ - clickAndWait(Locator.linkWithText("Insert a New Group")); - setFormElement(Locator.name("peptide_group_name"), "gagptegprac"); - selectOptionByText(Locator.name("pathogen_id"), "Other"); - selectOptionByText(Locator.name("clade_id"), "Other"); - selectOptionByText(Locator.name("group_type_id"), "Other"); - clickAndWait(Locator.css("a.labkey-button > span")); - clickFolder(FOLDER_NAME); - - // Import some test Peptides from a file. - clickAndWait(Locator.linkWithText("Import Peptides")); - selectOptionByText(Locator.id("actionType"), "Peptides"); - setFormElement(Locator.name("pFile"), getSampleData("/peptide_file/gagptegprac.txt")); - clickButton("Import Peptides"); - - /* Import Peptide Pool 'Pool Descriptions' file. - * ./test_import_files/pool_description_file/pool_description.txt - */ - clickFolder(FOLDER_NAME); - clickAndWait(Locator.linkWithText("Import Peptide Pools")); - selectOptionByText(Locator.name("actionType"), "Pool Descriptions"); - - setFormElement(Locator.name("pFile"), getSampleData("/pool_description_file/pool_description.txt")); - clickAndWait(Locator.css("a.labkey-button > span")); - - /* Import Peptide Pool 'Peptides in Pool' file. - ./test_import_files/pool_detail_file/pool_details.txt - */ - clickFolder(FOLDER_NAME); - clickAndWait(Locator.linkWithText("Import Peptide Pools")); - selectOptionByText(Locator.name("actionType"), "Peptides in Pool"); - - setFormElement(Locator.name("pFile"), getSampleData("/pool_detail_file/pool_details.txt")); - clickAndWait(Locator.css("a.labkey-button > span")); - - /* Search for the Peptides belonging to our just-imported pool */ - clickFolder(FOLDER_NAME); - clickAndWait(Locator.linkWithText("Search for Peptides by Criteria")); - selectOptionByText(Locator.name("queryKey"), "Peptides in a Peptide Pool"); - selectOptionByTextContaining(getDriver().findElement(Locator.name("queryValue")), "Prac_Pool"); - - clickAndWait(Locator.name("action_type")); - - // Identify the index at which our peptide IDs start. - findPeptideStartIndex(); - // List the peptides in the the 'gagptegprac' Peptide Group. We expect there to be 16 of them. - clickFolder(FOLDER_NAME); - clickAndWait(Locator.linkWithText("Search for Peptides by Criteria")); - waitForText("Search for Peptides using different criteria : "); - selectOptionByText(Locator.id("queryKey"), "Peptides in a Peptide Group"); - selectOptionByText(Locator.id("queryValue"), "gagptegprac"); - - clickAndWait(Locator.name("action_type")); - - assertTextPresentInThisOrder("There are (16) peptides in the 'gagptegprac' peptide group."); - // Select a newly uploaded peptide, #3 and edit it to have a storage location of 'Kitchen Sink' - clickAndWait(Locator.linkWithText(pepString(4))); - // Verify the expected record's content - assertTrue(getDriver().findElement(Locator.xpath("//form[@lk-region-form='peptides']/table/tbody")).getText().matches("^[\\s\\S]*Peptide Id:\\s*" + pepString(4) + "\nPeptide Sequence:\\s*REPRGSDIAGTTSTL\nProtein Category:\\s*p24\nSequence Length:\\s*15\nAAStart:\\s*97\nAAEnd:\\s*111\nIs Child:\\s*false\nIs Parent:\\s*false[\\s\\S]*$")); - - clickAndWait(Locator.linkWithText("Edit Peptide")); - setFormElement(Locator.name("storage_location"), "Kitchen Sink"); - clickAndWait(Locator.xpath("//span[text()='Save Changes']")); - - // Assert that the Storage Location now contains "Kitchen Sink" - assertTrue(getDriver().findElement(Locator.xpath("//form[@lk-region-form='peptides']/table/tbody")).getText().matches("^[\\s\\S]*Peptide Id:\\s*" + pepString(4) + "\nPeptide Sequence:\\s*REPRGSDIAGTTSTL\nProtein Category:\\s*p24\nSequence Length:\\s*15\nAAStart:\\s*97\nAAEnd:\\s*111\nIs Child:\\s*false\nIs Parent:\\s*false[\\s\\S]*$")); - clickAndWait(Locator.css("a.labkey-button > span")); - - // Search for a single, newly-uploaded peptide and verify it displays as expected. - setFormElement(Locator.name("peptide_id"), Integer.toString(peptideStartIndex + 9)); - clickButton("Find"); - // Verify the expected record's content - assertTrue(getDriver().findElement(Locator.tagWithAttribute("form", "lk-region-form", "peptides")).getText() - .matches("^[\\s\\S]*Peptide Id:\\s*" + pepString(9) + "\nPeptide Sequence:\\s*KCGKEGHQMKDCTER\nProtein Category:\\s*p2p7p1p6\nSequence Length:\\s*15\nAAStart:\\s*52\nAAEnd:\\s*66\nIs Child:\\s*false\nIs Parent:\\s*false\nStorage Location:\\s*\n[\\s\\S]*$")); - - clickAndWait(Locator.css("a.labkey-button > span")); - - - /* - * - * 'Search for Peptides by Criteria' using 'Peptides in a Peptide Pool' - * using the newly imported Peptide Pool. - * - * Verify that the peptides found match what was expected (by the pool import), and their values include the - * columns imported earlier during the importing of the peptides. - * - */ - clickFolder(FOLDER_NAME); - clickAndWait(Locator.linkWithText("Search for Peptides by Criteria")); - selectOptionByText(Locator.id("queryKey"), "Peptides in a Peptide Pool"); - - selectOptionByTextContaining(getDriver().findElement(Locator.name("queryValue")), "Prac_Pool"); - clickAndWait(Locator.name("action_type")); - clickAndWait(Locator.linkWithText(pepString(4))); - - checker().verifyEquals("", "Peptide Sequence:", getDriver().findElement(Locator.xpath("//form[@lk-region-form='peptides']/table/tbody/tr[2]/td")).getText()); - checker().verifyEquals("", "REPRGSDIAGTTSTL", getDriver().findElement(Locator.xpath("//form[@lk-region-form='peptides']/table/tbody/tr[2]/td[2]")).getText()); - checker().verifyEquals("", "gagptegprac (PEPTIDE NUMBER =GAG1-4)", getDriver().findElement(Locator.css(".lk-body-ct div:nth-of-type(2) > table > tbody > tr > td")).getText()); - } - - @LogMethod - private void cleanupSchema() throws IOException, CommandException - { - Connection cn = createDefaultConnection(); - - cleanupTable(cn, "pepdb", "peptide_pool_assignment"); - cleanupTable(cn, "pepdb", "peptide_group_assignment"); - cleanupTable(cn, "pepdb", "peptides"); - cleanupTable(cn, "pepdb", "peptide_pool"); - cleanupTable(cn, "pepdb", "peptide_group"); - - } - - @LogMethod - private void cleanupTable(Connection cn, String schemaName, String tableName) throws IOException, CommandException - { - SelectRowsCommand selectCmd = new SelectRowsCommand(schemaName, tableName); - selectCmd.setMaxRows(-1); - selectCmd.setContainerFilter(ContainerFilter.AllFolders); - selectCmd.setColumns(Arrays.asList("*")); - SelectRowsResponse selectResp = selectCmd.execute(cn, getProjectName()); - if (selectResp.getRowCount().intValue() > 0) - { - DeleteRowsCommand deleteCmd = new DeleteRowsCommand(schemaName, tableName); - deleteCmd.setRows(selectResp.getRows()); - deleteCmd.execute(cn, getProjectName()); - assertEquals("Expected no rows remaining", 0, selectCmd.execute(cn, getProjectName()).getRowCount().intValue()); - } - } - - // We have to expose our schema as an external schema in order to run the selectRow and deleteRow commands. - void ensureExternalSchema(String containerPath) - { - log("** Ensure ExternalSchema: " + USER_SCHEMA_NAME); - - beginAt(WebTestHelper.buildURL("query", containerPath, "admin")); - - if (!isTextPresent("reload")) - { - assertTextPresent("new external schema"); - log("** Creating ExternalSchema: " + USER_SCHEMA_NAME); - clickAndWait(Locator.linkWithText("new external schema")); - checkCheckbox(Locator.name("includeSystem")); - setFormElement(Locator.name("userSchemaName"), USER_SCHEMA_NAME); - setFormElement(Locator.name("sourceSchemaName"), USER_SCHEMA_NAME); - pressEnter(Locator.name("sourceSchemaName")); - checkCheckbox(Locator.name("editable")); - uncheckCheckbox(Locator.name("indexable")); - clickButton("Create"); - } - assertTextPresent(USER_SCHEMA_NAME); - assertTextNotPresent("reload all schemas"); // Present only for external schemas > 1 - } - - // Identify the index at which our peptide IDs start. - private void findPeptideStartIndex() throws IOException - { - Connection cn = createDefaultConnection(); - try - { - ensureExternalSchema(getProjectName()); - SelectRowsCommand selectCmd = new SelectRowsCommand("pepdb", "peptides"); - selectCmd.setMaxRows(1); - selectCmd.setContainerFilter(ContainerFilter.AllFolders); - selectCmd.setColumns(Arrays.asList("*")); - SelectRowsResponse selectResp = selectCmd.execute(cn, getProjectName()); - - if (selectResp.getRowCount().intValue() > 0) - { - Row convertedRow = new RowMap(selectResp.getRows().get(0)); - peptideStartIndex = ((int) convertedRow.getValue("peptide_id")) - 1; - } - } - catch (CommandException e) - { - log("** Error during findPeptideStartIndex:"); - e.printStackTrace(System.out); - } - } - - // Convert the peptide ID integer into its string representation. - private String pepString(int peptideIdOffset) - { - //return String.format("P%06d", peptideStartIndex + peptideIdOffset); - return String.format("P%d", peptideStartIndex + peptideIdOffset); - } - - protected void assertModuleDeployed(String moduleName) - { - log("Ensuring that that '" + moduleName + "' module is deployed"); - goToAdminConsole(); - assertTextPresent(moduleName); - } - - protected void assertModuleEnabled(String moduleName) - { - log("Ensuring that that '" + moduleName + "' module is enabled"); - goToFolderManagement(); - clickAndWait(Locator.linkWithText("Folder Type")); - assertElementPresent(Locator.xpath("//input[@type='checkbox' and @checked and @title='" + moduleName + "']")); - } - - protected void assertModuleEnabledByDefault(String moduleName) - { - log("Ensuring that that '" + moduleName + "' module is enabled"); - goToFolderManagement(); - clickAndWait(Locator.linkWithText("Folder Type")); - assertElementPresent(Locator.xpath("//input[@type='checkbox' and @checked and @disabled and @title='" + moduleName + "']")); - } - - @Override - protected void doCleanup(boolean afterTest) throws TestTimeoutException - { - if (afterTest) - { - try - { - cleanupSchema(); - } - catch (IOException | CommandException e) - { - throw new RuntimeException(e); - } - } - _containerHelper.deleteProject(getProjectName(), afterTest); - } - - @Override - public List getAssociatedModules() - { - return Arrays.asList("pepdb"); - } - - public static File getSampleData(String sampleDataPath) - { - return TestFileUtils.getSampleData("test_import_files" + sampleDataPath); - } -}