Skip to content

Commit 45bd305

Browse files
authored
Merge pull request #10 from jdesaphy/patch-biorj_variant
Patch biorj variant
2 parents 4f8a805 + cd8732d commit 45bd305

File tree

9 files changed

+286
-150
lines changed

9 files changed

+286
-150
lines changed

BACKEND/INSTALL/QUICKSTART/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ While still in $TG_DIR/BACKEND/INSTALL, please execute the following command:
5252
biorels_php gen_single_script.php > biorels_execute.sh
5353
sh biorels_execute.sh
5454

55-
This will execute the necessary scripts in the correct order.
55+
This will execute the necessary scripts in the correct order. It will take about an hour and a half.
5656

5757

5858
## Querying the database
@@ -76,3 +76,4 @@ Please go to $TG_DIR/BACKEND/SCRIPT/BIORJ/
7676
You can execute the following scripts:
7777
* biorels_php api_import.php --JSON Example/HeLa.biorj
7878
* biorels_php api_export.php -JSON_OUTPUT=CVCL_B6YM.biorj --JSON_PRETTY_PRINT CELL CVCL_B6YM && more CVCL_B6YM.biorj
79+
* biorels_php api_import.php --JSON Example/rs712.json

BACKEND/INSTALL/biorels_public.sql

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3272,14 +3272,14 @@ COMMENT ON COLUMN DB_SCHEMA_NAME.org_group_map.org_group_id IS 'Foreign key to o
32723272
COMMENT ON COLUMN DB_SCHEMA_NAME.org_group_map.web_user_id IS 'Foreign key to web_user representing a scientist';
32733273

32743274
CREATE SEQUENCE DB_SCHEMA_NAME.org_group_map_sq
3275-
START WITH 3822421
3275+
START WITH 1
32763276
INCREMENT BY 1
32773277
NO MINVALUE
32783278
NO MAXVALUE
32793279
CACHE 1;
32803280

32813281
CREATE SEQUENCE DB_SCHEMA_NAME.org_group_sq
3282-
START WITH 75516
3282+
START WITH 1
32833283
INCREMENT BY 1
32843284
NO MINVALUE
32853285
NO MAXVALUE
@@ -5121,7 +5121,7 @@ COMMENT ON COLUMN DB_SCHEMA_NAME.source.source_type IS 'Type of database/resourc
51215121
COMMENT ON COLUMN DB_SCHEMA_NAME.source.source_metadata IS 'Additional information';
51225122

51235123
CREATE SEQUENCE DB_SCHEMA_NAME.source_seq
5124-
START WITH 1194
5124+
START WITH 1
51255125
INCREMENT BY 1
51265126
NO MINVALUE
51275127
NO MAXVALUE
@@ -5420,8 +5420,7 @@ CREATE TABLE DB_SCHEMA_NAME.variant_frequency (
54205420
variant_change_id bigint NOT NULL,
54215421
variant_freq_study_id smallint NOT NULL,
54225422
ref_count integer NOT NULL,
5423-
alt_count integer NOT NULL,
5424-
source_id smallint
5423+
alt_count integer NOT NULL
54255424
);
54265425

54275426
COMMENT ON TABLE DB_SCHEMA_NAME.variant_frequency IS 'Frequency in different studies of a given allele';
@@ -5436,10 +5435,9 @@ COMMENT ON COLUMN DB_SCHEMA_NAME.variant_frequency.ref_count IS 'Reference count
54365435

54375436
COMMENT ON COLUMN DB_SCHEMA_NAME.variant_frequency.alt_count IS 'Total count';
54385437

5439-
COMMENT ON COLUMN DB_SCHEMA_NAME.variant_frequency.source_id IS 'Foreign key to source.';
54405438

54415439
CREATE SEQUENCE DB_SCHEMA_NAME.variant_frequency_sq
5442-
START WITH 18778296255
5440+
START WITH 1
54435441
INCREMENT BY 1
54445442
NO MINVALUE
54455443
NO MAXVALUE
@@ -5659,7 +5657,7 @@ CREATE SEQUENCE DB_SCHEMA_NAME.web_job_document_sq
56595657
CACHE 1;
56605658

56615659
CREATE SEQUENCE DB_SCHEMA_NAME.web_job_sq
5662-
START WITH 1640
5660+
START WITH 1
56635661
INCREMENT BY 1
56645662
NO MINVALUE
56655663
NO MAXVALUE
@@ -5734,7 +5732,7 @@ COMMENT ON COLUMN DB_SCHEMA_NAME.web_user.manager_id IS 'Foreign key to web_user
57345732
COMMENT ON COLUMN DB_SCHEMA_NAME.web_user.worker_type IS 'Type of worker - employee or contingent';
57355733

