-- DBMS: bigquery
CREATE TABLE `isb-cgc-bq.HTAN_versioned.bulkRNAseq_level2_metadata_r3`
(
  Component STRING OPTIONS(description="Category of metadata (e.g. Diagnosis, Biospecimen, scRNA-seq Level 1, etc.); provide the same one for all items/rows."),
  Filename STRING OPTIONS(description="Name of a file"),
  File_Format STRING OPTIONS(description="Format of a file (e.g. txt, csv, fastq, bam, etc.)"),
  HTAN_Parent_Data_File_ID STRING OPTIONS(description="HTAN Data File Identifier indicating the file(s) from which these files were derived"),
  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)"),
  Alignment_Workflow_Url STRING OPTIONS(description="Link to workflow used for read alignment. DockStore.org recommended. String"),
  Alignment_Workflow_Type STRING OPTIONS(description="Generic name for the workflow used to analyze a data set."),
  Genomic_Reference STRING OPTIONS(description="Exact version of the human genome reference used in the alignment of reads (e.g. GCF_000001405.39)"),
  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)"),
  Index_File_Name STRING OPTIONS(description="The name (or part of a name) of a file (of any type). String"),
  Average_Base_Quality STRING OPTIONS(description="Average base quality collected from samtools. Number"),
  Average_Insert_Size STRING OPTIONS(description="Average insert size collected from samtools. Integer"),
  Average_Read_Length STRING OPTIONS(description="Average read length collected from samtools. Integer"),
  Contamination STRING OPTIONS(description="Fraction of reads coming from cross-sample contamination collected from GATK4. Number"),
  Contamination_Error STRING OPTIONS(description="Estimation error of cross-sample contamination collected from GATK4. Number"),
  Mean_Coverage STRING OPTIONS(description="Mean coverage for whole genome sequencing, or mean target coverage for whole exome and targeted sequencing, collected from Picard. Number"),
  MSI_Workflow_Link STRING OPTIONS(description="Link to method workflow (or command) used in estimating the MSI. URL"),
  MSI_Score STRING OPTIONS(description="Numeric score denoting the aligned reads file's MSI score from MSIsensor. Number"),
  MSI_Status STRING OPTIONS(description="MSIsensor determination of either microsatellite stability or instability."),
  Pairs_On_Diff_CHR STRING OPTIONS(description="Pairs on different chromosomes collected from samtools. Integer"),
  Total_Reads STRING OPTIONS(description="Total number of reads per sample. Integer"),
  Total_Uniquely_Mapped STRING OPTIONS(description="Number of reads that map to genome. Integer"),
  Total_Unmapped_reads STRING OPTIONS(description="Number of reads that did not map to genome. Integer"),
  Proportion_Reads_Duplicated STRING OPTIONS(description="Proportion of duplicated reads collected from samtools. Number"),
  Proportion_Reads_Mapped STRING OPTIONS(description="Proportion of mapped reads collected from samtools. Number"),
  Proportion STRING OPTIONS(description="Description unavailable. Contact HTAN DCC for more information"),
  Targets_No_Coverage STRING OPTIONS(description="Description unavailable. Contact HTAN DCC for more information"),
  Proportion_Base_Mismatch STRING OPTIONS(description="Proportion of mismatched bases collected from samtools. Number"),
  Short_Reads STRING OPTIONS(description="Number of reads that were too short. Integer"),
  Is_lowest_level STRING OPTIONS(description="Denotes that the manifest represents the lowest data level submitted. Use when L1 data is missing"),
  entityId STRING OPTIONS(description="Synapse ID of entity"),
  HTAN_Center STRING OPTIONS(description="Name of HTAN Center e.g. HTAN HTAPP"),
  Data_Release STRING OPTIONS(description="Inclusion in HTAN Data Release e.g. Release 1.0"),
  Manifest_Version INT64 OPTIONS(description="Latest version of metadata manifest"),
  Uuid STRING OPTIONS(description="Unique identifier of entity e.g. a96059eb-81af-4b24-ae50-9242c0d8f819"),
  HTAN_Parent_Biospecimen_ID STRING OPTIONS(description="HTAN Biospecimen Identifier (eg HTANx_yyy_zzz) indicating the biospecimen(s) from which these files were derived; multiple parent biospecimen should be comma-separated"),
  File_Size INT64 OPTIONS(description="Size of file (bucket object) in bytes"),
  md5 STRING OPTIONS(description="md5 hash of file"),
  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 2 METADATA R3 VERSIONED",
  description="This table contains the file metadata for second level (i.e. BAM files) bulk RNA sequencing. Data was extracted from HTAN Synapse projects in April 2023. More details: see https://data.humantumoratlas.org/standard/sequencing",
  labels=[("access", "open"), ("data_type", "file_metadata"), ("program", "htan"), ("source", "htan"), ("status", "current"), ("category", "metadata")]
);

