Example #1
0
    def createManualAnnotationsGivenConfigFile(configFile):
        """
        Assumes a config file as:
        [manual_annotations]
        # annotation3 has blank ('') value
        override:annotation1=value1,annotation2=value2,annotation3=,annotation4=value4
        
        Returns a dictionary:
        {annotation1:value1,annotation2:value2,annotation3:'',annotation4=value4}
        """
        if (configFile is None) or (configFile.strip() == ""):
            return dict()

        if not os.path.exists(configFile):
            logging.getLogger(__name__).warn(
                "Could not find annotation config file: " + configFile + "  ... Proceeding without it."
            )
            return dict()

        config = ConfigUtils.createConfigParser(configFile)
        opts = config.get("manual_annotations", "override").split(",")
        result = dict()
        for optTmp in opts:
            opt = optTmp.split("=")
            if (len(opt) == 1) or (opt[1] is None):
                opt[1] = ""
            result[opt[0]] = opt[1]
        return result
Example #2
0
    def createManualAnnotationsGivenConfigFile(configFile):
        """
        Assumes a config file as:
        [manual_annotations]
        # annotation3 has blank ('') value
        override:annotation1=value1,annotation2=value2,annotation3=,annotation4=value4
        
        Returns a dictionary:
        {annotation1:value1,annotation2:value2,annotation3:'',annotation4=value4}
        """
        if (configFile is None) or (configFile.strip() == ''):
            return dict()

        if not os.path.exists(configFile):
            logging.getLogger(
                __name__).warn("Could not find annotation config file: " +
                               configFile + "  ... Proceeding without it.")
            return dict()

        config = ConfigUtils.createConfigParser(configFile)
        opts = config.get('manual_annotations', 'override').split(',')
        result = dict()
        for optTmp in opts:
            opt = optTmp.split('=')
            if (len(opt) == 1) or (opt[1] is None):
                opt[1] = ''
            result[opt[0]] = opt[1]
        return result