-- DBMS: bigquery
CREATE TABLE `isb-cgc-bq.HTAN_versioned.scRNAseq_MSK_SCLC_combined_samples_r3`
(
  iObs INT64 OPTIONS(description="Index to cell barcodes"),
  iVar INT64 OPTIONS(description="Index to gene IDs"),
  X_value FLOAT64 OPTIONS(description="Expression value for a given gene and cell"),
  ngenes INT64 OPTIONS(description="Number of genes detected in a given cell"),
  libsize FLOAT64 OPTIONS(description="Log (N+1) on the number of gene expression counts (reads mapped) for a given cell"),
  mito_frac FLOAT64 OPTIONS(description="Percent of UMIs mapping to mitochondrial genes"),
  RBP_frac FLOAT64 OPTIONS(description="Percent of UMIs mapping to RNA-binding proteins (RBPs)"),
  batch STRING OPTIONS(description="Sample ID"),
  donor_id STRING OPTIONS(description="Identifies a unique individual that data were derived from"),
  treatment STRING OPTIONS(description="The type of treatment recieved by the patient"),
  procedure STRING OPTIONS(description="The method used in sampling the tumor, Biopsy or Resection"),
  histo STRING OPTIONS(description="Histological cancer type"),
  cell_type_coarse STRING OPTIONS(description="Coarse-grained cell labels"),
  cell_type_fine STRING OPTIONS(description="Fine-grained subclustering of cells"),
  cell_type_general STRING OPTIONS(description="Broadly defined cell type compartments"),
  clusters STRING OPTIONS(description="Cluster labels assigned to each cell"),
  cell_type_med STRING OPTIONS(description="Medium range cell type names, between coarse and fine."),
  H_knn FLOAT64 OPTIONS(description="Entropy of samples represented in the kNN neighborhood of each cell (kNN=30)"),
  development_stage_ontology_term_id STRING OPTIONS(description="Human Developmental Stages ID (REF: https://www.ebi.ac.uk/ols/ontologies/hsapdv) or Mouse Developmental Stages ID (REF: https://www.ebi.ac.uk/ols/ontologies/mmusdv) (HsapDv if human, MmusDv if mouse, unknown if information unavailable)"),
  sex_ontology_term_id STRING OPTIONS(description="Phenotype And Trait Ontology ID, PATO:0000384 for male, PATO:0000383 for female, or unknown if unavailable"),
  self_reported_ethnicity_ontology_term_id STRING OPTIONS(description="If human, the Human Ancestry Ontology ID (i.e. HANCESTRO:0005) (REF: https://www.ebi.ac.uk/ols/ontologies/hancestro); \"multiethnic\" if more than one ethnicity. \"Unknown\" if human and no information, else \"na\" if non-human"),
  assay_ontology_term_id STRING OPTIONS(description="Experimental Factor Ontology ID (REF: https://www.ebi.ac.uk/ols/ontologies/efo)"),
  is_primary_data BOOL OPTIONS(description="Indicates if the sample is primary or not (True/False)"),
  tissue_ontology_term_id STRING OPTIONS(description="Uber-anatomy ontology ID (REF: https://www.ebi.ac.uk/ols/ontologies/uberon) (ex.UBERON:2001190)"),
  disease_ontology_term_id STRING OPTIONS(description="MONDO disease ontology ID (REF: https://www.ebi.ac.uk/ols/ontologies/mondo) (ex. MONDO:0100426 or PATO:0000461 for 'normal')"),
  organism_ontology_term_id STRING OPTIONS(description="NCBITaxon ID (REF: https://www.ncbi.nlm.nih.gov/taxonomy) (ex. NCBITaxon:9606 for human, NCBITaxon:10090 for mouse)"),
  cell_type_ontology_term_id STRING OPTIONS(description="Cell Ontology ID (i.e. CL:0000784)  (REF: https://www.ebi.ac.uk/ols/ontologies/cl)"),
  suspension_type STRING OPTIONS(description="Cell, nucleus, or na, as corresponding to sample preparation"),
  HTAN_Biospecimen_ID STRING OPTIONS(description="HTAN ID associated with a biosample based on HTAN ID SOP (eg HTANx_yyy_zzz)"),
  HTAN_Participant_ID STRING OPTIONS(description="HTAN ID associated with a patient based on HTAN ID SOP (eg HTANx_yyy )"),
  cell_type STRING OPTIONS(description="The type of cell (i.e. T-cell)"),
  assay STRING OPTIONS(description="An assay based on 10X Genomics. Example : 100x3’ v2"),
  disease STRING OPTIONS(description="Description of disease (example: lung adenocarcinoma) or normal cells"),
  organism STRING OPTIONS(description="The genus and species from which biosamples are derived"),
  sex STRING OPTIONS(description="Phenotypic sex"),
  tissue STRING OPTIONS(description="Derived from UBERON or CL terms that best describes the tissue that the cell was derived from."),
  self_reported_ethnicity STRING OPTIONS(description="Ethnicity of the individual (obtained from HANCESTRO terms for Homo sapiens)"),
  development_stage STRING OPTIONS(description="Human development stage derived from HsapDv term  (Example if data is Homo sapiens, development stage is obtained from Link. HsapDv:0000114 - 20-year-old human stage)"),
  feature_is_filtered BOOL OPTIONS(description="Indicates if the feature (gene) was/should be filtered in analysis"),
  feature_name STRING OPTIONS(description="Gene name from HUGO Human Gene Nomenclature Committee (https://www.genenames.org/)"),
  feature_reference STRING OPTIONS(description="A reference to the feature: NCBI Taxonomy ID"),
  feature_biotype STRING OPTIONS(description="Biological type of feature (e.g. gene)")
)
OPTIONS(
  friendly_name="MSK SCLC ALL CELLS R3 VERSIONED",
  description="Data was derived in April 2023 from an H5AD file (Synapse ID: syn51297089) submitted by the MSK HTAN Center. This data set contains both raw gene expression counts and log2(X+1) transformed, median-normalized expression from 62 pooled samples (N=147,137 cells). Data was generated using the 10X Genomics and was processed using SEQC, where reads were mapped to HG38, followed by cell filtering for mitochondrial fraction > 20%, empty droplet filtering (scCB2), and doublet removal (doubletdetection). Genes that were expressed in more than 10 cells were retained. Batch correction with fastMNN was performed for subsequent analysis, including UMAP visualization with scanpy and Phenograph clustering.",
  labels=[("access", "open"), ("reference_genome", "hg38"), ("data_type", "gene_expression"), ("program", "htan"), ("source", "htan-msk"), ("category", "processed_-omics_data"), ("status", "current")]
);

