#!/usr/bin/env python
# coding: utf-8

import configparser

config = configparser.ConfigParser()

config['Plug-in'] = {'name': 'gm_cmms',
                     'version': '1.0',
                     }
config['1000GMAF'] = {'data_type': 'float',
                      'category': 'Frequency',
                      'category_aggregate': 'min',
                      'record_aggregate': 'max',
                      'value-notreported': 'na:na',
                      'value-rare': 'le:0.005',
                      'value-intermediate': 'le:0.02',
                      'value-common': 'gt:0.02',
                      'score-notreported': '3',
                      'score-rare': '2',
                      'score-intermediate': '1',
                      'score-common': '-12',
                      }
config['DbsnpMAF'] = {'data_type': 'float',
                      'category': 'Frequency',
                      'category_aggregate': 'min',
                      'record_aggregate': 'max',
                      'value-notreported': 'na:na',
                      'value-rare': 'le:0.005',
                      'value-intermediate': 'le:0.02',
                      'value-common': 'gt:0.02',
                      'score-notreported': '3',
                      'score-rare': '2',
                      'score-intermediate': '1',
                      'score-common': '-12',
                      }
config['Dbsnp129MAF'] = {'data_type': 'float',
                         'category': 'Frequency',
                         'category_aggregate': 'min',
                         'record_aggregate': 'max',
                         'value-notreported': 'na:na',
                         'value-rare': 'le:0.005',
                         'value-intermediate': 'le:0.02',
                         'value-common': 'gt:0.02',
                         'score-notreported': '3',
                         'score-rare': '2',
                         'score-intermediate': '1',
                         'score-common': '-12',
                         }
config['ESPMAF'] = {'data_type': 'float',
                    'category': 'Frequency',
                    'category_aggregate': 'min',
                    'record_aggregate': 'max',
                    'value-notreported': 'na:na',
                    'value-rare': 'le:0.005',
                    'value-intermediate': 'le:0.02',
                    'value-common': 'gt:0.02',
                    'score-notreported': '3',
                    'score-rare': '2',
                    'score-intermediate': '1',
                    'score-common': '-12',
                    }
config['dbNSFP_MutationTaster_pred'] = {'data_type': 'string',
                                        'category': 'Protein_prediction',
                                        'category_aggregate': 'sum',
                                        'record_aggregate': 'min',
                                        'field_separators': ",",
                                        'value-notreported': 'na',
                                        'value-a': 'a',
                                        'value-d': 'd',
                                        'value-n': 'n',
                                        'value-p': 'p',
                                        'score-notreported': '0',
                                        'score-a': '1',
                                        'score-d': '1',
                                        'score-n': '0',
                                        'score-p': '0',
                                        }
config['dbNSFP_Polyphen2_HVAR_pred'] = {'data_type': 'string',
                                        'category': 'Protein_prediction',
                                        'category_aggregate': 'sum',
                                        'record_aggregate': 'min',
                                        'field_separators': ",",
                                        'value-notreported': 'na',
                                        'value-d': 'd',
                                        'value-p': 'p',
                                        'value-b': 'b',
                                        'score-notreported': '0',
                                        'score-d': '1',
                                        'score-p': '1',
                                        'score-b': '0',
                                        }
config['dbNSFP_SIFT_pred'] = {'data_type': 'string',
                              'category': 'Protein_prediction',
                              'category_aggregate': 'sum',
                              'record_aggregate': 'min',
                              'field_separators': ",",
                              'value-notreported': 'na',
                              'value-d': 'd',
                              'value-t': 't',
                              'score-notreported': '0',
                              'score-d': '1',
                              'score-t': '1',
                              }
