-- DBMS: bigquery
CREATE TABLE `isb-cgc-bq.HTAN_versioned.bulkRNAseq_level2_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"),
  MSI_Score STRING OPTIONS(description="Numeric score denoting the aligned reads file's MSI score from MSIsensor. Number"),
  Average_Base_Quality STRING OPTIONS(description="Average base quality collected from samtools. Number"),
  Proportion_Reads_Mapped STRING OPTIONS(description="Proportion of mapped reads collected from samtools. 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"),
  entityId STRING OPTIONS(description="Synapse ID of entity"),
  MSI_Status STRING OPTIONS(description="MSIsensor determination of either microsatellite stability or instability."),
  Is_lowest_level STRING OPTIONS(description="Denotes that the manifest represents the lowest data level submitted. Use when L1 data is missing"),
  Genomic_Reference STRING OPTIONS(description="Exact version of the human genome reference used in the alignment of reads (e.g. GCF_000001405.39)"),
  Alignment_Workflow_Type STRING OPTIONS(description="Generic name for the workflow used to analyze a data set."),
  Index_File_Name STRING OPTIONS(description="The name (or part of a name) of a file (of any type). String"),
  Pairs_On_Diff_CHR STRING OPTIONS(description="Pairs on different chromosomes collected from samtools. Integer"),
  Component STRING OPTIONS(description="Category of metadata (e.g. Diagnosis, Biospecimen, scRNA-seq Level 1, etc.); provide the same one for all items/rows."),
  Average_Read_Length STRING OPTIONS(description="Average read length collected from samtools. Integer"),
  Total_Unmapped_reads STRING OPTIONS(description="Number of reads that did not map to genome. Integer"),
  Contamination_Error STRING OPTIONS(description="Estimation error of cross-sample contamination collected from GATK4. Number"),
  MSI_Workflow_Link STRING OPTIONS(description="Link to method workflow (or command) used in estimating the MSI. URL"),
  Proportion_Reads_Duplicated STRING OPTIONS(description="Proportion of duplicated reads collected from samtools. Number"),
  Proportion_Targets_No_Coverage STRING OPTIONS(description="Proportion of targets that did not reach 1X coverage over any base from Picard Tools. Number"),
  Alignment_Workflow_Url STRING OPTIONS(description="Link to workflow used for read alignment. DockStore.org recommended. String"),
  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"),
  Short_Reads STRING OPTIONS(description="Number of reads that were too short. Integer"),
  Total_Uniquely_Mapped STRING OPTIONS(description="Number of reads that map to genome. Integer"),
  Contamination STRING OPTIONS(description="Fraction of reads coming from cross-sample contamination collected from GATK4. Number"),
  Custom_Alignment_Workflow STRING OPTIONS(description="Specify the name of a custom alignment workflow"),
  Average_Insert_Size STRING OPTIONS(description="Average insert size collected from samtools. Integer"),
  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"),
  Proportion_Base_Mismatch STRING OPTIONS(description="Proportion of mismatched bases collected from samtools. Number"),
  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)"),
  Total_Reads STRING OPTIONS(description="Total number of reads per sample. Integer"),
  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 2 METADATA R4 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 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_level2_metadata_r4` (HTAN_Data_File_ID, Id, MSI_Score, Average_Base_Quality, Proportion_Reads_Mapped, Mean_Coverage, entityId, MSI_Status, Is_lowest_level, Genomic_Reference, Alignment_Workflow_Type, Index_File_Name, Pairs_On_Diff_CHR, Component, Average_Read_Length, Total_Unmapped_reads, Contamination_Error, MSI_Workflow_Link, Proportion_Reads_Duplicated, Proportion_Targets_No_Coverage, Alignment_Workflow_Url, HTAN_Parent_Biospecimen_ID, Short_Reads, Total_Uniquely_Mapped, Contamination, Custom_Alignment_Workflow, Average_Insert_Size, File_Format, Filename, HTAN_Parent_Data_File_ID, Proportion_Base_Mismatch, Genomic_Reference_URL, Total_Reads, HTAN_Center, Manifest_Id, Manifest_Version, File_Size, md5, Data_Release, CDS_Release) VALUES ('HTA9_1_19616', 'b3bfe676-4809-45b7-ad63-fff23243738e', NULL, NULL, NULL, NULL, 'syn26535640', NULL, NULL, 'Not Available', 'STAR 2-Pass', 'Not Available', NULL, 'BulkRNA-seqLevel2', NULL, NULL, NULL, NULL, NULL, NULL, 'Not Available', NULL, NULL, NULL, NULL, NULL, NULL, 'bam', 'bulk_rnaseq_level_2/0000321955.bam', 'HTA9_1_19615;HTA9_1_19613', NULL, 'Not Available', NULL, 'HTAN OHSU', 'syn39142062', 5, 9776713676, 'c379a524ef20117b2d6af657d933b676', 'Release 2.0', 'v22.6.1.seq'), ('HTA9_1_19617', '9c2a4f4b-99dc-4cc1-a728-6e4701c3f9cb', NULL, NULL, NULL, NULL, 'syn26535666', NULL, NULL, 'Not Available', 'STAR 2-Pass', 'Not Available', NULL, 'BulkRNA-seqLevel2', NULL, NULL, NULL, NULL, NULL, NULL, 'Not Available', NULL, NULL, NULL, NULL, NULL, NULL, 'bam', 'bulk_rnaseq_level_2/0000322075.bam', 'HTA9_1_19612;HTA9_1_19614', NULL, 'Not Available', NULL, 'HTAN OHSU', 'syn39142062', 5, 11533265411, '938acff35cb400d313a2c531670aa14f', 'Release 2.0', 'v22.6.1.seq'), ('HTA9_15_9710', '4bf4a717-1b2d-426e-8200-752e2021ba8c', NULL, NULL, NULL, NULL, 'syn51535012', NULL, NULL, 'Not Available', 'STAR 2-Pass', 'Not Available', NULL, 'BulkRNA-seqLevel2', NULL, NULL, NULL, NULL, NULL, NULL, 'Not Available', NULL, NULL, NULL, NULL, NULL, NULL, 'bam', 'bulk_rnaseq_level_2/0000191980.bam', 'HTA9_15_9703;HTA9_15_9708', NULL, 'Not Available', NULL, 'HTAN OHSU', 'syn39142062', 5, 7071011876, 'e18da496ca616c4405e4a15620a7fb05', 'Release 4.0', NULL), ('HTA9_10_1007', '0401f2db-26bb-4fa6-a7b5-c513ee64b8f4', NULL, NULL, NULL, NULL, 'syn51535299', NULL, NULL, 'Not Available', 'STAR 2-Pass', 'Not Available', NULL, 'BulkRNA-seqLevel2', NULL, NULL, NULL, NULL, NULL, NULL, 'Not Available', NULL, NULL, NULL, NULL, NULL, NULL, 'bam', 'bulk_rnaseq_level_2/0000265752.bam', 'HTA9_10_1002;HTA9_10_1004', NULL, 'Not Available', NULL, 'HTAN OHSU', 'syn39142062', 5, 11104432031, '0623d895e58e2833bd2063d49d813a02', 'Release 4.0', NULL), ('HTA9_2_11935', '8d62ca84-0387-4539-92ca-e7dae35606f7', NULL, NULL, NULL, NULL, 'syn51535028', NULL, NULL, 'Not Available', 'STAR 2-Pass', 'Not Available', NULL, 'BulkRNA-seqLevel2', NULL, NULL, NULL, NULL, NULL, NULL, 'Not Available', NULL, NULL, NULL, NULL, NULL, NULL, 'bam', 'bulk_rnaseq_level_2/0000272830.bam', 'HTA9_2_11931;HTA9_2_11932', NULL, 'Not Available', NULL, 'HTAN OHSU', 'syn39142062', 5, 7266636370, '1c8441edeab166c583d26b42f74eb244', 'Release 4.0', NULL);