57365734
CREATE SEQUENCE DB_SCHEMA_NAME.web_user_seq
5737-
START WITH 2000
5735+
START WITH 1
57385736
INCREMENT BY 1
57395737
NO MINVALUE
57405738
NO MAXVALUE
@@ -7390,6 +7388,9 @@ ALTER TABLE ONLY DB_SCHEMA_NAME.variant_freq_study
73907388
ALTER TABLE ONLY DB_SCHEMA_NAME.variant_frequency
73917389
ADD CONSTRAINT variant_frequency_pkey PRIMARY KEY (variant_frequency_id);
73927390

7391+
ALTER TABLE ONLY DB_SCHEMA_NAME.variant_frequency
7392+
ADD CONSTRAINT variant_frequency_uk UNIQUE (variant_change_id, variant_freq_study_id);
7393+
73937394
ALTER TABLE ONLY DB_SCHEMA_NAME.variant_info
73947395
ADD CONSTRAINT variant_info_pkey PRIMARY KEY (variant_info_id);
73957396

BACKEND/INSTALL/runInstall.php

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,22 @@
44
$TG_DIR=getenv('TG_DIR');
55
if ($TG_DIR===false)die('TG_DIR not set in setenv.sh');/// TG_DIR is not set as environment variable
66
if (!is_dir($TG_DIR))die('Unable to find directory '.$TG_DIR);//// TG_DIR is not an existing directory
7-
if (!is_file($TG_DIR.'/BACKEND/CONTAINER/env-file.txt'))die('No environment file found');
8-
if (!is_file($TG_DIR.'/BACKEND/CONTAINER/biorels_container.sif'))echo ('Warning - No container file found');
7+
if (!is_file($TG_DIR.'/BACKEND/CONTAINER/env-file.txt'))die('No environment file found'."\n");
8+
if (!is_file($TG_DIR.'/BACKEND/CONTAINER/biorels_container.sif'))echo ('Warning - No container file found'."\n");
9+
10+
$AGREE_ALL=false;
11+
if (isset($argv[1]) && $argv[1]=='--agree') $AGREE_ALL=true;
12+
913

1014
echo "Root directory for biorels: ".$TG_DIR."\n";
11-
$resSTDIN=fopen("php://stdin","r");
15+
if (!$AGREE_ALL)
16+
{
17+
$resSTDIN=fopen("php://stdin","r");
1218
echo("Do you confirm? Y/N. Then press return: ");
1319
$strChar = stream_get_contents($resSTDIN, 1);
1420
if ($strChar=='N') die('You did not agreed'."\n");
1521
if ($strChar!='Y') die('We didn\'t understood the answer'."\n");
16-
22+
}
1723
/// Getting environment variables defined in setenv.sh. Here it's DB_SCHEMA, the name of the public schema
1824
$DB_SCHEMA=getenv('DB_SCHEMA'); if ($DB_SCHEMA===false) die('No schema provided');
1925
/// Getting environment variables defined in setenv.sh. Here it's PRIVATE_SCHEMA, the name of the private schema
@@ -22,12 +28,14 @@
2228

2329

2430
echo "\n\n\nPublic schema:".$DB_SCHEMA."\n";
31+
if (!$AGREE_ALL)
32+
{
2533
$resSTDIN=fopen("php://stdin","r");
2634
echo("This will delete this schema if it exists. Do you confirm? Y/N. Then press return: ");
2735
$strChar = stream_get_contents($resSTDIN, 1);
2836
if ($strChar=='N') die('You did not agreed'."\n");
2937
if ($strChar!='Y') die('We didn\'t understood the answer'."\n");
30-
38+
}
3139

