-- DBMS: bigquery
CREATE TABLE `isb-cgc-bq.HTAN_versioned.srrs_imaging_level2_metadata_r3`
(
  Component STRING OPTIONS(description="Category of metadata (e.g. Diagnosis, Biospecimen, scRNA-seq Level 1, etc.); provide the same one for all items/rows."),
  Filename STRING OPTIONS(description="Name of a file"),
  File_Format STRING OPTIONS(description="Format of a file (e.g. txt, csv, fastq, bam, etc.)"),
  HTAN_Participant_ID STRING OPTIONS(description="HTAN ID associated with a patient based on HTAN ID SOP (eg HTANx_yyy )"),
  HTAN_Parent_Biospecimen_ID STRING OPTIONS(description="HTAN Biospecimen Identifier (eg HTANx_yyy_zzz) indicating the biospecimen(s) from which these files were derived; multiple parent biospecimen should be comma-separated"),
  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)"),
  Channel_Metadata_Filename STRING OPTIONS(description="Full path within Synapse project of uploaded companion CSV file containing channel-level metadata details"),
  Imaging_Assay_Type STRING OPTIONS(description="Type of imaging assay"),
  Protocol_Link STRING OPTIONS(description="Protocols.io ID or DOI link to a free/open protocol resource describing in detail the assay protocol (e.g. surface markers used in Smart-seq, dissociation duration,  lot/batch numbers for key reagents such as primers, sequencing reagent kits, etc.) or the protocol by which the sample was obtained or generated."),
  Software_and_Version STRING OPTIONS(description="Name of software used to generate expression values. String"),
  Microscope STRING OPTIONS(description="Microscope type (manufacturer, model, etc) used for this experiment"),
  Objective STRING OPTIONS(description="Objective"),
  NominalMagnification STRING OPTIONS(description="The magnification of the lens as specified by the manufacturer - i.e. '60' is a 60X lens. floating point value > 1(no units)"),
  Pyramid STRING OPTIONS(description="Does data file contain pyramid of images"),
  Zstack STRING OPTIONS(description="Does data file contain a Z-stack of images"),
  Tseries STRING OPTIONS(description="Does data file contain a time-series of images"),
  Passed_QC STRING OPTIONS(description="Did all channels pass QC (if not add free text Comment)"),
  Frame_Averaging STRING OPTIONS(description="Number of frames averaged together (if no averaging, set to 1). Integer >= 1"),
  Image_ID STRING OPTIONS(description="Unique internal image identifier. eg \"Image:0\". (To be extracted from OME-XML)"),
  DimensionOrder STRING OPTIONS(description="The order in which the individual planes of data are interleaved."),
  PhysicalSizeX STRING OPTIONS(description="Physical size (X-dimension) of a pixel. Units are set by PhysicalSizeXUnit. Floating point value > 0."),
  PhysicalSizeXUnit STRING OPTIONS(description="The units of the physical size of a pixel. See OME enumeration of allowed values for the UnitsLength attribute -- default: microns (um)"),
  PhysicalSizeY STRING OPTIONS(description="Physical size (Y-dimension) of a pixel. Units are set by PhysicalSizeYUnit. Floating point value > 0."),
  PhysicalSizeYUnit STRING OPTIONS(description="The units of the physical size of a pixel. See OME enumeration of allowed values for the UnitsLength attribute -- default: microns (um)"),
  Pixels_BigEndian STRING OPTIONS(description="Boolean (True/False)"),
  PlaneCount STRING OPTIONS(description="Number of Z-planes (not to be confused with downsampled \"pyramid\"). Integer >=1"),
  SizeC STRING OPTIONS(description="Number of channels. Integer >= 1"),
  SizeT STRING OPTIONS(description="Number of time points. Integer >= 1"),
  SizeX STRING OPTIONS(description="Size of image: X dimension (in pixels). Integer >= 1"),
  SizeY STRING OPTIONS(description="Size of image: Y dimension (in pixels). Integer >= 1"),
  SizeZ STRING OPTIONS(description="Size of image: Z dimension (in pixels). Integer >= 1"),
  PixelType STRING OPTIONS(description="Data type for each pixel value. E.g. \"uint16\""),
  entityId STRING OPTIONS(description="Synapse ID of entity"),
  HTAN_Center STRING OPTIONS(description="Name of HTAN Center e.g. HTAN HTAPP"),
  Data_Release STRING OPTIONS(description="Inclusion in HTAN Data Release e.g. Release 1.0"),
  Manifest_Version INT64 OPTIONS(description="Latest version of metadata manifest"),
  Uuid STRING OPTIONS(description="Unique identifier of entity e.g. a96059eb-81af-4b24-ae50-9242c0d8f819"),
  File_Size INT64 OPTIONS(description="Size of file (bucket object) in bytes"),
  md5 STRING OPTIONS(description="md5 hash of file"),
  CDS_Release STRING OPTIONS(description="CDS transfer package in which file was included e.g. v22.6.1.seq")
)
OPTIONS(
  friendly_name="HTAN SRRS IMAGING LEVEL 2 METADATA R3 VERSIONED",
  description="This table contains second-level imaging data specific to SRRS (Standardized Repository of Reference Specimens). Data was extracted from HTAN Synapse projects in April 2023. More details: see https://data.humantumoratlas.org/standard/imaging",
  labels=[("access", "open"), ("data_type", "file_metadata"), ("program", "htan"), ("source", "htan"), ("status", "current"), ("category", "metadata")]
);