config['GeneticModels'] = {'data_type': 'string',
                           'category': 'Inheritance_Models',
                           'category_aggregate': 'min',
                           'record_aggregate': 'max',
                           'field_separators': ",",
                           'value-notreported': 'na',
                           'value-ar_hom': 'ar_hom',
                           'value-ar_hom_dn': 'ar_hom_dn',
                           'value-ad': 'ad',
                           'value-ad_dn': 'ad_dn',
                           'value-ar_comp': 'ar_comp',
                           'value-xd': 'xd',
                           'value-xd_dn': 'xd-dn',
                           'value-xr': 'xr',
                           'value-xr_dn': 'xr-dn',
                           'score-notreported': '-12',
                           'score-ar_hom': '1',
                           'score-ar_hom_dn': '1',
                           'score-ad': '1',
                           'score-ad_dn': '1',
                           'score-ar_comp': '1',
                           'score-xd': '1',
                           'score-xd_dn': '1',
                           'score-xr': '1',
                           'score-xr_dn': '1',
                           }
config['MostSevereConsequence'] = {'data_type': 'string',
                                   'category': 'Consequence',
                                   'category_aggregate': 'max',
                                   'record_aggregate': 'max',
                                   'field_separators': ":",
                                   'score-transcript_ablation': '5',
                                   'score-splice_donor_variant': '4',
                                   'score-splice_acceptor_variant': '4',
                                   'score-stop_gained': '4',
                                   'score-frameshift_variant': '4',
                                   'score-stop_lost': '4',
                                   'score-initiator_codon_variant': '4',
                                   'score-inframe_insertion': '3',
                                   'score-inframe_deletion': '3',
                                   'score-missense_variant': '3',
                                   'score-transcript_amplification': '3',
                                   'score-splice_region_variant': '3',
                                   'score-incomplete_terminal_codon_variant': '3',
                                   'score-synonymous_variant': '1',
                                   'score-stop_retained_variant': '1',
                                   'score-coding_sequence_variant': '1',
                                   'score-mature_miRNA_variant': '1',
                                   'score-5_prime_UTR_variant': '1',
                                   'score-3_prime_UTR_variant': '1',
                                   'score-non_coding_exon_variant': '1',
                                   'score-nc_transcript_variant': '1',
                                   'score-intron_variant': '1',
                                   'score-NMD_transcript_variant': '1',
                                   'score-upstream_gene_variant': '1',
                                   'score-downstream_gene_variant': '1',
                                   'score-TFBS_ablation': '1',
                                   'score-TFBS_amplification': '1',
                                   'score-TF_binding_site_variant': '1',
                                   'score-regulatory_region_variant': '1',
                                   'score-regulatory_region_ablation': '1',
                                   'score-regulatory_region_amplification': '1',
                                   'score-feature_elongation': '1',
                                   'score-feature_truncation': '1',
                                   'score-intergenic_variant': '0',
                                   'score-notreported': '0',
                                   'value-transcript_ablation': 'transcript_ablation',
                                   'value-splice_donor_variant': 'splice_donor_variant',
                                   'value-splice_acceptor_variant': 'splice_acceptor_variant',
                                   'value-stop_gained': 'stop_gained',
                                   'value-frameshift_variant': 'frameshift_variant',
                                   'value-stop_lost': 'stop_lost',
                                   'value-initiator_codon_variant': 'initiator_codon_variant',
                                   'value-inframe_insertion': 'inframe_insertion',
                                   'value-inframe_deletion': 'inframe_deletion',
                                   'value-missense_variant': 'missense_variant',
                                   'value-transcript_amplification': 'transcript_amplification',
                                   'value-splice_region_variant': 'splice_region_variant',
                                   'value-incomplete_terminal_codon_variant': 'incomplete_terminal_codon_variant',
                                   'value-synonymous_variant': 'synonymous_variant',
                                   'value-stop_retained_variant': 'stop_retained_variant',
                                   'value-coding_sequence_variant': 'coding_sequence_variant',
                                   'value-mature_miRNA_variant': 'mature_miRNA_variant',
                                   'value-5_prime_UTR_variant': '5_prime_UTR_variant',
                                   'value-3_prime_UTR_variant': '3_prime_UTR_variant',
                                   'value-non_coding_exon_variant': 'non_coding_exon_variant',
                                   'value-nc_transcript_variant': 'nc_transcript_variant',
                                   'value-intron_variant': 'intron_variant',
                                   'value-NMD_transcript_variant': 'NMD_transcript_variant',
                                   'value-upstream_gene_variant': 'upstream_gene_variant',
                                   'value-downstream_gene_variant': 'downstream_gene_variant',
                                   'value-TFBS_ablation': 'TFBS_ablation',
                                   'value-TFBS_amplification': 'TFBS_amplification',
                                   'value-TF_binding_site_variant': 'TF_binding_site_variant',
                                   'value-regulatory_region_variant': 'regulatory_region_variant',
                                   'value-regulatory_region_ablation': 'regulatory_region_ablation',
                                   'value-regulatory_region_amplification': 'regulatory_region_amplification',
                                   'value-feature_elongation': 'feature_elongation',
                                   'value-feature_truncation': 'feature_truncation',
                                   'value-intergenic_variant': 'intergenic_variant',
                                   'value-notreported': 'na',
                                   }
