-- DBMS: bigquery
CREATE TABLE `isb-cgc-bq.HTAN_versioned.scATACseq_level3_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)"),
  MACS2_End STRING OPTIONS(description="Genomic ending position in MACS2"),
  Id STRING OPTIONS(description="Unique identifier of entity e.g. a96059eb-81af-4b24-ae50-9242c0d8f819"),
  Enhancer_Region_Fragments STRING OPTIONS(description="Number of fragments overlapping enhancer regions"),
  MACS2_Strand STRING OPTIONS(description="DNA stand aligned with in MACS2"),
  nFeature_Peaks STRING OPTIONS(description="Number of peaks with at least one read"),
  MACS2_Relative_Summit_Position STRING OPTIONS(description="Position of the peak summit related to the start position in MACS2"),
  Promoter_Region_Fragments STRING OPTIONS(description="Number of fragments overlapping promoter regions"),
  MACS2_Seqnames STRING OPTIONS(description="Chromosome id"),
  Peak_Region_Cutsites STRING OPTIONS(description="Number of ends of fragments in peak regions"),
  Duplicate_Read_Pairs STRING OPTIONS(description="Number of duplicate read-pairs"),
  scATAC_seq_Object_ID STRING OPTIONS(description="Orig.Ident or scATAC-seq Object ID"),
  nCount_RNA STRING OPTIONS(description="Total number of fragments in genes"),
  Mitochondrial_Read_Pairs STRING OPTIONS(description="Number of read-pairs mapping to mitochondria and non-nuclear contigs"),
  entityId STRING OPTIONS(description="Synapse ID of entity"),
  MACS2_Fold_Change STRING OPTIONS(description="Fold enrichment for this peak summit against random Poisson distribution with local lambda in MACS2"),
  TSS_Enrichment STRING OPTIONS(description="Transcription start site (TSS) enrichment score"),
  Blacklist_Region_Fragments STRING OPTIONS(description="Number of fragments overlapping blacklisted regions"),
  Component STRING OPTIONS(description="Category of metadata (e.g. Diagnosis, Biospecimen, scRNA-seq Level 1, etc.); provide the same one for all items/rows."),
  Seurat_Clusters STRING OPTIONS(description="Clusters of cells by a shared nearest neighbor (SNN) modularity optimization based clustering algorithm"),
  TSS_Percentile STRING OPTIONS(description="Percentile rank of TSS score"),
  MACS2_Neg_Log10_pvalue_Summit STRING OPTIONS(description="Negative log10 p-value for the peak summit in MACS2"),
  Peak_Region_Fragments STRING OPTIONS(description="Number of fragments overlapping peaks"),
  Unmapped_Read_Pairs STRING OPTIONS(description="Number of read-pairs with at least one end not mapped"),
  Blacklist_Ratio STRING OPTIONS(description="Ratio of reads in blacklist regions"),
  MACS2_Name STRING OPTIONS(description="Name of the peak in MACS2"),
  Chimeric_Read_Pairs STRING OPTIONS(description="Number of chimerically mapped read-pairs"),
  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))"),
  TSS_Fragments STRING OPTIONS(description="Number of fragments overlapping with TSS regions"),
  MACS2_Width STRING OPTIONS(description="Width of the peak in bases in MACS2"),
  Nucleosome_Percentile STRING OPTIONS(description="Percentile rank of nucleosome score"),
  MACS2_Score STRING OPTIONS(description="Peak score (proportional to q-value) in MACS2"),
  MACS2_Start STRING OPTIONS(description="Genomic starting position in MACS2"),
  Passed_Filters STRING OPTIONS(description="Number of non-duplicate, usable read-pairs i.e. fragments"),
  LowMapQ STRING OPTIONS(description="Number of read-pairs with <30 mapq on at least one end"),
  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"),
  Pct_Reads_in_Peaks STRING OPTIONS(description="Percentage of reads in peaks"),
  DNase_Sensitive_Region_Fragments STRING OPTIONS(description="Number of fragments overlapping with DNase sensitive regions"),
  nFeature_RNA STRING OPTIONS(description="Number of genes detected in cell"),
  MACS2_Neg_Log10_qvalue_Summit STRING OPTIONS(description="Negative log10 q-value for the peak summit in MACS2"),
  Total_Read_Pairs STRING OPTIONS(description="Total read-pairs"),
  nCount_Peaks STRING OPTIONS(description="Total number of fragments in peaks"),
  On_Target_Fragments STRING OPTIONS(description="Number of fragments overlapping any of TSS, enhancer, promoter and DNase hypersensitivity sites (counted with multiplicity)"),
  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 R4 VERSIONED",
  description="This table contains the file metadata for third level 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_level3_metadata_r4` (HTAN_Data_File_ID, MACS2_End, Id, Enhancer_Region_Fragments, MACS2_Strand, nFeature_Peaks, MACS2_Relative_Summit_Position, Promoter_Region_Fragments, MACS2_Seqnames, Peak_Region_Cutsites, Duplicate_Read_Pairs, scATAC_seq_Object_ID, nCount_RNA, Mitochondrial_Read_Pairs, entityId, MACS2_Fold_Change, TSS_Enrichment, Blacklist_Region_Fragments, Component, Seurat_Clusters, TSS_Percentile, MACS2_Neg_Log10_pvalue_Summit, Peak_Region_Fragments, Unmapped_Read_Pairs, Blacklist_Ratio, MACS2_Name, Chimeric_Read_Pairs, Nucleosome_Signal, TSS_Fragments, MACS2_Width, Nucleosome_Percentile, MACS2_Score, MACS2_Start, Passed_Filters, LowMapQ, File_Format, Filename, HTAN_Parent_Data_File_ID, Pct_Reads_in_Peaks, DNase_Sensitive_Region_Fragments, nFeature_RNA, MACS2_Neg_Log10_qvalue_Summit, Total_Read_Pairs, nCount_Peaks, On_Target_Fragments, HTAN_Center, Manifest_Id, Manifest_Version, File_Size, md5, Data_Release, CDS_Release) VALUES ('HTA12_105_3011', NULL, '9315d185-7889-4df4-91d0-3412bed9d298', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'syn52176240', NULL, NULL, NULL, 'ScATAC-seqLevel3', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'bed', 'snATAC-Seq_level_3_atac_tumor/CM556C1-T1-peaks.bed', 'HTA12_105_2010', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'HTAN WUSTL', 'syn52257258', 6, 2138053, '852843719c0d53879688beac7d58adc9', 'Release 3.0', NULL), ('HTA12_115_3011', NULL, '7b25ad90-8f46-4a50-ad7e-9e126ab7929b', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'syn52176226', NULL, NULL, NULL, 'ScATAC-seqLevel3', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'bed', 'snATAC-Seq_level_3_atac_tumor/HT-018-P-Slice2-peaks.bed', 'HTA12_115_2010', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'HTAN WUSTL', 'syn52257258', 6, 1678830, 'f20ee144a07e85d9eb785e2cf4499141', 'Release 3.0', NULL), ('HTA12_116_3011', NULL, 'c0f8d331-3bbf-48da-b50f-f5436ac0827a', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'syn52176230', NULL, NULL, NULL, 'ScATAC-seqLevel3', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'bed', 'snATAC-Seq_level_3_atac_tumor/HT-020-P-PunchA2-peaks.bed', 'HTA12_116_2010', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'HTAN WUSTL', 'syn52257258', 6, 2003895, '357bf9b6fa09951a15c9b7185cb38088', 'Release 3.0', NULL), ('HTA12_117_3011', NULL, '298ac76f-cacb-4e86-9af2-1a4e81d4bd0e', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'syn52176253', NULL, NULL, NULL, 'ScATAC-seqLevel3', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'bed', 'snATAC-Seq_level_3_atac_tumor/HT-022-P-PunchA1-peaks.bed', 'HTA12_117_2010', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'HTAN WUSTL', 'syn52257258', 6, 2633295, 'c5a70e9efa4ba3eb0bbd2b828deb1f15', 'Release 3.0', NULL), ('HTA12_118_3011', NULL, '8ec96240-5ce4-4b9e-a3cb-0ea7ba77b3e2', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'syn52176249', NULL, NULL, NULL, 'ScATAC-seqLevel3', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'bed', 'snATAC-Seq_level_3_atac_tumor/HT029B1-S1PC-peaks.bed', 'HTA12_118_2010', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'HTAN WUSTL', 'syn52257258', 6, 3280262, '16d125a71ae23b452937f2e6056b999c', 'Release 3.0', NULL);