-- DBMS: bigquery
CREATE TABLE `isb-cgc-bq.HTAN_versioned.bulkWES_level1_metadata_r2_v2`
(
  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"),
  File_Size INT64 OPTIONS(description="Size of file (bucket object) in bytes"),
  Base_Filename STRING OPTIONS(description="Base name of file"),
  md5 STRING OPTIONS(description="md5 hash of file")
)
OPTIONS(
  friendly_name="HTAN BULKWES LEVEL 1 METADATA R2 VERSIONED",
  description="Data was extracted from HTAN Synapse projects in April 2022.  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_r2_v2` (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, File_Size, Base_Filename, md5) 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', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'syn23594338', 'HTAN Stanford', 'Release 1.0', 66688639963, 'A001_blood.sorted.ir.br.rmDup.md.bam', '1186d4ea41e772fecfe0fa0620dccec8'), ('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', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'syn23594379', 'HTAN Stanford', 'Release 1.0', 61887253784, 'A002_blood.sorted.ir.br.rmDup.md.bam', 'bcbee4a0373c6adaea43f2bd456d5349'), ('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', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'syn23594347', 'HTAN Stanford', 'Release 1.0', 168813208773, 'A001C007.sorted.ir.br.rmDup.md.bam', 'ed729c54982f2a6271982b4f68d7d95f'), ('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', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'syn23594339', 'HTAN Stanford', 'Release 1.0', 60385716845, 'A001C004.sorted.ir.br.rmDup.md.bam', '0349fb2e761141c3b7a7284009d67b5b'), ('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', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'syn23594344', 'HTAN Stanford', 'Release 1.0', 64772579943, 'A001C005.sorted.ir.br.rmDup.md.bam', '54abbdac576bedb9f1ff01cdef77f3ae');