text: import json
  import os
  import csv
  import yaml
  from datetime import date
  
  data = dict(
      contact = dict(#mutiple submitters
          full_name = "Vitaly Sedlyarov", #autogenerated
          first_name = "Vitaly",
          last_name = "Sedlyarov",
          country = "Austria", #country for phone number, better controlled
          institution = "Research Center for Molecular Medicine of the Austrian Academy of Sciences", #institution code
          email = "VSedlyarov@cemm.oeaw.ac.at",
          address = "NA",
          person_role = "submitter", # controlled
      ),
      publication = dict(#optional
          publication_name = "NA",
          pubmed_id = "NA",
          DOI = "NA",
      ),
      project = dict(
          project_abbreviation = "resolute",
          project_full_name = "Research Empowerment on Solute Carriers",#autofill
          project_description = "To trigger an escalation in the appreciation and intensity of research on solute \
  carriers (SLCs) worldwide and to establish SLCs as a tractable target class for medical research and development.",
          project_website = "https://re-solute.eu",
          INSDC_project_accession = "NA",# auto bioproject id?
          study_name = "Transcriptome of RESOLUTE parental cell lines",#same with release_name
          study_description = '''To enable successful SLC function deorphanization we aimed to select minimal number of \
  cell lines covering expression of as many SLCs as possible based on publicly available RNA-Seq dataset of 675 cell \
  lines (Klijn C. et al,Nat. Biotechnol. 2015). ''', # or background, aim
          study_summary = '''we generated transcriptome profile for 7 cell line which will be used in course of RESOLUTE \
  project. RNA-Seq based transcriptome profile of 321-N1 and Jump In T-REx HEK 293, to our knowledge, have not been \
  published before. Transcriptome of the RESOLUTE cell lines would be interesting to SLC community as a minimal set of \
  cell lines covering maximal number of expressed SLC (approx. 80%).''', 
          study_id = "NA",## what is study id?
      ),
      sample = dict(
          sample_name = "RS000F",# named by the data generator
          organism = "human",
          taxon_id = 9606,#auto
          genus_species = "homo sapiens", #auto
          sex = "M",#select
          age = 57,#select
          disease_status = "NA",#ontology
          disease_stage = "NA",#free text
          tissue = "liver",#
          source_ref ="NA", #?
      ),
      cell_line = dict(
          strain = "HuH7",#better name. not sure the difference between "cell line name","parent cells", "strains",etc.
          replicate = 3,
          cell_sample_title = "HuH-7-rep3",#include replication. Maybe pops out only when the replicate is true? what other
                                          # info could be included in this?
          cellosaurus_id = "CVCL_0336", # to be generated automatically, what if multiple cell line id?
          # how to control jump in t-rex hek 293 mapping
          # some mapping using cellosaurus and BTO databases are very differenct!
          # how to include "treatment" or "trademark" information? e.g. jump-in
          cell_line_source = "JCRB",#to refine?
          culture_medium = "DMEM; 10 % FCS; Pen-Strep", # any other information than culture medium and concentration.
          cell_treatment = "NA", #multiple modifictaions, how to handle
          cell_line_qc = " tested for mycoplasma,STR profiling was performed for all cell lines to confirm identity.",
          cell_line_genotype = "WT",
          # transfection miR-124
          # QC is not needed for everyone. How to better describe the GM cell lines?
          #timulation	3 h IFN-γ
          #Replicate	3
          #Cortistatin A treatment	untreated
          #siRNA treatment	NA
          #Tamoxifen treatment	NA
          #CDK19 reconstitutions	not reconstituted
          #molecule isolated	mRNA
      ),
      experiment = dict(
          RNA_isolation=dict(
              isolation_process="Cells (1 x 106 ) were washed 1x with PBS and lysed directly on the dish with RLT buffer\
  (Qiagen) supplemented with 0.143 M -Mercaptoethanol.RNA was isolated using RNeasy Mini Kit (Qiagen) including DNase I\
  digestion according to the manufacture’s protocol.",
              RNA_isolation_QC_tools="Bioanalyzer (Agilent)",
              RNA_isolation_QC_results="high RNA integrity",
          ),
          library_prep = dict(
              library_prep_protocol = '''NEBNext Ultra II Directional RNA Library Prep Kit for Illumina,together with \
  rRNA depletion (NEB)''',
          ),
          sequencing = dict(
          #overlap with sequencing, check if there is ontology mapping
              sequencing_instrument = "Illumina HiSeq 4000",
              read_length = "80bp",#numeric?
          ),
          sequencing_QC = dict(
              sequencing_QC_tools = "FastQC",
              sequencing_QC_results = "all good",
              #sequencing_QC_attributes = dict(# to detailed
              #    per_base_sequence_quality = 30,
              #    per_base_quality_action = "no",
              #    per_base_seuqence_content = "slightly distorted profile till base 10",
              #    per_base_content_action = "trimming",
              seuqencing_QC_action = "standard trimming and clipping of illumina adapters",
              sequencing_QC_action_tools = "cutadapt 1.18",
              ),
          alignment = dict(
              read_mapping_tools = "STAR 2.6.1a",
              read_mapping_model = "h38",
              alignment_algorithm = "STAR alignment",#redundant?
          ),
          quantification = dict(
              transcript_counting_model="ENSEMBL GRCh38 94",
              transcript_counting_tools="Mix2",
              transcript_abundance_method="pseudoalignemnt",
              transcript_abundance_model="ENSEMBL GRCh38 94",
              transcript_abundance_tools="kallisto 0.44.0",
          ),#are bai,bam file included?
          data_analysis = dict(
              #data_filtering="dsfds",
              data_analysis="uniformly covered gene body, no 3-end bias, high correlation, agree with other results",
              #analysis_protocol="fds",
              #data_rejection="dsf",
              #data_correction="fdsf",
              #data_smoothing="dfs",
          ),
  ),
       #labeling_amplification = "fdsjkfks",
      sequencing_files= dict( 
          file_name = "180927_J00151_0269_AH2C25BBXY_716_{SampleNr}_SXX_LXXX_R1_001.fastq",# How to include the sample table
          file_format = "fastq",
          data_creation_date = "2018.10.03",
      ),
      # sequencing raw data, seqeuncing parsed, sequencing = all replicates merged,TPM_alignment files,files mapping table
      submission = dict(
          submission_title = "Transcriptome of RESOLUTE parental cell lines",
          submission_id = "NA",
          first_submit_date = "27 Nov 2018",
          update_date = "2019-09-91",
      ),
      accession_id = dict(
          bioproject_id = "PRJNA545487",
          sra_id = "SRS4847467",
          biosample_id = "SAMN11893684",
          geo_id = "NA",
          #arrayexpress_id = "dsf"
      ),
      license = dict(
          license_exist = "Y", # recommend using seperate file for license
          license_type = "CC BY 4.0", #Creative Commons Attribution 4.0 International License
          license_link = "http://creativecommons.org/licenses/by/4.0/",
      ),
  )
  
  #with open('data.yml', 'w') as outfile:
  #    yaml.dump(data, outfile, default_flow_style=True,indent = 4)
  
  today = date.today()
  out_name = "transcriptomics_metadata_" + today.strftime("%Y%m%d") + ".json"
  with open(out_name,"w") as json_out:
      json.dump(data,json_out,indent=4, sort_keys=False)
  