-- DBMS: bigquery
CREATE TABLE `isb-cgc-bq.HTAN_versioned.scRNAseq_level2_metadata_r5`
(
  Workflow_Link STRING OPTIONS(description="Link to workflow or command. DockStore.org recommended. URL"),
  UMI_Tag STRING OPTIONS(description="SAM tag for the UMI field; please provide a valid UB, UMI (e.g. UB:Z or UR:Z)"),
  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)"),
  Component STRING OPTIONS(description="Category of metadata (e.g. Diagnosis, Biospecimen, scRNA-seq Level 1, etc.); provide the same one for all items/rows."),
  scRNAseq_Workflow_Type STRING OPTIONS(description="Generic name for the workflow used to analyze a data set."),
  Aligned_Read_Length STRING OPTIONS(description="Read length used for alignment if hard trimming was applied"),
  Cell_Barcode_Tag STRING OPTIONS(description="SAM tag for cell barcode field; please provide a valid cell barcode tag (e.g. CB:Z)"),
  HTAN_Parent_Data_File_ID STRING OPTIONS(description="HTAN Data File Identifier indicating the file(s) from which these files were derived"),
  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)"),
  Checksum STRING OPTIONS(description="MD5 checksum of the BAM file"),
  Genomic_Reference STRING OPTIONS(description="Exact version of the human genome reference used in the alignment of reads (e.g. GCF_000001405.39)"),
  Workflow_Version STRING OPTIONS(description="Major version of the workflow (e.g. Cell Ranger v3.1)"),
  Genome_Annotation_URL STRING OPTIONS(description="Link to the human genome annotation (GTF) file (e.g. ftp://ftp.ebi.ac.uk/pub/databases/gencode/Gencode_human/release_34/gencode.v34.annotation.gtf.gz)"),
  Filename STRING OPTIONS(description="Name of a file"),
  entityId STRING OPTIONS(description="Synapse ID of entity"),
  Applied_Hard_Trimming STRING OPTIONS(description="Was Hard Trimming applied"),
  scRNAseq_Workflow_Parameters_Description STRING OPTIONS(description="Parameters used to run the workflow. scRNA-seq level 3: e.g. Normalization and log transformation, ran empty drops or doublet detection, used filter on # genes/cell, etc. scRNA-seq Level 4: dimensionality reduction with PCA and 50 components, nearest-neighbor graph with k = 20 and Leiden clustering with resolution = 1, UMAP visualization using 50 PCA components, marker genes used to annotate cell types, information about droplet matrix (all barcodes) to cell matrix (only informative barcodes representing real cells) conversion"),
  Id STRING OPTIONS(description="Unique identifier of entity e.g. a96059eb-81af-4b24-ae50-9242c0d8f819"),
  Whitelist_Cell_Barcode_File_Link STRING OPTIONS(description="Link to file listing all possible cell barcodes. URL"),
  File_Format STRING OPTIONS(description="Format of a file (e.g. txt, csv, fastq, bam, etc.)"),
  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 SCRNASEQ LEVEL 2 METADATA R5 VERSIONED",
  description="This table contains the file metadata for second level (i.e. BAM files) single cell RNA 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.scRNAseq_level2_metadata_r5` (Workflow_Link, UMI_Tag, HTAN_Data_File_ID, Component, scRNAseq_Workflow_Type, Aligned_Read_Length, Cell_Barcode_Tag, HTAN_Parent_Data_File_ID, Genomic_Reference_URL, Checksum, Genomic_Reference, Workflow_Version, Genome_Annotation_URL, Filename, entityId, Applied_Hard_Trimming, scRNAseq_Workflow_Parameters_Description, Id, Whitelist_Cell_Barcode_File_Link, File_Format, HTAN_Center, Manifest_Id, Manifest_Version, File_Size, md5, Data_Release, CDS_Release) VALUES ('Not Applicable', 'UB:Z', 'HTA5_0000_1002140', 'ScRNA-seqLevel2', 'CellRanger', NULL, 'CR:Z', 'HTA5_0000_10020, HTA5_0000_10021, HTA5_0000_10022, HTA5_0000_10023, HTA5_0000_10024, HTA5_0000_10025, HTA5_0000_10026, HTA5_0000_10027', 'https://ftp.ebi.ac.uk/pub/databases/gencode/Gencode_human/release_32/GRCh38.primary_assembly.genome.fa.gz', 'Aob4JkHln2JoVAqJEZRfIg==', 'GCF_000001405.39', 'CellRanger v6.0.1', 'https://cf.10xgenomics.com/supp/cell-exp/refdata-gex-GRCh38-2020-A.tar.gz', 'single_cell_RNAseq_level_2_breast/SM-K75P2.genome.bam', 'syn52589057', 'No', 'cellranger count     --id ${sample_id}     --transcriptome ${reference}     --include-introns     --disable-ui     --fastqs ${fastq_dir}     --expect-cells ${expected_cells}     --localcores ${cpu}     --localmem ${memory}', '75a7cc34-3673-4be3-aa41-0d36dbd5652c', 'Not Applicable', 'bam', 'HTAN DFCI', 'syn52598989', 2, 60966543491, '0286f82641e59f6268540a8911945f22', 'Release 5.0', NULL), ('Not Applicable', 'UB:Z', 'HTA5_0000_1002142', 'ScRNA-seqLevel2', 'CellRanger', NULL, 'CR:Z', 'HTA5_0000_10028, HTA5_0000_10029, HTA5_0000_100210, HTA5_0000_100211', 'https://ftp.ebi.ac.uk/pub/databases/gencode/Gencode_human/release_32/GRCh38.primary_assembly.genome.fa.gz', '3/tghkiIX+I8QKDaiwXGyg==', 'GCF_000001405.39', 'CellRanger v6.0.1', 'https://cf.10xgenomics.com/supp/cell-exp/refdata-gex-GRCh38-2020-A.tar.gz', 'single_cell_RNAseq_level_2_breast/SM-KU86U.genome.bam', 'syn52589059', 'No', 'cellranger count     --id ${sample_id}     --transcriptome ${reference}     --include-introns     --disable-ui     --fastqs ${fastq_dir}     --expect-cells ${expected_cells}     --localcores ${cpu}     --localmem ${memory}', 'c0625e72-b1b9-4303-a625-874b5a050a67', 'Not Applicable', 'bam', 'HTAN DFCI', 'syn52598989', 2, 33653000654, 'dffb608648885fe23c40a0da8b05c6ca', 'Release 5.0', NULL), ('Not Applicable', 'UB:Z', 'HTA5_0000_1002144', 'ScRNA-seqLevel2', 'CellRanger', NULL, 'CR:Z', 'HTA5_0000_100212, HTA5_0000_100213, HTA5_0000_100214, HTA5_0000_100215', 'https://ftp.ebi.ac.uk/pub/databases/gencode/Gencode_human/release_32/GRCh38.primary_assembly.genome.fa.gz', 'feOUDGf9wX2HMBHSYBEIHg==', 'GCF_000001405.39', 'CellRanger v6.0.1', 'https://cf.10xgenomics.com/supp/cell-exp/refdata-gex-GRCh38-2020-A.tar.gz', 'single_cell_RNAseq_level_2_breast/SM-KU86V.genome.bam', 'syn52589060', 'No', 'cellranger count     --id ${sample_id}     --transcriptome ${reference}     --include-introns     --disable-ui     --fastqs ${fastq_dir}     --expect-cells ${expected_cells}     --localcores ${cpu}     --localmem ${memory}', '52506579-742b-4129-9d4b-46b2b529c4fa', 'Not Applicable', 'bam', 'HTAN DFCI', 'syn52598989', 2, 30413776447, '7de3940c67fdc17d873011d26011081e', 'Release 5.0', NULL), ('Not Applicable', 'UB:Z', 'HTA5_0000_1002146', 'ScRNA-seqLevel2', 'CellRanger', NULL, 'CR:Z', 'HTA5_0000_100216, HTA5_0000_100217, HTA5_0000_100218, HTA5_0000_100219', 'https://ftp.ebi.ac.uk/pub/databases/gencode/Gencode_human/release_32/GRCh38.primary_assembly.genome.fa.gz', '6T5dUBojKqZjbwLuf102mA==', 'GCF_000001405.39', 'CellRanger v6.0.1', 'https://cf.10xgenomics.com/supp/cell-exp/refdata-gex-GRCh38-2020-A.tar.gz', 'single_cell_RNAseq_level_2_breast/SM-KU86W.genome.bam', 'syn52589067', 'No', 'cellranger count     --id ${sample_id}     --transcriptome ${reference}     --include-introns     --disable-ui     --fastqs ${fastq_dir}     --expect-cells ${expected_cells}     --localcores ${cpu}     --localmem ${memory}', 'fe67ab2b-3341-4068-9d57-1f4416d62a20', 'Not Applicable', 'bam', 'HTAN DFCI', 'syn52598989', 2, 28766934107, 'e93e5d501a232aa6636f02ee7f5d3698', 'Release 5.0', NULL), ('Not Applicable', 'UB:Z', 'HTA5_0000_1002148', 'ScRNA-seqLevel2', 'CellRanger', NULL, 'CR:Z', 'HTA5_0000_100220, HTA5_0000_100221, HTA5_0000_100222, HTA5_0000_100223', 'https://ftp.ebi.ac.uk/pub/databases/gencode/Gencode_human/release_32/GRCh38.primary_assembly.genome.fa.gz', 'iXUOGfZf7CzwqcWZmHAXrA==', 'GCF_000001405.39', 'CellRanger v6.0.1', 'https://cf.10xgenomics.com/supp/cell-exp/refdata-gex-GRCh38-2020-A.tar.gz', 'single_cell_RNAseq_level_2_breast/SM-KU86X.genome.bam', 'syn52589064', 'No', 'cellranger count     --id ${sample_id}     --transcriptome ${reference}     --include-introns     --disable-ui     --fastqs ${fastq_dir}     --expect-cells ${expected_cells}     --localcores ${cpu}     --localmem ${memory}', '162510fd-afbc-4155-85d6-a767e9cfa692', 'Not Applicable', 'bam', 'HTAN DFCI', 'syn52598989', 2, 34665221334, '89750e19f65fec2cf0a9c599987017ac', 'Release 5.0', NULL);