-- DBMS: bigquery
CREATE TABLE `isb-cgc.TCGA_bioclin_v0.Biospecimen`
(
  sample_barcode STRING OPTIONS(description="TCGA sample_barcode; e.g. TCGA-AB-2809-03A."),
  sample_gdc_id STRING OPTIONS(description="Unique GDC identifier for this sample (corresponds to the sample_barcode), eg a1ec9279-c1a6-4e58-97ed-9ec1f36187c5  --  this can be used to access more information from the GDC data portal"),
  case_barcode STRING OPTIONS(description="TCGA patient/case barcode, eg TCGA-AB-2809 (the first 12 characters of the 16-character sample barcode)"),
  case_gdc_id STRING OPTIONS(description="GDC unique identifer for this case; e.g. 7b4ce492-ff40-4bf1-b3e8-75ff83e8746d. This identifier can be used to find more information at the GDC Data Portal ( https://portal.gdc.cancer.gov/cases/7b4ce492-ff40-4bf1-b3e8-75ff83e8746d )"),
  sample_type STRING OPTIONS(description="Two-digit sample_type code which forms part of the sample barcode e.g. 01,11,06, etc."),
  sample_type_name STRING OPTIONS(description="The longer name of the sample type; e.g. Primary Tumor, Recurrent Tumor, etc."),
  program_name STRING OPTIONS(description="Program Name, always TCGA (The Cancer Genome Atlas) in this table."),
  project_short_name STRING OPTIONS(description="Project name abbreviation; the program name appended with a project name abbreviation; e.g. TCGA-OV, etc."),
  batch_number INT64 OPTIONS(description="The BCR Batch Code; see https://gdc.cancer.gov/resources-TCGA-users/TCGA-code-tables/bcr-batch-codes for explanation of the codes"),
  bcr STRING OPTIONS(description="Biospecimen Core Resource; e.g. Nationwide Children's Hospital, Washington University"),
  days_to_collection FLOAT64 OPTIONS(description="Time interval from the date of biospecimen collection to the date of initial pathologic diagnosis, represented as a calculated number of days."),
  days_to_sample_procurement FLOAT64 OPTIONS(description="The number of days from the date the patient was diagnosed to the date of the procedure that produced the sample."),
  is_ffpe STRING OPTIONS(description="Indicator to signify whether or not the tissue sample was fixed in formalin and embedded in paraffin (FFPE); almost always NO -- only a few (99) FFPE samples were included in the TCGA project"),
  num_portions INT64 OPTIONS(description="In some cases, a sample was divided into multiple portions -- up to 6 portions, but for most samples the number is 1 (or even 0)."),
  num_slides INT64 OPTIONS(description="In some cases, portions of a sample were placed onto multiple slides -- generally not more than 2, but occasionally more."),
  avg_percent_lymphocyte_infiltration FLOAT64 OPTIONS(description="The average percentage of infiltration by lymphocytes in a sample or specimen"),
  avg_percent_monocyte_infiltration FLOAT64 OPTIONS(description="The average percentage of infiltration by monocyte in a sample or specimen"),
  avg_percent_necrosis FLOAT64 OPTIONS(description="The average percentage of necrosis in a sample or specimen"),
  avg_percent_neutrophil_infiltration FLOAT64 OPTIONS(description="The average percentage of neutrophil infiltration in a sample or specimen"),
  avg_percent_normal_cells FLOAT64 OPTIONS(description="The average percentage of normal cells in a sample or specimen"),
  avg_percent_stromal_cells FLOAT64 OPTIONS(description="The average percentage of stromal cells in a sample or specimen"),
  avg_percent_tumor_cells FLOAT64 OPTIONS(description="The average percentage of tumor cells in a sample or specimen"),
  avg_percent_tumor_nuclei FLOAT64 OPTIONS(description="The average percentage of tumor nuclei in a sample or specimen"),
  max_percent_lymphocyte_infiltration FLOAT64 OPTIONS(description="The maximum percentage of infiltration by lymphocytes in a sample or specimen"),
  max_percent_monocyte_infiltration FLOAT64 OPTIONS(description="The maximum percentage of infiltration by monocytes in a sample or specimen"),
  max_percent_necrosis FLOAT64 OPTIONS(description="The maximum percentage of necrosis in a sample or specimen"),
  max_percent_neutrophil_infiltration FLOAT64 OPTIONS(description="The maximum percentage of neutrophil infiltration in a sample or specimen"),
  max_percent_normal_cells FLOAT64 OPTIONS(description="The maximum percentage of normal cells in a sample or specimen"),
  max_percent_stromal_cells FLOAT64 OPTIONS(description="The maximum percentage of stromal cells in a sample or specimen"),
  max_percent_tumor_cells FLOAT64 OPTIONS(description="The maximum percentage of tumor cells in a sample or specimen"),
  max_percent_tumor_nuclei FLOAT64 OPTIONS(description="The maximum percentage of tumor nuclei in a sample or specimen"),
  min_percent_lymphocyte_infiltration FLOAT64 OPTIONS(description="The minimum percentage of infiltration by lymphocytes in a sample or specimen"),
  min_percent_monocyte_infiltration FLOAT64 OPTIONS(description="The minimum percentage of infiltration by lymphocytes in a sample or specimen"),
  min_percent_necrosis FLOAT64 OPTIONS(description="The minimum percentage of necrosis in a sample or specimen"),
  min_percent_neutrophil_infiltration FLOAT64 OPTIONS(description="The minimum percentage of neutrophil infiltration in a sample or specimen"),
  min_percent_normal_cells FLOAT64 OPTIONS(description="The minimum percentage of normal cells in a sample or specimen"),
  min_percent_stromal_cells FLOAT64 OPTIONS(description="The minimum percentage of stromal cells in a sample or specimen"),
  min_percent_tumor_cells FLOAT64 OPTIONS(description="The minimum percentage of tumor cells in a sample or specimen"),
  min_percent_tumor_nuclei FLOAT64 OPTIONS(description="The minimum percentage of tumor nuclei in a sample or specimen")
)
OPTIONS(
  friendly_name="TCGA BIOSPECIMEN 2017 DEPRECATED",
  description="Data was extracted from the TCGA program in April 2017. It contains sample data for TCGA patient cases, originally based on the information provided by the TCGA biospecimen core resource (BCR) to the TCGA DCC in the form of xml files. Most patients (cases) provided two samples: one primary tumor sample and one blood normal sample, although other sample types exist, such as metastatic tumor samples, adjacent \"\"normal\"\" tissue samples, etc. There are, in a few cases, as many as 8 samples from a single case, although these may represent multiple \"vials\" from a smaller number of biospecimens. Also, some samples were obtained from cases for which no clinical information existed and which are therefore not represented in the Clinical table (which contains close to 200 fewer cases than this table does). More details: information about “clinical data elements” can be found at the NCI CDE (clinical data element) browser at https://cdebrowser.nci.nih.gov. This table has been deprecated. It has been copied to isb-cgc-bq.TCGA_versioned.biospecimen_gdc_2017_02. Please see isb-cgc-bq.TCGA.biospecimen_gdc_current for the most current table.",
  labels=[("data_type", "biospecimen"), ("category", "clinical_biospecimen_data"), ("access", "open"), ("status", "deprecated"), ("program", "tcga"), ("source", "gdc")]
);

