コード例 #1
0
    compNames = fused_bkb.getAllComponentNames()
    f = open(withheld_patients_file, 'r')
    withheldPatientHashes = f.read().split(',')

    patientDict = pickle.load(open(patient_data_file, 'rb'))
    patientsMutationVariantEvidence = []
    patientIDs = []
    for withheldPatientHash in withheldPatientHashes:
        withheldPatientDict = patientDict[int(withheldPatientHash)]
        patientIDs.append(withheldPatientDict["Patient_ID"])
        genes = withheldPatientDict["Patient_Genes"]
        variants = withheldPatientDict["Patient_Variants"]
        patientMutationVariantEvidence = dict()
        for idx, mut in enumerate(genes[0:5]):
            compName = 'mut-var_'+mut
            if compName in compNames:
                compIDX = fused_bkb.getComponentIndex(compName)
                compStatesIDXs = fused_bkb.getAllComponentINodeIndices(compIDX)
                stateNames = [fused_bkb.getComponentINodeName(compIDX,csIdx) for csIdx in compStatesIDXs]
                if variants[idx] in stateNames:
                    patientMutationVariantEvidence[compName] = variants[idx]
        patientsMutationVariantEvidence.append(patientMutationVariantEvidence)
    target = ('Survival_Time', '<=', 943)

    cross_validator = CrossValidator(fused_bkb,withheldPatientHashes, patient_data_file, patientDict)
    cross_validator.run_demo_suite(target,
                                   patientIDs,
                                   patientsMutationVariantEvidence)


コード例 #2
0
    f = open(withheld_patients_file, 'r')
    withheldPatientHashes = f.read().split(',')

    patientDict = pickle.load(open(patient_data_file, 'rb'))
    patientsMutationVariantEvidence = []
    patientIDs = []
    for withheldPatientHash in withheldPatientHashes:
        withheldPatientDict = patientDict[int(withheldPatientHash)]
        patientIDs.append(withheldPatientDict["Patient_ID"])
        genes = withheldPatientDict["Patient_Genes"]
        variants = withheldPatientDict["Patient_Variants"]
        patientMutationVariantEvidence = dict()
        for idx, mut in enumerate(genes[0:5]):
            compName = 'mut-var_' + mut
            if compName in compNames:
                compIDX = fused_bkb.getComponentIndex(compName)
                compStatesIDXs = fused_bkb.getAllComponentINodeIndices(compIDX)
                stateNames = [
                    fused_bkb.getComponentINodeName(compIDX, csIdx)
                    for csIdx in compStatesIDXs
                ]
                if variants[idx] in stateNames:
                    patientMutationVariantEvidence[compName] = variants[idx]
        patientsMutationVariantEvidence.append(patientMutationVariantEvidence)
    target = ('Survival_Time', '<=', 943)

    cross_validator = CrossValidator(fused_bkb, withheldPatientHashes,
                                     patient_data_file, patientDict)
    cross_validator.run_demo_suite(target, patientIDs,
                                   patientsMutationVariantEvidence)