-- DBMS: bigquery
CREATE TABLE `isb-cgc-bq.HTAN_versioned.bulkWES_level2_metadata_r4`
(
  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."),
  Encoding STRING OPTIONS(description="Version of ASCII encoding of quality values found in the file. String"),
  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)"),
  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."),
  Id STRING OPTIONS(description="Unique identifier of entity e.g. a96059eb-81af-4b24-ae50-9242c0d8f819"),
  Basic_Statistics STRING OPTIONS(description="State classification given by FASTQC for the metric. Metric specific details about the states are available on their website."),
  Adapter_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_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"),
  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."),
  Average_Base_Quality STRING OPTIONS(description="Average base quality collected from samtools. Number"),
  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."),
  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."),
  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."),
  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."),
  Is_lowest_level STRING OPTIONS(description="Denotes that the manifest represents the lowest data level submitted. Use when L1 data is missing"),
  QC_Workflow_Link STRING OPTIONS(description="Link to workflow used. String"),
  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."),
  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."),
  Average_Read_Length STRING OPTIONS(description="Average read length collected from samtools. Integer"),
  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."),
  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"),
  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."),
  MSI_Workflow_Link STRING OPTIONS(description="Link to method workflow (or command) used in estimating the MSI. URL"),
  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."),
  Overrepresented_Sequences 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"),
  Proportion_Targets_No_Coverage STRING OPTIONS(description="Proportion of targets that did not reach 1X coverage over any base from Picard Tools. Number"),
  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"),
  QC_Workflow_Type STRING OPTIONS(description="Generic name for the workflow used to analyze a data set. String"),
  Contamination STRING OPTIONS(description="Fraction of reads coming from cross-sample contamination collected from GATK4. Number"),
  Total_Uniquely_Mapped STRING OPTIONS(description="Number of reads that map to genome. Integer"),
  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"),
  Percent_GC_Content STRING OPTIONS(description="The overall %GC of all bases in all sequences. Integer"),
  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 BULKWES LEVEL 2 METADATA R4 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 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.bulkWES_level2_metadata_r4` (Per_Sequence_GC_Content, Encoding, HTAN_Data_File_ID, Per_Base_Sequence_Content, Id, Basic_Statistics, Adapter_Content, QC_Workflow_Version, MSI_Score, Proportion_Coverage_30X, Average_Base_Quality, Per_Sequence_Quality_Score, Per_Base_N_Content, Proportion_Reads_Mapped, Mean_Coverage, entityId, MSI_Status, Per_Tile_Sequence_Quality, Is_lowest_level, QC_Workflow_Link, Genomic_Reference, Alignment_Workflow_Type, Index_File_Name, Pairs_On_Diff_CHR, Component, Proportion_Coverage_10x, Average_Read_Length, Sequence_Duplication_Levels, Total_Unmapped_reads, Contamination_Error, Per_Base_Sequence_Quality, MSI_Workflow_Link, Sequence_Length_Distribution, Overrepresented_Sequences, Proportion_Reads_Duplicated, Proportion_Targets_No_Coverage, HTAN_Parent_Biospecimen_ID, Short_Reads, QC_Workflow_Type, Contamination, Total_Uniquely_Mapped, Custom_Alignment_Workflow, Average_Insert_Size, File_Format, Filename, HTAN_Parent_Data_File_ID, Proportion_Base_Mismatch, Percent_GC_Content, Genomic_Reference_URL, Total_Reads, HTAN_Center, Manifest_Id, Manifest_Version, File_Size, md5, Data_Release, CDS_Release) VALUES (NULL, NULL, 'HTA11_347_200000101122111', NULL, '23c10f49-e628-4350-8f08-a80c56c92cf1', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'syn26965888', NULL, NULL, NULL, NULL, 'Hg19', 'BWA with Mark Duplicates and BQSR', 'https://console.cloud.google.com/storage/browser/_details/broad-references/hg19/v0/Homo_sapiens_assembly19.fasta.fai', NULL, 'BulkWESLevel2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'bam', 'whole_exome_seq_level_2/Aligned_BAM/MAP.00347_polyp.rmdup.indel.recal.bam', 'HTA11_347_200000101121111,HTA11_347_200000101121121', NULL, NULL, 'https://console.cloud.google.com/storage/browser/_details/broad-references/hg19/v0/Homo_sapiens_assembly19.fasta', NULL, 'HTAN Vanderbilt', 'syn39059805', 4, 6783338798, '3e235a20b48f8a2d999b89629f7ae101', 'Release 2.0', 'v22.6.1.seq'), (NULL, NULL, 'HTA11_347_200000990122111', NULL, 'ea72d8b5-9021-4915-9211-1050c765bf87', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'syn26965914', NULL, NULL, NULL, NULL, 'Hg19', 'BWA with Mark Duplicates and BQSR', 'https://console.cloud.google.com/storage/browser/_details/broad-references/hg19/v0/Homo_sapiens_assembly19.fasta.fai', NULL, 'BulkWESLevel2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'bam', 'whole_exome_seq_level_2/Aligned_BAM/MAP.00347_WBC.rmdup.indel.recal.bam', 'HTA11_347_200000990121111,HTA11_347_200000990121121', NULL, NULL, 'https://console.cloud.google.com/storage/browser/_details/broad-references/hg19/v0/Homo_sapiens_assembly19.fasta', NULL, 'HTAN Vanderbilt', 'syn39059805', 4, 49430679741, '00a1ea33b562b19b5156adc040ddacbc', 'Release 2.0', 'v22.6.1.seq'), (NULL, NULL, 'HTA11_696_200000101122111', NULL, 'd43bc206-54a2-4df6-b2b9-097d200f5a1d', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'syn26965890', NULL, NULL, NULL, NULL, 'Hg19', 'BWA with Mark Duplicates and BQSR', 'https://console.cloud.google.com/storage/browser/_details/broad-references/hg19/v0/Homo_sapiens_assembly19.fasta.fai', NULL, 'BulkWESLevel2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'bam', 'whole_exome_seq_level_2/Aligned_BAM/MAP.00696_polyp.rmdup.indel.recal.bam', 'HTA11_696_200000101121111,HTA11_696_200000101121121', NULL, NULL, 'https://console.cloud.google.com/storage/browser/_details/broad-references/hg19/v0/Homo_sapiens_assembly19.fasta', NULL, 'HTAN Vanderbilt', 'syn39059805', 4, 6407157512, '93a388c75adf38008abbaa9d8189e0d0', 'Release 2.0', 'v22.6.1.seq'), (NULL, NULL, 'HTA11_696_200000990122111', NULL, '5d1af692-1974-407e-a6ae-3aee6b816995', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'syn26966033', NULL, NULL, NULL, NULL, 'Hg19', 'BWA with Mark Duplicates and BQSR', 'https://console.cloud.google.com/storage/browser/_details/broad-references/hg19/v0/Homo_sapiens_assembly19.fasta.fai', NULL, 'BulkWESLevel2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'bam', 'whole_exome_seq_level_2/Aligned_BAM/MAP.00696_WBC.rmdup.indel.recal.bam', 'HTA11_696_200000990121111,HTA11_696_200000990121121', NULL, NULL, 'https://console.cloud.google.com/storage/browser/_details/broad-references/hg19/v0/Homo_sapiens_assembly19.fasta', NULL, 'HTAN Vanderbilt', 'syn39059805', 4, 4165423530, '67dc02fe6b6c8fe9126e395be25e0788', 'Release 2.0', 'v22.6.1.seq'), (NULL, NULL, 'HTA11_866_200000910122111', NULL, '55b414a2-8f6f-46fd-afb2-a9323deb13e9', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'syn26966193', NULL, NULL, NULL, NULL, 'Hg19', 'BWA with Mark Duplicates and BQSR', 'https://console.cloud.google.com/storage/browser/_details/broad-references/hg19/v0/Homo_sapiens_assembly19.fasta.fai', NULL, 'BulkWESLevel2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'bam', 'whole_exome_seq_level_2/Aligned_BAM/MAP.00866_blood.rmdup.indel.recal.bam', 'HTA11_866_200000910121111,HTA11_866_200000910121121', NULL, NULL, 'https://console.cloud.google.com/storage/browser/_details/broad-references/hg19/v0/Homo_sapiens_assembly19.fasta', NULL, 'HTAN Vanderbilt', 'syn39059805', 4, 8099459203, 'eaf5f98dd036f67e8b35dfc640bf902f', 'Release 2.0', 'v22.6.1.seq');