Skip to content

Commit

Permalink
a little mistake. Correct them.
Browse files Browse the repository at this point in the history
  • Loading branch information
zzyueb committed Feb 15, 2021
1 parent fbb70d4 commit 370ab03
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
4 changes: 3 additions & 1 deletion load_UMLS.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/usr/bin zsh

# change the user and database according to your parctice.

echo "Loading UMLS 2020 tables and data"
psql -U postgres -d umls -f pgsql_all_tables.sql
echo "Tables loaded"
psql -U jmbanda -d umls2018aa -f pgsql_index.sql
psql -U postgres -d umls -f pgsql_index.sql
echo "Indexing Ready"
22 changes: 19 additions & 3 deletions pgsql_all_tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ This script has been tested in PostgreSQL 8.2.3 on Mac OS 10.4.10
# The script can also work with PostgreSQL 11.2 and UMLS-2020AB by Zhao Zhengyang ([email protected])
Thank you for Mr Banda and Mr Bedrick!
Please point each 'COPY' statement to your local '/tmp/META' installation directory, or wherever you have stored the .RRF files output by MetamorphoSys.
This script has been tested in PostgreSQL 11.2 on Linux (Deepin 20.1, Debain 10 cored).
*/

create schema if not exists _2020ab;
create schema if not exists _2020ab; /* You can change the schema name as your wish. */
set schema '_2020ab';

DROP TABLE if exists MRCOLS;
Expand All @@ -28,6 +27,7 @@ CREATE TABLE MRCOLS (
dummy char(1)
);

---change the path of RRF file according the practice---
COPY MRCOLS FROM '/media/yuebing/new_dev/umls/2020AB/META/MRCOLS.RRF'
WITH DELIMITER AS '|' NULL AS '';
ALTER TABLE MRCOLS DROP COLUMN dummy;
Expand Down Expand Up @@ -351,6 +351,22 @@ CREATE TABLE MRXW_ENG (
COPY MRXW_ENG FROM '/media/yuebing/new_dev/umls/2020AB/META/MRXW_ENG.RRF' WITH DELIMITER AS '|' NULL AS '';
ALTER TABLE MRXW_ENG DROP COLUMN dummy;

/* Because I only use English items, I deleted the load of MRXW_XXX loaders except English one.
If you want to load another language, you can rewrite the SQL expression as follows:
DROP TABLE if exists MRXW_LAN; ---'LAN' means the language.---
CREATE TABLE MRXW_ENG (
LAT char(3) NOT NULL,
WD varchar(100) NOT NULL,
CUI char(12) NOT NULL,
LUI char(12) NOT NULL,
SUI char(12) NOT NULL,
dummy char(1)
);
COPY MRXW_LAN FROM '/your/path/META/MRXW_ENG.RRF' WITH DELIMITER AS '|' NULL AS '';
ALTER TABLE MRXW_LAN DROP COLUMN dummy;
*/

DROP TABLE if exists MRAUI;
CREATE TABLE MRAUI (
AUI1 varchar(9) NOT NULL,
Expand All @@ -364,7 +380,7 @@ CREATE TABLE MRAUI (
MAPIN char(1) NOT NULL,
dummy char(1)
);
COPY MRAUI FROM '/media/yuebing/new_dev/umls/2020AB/META//MRAUI.RRF' WITH DELIMITER AS '|' NULL AS '';
COPY MRAUI FROM '/media/yuebing/new_dev/umls/2020AB/META/MRAUI.RRF' WITH DELIMITER AS '|' NULL AS '';
ALTER TABLE MRAUI DROP COLUMN dummy;


Expand Down
4 changes: 4 additions & 0 deletions pgsql_index.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@
Created by:
Yeb Havinga, MSc
[email protected]
Modified by:
Juan M. Banda
[email protected]
Tested by:
Zhao Zhengyang
[email protected]
*/

--- I deleted the expression where tables does not exist in this version. ---

CREATE INDEX X_MRCONSO_CUI ON MRCONSO(CUI);
ALTER TABLE MRCONSO ADD CONSTRAINT X_MRCONSO_PK PRIMARY KEY (AUI);
Expand Down

0 comments on commit 370ab03

Please sign in to comment.