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