Exemplo n.º 1
0
def is_pathogenic(templine, headlist, yaml_commands):
    templinelist = templine.split("\t")
    pathogenic = 0

    tiering_cmds = yaml_commands[yaml_keys.kModules][yaml_keys.kTiering]
    nalg = tiering_cmds[yaml_keys.kTPathogenicityGlobalThreshold]

    colHeaders = yaml_utils.convertColumns(
        tiering_cmds[yaml_keys.kTPathogenicityCols], yaml_commands)
    colsThresholds = tiering_cmds[yaml_keys.kTPathogenicityThresholds]

    for idx, colHeader in enumerate(colHeaders):
        if (isinstance(colHeader, list)):
            passed = False
            colThresholdsList = colsThresholds[idx]
            for idx, singleColHeader in enumerate(colHeader):
                colThresholds = yaml_utils.split_multiple_col_thresholds(
                    colThresholdsList[idx], yaml_commands)
                col = templinelist[headlist.index(singleColHeader)]
                if (passes_criteria(col, colThresholds)):
                    passed = True
                    break
            if (passed):
                pathogenic += 1
            continue

        #else
        colThresholds = yaml_utils.split_multiple_col_thresholds(
            colsThresholds[idx], yaml_commands)
        col = templinelist[headlist.index(colHeader)]
        passed = passes_criteria(col, colThresholds)
        if (passed):
            pathogenic += 1

    if pathogenic >= int(nalg):
        #debug
        #         print 'is pathogenic'
        return 1
    else:
        #debug
        #         print 'not pathogenic'
        return 0
Exemplo n.º 2
0
def is_pathogenic(templine, headlist, yaml_commands):
    templinelist = templine.split("\t")
    pathogenic = 0
    
    tiering_cmds = yaml_commands[yaml_keys.kModules][yaml_keys.kTiering]
    nalg = tiering_cmds[yaml_keys.kTPathogenicityGlobalThreshold]
    
    colHeaders = yaml_utils.convertColumns(tiering_cmds[yaml_keys.kTPathogenicityCols], yaml_commands)
    colsThresholds = tiering_cmds[yaml_keys.kTPathogenicityThresholds]
    
    for idx,colHeader in enumerate(colHeaders):
        if(isinstance(colHeader, list)):
            passed = False
            colThresholdsList = colsThresholds[idx]
            for idx,singleColHeader in enumerate(colHeader):
                colThresholds = yaml_utils.split_multiple_col_thresholds(colThresholdsList[idx], yaml_commands)
                col = templinelist[headlist.index(singleColHeader)]
                if(passes_criteria(col, colThresholds)):
                    passed = True
                    break
            if(passed):
                pathogenic += 1
            continue

        #else
        colThresholds = yaml_utils.split_multiple_col_thresholds(colsThresholds[idx], yaml_commands)
        col = templinelist[headlist.index(colHeader)]
        passed = passes_criteria(col, colThresholds)
        if(passed):
            pathogenic += 1
            
    if pathogenic >= int(nalg):
        #debug
#         print 'is pathogenic'
        return 1
    else:
        #debug
#         print 'not pathogenic'
        return 0
Exemplo n.º 3
0
def is_pathogenic(templine, headlist, yaml_commands):
    templinelist = templine.split("\t")
    pathogenic = 0
    
    tiering_cmds = yaml_commands[yaml_keys.kModules][yaml_keys.kTiering]
    nalg = tiering_cmds[yaml_keys.kTPathogenicityGlobalThreshold]
    
    colHeaders = yaml_utils.convertColumns(tiering_cmds[yaml_keys.kTPathogenicityCols], yaml_commands)
    colsThresholds = tiering_cmds[yaml_keys.kTPathogenicityThresholds]
    
    for idx,colHeader in enumerate(colHeaders):
        if(isinstance(colHeader, list)):
            passed = False
            colThresholdsList = colsThresholds[idx]
            for idx,singleColHeader in enumerate(colHeader):
                colThresholds = yaml_utils.split_multiple_col_thresholds(colThresholdsList[idx], yaml_commands)
                col = templinelist[headlist.index(singleColHeader)]
                if(passes_criteria(col, colThresholds)):
                    passed = True
                    break
            if(passed):
                pathogenic += 1
            continue

        #else
#         if(isinstance(colsThresholds[idx], list)):
        colThresholds = yaml_utils.split_multiple_col_thresholds(colsThresholds[idx], yaml_commands)
        col = templinelist[headlist.index(colHeader)]
        passed = passes_criteria(col, colThresholds)
        if(passed):
            pathogenic += 1
            
#         passed = False
#         for colThreshold in colThresholds:
#             if(col != '' and
#                (((type(colThreshold) is float or type(colThreshold) is int) and float(col) >= colThreshold)
#                 or col == colThreshold)
#             ):
#                 passed = True
#                 break
#         if(passed):
#             pathogenic += 1
    
#     sift = templinelist[headlist.index(vcfHeaders.kSiftPred)] if vcfHeaders.kSiftPred in headlist else ''
#     pp2 = templinelist[headlist.index(vcfHeaders.kPolyphen2Pred)] if vcfHeaders.kPolyphen2Pred in headlist else ''
#     lrt = templinelist[headlist.index(vcfHeaders.kLrtPred)] if vcfHeaders.kLrtPred in headlist else ''
#     mt = templinelist[headlist.index(vcfHeaders.kMutationTasterPred)] if vcfHeaders.kMutationTasterPred in headlist else ''
#     pp2_2 = templinelist[headlist.index(vcfHeaders.kPolyphen2Pred_2)] if vcfHeaders.kPolyphen2Pred_2 in headlist else ''
#     
#     # check for header mismatches
#     if(vcfHeaders.kSiftPred not in headlist):
#         print 'warning: ' + vcfHeaders.kSiftPred + ' not found in annotated header'
#     if(vcfHeaders.kPolyphen2Pred not in headlist):
#         print 'warning: ' + vcfHeaders.kPolyphen2Pred + ' not found in annotated header'
#     if(vcfHeaders.kLrtPred not in headlist):
#         print 'warning: ' + vcfHeaders.kLrtPred + ' not found in annotated header'
#     if(vcfHeaders.kMutationTasterPred not in headlist):
#         print 'warning: ' + vcfHeaders.kMutationTasterPred + ' not found in annotated header'
#     if(vcfHeaders.kPolyphen2Pred_2 not in headlist):
#         print 'warning: ' + vcfHeaders.kPolyphen2Pred_2 + ' not found in annotated header (though currently unused)'
#     
#     if sift == "D":
#         pathogenic+=1
#         #debug
#         print 'SIFT=D'
#     if (pp2 == "P") or (pp2 == "D"):
#         pathogenic+=1
#         #debug 
#         print 'pp=P or D'
#     if lrt == "D":
#         pathogenic+=1
#         # debug
#         print 'lrt=D'
#     if (mt == "A") or (mt == "D"):
#         pathogenic+=1
#         #debug
#         print 'mt=A or D'
    if pathogenic >= int(nalg):
        #debug
#         print 'is pathogenic'
        return 1
    else:
        #debug
#         print 'not pathogenic'
        return 0