3240
echo "\n\nCreating tables for ".$DB_SCHEMA."\n";
3341
/// Here we are going to convert the sql template file into the installation file, which includes the correct schema name.
@@ -47,11 +55,14 @@
4755
if ($PRIVATE_SCHEMA!==false)
4856
{
4957
echo "\n\n\n\nPrivate schema:".$PRIVATE_SCHEMA."\n";
58+
if (!$AGREE_ALL)
59+
{
5060
$resSTDIN=fopen("php://stdin","r");
5161
echo("This will delete this schema if it exists. Do you confirm? Y/N. Then press return: ");
5262
$strChar = stream_get_contents($resSTDIN, 1);
5363
if ($strChar=='N') die('You did not agreed'."\n");
5464
if ($strChar!='Y') die('We didn\'t understood the answer'."\n");
65+
}
5566
$change=array('DB_SCHEMA_NAME'=>$DB_SCHEMA,'DB_PRIVATE_SCHEMA'=>$PRIVATE_SCHEMA);
5667
//// Here we convert the template sql file by changing the template schema name to the private schema name
5768
convertFile($TG_DIR.'/BACKEND/INSTALL/biorels_private.sql',$TG_DIR.'/BACKEND/INSTALL/private_schema_ready.sql',$change);

BACKEND/SCRIPT/API/queries.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2774,14 +2774,12 @@ function get_translation_isoform_pos($ISOFORM_ID,$POSITION)
27742774
# // Title: Search gene ontology record by name and/or accession and/or namespace
27752775
# // Function: search_gene_ontology
27762776
# // Description: Search for a gene ontology record by using its name and/or accession and/or namespace
2777-
# // Parameter: AC | Gene ontology accession | string | GO:0010389 | optional
2777+
# // Parameter: AC | Gene ontology accession | string | GO:0010389
27782778
# // Parameter: NAME | Gene ontology name | string | cell cycle | optional
27792779
# // Parameter: NAMESPACE | Gene ontology namespace | string | biological_process | optional
27802780
# // Return: Gene ontology record
27812781
# // Ecosystem: Proteomics:gene ontology
27822782
# // Example: php biorels_api.php search_gene_ontology -AC 'GO:0010389'
2783-
# // Example: php biorels_api.php search_gene_ontology -NAME 'cell cycle'
2784-
# // Example: php biorels_api.php search_gene_ontology -NAMESPACE 'biological_process'
27852783
# // $[/API]
27862784
function search_gene_ontology($AC='',$NAME='',$NAMESPACE='')
27872785
{

BACKEND/SCRIPT/BIORJ/BIORJ_RULES

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,14 +155,15 @@ CHILD drug_atc_map<atc_entry
155155
#CHILD drug_mol_entity_map
156156
END
157157

158-
BLOCK clinical_variant
158+
BLOCK clinical_variant_entry
159159
PARENT clinical_variant_review_status
160-
CHILD clinical_variant_disease_map<disease_entry
161-
CHILD clinical_variant_gn_map<gn_entry
162-
CHILD clinical_variant_map<variant_entry
163-
CHILD clinical_variant_pmid_map<pmid_entry:E
160+
PARENT clinical_variant_type<so_entry
161+
CHILD clinical_variant_map<variant_entry:E
162+
CHILD clinical_variant_submission>clinical_variant_pmid_map<pmid_entry:E
164163
CHILD clinical_variant_submission<clinical_variant_review_status
165164
CHILD clinical_variant_submission<clinical_significance
165+
CHILD clinical_variant_submission>clinical_variant_disease_map<disease_entry:E
166+
CHILD clinical_variant_submission>clinical_variant_gn_map<gn_entry:E
166167
END
167168

168169

@@ -195,6 +196,7 @@ BLOCK variant_entry
195196
CHILD variant_position<chr_seq_pos<chr_seq<chromosome<taxon
196197
CHILD variant_position<chr_seq_pos<chr_seq<genome_assembly<taxon
197198
CHILD variant_position<variant_allele
199+
CHILD clinical_variant_map<clinical_variant_entry:E
198200
CHILD variant_position>variant_change<variant_type<so_entry
199201
CHILD variant_position>variant_change<variant_allele
200202
CHILD variant_position>variant_change>variant_frequency<variant_freq_study<source
@@ -306,6 +308,7 @@ clinical_trial_intervention intervention_name|clinical_trial_id|intervention_typ
306308
clinical_trial_intervention_drug_map clinical_trial_intervention_id|drug_entry_id|source_id
307309
clinical_trial_arm_intervention_map clinical_trial_arm_id|clinical_trial_intervention_id
308310
clinical_trial_alias alias_name|clinical_trial_id
311+
clinical_variant_entry clinical_variant_name
309312
clinical_variant_disease_map disease_entry_id|clinvar_submission_id
310313
clinical_variant_gn_map gn_entry_id|clinvar_submission_id
311314
clinical_variant_map clinvar_entry_id|variant_entry_id
@@ -382,7 +385,7 @@ pmid_abstract pmid_entry_id|abstract_type
382385
pmid_citation pmid_entry_id|citation_pmid_entry_id
383386
pmid_company_map company_entry_id|pmid_entry_id
384387
pmid_instit instit_hash
385-
pmid_journal journal_name
388+
pmid_journal journal_name|issn_print
386389
prot_ac ac|prot_entry_id
387390
prot_desc prot_entry_id|desc_type|description
388391
prot_desc_pmid prot_desc_id|pmid_entry_id

BACKEND/SCRIPT/BIORJ/Example/rs712.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

BACKEND/SCRIPT/BIORJ/api_export.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
'/LIB/loader_process.php'=>0
1414
);
1515

16+
$DEBUG=false;
17+
1618
function microtime_float()
1719
{
1820
list($usec, $sec) = explode(" ", microtime());

BACKEND/SCRIPT/BIORJ/api_import.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ function microtime_float()
4949

5050
connectDB();
5151

52+
$DEBUG=false;
5253

5354

5455
if ($argc<2)

0 commit comments

Comments
 (0)