Exemplo n.º 1
0
def main():

    genes_of_interest = input(
        "Enter the genes you want to look up, separated by a space: ")
    confirmation = input("You entered these genes: " +
                         genes_of_interest.strip() +
                         ". Is that right? Enter y/n: ")

    if confirmation == 'y':
        # Check if the database already exists
        print("Checking if databases exist...")
        if is_sqlite3('./data/mydb'):
            # If it does, ask if user wants to update it
            update_database = input(
                "Do you want to update your database before running analysis? Enter y/n: "
            )
            if update_database == 'y':
                # Do the updating
                print("Updating databases...")
                refresh_db()
        else:
            # Otherwise create the database
            print("Creating databases...")
            create_db()
        # Then run the analysis
        run_analysis(genes_of_interest)

    elif confirmation == "n":
        print('Exiting! Bye bye.')
Exemplo n.º 2
0
def run_pipeline():
    """
    Runs all functions in the pipeline. Parses tracking and events data from 52 xml files. Preprocesses the DataFrame
    to conform to Metrica Sports format. Then calculates EPV values to get the optimal passes using the
    Friends Of Tracking code, which can be found in the EPV_code folder. Then creates multiple features based on
    tracking and events data. Followed by the analysis, using a Linear Regression and Decision Tree.

    After each step files are saved to the /data folder.
    """
    data_parser.parse_data()
    preprocessing.preprocess()
    generate_EPV_values.generate_epv_files()
    feature_engineering.engineer_features()
    analysis.run_analysis()
Exemplo n.º 3
0
def main(java_file):
    os.system("clear")
    print("Thanks for choosing")
    print_ascii_art()
    print("A Companion Application for Byteman.")
    print("---------------------------------------")
    if java_file != False:
        print("- Running program analysis")
        print("- - If you think the program is stuck looping, use <ctrl+c> to continue")
        rankings, methods, classname  = run_analysis(java_file)
        interactive(rankings, methods, classname)
    else:
        print("You have not supplied a Java application to Byteboy.")
        print("The functionality available to you is Manual Rule Creation.")
        result = raw_input("Do you wish to continue? (y/n): ")
        if result == "y":
            manual_creation()
    print("Thank you for using Byteboy.\nHave a nice day!")
Exemplo n.º 4
0
def success():
    try:
        if request.method == 'POST':
            show_course_rec = True if request.form.get(
                'show_course_rec') == "True" else False
            obj = run_analysis(request.form)
            tables = build_tables(obj)
            verbal_plot = plot_verbal(obj)
            math_plot = plot_math(obj)
            math_improve_plot = plot_total_miss_barchart(
                obj, "math_concept_plot", "Math")
            verbal_improve_plot = plot_total_miss_barchart(
                obj, "verbal_concept_plot", "Verbal")
            reading_improve_plot = plot_total_miss_barchart(
                obj, "reading_concept_plot", "Reading")
            writing_improve_plot = plot_total_miss_barchart(
                obj, "writing_concept_plot", "Writing")
            return render_template(
                'result.html',
                table=tables,
                obj=obj,
                cols_concept=['', 'Concept', 'Correct', 'Incorrect', 'Total'],
                cols_diff=[
                    '', 'Question Level Difficulty', 'Wrong', 'Correct',
                    'Total'
                ],
                cols_explain=[
                    '', 'Section', 'Question', 'Your Answer', 'Correct Answer',
                    'Explaination'
                ],
                cols_improve=['', 'Concept', 'Possible Score Increase'],
                reading_improve_plot=reading_improve_plot,
                writing_improve_plot=writing_improve_plot,
                math_improve_plot=math_improve_plot,
                verbal_plot=verbal_plot,
                math_plot=math_plot,
                show_rec=show_course_rec)

        else:
            pass
    except Exception as e:
        return render_template('500.html', error=str(e))
Exemplo n.º 5
0
def run_scale_up(a_type, f, linear_puzzles, algo_set):
    for size in range(PUZZLE_START_SIZE, PUZZLE_END_SIZE + 1):
        linear_puzzles, puzzle_tuples = extend_puzzles(linear_puzzles, size)

        run_analysis(a_type, f, puzzle_tuples, algo_set, size, True)
Exemplo n.º 6
0
                        default=256)
    # Specify frequency range
    parser.add_argument('-b',
                        '--band',
                        nargs=2,
                        type=int,
                        help="Specify the \
    frequency band in Hz, for example \'--band 8 13\'",
                        default=[8, 13])
    # Specify the length of the signal in seconds
    parser.add_argument('-l',
                        '--length',
                        type=float,
                        help="Specify the \
    length of the signal to process, for example \'--length 1.5\' to only \
    process the first one and a half seconds of the signal. If the specified \
    length is longer than the length of the signal, the whole signal is used.")

    args = parser.parse_args()
    folders = args.folder
    band = args.band
    sample_rate = args.sample_rate
    length = args.length

    results = run_analysis(folders, band, sample_rate, length)
    KNN = create_knn_classifier(results)

    # Create an interactive plot
    plot(results, sample_rate, band, callback=on_click)
    exit(0)