INSERT INTO `isb-cgc-bq.HTAN_versioned.srrs_imaging_level2_metadata_r3` (Component, Filename, File_Format, HTAN_Participant_ID, HTAN_Parent_Biospecimen_ID, HTAN_Data_File_ID, Channel_Metadata_Filename, Imaging_Assay_Type, Protocol_Link, Software_and_Version, Microscope, Objective, NominalMagnification, Pyramid, Zstack, Tseries, Passed_QC, Frame_Averaging, Image_ID, DimensionOrder, PhysicalSizeX, PhysicalSizeXUnit, PhysicalSizeY, PhysicalSizeYUnit, Pixels_BigEndian, PlaneCount, SizeC, SizeT, SizeX, SizeY, SizeZ, PixelType, entityId, HTAN_Center, Data_Release, Manifest_Version, Uuid, File_Size, md5, CDS_Release) VALUES ('SRRSImagingLevel2', 'imaging_level_2/BU/TUCD007823_HABX1.svs', 'svs', 'HTA3_11009', 'HTA3_11009_11000001', 'HTA3_11009_1100000101', 'Not Applicable', 'H&E', 'dx.doi.org/10.17504/protocols.io.bzuvp6w6', 'Aperio Image Library v12.0.15', 'Leica-Aperio AT2', NULL, '40', 'Yes', 'No', 'No', 'Yes', NULL, '398033', 'XYZCT', '0.25', 'µm', '0.25', 'µm', 'True', '1', '3', '1', '21824', '28218', '1', 'uint8', 'syn26445552', 'HTAN SRRS', 'Release 2.0', 1, '9d733a98-bd7f-4658-b4ae-e80ea41d8e33', 0, NULL, NULL), ('SRRSImagingLevel2', 'imaging_level_2/BU/TUCD007823_HABX1.svs', 'svs', 'HTA3_11009', 'HTA3_11009_11000001', 'HTA3_11009_1100000101', 'Not Applicable', 'H&E', 'dx.doi.org/10.17504/protocols.io.bzuvp6w6', 'Aperio Image Library v12.0.15', 'Leica-Aperio AT2', NULL, '40', 'Yes', 'No', 'No', 'Yes', NULL, '398033', 'XYZCT', '0.25', 'µm', '0.25', 'µm', 'True', '1', '3', '1', '21824', '28218', '1', 'uint8', 'syn26445552', 'HTAN SRRS', 'Release 2.0', 1, '96b927ec-6772-420f-9cc6-d8e1acb9ea68', 0, NULL, NULL), ('SRRSImagingLevel2', 'imaging_level_2/BU/TUCD007823_HABX2.svs', 'svs', 'HTA3_11009', 'HTA3_11009_11000002', 'HTA3_11009_1100000201', 'Not Applicable', 'H&E', 'dx.doi.org/10.17504/protocols.io.bzuvp6w6', 'Aperio Image Library v12.0.15', 'Leica-Aperio AT2', NULL, '40', 'Yes', 'No', 'No', 'Yes', NULL, '398034', 'XYZCT', '0.25', 'µm', '0.25', 'µm', 'True', '1', '3', '1', '29760', '24376', '1', 'uint8', 'syn26445553', 'HTAN SRRS', 'Release 2.0', 1, '6042e12d-e0cb-4636-8994-946b8017f381', 0, NULL, NULL), ('SRRSImagingLevel2', 'imaging_level_2/BU/TUCD007823_HABX2.svs', 'svs', 'HTA3_11009', 'HTA3_11009_11000002', 'HTA3_11009_1100000201', 'Not Applicable', 'H&E', 'dx.doi.org/10.17504/protocols.io.bzuvp6w6', 'Aperio Image Library v12.0.15', 'Leica-Aperio AT2', NULL, '40', 'Yes', 'No', 'No', 'Yes', NULL, '398034', 'XYZCT', '0.25', 'µm', '0.25', 'µm', 'True', '1', '3', '1', '29760', '24376', '1', 'uint8', 'syn26445553', 'HTAN SRRS', 'Release 2.0', 1, '09564954-7f92-4448-bf13-e79c81339150', 0, NULL, NULL), ('SRRSImagingLevel2', 'imaging_level_2/BU/TUCD007823_HABX3.svs', 'svs', 'HTA3_11009', 'HTA3_11009_11000003', 'HTA3_11009_1100000301', 'Not Applicable', 'H&E', 'dx.doi.org/10.17504/protocols.io.bzuvp6w6', 'Aperio Image Library v12.0.15', 'Leica-Aperio AT2', NULL, '40', 'Yes', 'No', 'No', 'Yes', NULL, '398035', 'XYZCT', '0.25', 'µm', '0.25', 'µm', 'True', '1', '3', '1', '12896', '17092', '1', 'uint8', 'syn26445554', 'HTAN SRRS', 'Release 2.0', 1, 'd3f3ae07-c2a3-4552-ae49-2323ef55af3d', 0, NULL, NULL);