-- DBMS: bigquery
CREATE TABLE `isb-cgc-bq.HTAN_versioned.scATACseq_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"),
  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"),
  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."),
  MapQ30 STRING OPTIONS(description="Number of reads with Quality >= 30."),
  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"),
  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"),
  Median_Percentage_of_Mitochondrial_Reads_per_Nucleus STRING OPTIONS(description="Contamination from mitochondrial sequences"),
  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"),
  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 SCATACSEQ LEVEL 2 METADATA R4 VERSIONED",
  description="This table contains the file metadata for second level (i.e. BAM) single cell ATAC 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.scATACseq_level2_metadata_r4` (HTAN_Data_File_ID, Id, Proportion_Coverage_30X, Average_Base_Quality, Proportion_Reads_Mapped, Mean_Coverage, entityId, Genomic_Reference, Alignment_Workflow_Type, MapQ30, Index_File_Name, Pairs_On_Diff_CHR, Component, Proportion_Coverage_10x, Average_Read_Length, Total_Unmapped_reads, Contamination_Error, Proportion_Targets_No_Coverage, Proportion_Reads_Duplicated, Alignment_Workflow_Url, Short_Reads, Total_Uniquely_Mapped, Contamination, Custom_Alignment_Workflow, Median_Percentage_of_Mitochondrial_Reads_per_Nucleus, Average_Insert_Size, File_Format, Filename, HTAN_Parent_Data_File_ID, Proportion_Base_Mismatch, Genomic_Reference_URL, Total_Reads, HTAN_Center, Manifest_Id, Manifest_Version, File_Size, md5, Data_Release, CDS_Release) VALUES ('HTA10_01_25298670633699179141272640741209', 'e8835e74-5cc8-4aa3-9db8-4a38a9f08492', NULL, NULL, NULL, NULL, NULL, 'GRCh38', 'BWA-mem', NULL, 'scatacseq_level_2/A001-C-014-D_20200715_possorted_bam.bam.bai', NULL, 'ScATAC-seqLevel2', NULL, NULL, NULL, NULL, NULL, NULL, 'Not reported', NULL, NULL, NULL, NULL, 'Not reported', NULL, 'bai', 'scatacseq_level_2/A001-C-014-D_20200715_possorted_bam.bam.bai', 'HTA10_01_90243443196521389339723491376359', NULL, NULL, NULL, 'HTAN Stanford', 'syn52177151', 2, NULL, NULL, 'Release 3.0', NULL), ('HTA10_01_72332027394390221010029202375050', 'd47f47f9-9899-4836-b541-4aa29e327047', NULL, NULL, NULL, NULL, NULL, 'GRCh38', 'BWA-mem', NULL, 'scatacseq_level_2/A001-C-108-D_20200811_possorted_bam.bam.bai', NULL, 'ScATAC-seqLevel2', NULL, NULL, NULL, NULL, NULL, NULL, 'Not reported', NULL, NULL, NULL, NULL, 'Not reported', NULL, 'bai', 'scatacseq_level_2/A001-C-108-D_20200811_possorted_bam.bam.bai', 'HTA10_01_39764031532103604433024454006407', NULL, NULL, NULL, 'HTAN Stanford', 'syn52177151', 2, NULL, NULL, 'Release 3.0', NULL), ('HTA10_01_55975145956205524233361918760323', '21b24d91-92ae-4dcf-842f-28affb37bbfb', NULL, NULL, NULL, NULL, NULL, 'GRCh38', 'BWA-mem', NULL, 'scatacseq_level_2/A001-C-123-D_20200214_possorted_bam.bam.bai', NULL, 'ScATAC-seqLevel2', NULL, NULL, NULL, NULL, NULL, NULL, 'Not reported', NULL, NULL, NULL, NULL, 'Not reported', NULL, 'bai', 'scatacseq_level_2/A001-C-123-D_20200214_possorted_bam.bam.bai', 'HTA10_01_50804062430232390005309493285051', NULL, NULL, NULL, 'HTAN Stanford', 'syn52177151', 2, NULL, NULL, 'Release 3.0', NULL), ('HTA10_02_20493319183914148251202684354525', '655f895d-be4f-4581-8663-6829278a5c7d', NULL, NULL, NULL, NULL, NULL, 'GRCh38', 'BWA-mem', NULL, 'scatacseq_level_2/A002-C-010_S2_20200310_possorted_bam.bam.bai', NULL, 'ScATAC-seqLevel2', NULL, NULL, NULL, NULL, NULL, NULL, 'Not reported', NULL, NULL, NULL, NULL, 'Not reported', NULL, 'bai', 'scatacseq_level_2/A002-C-010_S2_20200310_possorted_bam.bam.bai', 'HTA10_02_08632528445263190500914034437621', NULL, NULL, NULL, 'HTAN Stanford', 'syn52177151', 2, NULL, NULL, 'Release 3.0', NULL), ('HTA10_02_33068443558330400384301312553458', 'bf307541-b0aa-4f50-89e2-ce07970827d9', NULL, NULL, NULL, NULL, NULL, 'GRCh38', 'BWA-mem', NULL, 'scatacseq_level_2/A002-C-024-D_20200715_possorted_bam.bam.bai', NULL, 'ScATAC-seqLevel2', NULL, NULL, NULL, NULL, NULL, NULL, 'Not reported', NULL, NULL, NULL, NULL, 'Not reported', NULL, 'bai', 'scatacseq_level_2/A002-C-024-D_20200715_possorted_bam.bam.bai', 'HTA10_02_70197441898758264146140376150026', NULL, NULL, NULL, 'HTAN Stanford', 'syn52177151', 2, NULL, NULL, 'Release 3.0', NULL);