INSERT INTO `isb-cgc-bq.HTAN_versioned.scRNAseq_MSK_SCLC_combined_samples_r3` (iObs, iVar, X_value, ngenes, libsize, mito_frac, RBP_frac, batch, donor_id, treatment, procedure, histo, cell_type_coarse, cell_type_fine, cell_type_general, clusters, cell_type_med, H_knn, development_stage_ontology_term_id, sex_ontology_term_id, self_reported_ethnicity_ontology_term_id, assay_ontology_term_id, is_primary_data, tissue_ontology_term_id, disease_ontology_term_id, organism_ontology_term_id, cell_type_ontology_term_id, suspension_type, HTAN_Biospecimen_ID, HTAN_Participant_ID, cell_type, assay, disease, organism, sex, tissue, self_reported_ethnicity, development_stage, feature_is_filtered, feature_name, feature_reference, feature_biotype) VALUES (80451, 19071, 0.8623896241188049, 1673, 3.8069257736206055, 0.05833723396062851, 0.2040243297815323, 'RU1057_T', 'RU1057', 'Naive', 'Resection', 'LUAD', 'Myeloid', 'DC', 'Immune', '20', 'DC', 1.7394584072899608, 'HsapDv:0000161', 'PATO:0000383', 'HANCESTRO:0005', 'EFO:0009899', True, 'UBERON:0002048', 'MONDO:0005061', 'NCBITaxon:9606', 'CL:0000451', 'cell', 'HTA8_1002_1', 'HTA8_1002', 'dendritic cell', '10x 3'' v2', 'lung adenocarcinoma', 'Homo sapiens', 'female', 'lung', 'European', '67-year-old human stage', False, 'STAT3', 'NCBITaxon:9606', 'gene'), (98363, 19071, 1.930572509765625, 1111, 3.571708917617798, 0.027882037684321404, 0.27962467074394226, 'RU1057_T', 'RU1057', 'Naive', 'Resection', 'LUAD', 'Myeloid', 'DC', 'Immune', '20', 'DC', 1.866067261780084, 'HsapDv:0000161', 'PATO:0000383', 'HANCESTRO:0005', 'EFO:0009899', True, 'UBERON:0002048', 'MONDO:0005061', 'NCBITaxon:9606', 'CL:0000451', 'cell', 'HTA8_1002_1', 'HTA8_1002', 'dendritic cell', '10x 3'' v2', 'lung adenocarcinoma', 'Homo sapiens', 'female', 'lung', 'European', '67-year-old human stage', False, 'STAT3', 'NCBITaxon:9606', 'gene'), (102121, 19071, 0.434821754693985, 3135, 4.173477649688721, 0.03232729807496071, 0.18155600130558014, 'RU1057_T', 'RU1057', 'Naive', 'Resection', 'LUAD', 'Myeloid', 'DC', 'Immune', '29', 'DC', 2.0113790993041167, 'HsapDv:0000161', 'PATO:0000383', 'HANCESTRO:0005', 'EFO:0009899', True, 'UBERON:0002048', 'MONDO:0005061', 'NCBITaxon:9606', 'CL:0000451', 'cell', 'HTA8_1002_1', 'HTA8_1002', 'dendritic cell', '10x 3'' v2', 'lung adenocarcinoma', 'Homo sapiens', 'female', 'lung', 'European', '67-year-old human stage', False, 'STAT3', 'NCBITaxon:9606', 'gene'), (107745, 19071, 1.7593647241592407, 1186, 3.6431565284729004, 0.03456902503967285, 0.3393222689628601, 'RU1057_T', 'RU1057', 'Naive', 'Resection', 'LUAD', 'Myeloid', 'DC', 'Immune', '20', 'DC', 2.0488519861949417, 'HsapDv:0000161', 'PATO:0000383', 'HANCESTRO:0005', 'EFO:0009899', True, 'UBERON:0002048', 'MONDO:0005061', 'NCBITaxon:9606', 'CL:0000451', 'cell', 'HTA8_1002_1', 'HTA8_1002', 'dendritic cell', '10x 3'' v2', 'lung adenocarcinoma', 'Homo sapiens', 'female', 'lung', 'European', '67-year-old human stage', False, 'STAT3', 'NCBITaxon:9606', 'gene'), (110156, 19071, 1.8523296117782593, 1866, 3.9049859046936035, 0.030864965170621872, 0.28089606761932373, 'RU1057_T', 'RU1057', 'Naive', 'Resection', 'LUAD', 'Myeloid', 'DC', 'Immune', '20', 'DC', 2.4322781560465367, 'HsapDv:0000161', 'PATO:0000383', 'HANCESTRO:0005', 'EFO:0009899', True, 'UBERON:0002048', 'MONDO:0005061', 'NCBITaxon:9606', 'CL:0000451', 'cell', 'HTA8_1002_1', 'HTA8_1002', 'dendritic cell', '10x 3'' v2', 'lung adenocarcinoma', 'Homo sapiens', 'female', 'lung', 'European', '67-year-old human stage', False, 'STAT3', 'NCBITaxon:9606', 'gene');