Ejemplo n.º 1
0
def main():
    if len(argv) < 3:
        print_usage()
        experiments_folder = input('Enter folder name with experimental data: ')
        results_folder = input('Enter folder name for results: ')
    else:
        experiments_folder = argv[1]
        results_folder = argv[2]
        print('Experimental data will be loaded from \'{0}\''.format(experiments_folder))
        print('Results will be saved to \'{0}\''.format(results_folder))
        stdout.flush()
    if not exists(results_folder):
        makedirs(results_folder)
    experiments_files = [f for f in listdir(experiments_folder) if isfile(join( experiments_folder, f))]

    for experiment_file in experiments_files:
        experiment_file_name = join(experiments_folder, experiment_file)
        main_data = correlation.load_main_data_from_csv(experiment_file_name)
        proteins = correlation.construct_proteins(main_data)
        protein_records = correlation.construct_protein_records(proteins, main_data)
        correlation.fill_peptide_parameters(protein_records)

        received, missed = statistics.fill_parameter_lists(protein_records)
        peptides_file_name = join(results_folder, experiment_file[:-4] + '.peptides.csv')
        statistics.save_peptide_parameter_lists_to_csv(received, peptides_file_name)

        stats = statistics.calculate_simple_statistics(received)
        statistics_file_name = join(results_folder, experiment_file[:-4] + '.statistics.csv')
        statistics.save_simple_statistics_to_csv(stats, statistics_file_name)
Ejemplo n.º 2
0
        user_choice = input('Do you want to save your proteins into a new file [Yes/No]? ')
        if user_choice.upper() == 'YES':
            protein_file_name = input('Please, enter new file name: ')
            correlation.save_proteins_to_csv(proteins, protein_file_name + '.csv')
    else:
        proteins = correlation.load_proteins_from_csv(input('Please, enter proteins file name: '))

    protein_records = correlation.construct_protein_records(proteins, main_data)
    correlation.fill_missed_peptide_records(protein_records)
    correlation.fill_peptide_parameters(protein_records)

    received_parameters, missed_parameters = statistics.fill_parameter_lists(protein_records)
    received_per_peptide_correlations, missed_per_peptide_correlations = statistics.fill_per_peptide_correlations(protein_records)
    received_statistics = statistics.calculate_simple_statistics(received_parameters, received_per_peptide_correlations)
    missed_statistics = statistics.calculate_simple_statistics(missed_parameters, missed_per_peptide_correlations)

    user_choice = input('Do you want to save statistics for received peptides [Yes/No]? ')
    if user_choice.upper() == 'YES':
        file_name = input('Please, enter new file name: ')
        statistics.save_simple_statistics_to_csv(received_statistics, file_name)

    user_choice = input('Do you want to save statistics for missed peptides [Yes/No]? ')
    if user_choice.upper() == 'YES':
        file_name = input('Please, enter new file name: ')
        statistics.save_simple_statistics_to_csv(missed_statistics, file_name)

    user_choice = input('Do you want to save your protein records [Yes/No]? ')
    if user_choice.upper() == 'YES':
        folder_name = input('Please, enter folder name: ')
        correlation.save_protein_records_to_folder(protein_records, folder_name)