コード例 #1
0
ファイル: variant_format.py プロジェクト: redpixr/clc-vtable
    def FormatVariant(FileInfo, Type, Ref, Allele, Crc):
        """Format the variant based on the type

        Args:
            FileInfo (string): In case of error log this info about file
            Type (string): (SNV || Deletion || Insertion)
            Ref (string): Nucleotide[s] that is/are present in the reference
            Allele (string): Nucleotide[s] that is/are present in the allele
            Crc (string): Coding Region Change

        Returns:
            string: Processed and Formatted variant for the Variant Column
        """
        try:
            if Type == SNP:
                return VariantFormat.ProcessSNP(Ref, Allele, Crc)
            elif Type == INSERTION:
                return VariantFormat.ProcessInsertion(Ref, Allele, Crc)
            elif Type == DELETION:
                return VariantFormat.ProcessDeletion(Ref, Allele, Crc)
            else:
                return ""
        except ValidationException as crc_error:
            # Log here the crc_error message with File info wherever it
            # happened
            Logger.Warn("{} <> {} <> {}".format(FileInfo, crc_error.message,
                                                crc_error.errors))
            return crc_error.errors
コード例 #2
0
config = {}

with open(os.getcwd() + '/configuration/config.jsonc', 'r') as outfile:
        config['features'] = {}
        config['features']['backend'] = {}
        config['features']['frontend'] = {}
        config['features']['database'] = {}

        config = json.load(outfile)

try:
        with open(os.getcwd() + '/appi.json', 'r') as outfile:
                config = { **config, **json.load(outfile) }

except:
        Logger.Warn('appi.json does not exists')

def GetConfig():
    return config

def WriteAppiConfig(conf):
        appiConfig = None

        with open(config['root-file'], 'r') as appiFile:
           appiConfig = json.load(appiFile)

        appiConfig = { **appiConfig, **conf }
        appiFile.close()

        with open(config['root-file'], 'w') as appiFile:
                appiFile.write(json.dumps(appiConfig))