-- DBMS: bigquery
CREATE TABLE `isb-cgc-bq.HTAN_versioned.imaging_level4_HMS_mel_r3`
(
  CellID INT64 OPTIONS(description="Unique cell identifier in a specific image"),
  DNA_1 FLOAT64 OPTIONS(description="Mean intensity of pixels for specified marker"),
  bg_488 FLOAT64 OPTIONS(description="Mean intensity of pixels for specified marker"),
  bg_555 FLOAT64 OPTIONS(description="Mean intensity of pixels for specified marker"),
  bg_647 FLOAT64 OPTIONS(description="Mean intensity of pixels for specified marker"),
  DNA_2 FLOAT64 OPTIONS(description="Mean intensity of pixels for specified marker"),
  CD74 FLOAT64 OPTIONS(description="Mean intensity of pixels for specified marker"),
  CD3_rat FLOAT64 OPTIONS(description="Mean intensity of pixels for specified marker"),
  SOX10 FLOAT64 OPTIONS(description="Mean intensity of pixels for specified marker"),
  DNA_3 FLOAT64 OPTIONS(description="Mean intensity of pixels for specified marker"),
  IFNb FLOAT64 OPTIONS(description="Mean intensity of pixels for specified marker"),
  CD11c FLOAT64 OPTIONS(description="Mean intensity of pixels for specified marker"),
  CD31 FLOAT64 OPTIONS(description="Mean intensity of pixels for specified marker"),
  DNA_4 FLOAT64 OPTIONS(description="Mean intensity of pixels for specified marker"),
  CD163 FLOAT64 OPTIONS(description="Mean intensity of pixels for specified marker"),
  S100b FLOAT64 OPTIONS(description="Mean intensity of pixels for specified marker"),
  CD20 FLOAT64 OPTIONS(description="Mean intensity of pixels for specified marker"),
  X_centroid FLOAT64 OPTIONS(description="X-position of the centroid calculated as the center of mass of the cell."),
  Y_centroid FLOAT64 OPTIONS(description="Y-position of the centroid calculated as the center of mass of the cell."),
  Area INT64 OPTIONS(description="Matlab regionprops function: “Actual number of pixels in the region, returned as a scalar.”"),
  MajorAxisLength FLOAT64 OPTIONS(description="Matlab regionprops function: “Length (in pixels) of the major axis of the ellipse that has the same normalized second central moments as the region, returned as a scalar.”"),
  MinorAxisLength FLOAT64 OPTIONS(description="Matlab regionprops function: “Length (in pixels) of the minor axis of the ellipse that has the same normalized second central moments as the region, returned as a scalar.”"),
  Eccentricity FLOAT64 OPTIONS(description="Matlab regionprops function: “Eccentricity of the ellipse that has the same second-moments as the region, returned as a scalar. The eccentricity is the ratio of the distance between the foci of the ellipse and its major axis length. The value is between 0 and 1. (0 and 1 are degenerate cases. An ellipse whose eccentricity is 0 is actually a circle, while an ellipse whose eccentricity is 1 is a line segment.)”"),
  Solidity FLOAT64 OPTIONS(description="Matlab regionprops function: “Proportion of the pixels in the convex hull that are also in the region, returned as a scalar. Computed as Area/ConvexArea.”"),
  Extent FLOAT64 OPTIONS(description="Matlab regionprops function: “Ratio of pixels in the region to pixels in the total bounding box, returned as a scalar. Computed as the Area divided by the area of the bounding box.”"),
  Orientation FLOAT64 OPTIONS(description="Matlab regionprops function: “Angle between the x-axis and the major axis of the ellipse that has the same second-moments as the region, returned as a scalar. The value is in degrees, ranging from −90 degrees to 90 degrees.”"),
  Source_filename STRING OPTIONS(description="Name of file record was derived from"),
  Source_entityId STRING OPTIONS(description="Synapse ID of source file"),
  HTAN_Center STRING OPTIONS(description="Name of HTAN Center e.g. HTAN HTAPP"),
  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)"),
  HTAN_Biospecimen_ID STRING OPTIONS(description="HTAN ID associated with a biosample based on HTAN ID SOP (eg HTANx_yyy_zzz)"),
  MIF FLOAT64 OPTIONS(description="Mean intensity of pixels for specified marker"),
  CCR7 FLOAT64 OPTIONS(description="Mean intensity of pixels for specified marker")
)
OPTIONS(
  friendly_name="HTAN HMS IMAGING LEVEL 4 DATA - MELANOMA R3 VERSIONED",
  description="This table contains fourth level imaging data for melanoma cancer samples. Data was derived in April 2023 from Imaging Level 4 csv files submitted by the HMS HTAN center.",
  labels=[("access", "open"), ("data_type", "cell_spatial_characterization"), ("program", "htan"), ("source", "htan-hms"), ("status", "current"), ("category", "processed_-omics_data")]
);