config['FILTER'] = {'data_type': 'string',
                    'category': 'Variat_call_quality_filter',
                    'category_aggregate': 'min',
                    'record_aggregate': 'max',
                    'score-pass': '3',
                    'score-notreported': '0',
                    'value-pass': 'pass',
                    'value-notreported': 'na',
                    }
config['dbNSFP_GERP++_RS'] = {'data_type': 'float',
                              'category': 'Conservation',
                              'category_aggregate': 'sum',
                              'record_aggregate': 'max',
                              'value-conserved': 'ge:2',
                              'value-notconserved': 'lt:2',
                              'value-notreported': 'na:na',
                              'score-conserved': '1',
                              'score-notconserved': '0',
                              'score-notreported': '0',
                              }
config['dbNSFP_phastCons100way_vertebrate'] = {'data_type': 'float',
                                               'category': 'Conservation',
                                               'category_aggregate': 'sum',
                                               'record_aggregate': 'max',
                                               'value-conserved': 'ge:0.8',
                                               'value-notconserved': 'lt:0.8',
                                               'value-notreported': 'na:na',
                                               'score-conserved': '1',
                                               'score-notconserved': '0',
                                               'score-notreported': '0',
                              }
config['dbNSFP_phyloP100way_vertebrate'] = {'data_type': 'float',
                                            'category': 'Conservation',
                                            'category_aggregate': 'sum',
                                            'record_aggregate': 'max',
                                            'value-conserved': 'ge:2.5',
                                            'value-notconserved': 'lt:2.5',
                                            'value-notreported': 'na:na',
                                            'score-conserved': '1',
                                            'score-notconserved': '0',
                                            'score-notreported': '0',
                                            }
config['CADD'] = {'data_type': 'float',
                  'category': 'CADD_score',
                  'category_aggregate': 'max',
                  'record_aggregate': 'max',
                  'value-20': 'ge:20',
                  'value-10': 'ge:10',
                  'value-0': 'lt:10',
                  'value-notreported': 'na:na',
                  'score-20': '2',
                  'score-10': '1',
                  'score-0': '0',
                  'score-notreported': '0',
                  }
config['CLNSIG'] = {'data_type': 'float',
                    'category': 'Clinical_significance',
                    'category_aggregate': 'min',
                    'record_aggregate': 'max',
                    'field_separators': "|",
                    'score-pathogenic': '2',
                    'score-likely_pathogenic': '1',
                    'score-other': '0',
                    'score-histocompatibility': '0',
                    'score-drug_response': '0',
                    'score-likely_benign': '0',
                    'score-benign': '-1',
                    'score-not_provided': '0',
                    'score-uncertain_significance': '0',
                    'score-notreported': '0',
                    'value-other': 'e:255',
                    'value-histocompatibility': 'e:7',
                    'value-drug_response': 'e:6',
                    'value-pathogenic': 'e:5',
                    'value-likely_pathogenic': 'e:4',
                    'value-likely_benign': 'e:3',
                    'value-benign': 'e:2',
                    'value-not_provided': 'e:1',
                    'value-uncertain_significance': 'e:0',
                    'value-notreported': 'na:na',
                    }

with open('gm_cmms.ini', 'w') as configfile:
    config.write(configfile)
