-- DBMS: bigquery
CREATE TABLE `isb-cgc-bq.HTAN_versioned.bulkWES_level1_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_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"),
  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)"),
  Sequencing_Batch_ID STRING OPTIONS(description="Links samples to a specific local sequencer run. Can be string or 'null'"),
  Library_Layout STRING OPTIONS(description="Sequencing read type"),
  Read_Indicator STRING OPTIONS(description="Indicate if this is Read 1 (R1) or Read 2 (R2)"),
  Library_Selection_Method STRING OPTIONS(description="How the molecules are isolated."),
  Read_Length STRING OPTIONS(description="The length of the sequencing reads. Can be integer, null"),
  Target_Capture_Kit STRING OPTIONS(description="Description that can uniquely identify a target capture kit. Suggested value is a combination of vendor, kit name, and kit version."),
  Library_Preparation_Kit_Name STRING OPTIONS(description="Name of Library Preparation Kit. String"),
  Library_Preparation_Kit_Vendor STRING OPTIONS(description="Vendor of Library Preparation Kit. String"),
  Library_Preparation_Kit_Version STRING OPTIONS(description="Version of Library Preparation Kit. String"),
  Sequencing_Platform STRING OPTIONS(description="A platform is an object aggregate that is the set of instruments and software needed to perform a process [OBI_0000050]. Specific model of the sequencing instrument."),
  Adapter_Name STRING OPTIONS(description="Name of the sequencing adapter. String"),
  Adapter_Sequence STRING OPTIONS(description="Base sequence of the sequencing adapter. String"),
  Base_Caller_Name STRING OPTIONS(description="Name of the base caller. String"),
  Base_Caller_Version STRING OPTIONS(description="Version of the base caller. String"),
  Flow_Cell_Barcode STRING OPTIONS(description="Flow cell barcode. Wrong or missing information may affect analysis results. String"),
  Fragment_Maximum_Length STRING OPTIONS(description="Maximum length of the sequenced fragments (e.g., as predicted by Agilent Bioanalyzer). Integer"),
  Fragment_Mean_Length STRING OPTIONS(description="Mean length of the sequenced fragments (e.g., as predicted by Agilent Bioanalyzer). Number"),
  Fragment_Minimum_Length STRING OPTIONS(description="Minimum length of the sequenced fragments (e.g., as predicted by Agilent Bioanalyzer). Integer"),
  Fragment_Standard_Deviation_Length STRING OPTIONS(description="Standard deviation of the sequenced fragments length (e.g., as predicted by Agilent Bioanalyzer). Number"),
  Lane_Number STRING OPTIONS(description="The basic machine unit for sequencing. For Illumina machines, this reflects the physical lane number. Wrong or missing information may affect analysis results. Integer"),
  Multiplex_Barcode STRING OPTIONS(description="The barcode/index sequence used. Wrong or missing information may affect analysis results. String"),
  Library_Preparation_Days_from_Index STRING OPTIONS(description="Number of days between sample for assay was received in lab and the libraries were prepared for sequencing [number]. If not applicable please enter 'Not Applicable'"),
  Size_Selection_Range STRING OPTIONS(description="Range of size selection. String"),
  Target_Depth STRING OPTIONS(description="The targeted read depth prior to sequencing. Integer"),
  To_Trim_Adapter_Sequence STRING OPTIONS(description="Does the user suggest adapter trimming?"),
  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"),
  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 1 METADATA R3 VERSIONED",
  description="This table contains the file metadata for first level (i.e. fastq) 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_level1_metadata_r3` (Component, Filename, File_Format, HTAN_Parent_Biospecimen_ID, HTAN_Data_File_ID, Sequencing_Batch_ID, Library_Layout, Read_Indicator, Library_Selection_Method, Read_Length, Target_Capture_Kit, Library_Preparation_Kit_Name, Library_Preparation_Kit_Vendor, Library_Preparation_Kit_Version, Sequencing_Platform, Adapter_Name, Adapter_Sequence, Base_Caller_Name, Base_Caller_Version, Flow_Cell_Barcode, Fragment_Maximum_Length, Fragment_Mean_Length, Fragment_Minimum_Length, Fragment_Standard_Deviation_Length, Lane_Number, Multiplex_Barcode, Library_Preparation_Days_from_Index, Size_Selection_Range, Target_Depth, To_Trim_Adapter_Sequence, entityId, HTAN_Center, Data_Release, Manifest_Version, Uuid, File_Size, md5, CDS_Release) VALUES ('BulkWESLevel1', 'wgs/A001_blood.sorted.ir.br.rmDup.md.bam', 'bam', 'HTA10_01_900', 'HTA10_01_90009001', 'C202SC19030155', 'Paired End', 'R1&R2', 'Random', '150', 'unknown', 'NEBNext® DNA Library Prep Kit', 'NEB', 'NEBNext® DNA Library Prep Kit', 'NovaSeq 6000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'syn23594338', 'HTAN Stanford', 'Release 1.0', 1, '4a162096-03c1-4533-9bbc-545f16b275d0', 66688639963, '1186d4ea41e772fecfe0fa0620dccec8', 'v21.9.1.seq'), ('BulkWESLevel1', 'wgs/A002_blood.sorted.ir.br.rmDup.md.bam', 'bam', 'HTA10_02_900', 'HTA10_02_90009001', 'C202SC19030155', 'Paired End', 'R1&R2', 'Random', '150', 'unknown', 'NEBNext® DNA Library Prep Kit', 'NEB', 'NEBNext® DNA Library Prep Kit', 'NovaSeq 6000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'syn23594379', 'HTAN Stanford', 'Release 1.0', 1, '351be608-a2f7-40e5-b76e-7da8c108601e', 130575608000, 'de7377cafe225d171b0b504639a1f09b', 'v21.9.1.seq'), ('BulkWESLevel1', 'wgs/A001C007.sorted.ir.br.rmDup.md.bam', 'bam', 'HTA10_01_007', 'HTA10_01_00709001', 'C202SC19050608', 'Paired End', 'R1&R2', 'Random', '150', 'unknown', 'NEBNext® DNA Library Prep Kit', 'NEB', 'NEBNext® DNA Library Prep Kit', 'NovaSeq 6000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'syn23594347', 'HTAN Stanford', 'Release 1.0', 1, 'ece67586-1ef9-4e09-85e6-c583a665d155', 168813208773, 'ed729c54982f2a6271982b4f68d7d95f', 'v21.9.1.seq'), ('BulkWESLevel1', 'wgs/A001C004.sorted.ir.br.rmDup.md.bam', 'bam', 'HTA10_01_004', 'HTA10_01_00409001', 'C202SC19050749', 'Paired End', 'R1&R2', 'Random', '150', 'unknown', 'NEBNext® DNA Library Prep Kit', 'NEB', 'NEBNext® DNA Library Prep Kit', 'NovaSeq 6000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'syn23594339', 'HTAN Stanford', 'Release 1.0', 1, '5ba93de4-5e94-43bf-9c38-fdc03b679db7', 60385716845, '0349fb2e761141c3b7a7284009d67b5b', 'v21.9.1.seq'), ('BulkWESLevel1', 'wgs/A001C005.sorted.ir.br.rmDup.md.bam', 'bam', 'HTA10_01_005', 'HTA10_01_00509001', 'C202SC19050749', 'Paired End', 'R1&R2', 'Random', '150', 'unknown', 'NEBNext® DNA Library Prep Kit', 'NEB', 'NEBNext® DNA Library Prep Kit', 'NovaSeq 6000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'syn23594344', 'HTAN Stanford', 'Release 1.0', 1, '344d5476-8265-4542-b1e0-4341e4ebc5eb', 64772579943, '54abbdac576bedb9f1ff01cdef77f3ae', 'v21.9.1.seq');