INSERT INTO `isb-cgc-bq.HTAN_versioned.imaging_level4_HMS_mel_r3` (CellID, DNA_1, bg_488, bg_555, bg_647, DNA_2, CD74, CD3_rat, SOX10, DNA_3, IFNb, CD11c, CD31, DNA_4, CD163, S100b, CD20, X_centroid, Y_centroid, Area, MajorAxisLength, MinorAxisLength, Eccentricity, Solidity, Extent, Orientation, Source_filename, Source_entityId, HTAN_Center, HTAN_Data_File_ID, HTAN_Biospecimen_ID, MIF, CCR7) VALUES (602414, 11564.7578125, 2646.56640625, 557.2421875, 1518.9140625, 16190.78515625, nan, 1471.7421875, 10974.64453125, 14547.4296875, nan, 269.51171875, 214.1484375, 18383.015625, 1157.34765625, 7855.75390625, 1584.1015625, 4649.1953125, 13613.7890625, 256, 19.679586468688917, 16.744898052732246, 0.5253657273125717, 0.927536231884058, 0.7111111111111111, 0.592881879009592, 'MEL01-1-8.csv', 'syn36352168', 'HTAN HMS', 'HTA7_1_1691', 'HTA7_1_244', 10980.84375, 1185.30078125), (923500, 4082.5234375, 1429.38671875, 268.66015625, 1573.9765625, 5548.78125, nan, 269.2890625, 264.37890625, 5080.4765625, nan, 132.42578125, 124.1640625, 5563.6328125, 674.03125, 29.77734375, 1230.1484375, 13346.4609375, 20443.7734375, 256, 22.58214445414568, 14.58855882968217, 0.7633189137137598, 0.9481481481481482, 0.6956521739130435, 1.2212313613616952, 'MEL01-1-8.csv', 'syn36352168', 'HTAN HMS', 'HTA7_1_1691', 'HTA7_1_244', 4156.56640625, 702.9453125), (105122, 6273.59375, 2149.7890625, 494.609375, 2059.58203125, 6612.2734375, nan, 416.640625, 460.11328125, 6131.16015625, nan, 359.8203125, 246.8984375, 6281.28515625, 823.0390625, 71.25390625, 1029.85546875, 6949.6328125, 3395.5234375, 256, 20.918422585188047, 15.588572125839322, 0.6668322897391716, 0.9411764705882352, 0.7619047619047619, -0.3354759707281606, 'MEL01-1-8.csv', 'syn36352168', 'HTAN HMS', 'HTA7_1_1691', 'HTA7_1_244', 16455.1328125, 1208.94921875), (469097, 5896.31640625, 2620.69140625, 580.80078125, 1342.9140625, 7764.86328125, nan, 2578.20703125, 12219.7578125, 7344.65625, nan, 295.609375, 264.984375, 8610.9765625, 1092.52734375, 12200.96875, 1731.3671875, 9021.7890625, 11113.58203125, 256, 22.88451858677978, 14.317095689182416, 0.7801250336397817, 0.9343065693430656, 0.6666666666666666, -0.2798066843403282, 'MEL01-1-8.csv', 'syn36352168', 'HTAN HMS', 'HTA7_1_1691', 'HTA7_1_244', 13780.0078125, 1655.75390625), (870481, 11922.57421875, 1689.98046875, 330.73046875, 1623.75390625, 16126.30078125, nan, 379.515625, 294.625, 13630.7890625, nan, 179.49609375, 3502.265625, 14047.78515625, 780.671875, 78.76953125, 1346.58203125, 18825.2109375, 18942.9921875, 256, 22.389736571793307, 14.941111257891803, 0.7447714277847459, 0.920863309352518, 0.64, -0.7998556216212245, 'MEL01-1-8.csv', 'syn36352168', 'HTAN HMS', 'HTA7_1_1691', 'HTA7_1_244', 5880.75, 734.1328125);