-- DBMS: bigquery
CREATE TABLE `isb-cgc-bq.HTAN_versioned.bulkWES_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_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"),
  Adapter_Content STRING OPTIONS(description="State classification given by FASTQC for the metric. Metric specific details about the states are available on their website."),
  Basic_Statistics 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"),
  Overrepresented_Sequences 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."),
  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."),
  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."),
  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."),
  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_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."),
  Percent_GC_Content STRING OPTIONS(description="The overall %GC of all bases in all sequences. 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."),
  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."),
  QC_Workflow_Type STRING OPTIONS(description="Generic name for the workflow used to analyze a data set. String"),
  QC_Workflow_Version STRING OPTIONS(description="Major version for a workflow. String"),
  QC_Workflow_Link STRING OPTIONS(description="Link to workflow used. String"),
  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_Targets_No_Coverage STRING OPTIONS(description="Proportion of targets that did not reach 1X coverage over any base from Picard Tools. Number"),
  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"),
  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."),
  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."),
  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 BULKWES LEVEL 2 METADATA R3 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 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.bulkWES_level2_metadata_r3` (Component, Filename, File_Format, HTAN_Parent_Data_File_ID, HTAN_Data_File_ID, 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, Adapter_Content, Basic_Statistics, Encoding, Overrepresented_Sequences, Per_Base_N_Content, Per_Base_Sequence_Content, Per_Base_Sequence_Quality, Per_Sequence_GC_Content, Per_Sequence_Quality_Score, Per_Tile_Sequence_Quality, Percent_GC_Content, Sequence_Duplication_Levels, Sequence_Length_Distribution, QC_Workflow_Type, QC_Workflow_Version, QC_Workflow_Link, 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, Proportion_Coverage_10x, Proportion_Coverage_30X, Is_lowest_level, entityId, HTAN_Center, Data_Release, Manifest_Version, Uuid, HTAN_Parent_Biospecimen_ID, File_Size, md5, CDS_Release) VALUES ('BulkWESLevel2', 'whole_exome_seq_level_2/Aligned_BAM/MAP.00347_polyp.rmdup.indel.recal.bam', 'bam', 'HTA11_347_200000101121111,HTA11_347_200000101121121', 'HTA11_347_200000101122111', 'BWA with Mark Duplicates and BQSR', 'Hg19', 'https://console.cloud.google.com/storage/browser/_details/broad-references/hg19/v0/Homo_sapiens_assembly19.fasta', 'https://console.cloud.google.com/storage/browser/_details/broad-references/hg19/v0/Homo_sapiens_assembly19.fasta.fai', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'syn26965888', 'HTAN Vanderbilt', 'Release 2.0', 2, '23c10f49-e628-4350-8f08-a80c56c92cf1', NULL, 6783338798, '3e235a20b48f8a2d999b89629f7ae101', 'v22.6.1.seq'), ('BulkWESLevel2', 'whole_exome_seq_level_2/Aligned_BAM/MAP.00347_WBC.rmdup.indel.recal.bam', 'bam', 'HTA11_347_200000990121111,HTA11_347_200000990121121', 'HTA11_347_200000990122111', 'BWA with Mark Duplicates and BQSR', 'Hg19', 'https://console.cloud.google.com/storage/browser/_details/broad-references/hg19/v0/Homo_sapiens_assembly19.fasta', 'https://console.cloud.google.com/storage/browser/_details/broad-references/hg19/v0/Homo_sapiens_assembly19.fasta.fai', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'syn26965914', 'HTAN Vanderbilt', 'Release 2.0', 2, 'ea72d8b5-9021-4915-9211-1050c765bf87', NULL, 49430679741, '00a1ea33b562b19b5156adc040ddacbc', 'v22.6.1.seq'), ('BulkWESLevel2', 'whole_exome_seq_level_2/Aligned_BAM/MAP.00696_polyp.rmdup.indel.recal.bam', 'bam', 'HTA11_696_200000101121111,HTA11_696_200000101121121', 'HTA11_696_200000101122111', 'BWA with Mark Duplicates and BQSR', 'Hg19', 'https://console.cloud.google.com/storage/browser/_details/broad-references/hg19/v0/Homo_sapiens_assembly19.fasta', 'https://console.cloud.google.com/storage/browser/_details/broad-references/hg19/v0/Homo_sapiens_assembly19.fasta.fai', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'syn26965890', 'HTAN Vanderbilt', 'Release 2.0', 2, 'd43bc206-54a2-4df6-b2b9-097d200f5a1d', NULL, 6407157512, '93a388c75adf38008abbaa9d8189e0d0', 'v22.6.1.seq'), ('BulkWESLevel2', 'whole_exome_seq_level_2/Aligned_BAM/MAP.00696_WBC.rmdup.indel.recal.bam', 'bam', 'HTA11_696_200000990121111,HTA11_696_200000990121121', 'HTA11_696_200000990122111', 'BWA with Mark Duplicates and BQSR', 'Hg19', 'https://console.cloud.google.com/storage/browser/_details/broad-references/hg19/v0/Homo_sapiens_assembly19.fasta', 'https://console.cloud.google.com/storage/browser/_details/broad-references/hg19/v0/Homo_sapiens_assembly19.fasta.fai', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'syn26966033', 'HTAN Vanderbilt', 'Release 2.0', 2, '5d1af692-1974-407e-a6ae-3aee6b816995', NULL, 4165423530, '67dc02fe6b6c8fe9126e395be25e0788', 'v22.6.1.seq'), ('BulkWESLevel2', 'whole_exome_seq_level_2/Aligned_BAM/MAP.00866_blood.rmdup.indel.recal.bam', 'bam', 'HTA11_866_200000910121111,HTA11_866_200000910121121', 'HTA11_866_200000910122111', 'BWA with Mark Duplicates and BQSR', 'Hg19', 'https://console.cloud.google.com/storage/browser/_details/broad-references/hg19/v0/Homo_sapiens_assembly19.fasta', 'https://console.cloud.google.com/storage/browser/_details/broad-references/hg19/v0/Homo_sapiens_assembly19.fasta.fai', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'syn26966193', 'HTAN Vanderbilt', 'Release 2.0', 2, '55b414a2-8f6f-46fd-afb2-a9323deb13e9', NULL, 8099459203, 'eaf5f98dd036f67e8b35dfc640bf902f', 'v22.6.1.seq');