-- DBMS: bigquery
CREATE TABLE `isb-cgc-bq.HTAN_versioned.bulkWES_level2_metadata_r5`
(
  Total_Unmapped_reads STRING OPTIONS(description="Number of reads that did not map to genome. Integer"),
  Adapter_Content STRING OPTIONS(description="State classification given by FASTQC for the metric. Metric specific details about the states are available on their website."),
  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"),
  Basic_Statistics STRING OPTIONS(description="State classification given by FASTQC for the metric. Metric specific details about the states are available on their website."),
  Component STRING OPTIONS(description="Category of metadata (e.g. Diagnosis, Biospecimen, scRNA-seq Level 1, etc.); provide the same one for all items/rows."),
  Per_Base_Sequence_Content STRING OPTIONS(description="State classification given by FASTQC for the metric. Metric specific details about the states are available on their website."),
  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"),
  QC_Workflow_Link STRING OPTIONS(description="Link to workflow used. String"),
  Pairs_On_Diff_CHR STRING OPTIONS(description="Pairs on different chromosomes collected from samtools. Integer"),
  QC_Workflow_Version STRING OPTIONS(description="Major version for a workflow. String"),
  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"),
  Proportion_Coverage_10x STRING OPTIONS(description="Proportion of all reference bases for whole genome sequencing, or targeted bases for whole exome and targeted sequencing, that achieves 10X or greater coverage from Picard Tools."),
  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)"),
  Per_Sequence_GC_Content STRING OPTIONS(description="State classification given by FASTQC for the metric. Metric specific details about the states are available on their website."),
  Overrepresented_Sequences STRING OPTIONS(description="State classification given by FASTQC for the metric. Metric specific details about the states are available on their website."),
  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."),
  Sequence_Length_Distribution STRING OPTIONS(description="State classification given by FASTQC for the metric. Metric specific details about the states are available on their website."),
  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."),
  Sequence_Duplication_Levels STRING OPTIONS(description="State classification given by FASTQC for the metric. Metric specific details about the states are available on their website."),
  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"),
  Percent_GC_Content STRING OPTIONS(description="The overall %GC of all bases in all sequences. Integer"),
  Per_Tile_Sequence_Quality STRING OPTIONS(description="State classification given by FASTQC for the metric. Metric specific details about the states are available on their website."),
  Index_File_Name STRING OPTIONS(description="The name (or part of a name) of a file (of any type). String"),
  Proportion_Coverage_30X STRING OPTIONS(description="Proportion of all reference bases for whole genome sequencing, or targeted bases for whole exome and targeted sequencing, that achieves 30X or greater coverage from Picard Tools."),
  Per_Base_N_Content STRING OPTIONS(description="State classification given by FASTQC for the metric. Metric specific details about the states are available on their website."),
  QC_Workflow_Type STRING OPTIONS(description="Generic name for the workflow used to analyze a data set. String"),
  Is_lowest_level STRING OPTIONS(description="Denotes that the manifest represents the lowest data level submitted. Use when L1 data is missing"),
  Per_Base_Sequence_Quality STRING OPTIONS(description="State classification given by FASTQC for the metric. Metric specific details about the states are available on their website."),
  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"),
  Per_Sequence_Quality_Score STRING OPTIONS(description="State classification given by FASTQC for the metric. Metric specific details about the states are available on their website."),
  Encoding STRING OPTIONS(description="Version of ASCII encoding of quality values found in the file. String"),
  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 BULKWES LEVEL 2 METADATA R5 VERSIONED",
  description="This table contains the file metadata for second level (i.e. BAM files) bulk whole exome sequencing data 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.bulkWES_level2_metadata_r5` (Total_Unmapped_reads, Adapter_Content, Proportion_Base_Mismatch, Custom_Alignment_Workflow, HTAN_Data_File_ID, Average_Read_Length, Contamination, Basic_Statistics, Component, Per_Base_Sequence_Content, Proportion_Reads_Duplicated, MSI_Workflow_Link, Total_Reads, QC_Workflow_Link, Pairs_On_Diff_CHR, QC_Workflow_Version, MSI_Score, Total_Uniquely_Mapped, Short_Reads, Proportion_Coverage_10x, HTAN_Parent_Data_File_ID, Proportion_Reads_Mapped, Genomic_Reference_URL, Genomic_Reference, Per_Sequence_GC_Content, Overrepresented_Sequences, HTAN_Parent_Biospecimen_ID, Alignment_Workflow_Type, Sequence_Length_Distribution, Average_Insert_Size, MSI_Status, Sequence_Duplication_Levels, Filename, entityId, Average_Base_Quality, Percent_GC_Content, Per_Tile_Sequence_Quality, Index_File_Name, Proportion_Coverage_30X, Per_Base_N_Content, QC_Workflow_Type, Is_lowest_level, Per_Base_Sequence_Quality, Contamination_Error, Proportion_Targets_No_Coverage, Id, Per_Sequence_Quality_Score, Encoding, Mean_Coverage, File_Format, HTAN_Center, Manifest_Id, Manifest_Version, File_Size, md5, Data_Release, CDS_Release) VALUES (NULL, NULL, NULL, NULL, 'HTA4_1016_103337', NULL, NULL, NULL, 'BulkWESLevel2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'HTA4_1016_93337,HTA4_1016_93338,HTA4_1016_93339,HTA4_1016_93340,HTA4_1016_93341,HTA4_1016_93342,HTA4_1016_93343,HTA4_1016_93344', NULL, 'https://www.gencodegenes.org/human/release_38.html', 'GRCh38.p13', NULL, NULL, NULL, 'BWA', NULL, NULL, NULL, NULL, 'WGS_level_2_NBL/NB_7767_1774_REG1/NB_7767_1774_REG1.readgroup.sorted.bam', 'syn53283268', NULL, NULL, NULL, 'WGS_level_2_NBL/NB_7767_1774_REG1/NB_7767_1774_REG1.readgroup.sorted.bam.bai', NULL, NULL, NULL, NULL, NULL, NULL, NULL, '22b38f7c-842e-48a0-abad-2fcc147076a9', NULL, NULL, NULL, 'bam', 'HTAN CHOP', 'syn53462156', 4, 110185115360, '5bb9153c80b53eb3a57bf1fc1b5bc7f6', 'Release 5.0', NULL), (NULL, NULL, NULL, NULL, 'HTA4_1007_103339', NULL, NULL, NULL, 'BulkWESLevel2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'HTA4_1007_93345,HTA4_1007_93346,HTA4_1007_93347,HTA4_1007_93348,HTA4_1007_93349,HTA4_1007_93350,HTA4_1007_93351,HTA4_1007_93352', NULL, 'https://www.gencodegenes.org/human/release_38.html', 'GRCh38.p13', NULL, NULL, NULL, 'BWA', NULL, NULL, NULL, NULL, 'WGS_level_2_NBL/NB_7767_3051_REG2/NB_7767_3051_REG2.readgroup.sorted.bam', 'syn53281634', NULL, NULL, NULL, 'WGS_level_2_NBL/NB_7767_3051_REG2/NB_7767_3051_REG2.readgroup.sorted.bam.bai', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'f78d8984-4f97-4a89-af34-0f50b78e8ce5', NULL, NULL, NULL, 'bam', 'HTAN CHOP', 'syn53462156', 4, 135327680299, 'f43e88b500513348bd1ac10e1c311bd6', 'Release 5.0', NULL), (NULL, NULL, NULL, NULL, 'HTA4_1004_103341', NULL, NULL, NULL, 'BulkWESLevel2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'HTA4_1004_93353,HTA4_1004_93354,HTA4_1004_93355,HTA4_1004_93356,HTA4_1004_93357,HTA4_1004_93358,HTA4_1004_93359,HTA4_1004_93360', NULL, 'https://www.gencodegenes.org/human/release_38.html', 'GRCh38.p13', NULL, NULL, NULL, 'BWA', NULL, NULL, NULL, NULL, 'WGS_level_2_NBL/NB_7767_3053_REG2/NB_7767_3053_REG2.readgroup.sorted.bam', 'syn53280751', NULL, NULL, NULL, 'WGS_level_2_NBL/NB_7767_3053_REG2/NB_7767_3053_REG2.readgroup.sorted.bam.bai', NULL, NULL, NULL, NULL, NULL, NULL, NULL, '4de07413-c774-4479-b526-9c0f2fad41b1', NULL, NULL, NULL, 'bam', 'HTAN CHOP', 'syn53462156', 4, 230586727971, 'f822ba3a607914cb869e38188471f42e', 'Release 5.0', NULL), (NULL, NULL, NULL, NULL, 'HTA4_1004_103343', NULL, NULL, NULL, 'BulkWESLevel2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'HTA4_1004_93361,HTA4_1004_93362,HTA4_1004_93363,HTA4_1004_93364,HTA4_1004_93365,HTA4_1004_93366,HTA4_1004_93367,HTA4_1004_93368', NULL, 'https://www.gencodegenes.org/human/release_38.html', 'GRCh38.p13', NULL, NULL, NULL, 'BWA', NULL, NULL, NULL, NULL, 'WGS_level_2_NBL/NB_7767_3054_REG2/NB_7767_3054_REG2.readgroup.sorted.bam', 'syn53278348', NULL, NULL, NULL, 'WGS_level_2_NBL/NB_7767_3054_REG2/NB_7767_3054_REG2.readgroup.sorted.bam.bai', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'c408e0e5-5a12-47c2-8583-20580cdd46d9', NULL, NULL, NULL, 'bam', 'HTAN CHOP', 'syn53462156', 4, 161200688574, '11c39fc8bce3ab13a6c3b5d6eb8d04d5', 'Release 5.0', NULL), (NULL, NULL, NULL, NULL, 'HTA4_1013_103345', NULL, NULL, NULL, 'BulkWESLevel2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'HTA4_1013_93369,HTA4_1013_93370,HTA4_1013_93371,HTA4_1013_93372,HTA4_1013_93373,HTA4_1013_93374,HTA4_1013_93375,HTA4_1013_93376', NULL, 'https://www.gencodegenes.org/human/release_38.html', 'GRCh38.p13', NULL, NULL, NULL, 'BWA', NULL, NULL, NULL, NULL, 'WGS_level_2_NBL/NB_7767_3058_REG1/NB_7767_3058_REG1.readgroup.sorted.bam', 'syn53283459', NULL, NULL, NULL, 'WGS_level_2_NBL/NB_7767_3058_REG1/NB_7767_3058_REG1.readgroup.sorted.bam.bai', NULL, NULL, NULL, NULL, NULL, NULL, NULL, '5ba2ddb5-5b0d-4ed9-a291-fa0976138145', NULL, NULL, NULL, 'bam', 'HTAN CHOP', 'syn53462156', 4, 159392838165, 'cc1d5852e562fa0dcaf3c5935bd4ba58', 'Release 5.0', NULL);