-- DBMS: bigquery
CREATE TABLE `isb-cgc-bq.HTAN_versioned.imaging_level4_metadata_r5`
(
  Imaging_Object_Class STRING OPTIONS(description="Defines the structure that the mask delineates"),
  Parameter_file STRING OPTIONS(description="Path in Syanpse to a text file listing algorithm version numbers and relevant parameters needed to reproduce the analysis"),
  Imaging_Summary_Statistic STRING OPTIONS(description="Function used to summarize object/feature intensity"),
  HTAN_Parent_Channel_Metadata_ID STRING OPTIONS(description="HTAN ID for a level 3 channels table."),
  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"),
  entityId STRING OPTIONS(description="Synapse ID of entity"),
  Id STRING OPTIONS(description="Unique identifier of entity e.g. a96059eb-81af-4b24-ae50-9242c0d8f819"),
  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)"),
  Number_of_Features STRING OPTIONS(description="The number of features (eg channels) described"),
  Component STRING OPTIONS(description="Category of metadata (e.g. Diagnosis, Biospecimen, scRNA-seq Level 1, etc.); provide the same one for all items/rows."),
  Imaging_Object_Class_Description STRING OPTIONS(description="Free text description of object class [string]"),
  Number_of_Objects STRING OPTIONS(description="The number of objects (eg cells) described"),
  Commit_SHA STRING OPTIONS(description="Short SHA for software version [8 hexadecimal characters (for github), comma separated if multiple]"),
  Software_and_Version STRING OPTIONS(description="Name of software used to generate expression values. String"),
  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 IMAGING LEVEL 4 METADATA R5 VERSIONED",
  description="This table contains the file metadata for fourth level imaging data which includes an object-by-feature table generated from the segmentation mask and image. 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/imaging",
  labels=[("access", "open"), ("data_type", "file_metadata"), ("program", "htan"), ("source", "htan"), ("category", "metadata"), ("status", "current")]
);

INSERT INTO `isb-cgc-bq.HTAN_versioned.imaging_level4_metadata_r5` (Imaging_Object_Class, Parameter_file, Imaging_Summary_Statistic, HTAN_Parent_Channel_Metadata_ID, Filename, HTAN_Parent_Data_File_ID, entityId, Id, HTAN_Data_File_ID, Number_of_Features, Component, Imaging_Object_Class_Description, Number_of_Objects, Commit_SHA, Software_and_Version, File_Format, HTAN_Center, Manifest_Id, Manifest_Version, File_Size, md5, Data_Release, CDS_Release) VALUES ('whole cell', NULL, NULL, NULL, 'imaging_level_4/CRC202208/191-CRCWSI_Immune-2021JUL/unmicst-tnpcrc_01_cell.csv', 'HTA7_926_1006', 'syn36010148', '726ddd18-94c6-4821-8ca3-bc124ce5d662', 'HTA7_926_1009', '59', 'ImagingLevel4', NULL, '1257768', NULL, 'labsyspharm/quantification 1.4.0', 'csv', 'HTAN HMS', 'syn45226943', 4, 1298434754, 'ff0dfdfb2bb6b2408a6ac2d1c8f0d7e1', 'Release 3.0', NULL), ('whole cell', NULL, NULL, NULL, 'imaging_level_4/CRC202208/191-CRCWSI_Immune-2021JUL/unmicst-tnpcrc_02_cell.csv', 'HTA7_927_1007', 'syn36010209', 'c406647f-2b46-448a-b10b-80560fd762e4', 'HTA7_927_1010', '59', 'ImagingLevel4', NULL, '944790', NULL, 'labsyspharm/quantification 1.4.0', 'csv', 'HTAN HMS', 'syn45226943', 4, 976469455, 'e8bbe000c9e196e1574da459d5f81d59', 'Release 3.0', NULL), ('whole cell', NULL, NULL, NULL, 'imaging_level_4/CRC202208/191-CRCWSI_Immune-2021JUL/unmicst-tnpcrc_03_cell.csv', 'HTA7_932_1007', 'syn36010294', '86bd0d67-7646-4069-8472-ddf5a7038e41', 'HTA7_932_1010', '59', 'ImagingLevel4', NULL, '1767744', NULL, 'labsyspharm/quantification 1.4.0', 'csv', 'HTAN HMS', 'syn45226943', 4, 1822833743, '2eccef04ae9b779cb71d05451b31328b', 'Release 3.0', NULL), ('whole cell', NULL, NULL, NULL, 'imaging_level_4/CRC202208/191-CRCWSI_Immune-2021JUL/unmicst-tnpcrc_04_cell.csv', 'HTA7_934_1007', 'syn36010371', 'b6f3b9a7-e392-4485-869f-a1aa9a47eece', 'HTA7_934_1010', '59', 'ImagingLevel4', NULL, '1192288', NULL, 'labsyspharm/quantification 1.4.0', 'csv', 'HTAN HMS', 'syn45226943', 4, 1232940951, '5d0db0b0233b8d2125ee621050849570', 'Release 3.0', NULL), ('whole cell', NULL, NULL, NULL, 'imaging_level_4/CRC202208/191-CRCWSI_Immune-2021JUL/unmicst-tnpcrc_05_cell.csv', 'HTA7_966_1004', 'syn36010406', '3101cb1b-2358-479c-81b5-ea51a7dbf3bc', 'HTA7_966_1007', '59', 'ImagingLevel4', NULL, '705661', NULL, 'labsyspharm/quantification 1.4.0', 'csv', 'HTAN HMS', 'syn45226943', 4, 734315565, 'da6c574949cafbc0aaf8323aa11aac95', 'Release 3.0', NULL);