-- DBMS: bigquery
CREATE TABLE `isb-cgc-bq.HTAN_versioned.imaging_level4_metadata_r4`
(
  entityId STRING OPTIONS(description="Synapse ID of entity"),
  Commit_SHA STRING OPTIONS(description="Short SHA for software version [8 hexadecimal characters (for github), comma separated if multiple]"),
  Number_of_Objects STRING OPTIONS(description="The number of objects (eg cells) described"),
  HTAN_Parent_Channel_Metadata_ID STRING OPTIONS(description="HTAN ID for a level 3 channels table."),
  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)"),
  Id STRING OPTIONS(description="Unique identifier of entity e.g. a96059eb-81af-4b24-ae50-9242c0d8f819"),
  Software_and_Version STRING OPTIONS(description="Name of software used to generate expression values. String"),
  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"),
  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_Summary_Statistic STRING OPTIONS(description="Function used to summarize object/feature intensity"),
  Imaging_Object_Class_Description STRING OPTIONS(description="Free text description of object class [string]"),
  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"),
  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 R4 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 October 2023. 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_r4` (entityId, Commit_SHA, Number_of_Objects, HTAN_Parent_Channel_Metadata_ID, HTAN_Data_File_ID, Id, Software_and_Version, Imaging_Object_Class, Parameter_file, Number_of_Features, Component, Imaging_Summary_Statistic, Imaging_Object_Class_Description, File_Format, Filename, HTAN_Parent_Data_File_ID, HTAN_Center, Manifest_Id, Manifest_Version, File_Size, md5, Data_Release, CDS_Release) VALUES ('syn52126197', NULL, '69672', NULL, 'HTA6_0_7', '03102a31-0f6c-4005-ad4a-66731d97ce47', 'github.com/MESMER-group/mesmer/commits/', 'whole cell', 'Deepcell_Beta_Version_2019._Stroma_Parameters:_smooth=1_threshold=0.6_expansion=2._Epithelial_Parameters:_smooth=2.4_threshold=0.25_expansion=3', '134', 'ImagingLevel4', 'Mean', 'Single whole cell', 'csv', 'mibi_imaging_level_4/Single_cell_data.csv', 'HTA6_1135_316, HTA6_1133_312, HTA6_2038_310, HTA6_1029_55, HTA6_2129_56, HTA6_1045_52, HTA6_1118_369, HTA6_2023_314, HTA6_EXT1_45, HTA6_2029_312, HTA6_1032_414, HTA6_1038_312, HTA6_1054_418, HTA6_1048_313, HTA6_EXT2_45, HTA6_2350_50, HTA6_1028_52, HTA6_1025_312, HTA6_2078_312, HTA6_2020_413, HTA6_1057_310, HTA6_2026_310, HTA6_1044_312, HTA6_1042_312, HTA6_1039_312, HTA6_2130_50, HTA6_1073_310, HTA6_1084_312, HTA6_1085_414, HTA6_1095_312, HTA6_2071_318, HTA6_EXT3_45, HTA6_2077_318, HTA6_1077_316, HTA6_1081_310, HTA6_1066_312, HTA6_2055_310, HTA6_1060_312, HTA6_1082_312, HTA6_1086_310, HTA6_1092_312, HTA6_1098_417, HTA6_1079_312, HTA6_1064_312, HTA6_1102_312, HTA6_EXT4_45, HTA6_1085_415, HTA6_1098_418, HTA6_EXT5_45, HTA6_1165_412, HTA6_1127_314, HTA6_1156_365, HTA6_EXT6_45, HTA6_1159_413, HTA6_1032_415, HTA6_1054_419, HTA6_2020_414, HTA6_1022_358, HTA6_1002_358, HTA6_1033_313, HTA6_EXT7_45, HTA6_1089_316, HTA6_1083_310, HTA6_2327_46, HTA6_2048_310, HTA6_1159_414, HTA6_2074_312, HTA6_1164_310, HTA6_1151_312, HTA6_1134_312, HTA6_1152_311, HTA6_1160_314, HTA6_1010_54, HTA6_1009_56, HTA6_1002_359, HTA6_1022_359, HTA6_1165_413, HTA6_1166_312, HTA6_1136_316', 'HTAN Duke', 'syn52126722', 2, 40447180, 'eada6590c7af4771d7acd61c30112dd5', 'Release 4.0', NULL), ('syn52044380', NULL, '9116', NULL, 'HTA14_10_1070', '1b80ec6f-d787-4975-a5db-0a2b8a220487', 'labsyspharm/quantification v1.5.4', 'whole cell', NULL, '50', 'ImagingLevel4', 'Mean', NULL, 'csv', 'phase1_imaging_level_4/OHSU_TMA1_004-A10_OHSU_TMA1_004-A10-cellRingMask.csv', 'HTA14_10_1048', 'HTAN TNP - TMA', 'syn52133576', 4, 7790082, 'aa10c35611e4550c63e1137634abff6d', 'Release 4.0', NULL), ('syn52044381', NULL, '12964', NULL, 'HTA14_11_1035', '141e4b2e-2bf0-4cab-9f53-18393535022f', 'labsyspharm/quantification v1.5.4', 'whole cell', NULL, '50', 'ImagingLevel4', 'Mean', NULL, 'csv', 'phase1_imaging_level_4/OHSU_TMA1_004-A11_OHSU_TMA1_004-A11-cellRingMask.csv', 'HTA14_11_1024', 'HTAN TNP - TMA', 'syn52133576', 4, 11145672, 'e5a265080c6c14eeb13d2f5bda193cbf', 'Release 4.0', NULL), ('syn52044382', NULL, '23685', NULL, 'HTA14_1_1072', 'c6a8b9c8-c81a-42fb-89be-3523f3ea41f2', 'labsyspharm/quantification v1.5.4', 'whole cell', NULL, '50', 'ImagingLevel4', 'Mean', NULL, 'csv', 'phase1_imaging_level_4/OHSU_TMA1_004-A1_OHSU_TMA1_004-A1-cellRingMask.csv', 'HTA14_1_1050', 'HTAN TNP - TMA', 'syn52133576', 4, 20111814, '00924eb305da941661fd20841a8578a3', 'Release 4.0', NULL), ('syn52044383', NULL, '3027', NULL, 'HTA14_2_1071', 'cc3f5271-d3f2-4ffe-8cb6-f27f0e0b9340', 'labsyspharm/quantification v1.5.4', 'whole cell', NULL, '50', 'ImagingLevel4', 'Mean', NULL, 'csv', 'phase1_imaging_level_4/OHSU_TMA1_004-A2_OHSU_TMA1_004-A2-cellRingMask.csv', 'HTA14_2_1048', 'HTAN TNP - TMA', 'syn52133576', 4, 2575604, '80c41dc2482d7d29e23fab6e93b9eb85', 'Release 4.0', NULL);