-- DBMS: bigquery
CREATE TABLE `isb-cgc-bq.HTAN_versioned.bulkRNAseq_level2_metadata_r2`
(
  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_Parent_Data_File_ID STRING OPTIONS(description="HTAN Data File Identifier indicating the file(s) from which these files were derived"),
  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)"),
  Alignment_Workflow_Url STRING OPTIONS(description="Link to workflow used for read alignment. DockStore.org recommended. String"),
  Alignment_Workflow_Type STRING OPTIONS(description="Generic name for the workflow used to analyze a data set."),
  Genomic_Reference STRING OPTIONS(description="Exact version of the human genome reference used in the alignment of reads (e.g. https://www.gencodegenes.org/human/)"),
  Genomic_Reference_URL STRING OPTIONS(description="Link to human genome sequence (e.g. ftp://ftp.ebi.ac.uk/pub/databases/gencode/Gencode_human/release_34/GRCh38.primary_assembly.genome.fa.gz) [URL]"),
  Index_File_Name STRING OPTIONS(description="The name (or part of a name) of a file (of any type). String"),
  Average_Base_Quality STRING OPTIONS(description="Average base quality collected from samtools. Number"),
  Average_Insert_Size STRING OPTIONS(description="Average insert size collected from samtools. Integer"),
  Average_Read_Length STRING OPTIONS(description="Average read length collected from samtools. Integer"),
  Contamination STRING OPTIONS(description="Fraction of reads coming from cross-sample contamination collected from GATK4. Number"),
  Contamination_Error STRING OPTIONS(description="Estimation error of cross-sample contamination collected from GATK4. Number"),
  Mean_Coverage STRING OPTIONS(description="Mean coverage for whole genome sequencing, or mean target coverage for whole exome and targeted sequencing, collected from Picard. Number"),
  MSI_Workflow_Link STRING OPTIONS(description="Link to method workflow (or command) used in estimating the MSI. URL"),
  MSI_Score STRING OPTIONS(description="Numeric score denoting the aligned reads file's MSI score from MSIsensor. Number"),
  MSI_Status STRING OPTIONS(description="MSIsensor determination of either microsatellite stability or instability."),
  Pairs_On_Diff_CHR STRING OPTIONS(description="Pairs on different chromosomes collected from samtools. Integer"),
  Total_Reads STRING OPTIONS(description="Total number of reads per sample. Integer"),
  Total_Uniquely_Mapped STRING OPTIONS(description="Number of reads that map to genome. Integer"),
  Total_Unmapped_reads STRING OPTIONS(description="Number of reads that did not map to genome. Integer"),
  Proportion_Reads_Duplicated STRING OPTIONS(description="Proportion of duplicated reads collected from samtools. Number"),
  Proportion_Reads_Mapped STRING OPTIONS(description="Proportion of mapped reads collected from samtools. Number"),
  Proportion STRING OPTIONS(description="TBD"),
  Targets_No_Coverage STRING OPTIONS(description="TBD"),
  Proportion_Base_Mismatch STRING OPTIONS(description="Proportion of mismatched bases collected from samtools. Number"),
  Short_Reads STRING OPTIONS(description="Number of reads that were too short. Integer"),
  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"),
  File_Size INT64 OPTIONS(description="Size of file (bucket object) in bytes"),
  Base_Filename STRING OPTIONS(description="Base name of file"),
  md5 STRING OPTIONS(description="md5 hash of file")
)
OPTIONS(
  friendly_name="HTAN BULKRNASEQ LEVEL 2 METADATA R2 VERSIONED",
  description="Data was extracted from HTAN Synapse projects in April 2022. More details: see https://data.humantumoratlas.org/standard/bulkrnaseq",
  labels=[("access", "open"), ("data_type", "file_metadata"), ("program", "htan"), ("source", "htan"), ("status", "current"), ("category", "metadata")]
);

