-- DBMS: bigquery
CREATE TABLE `isb-cgc-bq.HTAN_versioned.scATACseq_level3_metadata_r5`
(
  LowMapQ STRING OPTIONS(description="Number of read-pairs with <30 mapq on at least one end"),
  TSS_Fragments STRING OPTIONS(description="Number of fragments overlapping with TSS regions"),
  TSS_Enrichment STRING OPTIONS(description="Transcription start site (TSS) enrichment score"),
  Passed_Filters STRING OPTIONS(description="Number of non-duplicate, usable read-pairs i.e. fragments"),
  TSS_Percentile STRING OPTIONS(description="Percentile rank of TSS score"),
  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)"),
  Peak_Region_Fragments STRING OPTIONS(description="Number of fragments overlapping peaks"),
  Component STRING OPTIONS(description="Category of metadata (e.g. Diagnosis, Biospecimen, scRNA-seq Level 1, etc.); provide the same one for all items/rows."),
  Promoter_Region_Fragments STRING OPTIONS(description="Number of fragments overlapping promoter regions"),
  Unmapped_Read_Pairs STRING OPTIONS(description="Number of read-pairs with at least one end not mapped"),
  MACS2_Name STRING OPTIONS(description="Name of the peak in MACS2"),
  Total_Read_Pairs STRING OPTIONS(description="Total read-pairs"),
  Seurat_Clusters STRING OPTIONS(description="Clusters of cells by a shared nearest neighbor (SNN) modularity optimization based clustering algorithm"),
  Nucleosome_Signal STRING OPTIONS(description="Nucleosome signal score (strength of the nucleosome signal per cell, computed as the ratio of fragments between 147 bp and 294 bp (mononucleosome) to fragments < 147 bp (nucleosome-free))"),
  Nucleosome_Percentile STRING OPTIONS(description="Percentile rank of nucleosome score"),
  Mitochondrial_Read_Pairs STRING OPTIONS(description="Number of read-pairs mapping to mitochondria and non-nuclear contigs"),
  nFeature_RNA STRING OPTIONS(description="Number of genes detected in cell"),
  HTAN_Parent_Data_File_ID STRING OPTIONS(description="HTAN Data File Identifier indicating the file(s) from which these files were derived"),
  MACS2_Start STRING OPTIONS(description="Genomic starting position in MACS2"),
  MACS2_Neg_Log10_qvalue_Summit STRING OPTIONS(description="Negative log10 q-value for the peak summit in MACS2"),
  Blacklist_Region_Fragments STRING OPTIONS(description="Number of fragments overlapping blacklisted regions"),
  MACS2_Neg_Log10_pvalue_Summit STRING OPTIONS(description="Negative log10 p-value for the peak summit in MACS2"),
  Duplicate_Read_Pairs STRING OPTIONS(description="Number of duplicate read-pairs"),
  On_Target_Fragments STRING OPTIONS(description="Number of fragments overlapping any of TSS, enhancer, promoter and DNase hypersensitivity sites (counted with multiplicity)"),
  MACS2_Relative_Summit_Position STRING OPTIONS(description="Position of the peak summit related to the start position in MACS2"),
  DNase_Sensitive_Region_Fragments STRING OPTIONS(description="Number of fragments overlapping with DNase sensitive regions"),
  Filename STRING OPTIONS(description="Name of a file"),
  entityId STRING OPTIONS(description="Synapse ID of entity"),
  MACS2_Score STRING OPTIONS(description="Peak score (proportional to q-value) in MACS2"),
  scATAC_seq_Object_ID STRING OPTIONS(description="Orig.Ident or scATAC-seq Object ID"),
  MACS2_Seqnames STRING OPTIONS(description="Chromosome id"),
  MACS2_End STRING OPTIONS(description="Genomic ending position in MACS2"),
  Enhancer_Region_Fragments STRING OPTIONS(description="Number of fragments overlapping enhancer regions"),
  MACS2_Width STRING OPTIONS(description="Width of the peak in bases in MACS2"),
  nFeature_Peaks STRING OPTIONS(description="Number of peaks with at least one read"),
  nCount_RNA STRING OPTIONS(description="Total number of fragments in genes"),
  Chimeric_Read_Pairs STRING OPTIONS(description="Number of chimerically mapped read-pairs"),
  Pct_Reads_in_Peaks STRING OPTIONS(description="Percentage of reads in peaks"),
  Blacklist_Ratio STRING OPTIONS(description="Ratio of reads in blacklist regions"),
  Id STRING OPTIONS(description="Unique identifier of entity e.g. a96059eb-81af-4b24-ae50-9242c0d8f819"),
  MACS2_Fold_Change STRING OPTIONS(description="Fold enrichment for this peak summit against random Poisson distribution with local lambda in MACS2"),
  nCount_Peaks STRING OPTIONS(description="Total number of fragments in peaks"),
  Peak_Region_Cutsites STRING OPTIONS(description="Number of ends of fragments in peak regions"),
  File_Format STRING OPTIONS(description="Format of a file (e.g. txt, csv, fastq, bam, etc.)"),
  MACS2_Strand STRING OPTIONS(description="DNA stand aligned with in MACS2"),
  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 3 METADATA R5 VERSIONED",
  description="This table contains the file metadata for third level single cell ATAC sequencing. Data was extracted from HTAN Synapse projects in April 2024 and corresponds to HTAN Data Release 5.1. 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_level3_metadata_r5` (LowMapQ, TSS_Fragments, TSS_Enrichment, Passed_Filters, TSS_Percentile, HTAN_Data_File_ID, Peak_Region_Fragments, Component, Promoter_Region_Fragments, Unmapped_Read_Pairs, MACS2_Name, Total_Read_Pairs, Seurat_Clusters, Nucleosome_Signal, Nucleosome_Percentile, Mitochondrial_Read_Pairs, nFeature_RNA, HTAN_Parent_Data_File_ID, MACS2_Start, MACS2_Neg_Log10_qvalue_Summit, Blacklist_Region_Fragments, MACS2_Neg_Log10_pvalue_Summit, Duplicate_Read_Pairs, On_Target_Fragments, MACS2_Relative_Summit_Position, DNase_Sensitive_Region_Fragments, Filename, entityId, MACS2_Score, scATAC_seq_Object_ID, MACS2_Seqnames, MACS2_End, Enhancer_Region_Fragments, MACS2_Width, nFeature_Peaks, nCount_RNA, Chimeric_Read_Pairs, Pct_Reads_in_Peaks, Blacklist_Ratio, Id, MACS2_Fold_Change, nCount_Peaks, Peak_Region_Cutsites, File_Format, MACS2_Strand, HTAN_Center, Manifest_Id, Manifest_Version, File_Size, md5, Data_Release, CDS_Release) VALUES (NULL, NULL, NULL, NULL, NULL, 'HTA4_1016_73335', NULL, 'ScATAC-seqLevel3', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'HTA4_1016_63335', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'single_cell_ATACseq_level_3_NBL/1774_REG2/matrix.rds', 'syn51690792', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'd5f788d3-4852-4fb6-89d4-3cf63f88555e', NULL, NULL, NULL, 'RData', NULL, 'HTAN CHOP', 'syn51791727', 4, 286653425, 'f55cee8f234aa2335c3da56f48c7d4a0', 'Release 5.0', NULL), (NULL, NULL, NULL, NULL, NULL, 'HTA4_1007_73336', NULL, 'ScATAC-seqLevel3', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'HTA4_1007_63336', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'single_cell_ATACseq_level_3_NBL/3051_REG2/matrix.rds', 'syn51690796', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '04dce1ed-7bbc-404f-8912-8c4618ae3178', NULL, NULL, NULL, 'RData', NULL, 'HTAN CHOP', 'syn51791727', 4, 239591540, '58799b1adccf19e98d30b24602d8875e', 'Release 5.0', NULL), (NULL, NULL, NULL, NULL, NULL, 'HTA4_1004_73337', NULL, 'ScATAC-seqLevel3', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'HTA4_1004_63337', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'single_cell_ATACseq_level_3_NBL/3053_REG2/matrix.rds', 'syn51690798', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '23751a9b-8777-4795-af34-6fdb4c3d7c77', NULL, NULL, NULL, 'RData', NULL, 'HTAN CHOP', 'syn51791727', 4, 256849830, '92806c71c948af61b7c51548bba03f0b', 'Release 5.0', NULL), (NULL, NULL, NULL, NULL, NULL, 'HTA4_1004_73338', NULL, 'ScATAC-seqLevel3', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'HTA4_1004_63338', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'single_cell_ATACseq_level_3_NBL/3054_REG2/matrix.rds', 'syn51690794', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'dc5a5934-3be8-45e8-947a-522e773d3af3', NULL, NULL, NULL, 'RData', NULL, 'HTAN CHOP', 'syn51791727', 4, 191852630, 'a5f74ef7622c0a9fc619cfc0172b5400', 'Release 5.0', NULL), (NULL, NULL, NULL, NULL, NULL, 'HTA4_1013_73339', NULL, 'ScATAC-seqLevel3', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'HTA4_1013_63339', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'single_cell_ATACseq_level_3_NBL/3058_REG2/matrix.rds', 'syn51690824', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '03d387aa-4692-4ed4-9981-be201d59307b', NULL, NULL, NULL, 'RData', NULL, 'HTAN CHOP', 'syn51791727', 4, 70716924, '6bec149caa0153e7ea58f6a914673271', 'Release 5.0', NULL);