-- DBMS: bigquery
CREATE TABLE `isb-cgc-bq.HTAN_versioned.id_provenance_r3`
(
  HTAN_Data_File_ID STRING OPTIONS(description="Self-identifier for this data file - HTAN ID of this file HTAN ID SOP (eg HTANx_yyy_zzz)"),
  HTAN_Assayed_Biospecimen_ID STRING OPTIONS(description="HTAN ID of the biospecimen directly assayed using the experimental platform"),
  HTAN_Parent_Data_File_ID STRING OPTIONS(description="HTAN Data File Identifier indicating the file(s) from which these files were derived"),
  Filename STRING OPTIONS(description="Name of a file"),
  entityId STRING OPTIONS(description="Synapse ID of entity"),
  Component STRING OPTIONS(description="Category of metadata (e.g. Diagnosis, Biospecimen, scRNA-seq Level 1, etc.); provide the same one for all items/rows."),
  Data_Release STRING OPTIONS(description="Inclusion in HTAN Data Release e.g. Release 1.0"),
  CDS_Release STRING OPTIONS(description="CDS transfer package in which file was included e.g. v22.6.1.seq"),
  HTAN_Center STRING OPTIONS(description="Name of HTAN Center e.g. HTAN HTAPP"),
  HTAN_Originating_Biospecimen_ID STRING OPTIONS(description="HTAN ID of the biopsied or resected biospecimen from the patient from which the assay data were derived"),
  HTAN_Participant_ID STRING OPTIONS(description="HTAN ID associated with a patient based on HTAN ID SOP (eg HTANx_yyy )"),
  Biospecimen_Path STRING OPTIONS(description="Full Biospecimen ancestry path from HTAN_Originating_Biospecimen_ID to HTAN_Assayed_Biospecimen_ID as comma separated list")
)
OPTIONS(
  friendly_name="ID PROVENANCE TABLE R3 VERSIONED",
  description="This table contains biospecimen and participant IDs for each HTAN data file",
  labels=[("access", "open"), ("program", "htan"), ("source", "htan"), ("category", "metadata"), ("status", "current"), ("data_type", "file_metadata")]
);

INSERT INTO `isb-cgc-bq.HTAN_versioned.id_provenance_r3` (HTAN_Data_File_ID, HTAN_Assayed_Biospecimen_ID, HTAN_Parent_Data_File_ID, Filename, entityId, Component, Data_Release, CDS_Release, HTAN_Center, HTAN_Originating_Biospecimen_ID, HTAN_Participant_ID, Biospecimen_Path) VALUES ('HTA3_8001_4152544161', 'HTA3_8001_1001', 'HTA3_8001_6680165667', 'sc_rna_seq_level_3/Linh_UCLA/Case1_Normal_rawCount.csv', 'syn24827008', 'ScRNA-seqLevel3', 'Release 1.0', 'None', 'HTAN BU', 'HTA3_8001_1001', 'HTA3_8001', 'HTA3_8001_1001'), ('HTA3_8001_0344122741', 'HTA3_8001_1001', 'HTA3_8001_6680165667', 'sc_rna_seq_level_3/Linh_UCLA/Case1_Normal_logNorm.csv', 'syn24827023', 'ScRNA-seqLevel3', 'Release 1.0', 'None', 'HTAN BU', 'HTA3_8001_1001', 'HTA3_8001', 'HTA3_8001_1001'), ('HTA3_8001_8707583701', 'HTA3_8001_1001', 'HTA3_8001_6680165667', 'sc_rna_seq_level_3/Linh_UCLA/Case1_Normal_batchAdj.csv', 'syn24827011', 'ScRNA-seqLevel3', 'Release 1.0', 'None', 'HTAN BU', 'HTA3_8001_1001', 'HTA3_8001', 'HTA3_8001_1001'), ('HTA3_8001_7463840742', 'HTA3_8001_1001', 'HTA3_8001_0344122741', 'sc_rna_seq_level_4/Linh_UCLA/Case1_Normal_CD45Neg_clusterID.csv', 'syn24875894', 'ScRNA-seqLevel4', 'Release 1.0', 'None', 'HTAN BU', 'HTA3_8001_1001', 'HTA3_8001', 'HTA3_8001_1001'), ('HTA3_8001_2586675862', 'HTA3_8001_1001', 'HTA3_8001_0344122741', 'sc_rna_seq_level_4/Linh_UCLA/Case1_Normal_CD45Pos_clusterID.csv', 'syn24875897', 'ScRNA-seqLevel4', 'Release 1.0', 'None', 'HTAN BU', 'HTA3_8001_1001', 'HTA3_8001', 'HTA3_8001_1001');