-- DBMS: bigquery
CREATE TABLE `isb-cgc-bq.HTAN_versioned.clinical_tier1_moleculartest_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."),
  HTAN_Participant_ID STRING OPTIONS(description="HTAN ID associated with a patient based on HTAN ID SOP (eg HTANx_yyy )"),
  Timepoint_Label STRING OPTIONS(description="Label to identify the time point at which the clinical data or biospecimen was obtained (e.g. Baseline, End of Treatment, Overall survival, Final). NO PHI/PII INFORMATION IS ALLOWED."),
  Start_Days_from_Index STRING OPTIONS(description="Number of days from the date of birth (index date) to the date of an event (e.g. exposure to environmental factor, treatment start, etc.). If not applicable please enter 'Not Applicable'"),
  Stop_Days_from_Index STRING OPTIONS(description="Number of days from the date of birth (index date) to the end date of the event (e.g. exposure to environmental factor, treatment start, etc.). Note: if the event occurs at a single time point, e.g. a diagnosis or a lab test, the values for this column is 'Not Applicable'"),
  Gene_Symbol STRING OPTIONS(description="The text term used to describe a gene targeted or included in molecular analysis. For rearrangements, this is should be used to represent the reference gene. Note: This node is meant to capture molecular tests that were completed clinically for the participant and only includes data from diagnostic array that was completed prior to research sequencing was done. Do not include data related to research assay outputs here."),
  Molecular_Analysis_Method STRING OPTIONS(description="The text term used to describe the method used for molecular analysis. Note: This node is meant to capture molecular tests that were completed clinically for the participant and only includes data from diagnostic array that was completed prior to research sequencing was done. Do not include data related to research assay outputs here."),
  Test_Result STRING OPTIONS(description="The text term used to describe the result of the molecular test. If the test result was a numeric value see test_value. Note: This node is meant to capture molecular tests that were completed clinically for the participant and only includes data from diagnostic array that was completed prior to research sequencing was done. Do not include data related to research assay outputs here."),
  AA_Change STRING OPTIONS(description="Alphanumeric value used to describe the amino acid change for a specific genetic variant. Example: R116Q. Note: This node is meant to capture molecular tests that were completed clinically for the participant and only includes data from diagnostic array that was completed prior to research sequencing was done. Do not include data related to research assay outputs here."),
  Antigen STRING OPTIONS(description="The text term used to describe an antigen included in molecular testing. Note: This node is meant to capture molecular tests that were completed clinically for the participant and only includes data from diagnostic array that was completed prior to research sequencing was done. Do not include data related to research assay outputs here."),
  Clinical_Biospecimen_Type STRING OPTIONS(description="The text term used to describe the biological material used for testing, diagnostic, treatment or research purposes. Note: This node is meant to capture molecular tests that were completed clinically for the participant and only includes data from diagnostic array that was completed prior to research sequencing was done. Do not include data related to research assay outputs here."),
  Blood_Test_Normal_Range_Upper STRING OPTIONS(description="Numeric value used to describe the upper limit of the normal range used to describe a healthy individual at the institution where the test was completed."),
  Blood_Test_Normal_Range_Lower STRING OPTIONS(description="Numeric value used to describe the lower limit of the normal range used to describe a healthy individual at the institution where the test was completed."),
  Cell_Count STRING OPTIONS(description="Numeric value used to describe the number of cells used for molecular testing. Note: This node is meant to capture molecular tests that were completed clinically for the participant and only includes data from diagnostic array that was completed prior to research sequencing was done. Do not include data related to research assay outputs here."),
  Chromosome STRING OPTIONS(description="The text term used to describe a chromosome targeted or included in molecular testing. If a specific genetic variant is being reported, this property can be used to capture the chromosome where that variant is located. Note: This node is meant to capture molecular tests that were completed clinically for the participant and only includes data from diagnostic array that was completed prior to research sequencing was done. Do not include data related to research assay outputs here."),
  Clonality STRING OPTIONS(description="The text term used to describe whether a genomic variant is related by descent from a single progenitor cell. Note: This node is meant to capture molecular tests that were completed clinically for the participant and only includes data from diagnostic array that was completed prior to research sequencing was done. Do not include data related to research assay outputs here."),
  Copy_Number STRING OPTIONS(description="Numeric value used to describe the number of times a section of the genome is repeated or copied within an insertion, duplication or deletion variant. Note: This node is meant to capture molecular tests that were completed clinically for the participant and only includes data from diagnostic array that was completed prior to research sequencing was done. Do not include data related to research assay outputs here."),
  Cytoband STRING OPTIONS(description="Alphanumeric value used to describe the cytoband or chromosomal location targeted or included in molecular analysis. If a specific genetic variant is being reported, this property can be used to capture the cytoband where the variant is located. Format: [chromosome][chromosome arm].[band+sub-bands]. Example: 17p13.1. Note: This node is meant to capture molecular tests that were completed clinically for the participant and only includes data from diagnostic array that was completed prior to research sequencing was done. Do not include data related to research assay outputs here."),
  Exon STRING OPTIONS(description="Exon number targeted or included in a molecular analysis. If a specific genetic variant is being reported, this property can be used to capture the exon where that variant is located. Note: This node is meant to capture molecular tests that were completed clinically for the participant and only includes data from diagnostic array that was completed prior to research sequencing was done. Do not include data related to research assay outputs here."),
  Histone_Family STRING OPTIONS(description="The text term used to describe the family, or classification of a group of basic proteins found in chromatin, called histones."),
  Histone_Variant STRING OPTIONS(description="The text term used to describe a specific histone variants, which are proteins that substitute for the core canonical histones."),
  Intron STRING OPTIONS(description="Intron number targeted or included in molecular analysis. If a specific genetic variant is being reported, this property can be used to capture the intron where that variant is located."),
  Laboratory_Test STRING OPTIONS(description="The text term used to describe the medical testing used to diagnose, treat or further understand a patient's disease."),
  Loci_Abnormal_Count STRING OPTIONS(description="Numeric value used to describe the number of loci determined to be abnormal."),
  Loci_Count STRING OPTIONS(description="Numeric value used to describe the number of loci tested."),
  Locus STRING OPTIONS(description="Alphanumeric value used to describe the locus of a specific genetic variant. Example: NM_001126114."),
  Mismatch_Repair_Mutation STRING OPTIONS(description="The yes/no/unknown indicator used to describe whether the mutation included in molecular testing was known to have an affect on the mismatch repair process. Note: This node is meant to capture molecular tests that were completed clinically for the participant and only includes data from diagnostic array that was completed prior to research sequencing was done. Do not include data related to research assay outputs here."),
  Molecular_Consequence STRING OPTIONS(description="The text term used to describe the molecular consequence of genetic variation. Note: This node is meant to capture molecular tests that were completed clinically for the participant and only includes data from diagnostic array that was completed prior to research sequencing was done. Do not include data related to research assay outputs here."),
  Pathogenicity STRING OPTIONS(description="The text used to describe a variant's level of involvement in the cause of the patient's disease according to the standards outlined by the American College of Medical Genetics and Genomics (ACMG)."),
  Ploidy STRING OPTIONS(description="Text term used to describe the number of sets of homologous chromosomes."),
  Second_Exon STRING OPTIONS(description="The second exon number involved in molecular variation. If a specific genetic variant is being reported, this property can be used to capture the second exon where that variant is located. This property is typically used for a translocation where two different locations are involved in the variation."),
  Second_Gene_Symbol STRING OPTIONS(description="The text term used to describe a secondary gene targeted or included in molecular analysis. For rearrangements, this is should represent the location of the variant. Note: This node is meant to capture molecular tests that were completed clinically for the participant and only includes data from diagnostic array that was completed prior to research sequencing was done. Do not include data related to research assay outputs here."),
  Specialized_Molecular_Test STRING OPTIONS(description="Text term used to describe a specific test that is not covered in the list of molecular analysis methods. Note: This node is meant to capture molecular tests that were completed clinically for the participant and only includes data from diagnostic array that was completed prior to research sequencing was done. Do not include data related to research assay outputs here."),
  Test_Analyte_Type STRING OPTIONS(description="The text term used to describe the type of analyte used for molecular testing. Note: This node is meant to capture molecular tests that were completed clinically for the participant and only includes data from diagnostic array that was completed prior to research sequencing was done. Do not include data related to research assay outputs here."),
  Test_Units STRING OPTIONS(description="The text term used to describe the units of the test value for a molecular test. This property is used in conjunction with test_value. Note: This node is meant to capture molecular tests that were completed clinically for the participant and only includes data from diagnostic array that was completed prior to research sequencing was done. Do not include data related to research assay outputs here."),
  Test_Value STRING OPTIONS(description="The text term or numeric value used to describe a specific result of a molecular test. Note: This node is meant to capture molecular tests that were completed clinically for the participant and only includes data from diagnostic array that was completed prior to research sequencing was done. Do not include data related to research assay outputs here"),
  Transcript STRING OPTIONS(description="Alphanumeric value used to describe the transcript of a specific genetic variant. Note: This node is meant to capture molecular tests that were completed clinically for the participant and only includes data from diagnostic array that was completed prior to research sequencing was done. Do not include data related to research assay outputs here."),
  Variant_Origin STRING OPTIONS(description="The text term used to describe the biological origin of a specific genetic variant. Note: This node is meant to capture molecular tests that were completed clinically for the participant and only includes data from diagnostic array that was completed prior to research sequencing was done. Do not include data related to research assay outputs here."),
  Variant_Type STRING OPTIONS(description="The text term used to describe the type of genetic variation."),
  Zygosity STRING OPTIONS(description="The text term used to describe the zygosity of a specific genetic variant."),
  Mutational_Signatures STRING OPTIONS(description="Mutational signatures identified in the patient, includes signatures linked to selected exogenous carcinogens, endogenous and enzymatic modification of DNA or defective DNA repair. Note: Include only outputs of tests that were completed clinically for the participant and only include data from a diagnostic array that was completed prior to research sequencing was done. "),
  Mismatch_Repair_System_Status STRING OPTIONS(description="The text that best describes the condition or state of MMR (mismatch repair system) in the patient"),
  Lab_Tests_for_MMR_Status STRING OPTIONS(description="Laboratory tests used to evaluate the status of mismatch repair pathways"),
  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")
)
OPTIONS(
  friendly_name="HTAN CLINICAL TIER 1 DATA - MOLECULAR TEST R3 VERSIONED",
  description="This table contains clinical molecular test information about HTAN patient cases. Data was extracted from HTAN Synapse projects in April 2023. More details: see https://data.humantumoratlas.org/standard/clinical",
  labels=[("access", "open"), ("data_type", "clinical_data"), ("program", "htan"), ("source", "htan"), ("category", "clinical_biospecimen_data"), ("status", "current")]
);

INSERT INTO `isb-cgc-bq.HTAN_versioned.clinical_tier1_moleculartest_r3` (Component, HTAN_Participant_ID, Timepoint_Label, Start_Days_from_Index, Stop_Days_from_Index, Gene_Symbol, Molecular_Analysis_Method, Test_Result, AA_Change, Antigen, Clinical_Biospecimen_Type, Blood_Test_Normal_Range_Upper, Blood_Test_Normal_Range_Lower, Cell_Count, Chromosome, Clonality, Copy_Number, Cytoband, Exon, Histone_Family, Histone_Variant, Intron, Laboratory_Test, Loci_Abnormal_Count, Loci_Count, Locus, Mismatch_Repair_Mutation, Molecular_Consequence, Pathogenicity, Ploidy, Second_Exon, Second_Gene_Symbol, Specialized_Molecular_Test, Test_Analyte_Type, Test_Units, Test_Value, Transcript, Variant_Origin, Variant_Type, Zygosity, Mutational_Signatures, Mismatch_Repair_System_Status, Lab_Tests_for_MMR_Status, entityId, HTAN_Center, Data_Release, Manifest_Version, Uuid) VALUES ('MolecularTest', 'HTA7_1', 'Baseline', '22559', NULL, 'BRAF', 'IHC', 'Negative', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'syn26486605', 'HTAN HMS', 'Release 2.0', 5, '022ca77b-915e-4dbd-95c8-da54798222e0'), ('MolecularTest', 'HTA7_8', 'Baseline', '19629', NULL, 'BRAF', 'IHC', 'Negative', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'syn26486607', 'HTAN HMS', 'Release 2.0', 5, 'c7510676-8d7e-4a57-8240-d6c212e6e99f'), ('MolecularTest', 'HTA7_926', 'pt_timepoint_1', '25185', NULL, 'p53', 'Targeted Sequencing', 'Negative', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'syn26601987', 'HTAN HMS', 'Release 2.0', 5, '6d4f1bca-7d6c-4a4d-98b5-7ca67e55e990'), ('MolecularTest', 'HTA7_926', 'pt_timepoint_1', '25185', NULL, 'NRAS', 'Targeted Sequencing', 'Negative', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'syn26601988', 'HTAN HMS', 'Release 2.0', 5, '560478b8-5314-49f2-8b11-0e697430c788'), ('MolecularTest', 'HTA7_926', 'pt_timepoint_1', '25185', NULL, 'BRAF', 'Targeted Sequencing', 'Negative', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'syn26601989', 'HTAN HMS', 'Release 2.0', 5, '10063724-92fd-431c-b1f3-033f10b889b7');