-- DBMS: bigquery
CREATE TABLE `isb-cgc-bq.HTAN_versioned.bulkMethylationseq_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"),
  Trimmer STRING OPTIONS(description="Software used for trimming"),
  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"),
  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"),
  Bulk_Methylation_Genomic_Reference STRING OPTIONS(description="The human genome reference used in the alignment of reads"),
  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"),
  Proportion_of_Minimum_CpG_Coverage_10X STRING OPTIONS(description="Proportion of all reference bases for whole genome sequencing, or targeted sequencing, that achieves 10X or greater coverage per CpG."),
  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"),
  Proportion_Targets_No_Coverage STRING OPTIONS(description="Proportion of targets that did not reach 1X coverage over any base from Picard Tools. Number"),
  Proportion_Reads_Duplicated STRING OPTIONS(description="Proportion of duplicated reads collected from samtools. Number"),
  Alignment_Workflow_Url STRING OPTIONS(description="Link to workflow used for read alignment. DockStore.org recommended. String"),
  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.)"),
  Duplicate_Removal_Software STRING OPTIONS(description="Software used for remove duplicate reads"),
  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"),
  Library_Layout STRING OPTIONS(description="Sequencing read type"),
  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 BULKMETHYLATION SEQ LEVEL 2 METADATA R4 VERSIONED",
  description="This table contains the file metadata for the second level  of Bulk Methyl 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.bulkMethylationseq_level2_metadata_r4` (HTAN_Data_File_ID, Id, Trimmer, Proportion_Coverage_30X, Average_Base_Quality, Proportion_Reads_Mapped, Mean_Coverage, entityId, Bulk_Methylation_Genomic_Reference, Alignment_Workflow_Type, Index_File_Name, Pairs_On_Diff_CHR, Component, Average_Read_Length, Proportion_of_Minimum_CpG_Coverage_10X, Total_Unmapped_reads, Contamination_Error, Proportion_Targets_No_Coverage, Proportion_Reads_Duplicated, Alignment_Workflow_Url, Short_Reads, Total_Uniquely_Mapped, Contamination, Custom_Alignment_Workflow, Average_Insert_Size, File_Format, Duplicate_Removal_Software, Filename, HTAN_Parent_Data_File_ID, Library_Layout, Proportion_Base_Mismatch, Genomic_Reference_URL, Total_Reads, HTAN_Center, Manifest_Id, Manifest_Version, File_Size, md5, Data_Release, CDS_Release) VALUES ('HTA10_01_19555600007912121574695667162305', 'cfd91283-099f-4478-b5bd-84a0ddb7937a', 'Trim Galore!', NULL, NULL, NULL, NULL, 'syn45173225', 'HG38', 'BWA-meth', NULL, NULL, 'BulkMethylation-seqLevel2', NULL, NULL, NULL, NULL, NULL, NULL, 'https://lucid.app/lucidchart/3921698e-01ad-4e02-805c-dfae9f70b9c4/view', NULL, NULL, NULL, NULL, NULL, 'bedgraph', 'picard MarkDuplicates', 'bulk_methyl_seq_level_2/A001_C004.sorted.rmdup.bam.mergeContext_CpG.bedGraph', 'HTA10_01_43208332606526216901477335450321, HTA10_01_31241678407000619453059401802613', 'Single Read', NULL, 'https://hgdownload.soe.ucsc.edu/goldenPath/hg38/bigZips/hg38.fa.gz', NULL, 'HTAN Stanford', 'syn51934273', 2, 882463091, '19f5f6aa0a79bcb2bf7e695667162d0f', 'Release 4.0', NULL), ('HTA10_01_11376335427842530213430155414309', '4df1924e-c4a4-4b2b-be35-a98f67cd6c37', 'Trim Galore!', NULL, NULL, NULL, NULL, 'syn45173228', 'HG38', 'BWA-meth', NULL, NULL, 'BulkMethylation-seqLevel2', NULL, NULL, NULL, NULL, NULL, NULL, 'https://lucid.app/lucidchart/3921698e-01ad-4e02-805c-dfae9f70b9c4/view', NULL, NULL, NULL, NULL, NULL, 'bedgraph', 'picard MarkDuplicates', 'bulk_methyl_seq_level_2/A001_C005.sorted.rmdup.bam.mergeContext_CpG.bedGraph', 'HTA10_01_46294077943108131591650144554192, HTA10_01_54114060048152634471554202053055', 'Single Read', NULL, 'https://hgdownload.soe.ucsc.edu/goldenPath/hg38/bigZips/hg38.fa.gz', NULL, 'HTAN Stanford', 'syn51934273', 2, 878495769, 'b1d76d3fec784c5d02bded015feb43a9', 'Release 4.0', NULL), ('HTA10_01_15010826040070101551037109010253', '480f0d3a-92da-4884-a3ab-6f8aa28da953', 'Trim Galore!', NULL, NULL, NULL, NULL, 'syn45173230', 'HG38', 'BWA-meth', NULL, NULL, 'BulkMethylation-seqLevel2', NULL, NULL, NULL, NULL, NULL, NULL, 'https://lucid.app/lucidchart/3921698e-01ad-4e02-805c-dfae9f70b9c4/view', NULL, NULL, NULL, NULL, NULL, 'bedgraph', 'picard MarkDuplicates', 'bulk_methyl_seq_level_2/A001_C007.sorted.rmdup.bam.mergeContext_CpG.bedGraph', 'HTA10_01_87763024572233951479832245018290, HTA10_01_51915141758210853130171453519884', 'Single Read', NULL, 'https://hgdownload.soe.ucsc.edu/goldenPath/hg38/bigZips/hg38.fa.gz', NULL, 'HTAN Stanford', 'syn51934273', 2, 880730862, 'bfaba8c604aa70babf510d7109ab0c5d', 'Release 4.0', NULL), ('HTA10_01_52404152580394452345435135340338', '8224ba1a-d89d-43f4-9e1b-214ebeb2fb3c', 'Trim Galore!', NULL, NULL, NULL, NULL, 'syn45173232', 'HG38', 'BWA-meth', NULL, NULL, 'BulkMethylation-seqLevel2', NULL, NULL, NULL, NULL, NULL, NULL, 'https://lucid.app/lucidchart/3921698e-01ad-4e02-805c-dfae9f70b9c4/view', NULL, NULL, NULL, NULL, NULL, 'bedgraph', 'picard MarkDuplicates', 'bulk_methyl_seq_level_2/A001_C021.sorted.rmdup.bam.mergeContext_CpG.bedGraph', 'HTA10_01_27635503330084247504154163037742, HTA10_01_73818340324167313356268513414053', 'Single Read', NULL, 'https://hgdownload.soe.ucsc.edu/goldenPath/hg38/bigZips/hg38.fa.gz', NULL, 'HTAN Stanford', 'syn51934273', 2, 880088496, '5c4041fc58039445c3e5ed513f34a3d8', 'Release 4.0', NULL), ('HTA10_01_07537966443615794524016665154003', 'ebba311d-e0c6-4a3a-8cd6-cb23c58009e9', 'Trim Galore!', NULL, NULL, NULL, NULL, 'syn45173234', 'HG38', 'BWA-meth', NULL, NULL, 'BulkMethylation-seqLevel2', NULL, NULL, NULL, NULL, NULL, NULL, 'https://lucid.app/lucidchart/3921698e-01ad-4e02-805c-dfae9f70b9c4/view', NULL, NULL, NULL, NULL, NULL, 'bedgraph', 'picard MarkDuplicates', 'bulk_methyl_seq_level_2/A001_C113.sorted.rmdup.bam.mergeContext_CpG.bedGraph', 'HTA10_01_95349379651062231555333416816070, HTA10_01_70070300363480687242100850711554', 'Single Read', NULL, 'https://hgdownload.soe.ucsc.edu/goldenPath/hg38/bigZips/hg38.fa.gz', NULL, 'HTAN Stanford', 'syn51934273', 2, 884790769, '07fd796644d6b579e52eab666f1f4a0d', 'Release 4.0', NULL);