コード例 #1
0
ファイル: rec_test.py プロジェクト: evocell/rec
    length = functions.check_length(args.test)

    #Get model data
    if args.model == None:
        model = os.path.join(os.path.join(base_folder, "Data"), 
                "base_model_" + str(length))
    else:
        model = args.model
    data = pickle.load(open(os.path.join(model, "data")))



    #Tranform data
    if algorithm == "CROSSED":
        crossed_test = functions.convert_crossed(filename = args.test,
                length = length, output = "test_crossed_" + args.output,
                features = data['crossed_features'], positive = True,
                folder = "", extra = data['extra'])
    else:
        if algorithm == "REC":
            crossed_test = functions.convert_crossed(
                    filename = args.test, length = length, 
                    output = "test_crossed_" + args.output, 
                    features = data['rec_crossed_features'], 
                    positive = True, folder = "", extra = data['extra'])
        ric_test = functions.convert_ric(filename = args.test, 
                length = length, output = "test_ric_" + args.output,
                folder = "")

    #Apply algorithms
    if algorithm == "CROSSED":
        crossed_output =  functions.run_crossed(filename=crossed_test,
コード例 #2
0
ファイル: rec_train.py プロジェクト: evocell/rec
            negative = ric_negative_scores,
            optim = "SEN")

    
    #Do CRoSSeD
    #Check if feature file was provided and if it's ok
    if args.features != None:
        features = functions.read_feature_file(args.features)
    else:
        features = functions.read_feature_file(os.path.join(
            base_folder, "Data/crossed_features_" + str(length) + 
            ".txt"))
    #Convert input files to CRoSSeD format
    crossed_positives = functions.convert_crossed(
            filename=args.positive,
            length=length,
            output="train_crossed_positives.fasta",
            features=features, positive=True, folder=unique, 
            extra=extra)
    crossed_negatives = functions.convert_crossed(
            filename=args.negative,
            length=length,
            output="train_crossed_negatives.fasta",
            features=features, positive=False, folder=unique, 
            extra=extra)
    #Train CRoSSeD model
    model = functions.train_crossed(positive=crossed_positives,
            negative=crossed_negatives, model="CRoSSeD_model",
            unique=unique, base_folder=base_folder)
    #Aply CRoSSeD to input data
    crossed_positives_output = functions.run_crossed(
            filename=crossed_positives, model=model,