INSERT INTO `isb-cgc-bq.HTAN_versioned.bulkRNAseq_level2_metadata_r3` (Component, Filename, File_Format, HTAN_Parent_Data_File_ID, HTAN_Data_File_ID, Alignment_Workflow_Url, Alignment_Workflow_Type, Genomic_Reference, Genomic_Reference_URL, Index_File_Name, Average_Base_Quality, Average_Insert_Size, Average_Read_Length, Contamination, Contamination_Error, Mean_Coverage, MSI_Workflow_Link, MSI_Score, MSI_Status, Pairs_On_Diff_CHR, Total_Reads, Total_Uniquely_Mapped, Total_Unmapped_reads, Proportion_Reads_Duplicated, Proportion_Reads_Mapped, Proportion, Targets_No_Coverage, Proportion_Base_Mismatch, Short_Reads, Is_lowest_level, entityId, HTAN_Center, Data_Release, Manifest_Version, Uuid, HTAN_Parent_Biospecimen_ID, File_Size, md5, CDS_Release) VALUES ('BulkRNA-seqLevel2', 'bulk_rnaseq_level_2/0000321955.bam', 'bam', 'HTA9_1_19615;HTA9_1_19613', 'HTA9_1_19616', 'Not Available', 'STAR 2-Pass', 'Not Available', 'Not Available', 'Not Available', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'syn26535640', 'HTAN OHSU', 'Release 2.0', 3, 'b3bfe676-4809-45b7-ad63-fff23243738e', NULL, 9776713676, 'c379a524ef20117b2d6af657d933b676', 'v22.6.1.seq'), ('BulkRNA-seqLevel2', 'bulk_rnaseq_level_2/0000322075.bam', 'bam', 'HTA9_1_19612;HTA9_1_19614', 'HTA9_1_19617', 'Not Available', 'STAR 2-Pass', 'Not Available', 'Not Available', 'Not Available', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'syn26535666', 'HTAN OHSU', 'Release 2.0', 3, '9c2a4f4b-99dc-4cc1-a728-6e4701c3f9cb', NULL, 11533265411, '938acff35cb400d313a2c531670aa14f', 'v22.6.1.seq'), ('BulkRNA-seqLevel2', 'PickSeq_Level_2/MEL202112/s1.bam', 'bam', 'HTA7_1_1009, HTA7_1_1010', 'HTA7_1_1453', 'https://bcbio-nextgen.readthedocs.io/en/latest/contents/bulk_rnaseq.html', 'STAR 2-Pass Transcriptome', 'HG38', 'https://gdc.cancer.gov/about-data/gdc-data-processing/gdc-reference-files', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'syn26546212', 'HTAN HMS', 'Release 2.0', 3, '8ba50fdb-62cb-486a-8850-99e751ff1dcb', NULL, 409473669, '4b6feda53660a3a30fd965d54b6ba8e6', 'v22.6.1.seq'), ('BulkRNA-seqLevel2', 'PickSeq_Level_2/MEL202112/s10.bam', 'bam', 'HTA7_1_1011, HTA7_1_1012', 'HTA7_1_1454', 'https://bcbio-nextgen.readthedocs.io/en/latest/contents/bulk_rnaseq.html', 'STAR 2-Pass Transcriptome', 'HG38', 'https://gdc.cancer.gov/about-data/gdc-data-processing/gdc-reference-files', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'syn26546264', 'HTAN HMS', 'Release 2.0', 3, '9ab71e1e-d066-48b7-9df2-d3646236cd90', NULL, 222093197, '58f731d6d6c71ebc2fcfa02a4844edc1', 'v22.6.1.seq'), ('BulkRNA-seqLevel2', 'PickSeq_Level_2/MEL202112/s100.bam', 'bam', 'HTA7_1_1013, HTA7_1_1014', 'HTA7_1_1455', 'https://bcbio-nextgen.readthedocs.io/en/latest/contents/bulk_rnaseq.html', 'STAR 2-Pass Transcriptome', 'HG38', 'https://gdc.cancer.gov/about-data/gdc-data-processing/gdc-reference-files', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'syn26546266', 'HTAN HMS', 'Release 2.0', 3, 'f467eb64-6166-4ee9-988b-3d8f60daaded', NULL, 281144172, 'b982f73576ff9e32f9a4e5b82c2275f1', 'v22.6.1.seq');