Exemplo n.º 7
0
print("----- INITIAL SHELL PARAMETERS -----")
read_params()

if gl.mode_input == 0:
    print("----- CLEAN PREVIOUS RESULTS -----")
    clear_previous_results()
    starting_depth = 1
else:
    print("----- LOAD LAST RESULTS (CSV) SAVED -----")
    starting_depth = load_last_csv()

print("----- CHECK DATABASE -----")
check_database()

print("----- START ANALYSIS -----")
run_analysis(starting_depth)
print("----- END ANALYSIS -----")

print("----- START GENERATE OUTPUT -----")
draw_from_analysis(
    [gl.gene_input_hsa, gl.gene_input, gl.gene_input_url],
    os.path.join(os.getcwd(), 'export_data')
)
print("----- END GENERATE OUTPUT -----")

print("----- START GENERATE ZIPFILE -----")
create_zip(f'analysis_{gl.pathway_input}_{gl.gene_input}_{gl.deep_input}')
print("----- END GENERATE ZIPFILE -----")

m, s = divmod(time.time() - start_time, 60)
print(f"----- DONE EXECUTION ({round(m)} mins, {round(s)} secs) -----")
# Run Genetic Algorithm Analysis #
##################################

# Tune population size. #
# analysis.run_analysis(ml.NeuralNetwork(hidden_nodes=[100], activation = 'identity', algorithm = 'genetic_alg', learning_rate= 0.001, max_iters=200, is_classifier= True),
#     X_train, Y_train, X_test, Y_test, 'Titanic', 'GA', 'Round_1', 'Population Size', 'pop_size', [25, 50, 75, 100, 150, 200, 250, 500, 750, 1000]
# )

# Tune mutation probability. #
# analysis.run_analysis(ml.NeuralNetwork(hidden_nodes=[100], activation = 'identity', algorithm = 'genetic_alg', learning_rate= 0.001, max_iters=200, pop_size= 150, is_classifier= True),
#     X_train, Y_train, X_test, Y_test, 'Titanic', 'GA', 'Round_2', 'Mutation Probability', 'mutation_prob', [.1, .2, .3, .4, .5, .6, .7, .8, .9]
# )

# Tune number of iterations. #
analysis.run_analysis(ml.NeuralNetwork(hidden_nodes=[100], activation = 'identity', algorithm = 'genetic_alg', learning_rate= 0.001, pop_size= 150, mutation_prob=0.5, is_classifier= True),
    X_train, Y_train, X_test, Y_test, 'Titanic', 'GA', 'Round_3', 'Iterations', 'max_iters', [0, 10, 100, 150, 200, 250, 500]
)

# Final Learning Curve. #
# analysis.run_analysis(ml.NeuralNetwork(hidden_nodes=[100], activation = 'identity', algorithm = 'genetic_alg', learning_rate= 0.001, pop_size= 150, mutation_prob=0.5, max_iters=100, is_classifier= True),
#     X_train, Y_train, X_test, Y_test, 'Titanic', 'GA', 'Final', '', '', []
# )

##############################
# Run Baseline Sklearn Model #
##############################

# Final Learning Curve. #
# analysis.run_analysis(neural_network.MLPClassifier(activation='identity', solver='adam', beta_1=0.4),
#     X_train, Y_train, X_test, Y_test, 'Titanic', 'Sklearn Baseline', 'Final', '', '', []
# )
Exemplo n.º 9
0
    try:
        max_iters = int(sys.argv[4])
    except:
        max_iters = 3
    print 'Arguments: %s %s' % (location_id, age_group_id)



    print "ndraws=", ndraws, " max_iters=", max_iters

    outdir = '{FILEPATH}' # should I change outdir to something else?
    sex_id_list = [{SEX IDS}]
    year_id_list = [{YEAR IDS}]
    consecutive_small_changes = 6 
    small_change = 1e-6
    scale_factor = 1000.
    data_dir = '{FILEPATH}'
    h5_dir = '/{FILEPATH}'


    res, logp, runtime = analysis.run_analysis(
            location_id, age_group_id, ndraws, max_iters,
            sex_id_list, year_id_list,
            consecutive_small_changes,
            small_change,
            scale_factor,
            data_dir,
            h5_dir,
            outdir
            )