INSERT INTO `isb-cgc.TCGA_bioclin_v0.Biospecimen` (sample_barcode, sample_gdc_id, case_barcode, case_gdc_id, sample_type, sample_type_name, program_name, project_short_name, batch_number, bcr, days_to_collection, days_to_sample_procurement, is_ffpe, num_portions, num_slides, avg_percent_lymphocyte_infiltration, avg_percent_monocyte_infiltration, avg_percent_necrosis, avg_percent_neutrophil_infiltration, avg_percent_normal_cells, avg_percent_stromal_cells, avg_percent_tumor_cells, avg_percent_tumor_nuclei, max_percent_lymphocyte_infiltration, max_percent_monocyte_infiltration, max_percent_necrosis, max_percent_neutrophil_infiltration, max_percent_normal_cells, max_percent_stromal_cells, max_percent_tumor_cells, max_percent_tumor_nuclei, min_percent_lymphocyte_infiltration, min_percent_monocyte_infiltration, min_percent_necrosis, min_percent_neutrophil_infiltration, min_percent_normal_cells, min_percent_stromal_cells, min_percent_tumor_cells, min_percent_tumor_nuclei) VALUES ('TCGA-AB-2997-11A', 'e3600348-0cac-4731-8ef2-41983573a5c0', 'TCGA-AB-2997', '5e491ce4-d8da-495b-a3aa-177e06cd69d0', '11', 'Solid Tissue Normal', 'TCGA', 'TCGA-LAML', 25, 'Washington University', nan, nan, 'NO', 1, 0, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan), ('TCGA-4T-AA8H-01A', 'b7e4daef-b24b-45c0-8f9d-21bcf46d9c9a', 'TCGA-4T-AA8H', 'a5e14add-1552-4606-9ffe-3a03bcf76640', '01', 'Primary solid Tumor', 'TCGA', 'TCGA-COAD', 422, 'Nationwide Children''s Hospital', 107.0, 0.0, 'NO', 1, 1, 5.0, 2.0, 0.0, 2.0, 25.0, 15.0, 60.0, 60.0, 5.0, 2.0, 0.0, 2.0, 25.0, 15.0, 60.0, 60.0, 5.0, 2.0, 0.0, 2.0, 25.0, 15.0, 60.0, 60.0), ('TCGA-DD-AAW0-01A', 'c7da1402-2958-469e-9956-395c03833125', 'TCGA-DD-AAW0', '109436aa-a655-429b-8d3b-1a43385c9016', '01', 'Primary solid Tumor', 'TCGA', 'TCGA-LIHC', 425, 'Nationwide Children''s Hospital', 1737.0, 0.0, 'NO', 1, 1, 2.0, 1.0, 0.0, 3.0, 0.0, 15.0, 85.0, 85.0, 2.0, 1.0, 0.0, 3.0, 0.0, 15.0, 85.0, 85.0, 2.0, 1.0, 0.0, 3.0, 0.0, 15.0, 85.0, 85.0), ('TCGA-C5-A7CM-01A', 'fefa6b4c-243d-4544-accc-11515bbe516e', 'TCGA-C5-A7CM', 'd223ff09-b80b-4368-9d80-a59dfbe4d820', '01', 'Primary solid Tumor', 'TCGA', 'TCGA-CESC', 350, 'Nationwide Children''s Hospital', 254.0, 42.0, 'NO', 1, 1, 2.0, 0.0, 4.0, 0.0, 0.0, 0.0, 96.0, 75.0, 2.0, 0.0, 4.0, 0.0, 0.0, 0.0, 96.0, 75.0, 2.0, 0.0, 4.0, 0.0, 0.0, 0.0, 96.0, 75.0), ('TCGA-AU-3779-10A', '35cc3db5-1c72-4d7a-8fa7-9ec1b40ef5f0', 'TCGA-AU-3779', 'fb4cc403-694c-421f-b360-3108b6d57ad5', '10', 'Blood Derived Normal', 'TCGA', 'TCGA-COAD', 116, 'Nationwide Children''s Hospital', nan, 0.0, 'NO', 1, 0, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan);