-- DBMS: bigquery
CREATE TABLE `isb-cgc-bq.HTAN_versioned.imaging_level3_segmentation_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"),
  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)"),
  Imaging_Segmentation_Data_Type STRING OPTIONS(description="Specifies how the segmentation is stored"),
  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 3 SEGMENTATION METADATA R5 VERSIONED",
  description="This table contains the file metadata for third level imaging data which includes segmentation masks, validated channel metadata, and QC checked images. 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_level3_segmentation_metadata_r5` (Imaging_Object_Class, Parameter_file, Filename, HTAN_Parent_Data_File_ID, entityId, Id, HTAN_Data_File_ID, Imaging_Segmentation_Data_Type, 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, 'imaging_level_3_segmentation/CRC202211/165-TNP_CRCTMA-2020AUG/CRC02-cell-mask.ome.tif', 'HTA7_926_1000', 'syn44293986', 'e513df3b-f772-43c1-b58e-4349f437ef7a', 'HTA7_926_1008', 'Mask', 'ImagingLevel3Segmentation', NULL, '1148404', NULL, 's3segmenter 1.2.0', 'OME-TIFF', 'HTAN HMS', 'syn45226287', 3, 215810829, '3e1264555d57bfc9168668d4d88b2bde', 'Release 3.0', NULL), ('whole cell', NULL, 'imaging_level_3_segmentation/CRC202211/165-TNP_CRCTMA-2020AUG/CRC03-cell-mask.ome.tif', 'HTA7_927_1000', 'syn44294003', '238a196f-99a3-4323-93d7-3a379320178b', 'HTA7_927_1009', 'Mask', 'ImagingLevel3Segmentation', NULL, '824758', NULL, 's3segmenter 1.2.0', 'OME-TIFF', 'HTAN HMS', 'syn45226287', 3, 172791291, '20b6b667cbdda72ac0bfcd9a776c5f6a', 'Release 3.0', NULL), ('whole cell', NULL, 'imaging_level_3_segmentation/CRC202211/165-TNP_CRCTMA-2020AUG/CRC04-cell-mask.ome.tif', 'HTA7_932_1000', 'syn44294038', '6188c9ff-5b7a-480c-9910-06999606b0cb', 'HTA7_932_1009', 'Mask', 'ImagingLevel3Segmentation', NULL, '1640430', NULL, 's3segmenter 1.2.0', 'OME-TIFF', 'HTAN HMS', 'syn45226287', 3, 306648573, '23c59a370ee71376f4e9dd46353f3067', 'Release 3.0', NULL), ('whole cell', NULL, 'imaging_level_3_segmentation/CRC202211/165-TNP_CRCTMA-2020AUG/CRC05-cell-mask.ome.tif', 'HTA7_934_1000', 'syn44294069', 'ca2ffeac-86c0-4492-8f4f-1610f28a3e56', 'HTA7_934_1009', 'Mask', 'ImagingLevel3Segmentation', NULL, '1138959', NULL, 's3segmenter 1.2.0', 'OME-TIFF', 'HTAN HMS', 'syn45226287', 3, 224071279, '289be92c8c2fdc8e1d4e66c18779ac6c', 'Release 3.0', NULL), ('whole cell', NULL, 'imaging_level_3_segmentation/CRC202211/165-TNP_CRCTMA-2020AUG/CRC06-cell-mask.ome.tif', 'HTA7_966_1000', 'syn44294086', '9f41c3a7-edf5-452e-9356-12b81ae8ef08', 'HTA7_966_1006', 'Mask', 'ImagingLevel3Segmentation', NULL, '441316', NULL, 's3segmenter 1.2.0', 'OME-TIFF', 'HTAN HMS', 'syn45226287', 3, 106457619, '73b79501933b860e35363d37b5ab9c35', 'Release 3.0', NULL);