INSERT INTO `isb-cgc-bq.HTAN_versioned.bulkRNAseq_level2_metadata_r2` (Component, Filename, File_Format, HTAN_Parent_Data_File_ID, HTAN_Data_File_ID, Alignment_Workflow_Url, Alignment_Workflow_Type, Genomic_Reference, Genomic_Reference_URL, Index_File_Name, Average_Base_Quality, Average_Insert_Size, Average_Read_Length, Contamination, Contamination_Error, Mean_Coverage, MSI_Workflow_Link, MSI_Score, MSI_Status, Pairs_On_Diff_CHR, Total_Reads, Total_Uniquely_Mapped, Total_Unmapped_reads, Proportion_Reads_Duplicated, Proportion_Reads_Mapped, Proportion, Targets_No_Coverage, Proportion_Base_Mismatch, Short_Reads, entityId, HTAN_Center, Data_Release, File_Size, Base_Filename, md5) VALUES ('BulkRNA-seqLevel2', 'PickSeq_Level_2/MEL202112/s1.bam', 'bam', 'HTA7_1_1009, HTA7_1_1010', 'HTA7_1_1453', 'https://bcbio-nextgen.readthedocs.io/en/latest/contents/bulk_rnaseq.html', 'STAR 2-Pass Transcriptome', 'HG38', 'https://gdc.cancer.gov/about-data/gdc-data-processing/gdc-reference-files', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'syn26546212', 'HTAN HMS', 'Release 2.0', 409473669, 'S1.bam', '4b6feda53660a3a30fd965d54b6ba8e6'), ('BulkRNA-seqLevel2', 'PickSeq_Level_2/MEL202112/s10.bam', 'bam', 'HTA7_1_1011, HTA7_1_1012', 'HTA7_1_1454', 'https://bcbio-nextgen.readthedocs.io/en/latest/contents/bulk_rnaseq.html', 'STAR 2-Pass Transcriptome', 'HG38', 'https://gdc.cancer.gov/about-data/gdc-data-processing/gdc-reference-files', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'syn26546264', 'HTAN HMS', 'Release 2.0', 222093197, 'S10.bam', '58f731d6d6c71ebc2fcfa02a4844edc1'), ('BulkRNA-seqLevel2', 'PickSeq_Level_2/MEL202112/s100.bam', 'bam', 'HTA7_1_1013, HTA7_1_1014', 'HTA7_1_1455', 'https://bcbio-nextgen.readthedocs.io/en/latest/contents/bulk_rnaseq.html', 'STAR 2-Pass Transcriptome', 'HG38', 'https://gdc.cancer.gov/about-data/gdc-data-processing/gdc-reference-files', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'syn26546266', 'HTAN HMS', 'Release 2.0', 281144172, 'S100.bam', 'b982f73576ff9e32f9a4e5b82c2275f1'), ('BulkRNA-seqLevel2', 'PickSeq_Level_2/MEL202112/s101.bam', 'bam', 'HTA7_1_1015, HTA7_1_1016', 'HTA7_1_1456', 'https://bcbio-nextgen.readthedocs.io/en/latest/contents/bulk_rnaseq.html', 'STAR 2-Pass Transcriptome', 'HG38', 'https://gdc.cancer.gov/about-data/gdc-data-processing/gdc-reference-files', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'syn26546268', 'HTAN HMS', 'Release 2.0', 467955757, 'S101.bam', 'fe3c7f4a13317b58495d7ad4322bfe34'), ('BulkRNA-seqLevel2', 'PickSeq_Level_2/MEL202112/s102.bam', 'bam', 'HTA7_1_1017, HTA7_1_1018', 'HTA7_1_1457', 'https://bcbio-nextgen.readthedocs.io/en/latest/contents/bulk_rnaseq.html', 'STAR 2-Pass Transcriptome', 'HG38', 'https://gdc.cancer.gov/about-data/gdc-data-processing/gdc-reference-files', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'None', 'syn26546269', 'HTAN HMS', 'Release 2.0', 216471892, 'S102.bam', 'f724f46fade10259033e50e9135f4dcc');