-- DBMS: bigquery
CREATE TABLE `isb-cgc-bq.HTAN_versioned.bulkRNAseq_level3_metadata_r4`
(
  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)"),
  Id STRING OPTIONS(description="Unique identifier of entity e.g. a96059eb-81af-4b24-ae50-9242c0d8f819"),
  Software_and_Version STRING OPTIONS(description="Name of software used to generate expression values. String"),
  Specify_Other_Fusion_Gene STRING OPTIONS(description="Specify fusion gene detected, if not in list"),
  Expression_Units STRING OPTIONS(description="How quantities are corrected for gene length"),
  Fusion_Gene_Detected STRING OPTIONS(description="Was a fusion gene identified?"),
  entityId STRING OPTIONS(description="Synapse ID of entity"),
  Genomic_Reference STRING OPTIONS(description="Exact version of the human genome reference used in the alignment of reads (e.g. GCF_000001405.39)"),
  Matrix_Type STRING OPTIONS(description="Type of data stored in matrix."),
  Component STRING OPTIONS(description="Category of metadata (e.g. Diagnosis, Biospecimen, scRNA-seq Level 1, etc.); provide the same one for all items/rows."),
  Fusion_Gene_Identity STRING OPTIONS(description="The gene symbols of fused genes."),
  Pseudo_Alignment_Used STRING OPTIONS(description="Pseudo aligners such as Kallisto or Salmon do not produce aligned reads BAM files. True indicates pseudoalignment was used."),
  Workflow_Link STRING OPTIONS(description="Link to workflow or command. DockStore.org recommended. URL"),
  File_Format STRING OPTIONS(description="Format of a file (e.g. txt, csv, fastq, bam, etc.)"),
  Filename STRING OPTIONS(description="Name of a file"),
  HTAN_Parent_Data_File_ID STRING OPTIONS(description="HTAN Data File Identifier indicating the file(s) from which these files were derived"),
  Genomic_Reference_URL STRING OPTIONS(description="Link to human genome sequence (e.g. ftp://ftp.ebi.ac.uk/pub/databases/gencode/Gencode_human/release_34/GRCh38.primary_assembly.genome.fa.gz)"),
  Data_Category STRING OPTIONS(description="Specific content type of the data file."),
  HTAN_Center STRING OPTIONS(description="Name of HTAN Center e.g. HTAN HTAPP"),
  Manifest_Id STRING OPTIONS(description="Synapse ID of manifest containing file annotation"),
  Manifest_Version INT64 OPTIONS(description="Latest version of metadata manifest"),
  File_Size INT64 OPTIONS(description="Size of file (bucket object) in bytes"),
  md5 STRING OPTIONS(description="md5 hash of file"),
  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")
)
OPTIONS(
  friendly_name="HTAN BULKRNASEQ LEVEL 3 METADATA R4 VERSIONED",
  description="This table contains the file metadata for third level (i.e. expression quantification files) bulk RNA sequencing data extracted from HTAN Synapse projects in October 2023. More details: see https://data.humantumoratlas.org/standard/sequencing",
  labels=[("access", "open"), ("data_type", "file_metadata"), ("program", "htan"), ("source", "htan"), ("category", "metadata"), ("status", "current")]
);

INSERT INTO `isb-cgc-bq.HTAN_versioned.bulkRNAseq_level3_metadata_r4` (HTAN_Data_File_ID, Id, Software_and_Version, Specify_Other_Fusion_Gene, Expression_Units, Fusion_Gene_Detected, entityId, Genomic_Reference, Matrix_Type, Component, Fusion_Gene_Identity, Pseudo_Alignment_Used, Workflow_Link, File_Format, Filename, HTAN_Parent_Data_File_ID, Genomic_Reference_URL, Data_Category, HTAN_Center, Manifest_Id, Manifest_Version, File_Size, md5, Data_Release, CDS_Release) VALUES ('HTA9_1_19618', 'e81ba590-fcb9-4b52-9716-114903229576', NULL, NULL, 'TPM', NULL, 'syn26535393', NULL, 'Raw Counts', 'BulkRNA-seqLevel3', NULL, 'No', NULL, 'tsv', 'bulk_rnaseq_level_3/0000254583_kallisto.tsv', 'HTA9_1_1150;HTA9_1_1147', NULL, 'Isoform Expression Quantification', 'HTAN OHSU', 'syn39142026', 5, 27783714, '4a130d14742afee7d041d41d0b9f9733', 'Release 2.0', NULL), ('HTA9_1_19619', '1dcba2bb-9b0f-4b1e-bcc7-340ac8430b87', NULL, NULL, 'TPM', NULL, 'syn26535398', NULL, 'Raw Counts', 'BulkRNA-seqLevel3', NULL, 'No', NULL, 'tsv', 'bulk_rnaseq_level_3/0000264005_kallisto.tsv', 'HTA9_1_1148;HTA9_1_1146', NULL, 'Isoform Expression Quantification', 'HTAN OHSU', 'syn39142026', 5, 28009572, 'fcc9dd764248ea99dc1be1b377e903af', 'Release 2.0', NULL), ('HTA9_1_19620', 'ff3db17d-7142-42f2-aa2b-9fb1a6564c9c', NULL, NULL, 'TPM', NULL, 'syn26535394', NULL, 'Raw Counts', 'BulkRNA-seqLevel3', NULL, 'No', NULL, 'tsv', 'bulk_rnaseq_level_3/0000322075_kallisto.tsv', 'HTA9_1_19612;HTA9_1_19614', NULL, 'Isoform Expression Quantification', 'HTAN OHSU', 'syn39142026', 5, 27802284, 'a9266d58872d76784c86574cc1b1ac9e', 'Release 2.0', NULL), ('HTA9_1_19621', 'ca59348a-c26d-4f22-b676-01eb91072abd', NULL, NULL, 'TPM', NULL, 'syn26535396', NULL, 'Raw Counts', 'BulkRNA-seqLevel3', NULL, 'No', NULL, 'tsv', 'bulk_rnaseq_level_3/0000265302_kallisto.tsv', 'HTA9_1_1145;HTA9_1_1149', NULL, 'Isoform Expression Quantification', 'HTAN OHSU', 'syn39142026', 5, 27947186, '1020e107d42b27c6d87948d8932d9180', 'Release 2.0', NULL), ('HTA9_1_19622', '91e1c790-a34e-476e-827e-184ef43b4b85', NULL, NULL, 'TPM', NULL, 'syn26535392', NULL, 'Raw Counts', 'BulkRNA-seqLevel3', NULL, 'No', NULL, 'tsv', 'bulk_rnaseq_level_3/0000322075-counts.txt', 'HTA9_1_19617', NULL, 'Isoform Expression Quantification', 'HTAN OHSU', 'syn39142026', 5, 27819541, 'baeca7b216861296c7ee15042ac8ef5e', 'Release 2.0', NULL);