示例#1
0
def plain_parse_xtandem_combine_with_mgf():
    xml_read_path = request.form['xmlReadPath']
    log_error_threshold = request.form['logErrorThreshold']
    geneFile = request.form['geneFile']
    should_use_unacceptable = request.form['assignUnacceptableModifications']
    unacceptable_mods = request.form.getlist('unacceptableMods[]')
    timestamp = request.form['timestamp']

    mgf_txt_foldername = makeFolderNames.construct_plain_parse_reporter_folder_path(
        request.form)

    mgf_read_dir_path = request.form['mgfReadDirPath']
    mgf_list = ",".join(
        utility.get_mgf_files_given_directory(mgf_read_dir_path))

    a = call_xml_parser.plain_parse_xtandem_combine_with_mgf(
        xml_read_path, log_error_threshold, geneFile, mgf_txt_foldername,
        unacceptable_mods, timestamp, mgf_list)

    if a:
        print("Error in tab 4. Trying cleanup now, either way returning error")
        try:
            clean_up_after_tab_2()
        finally:  #In case it breaks
            return a, 500
    else:
        return "Looks good"
示例#2
0
def getMGFFiles():
    try:
        mgf_read_dir_path = str(request.form['mgfReadDirPath'])
        files = utility.get_mgf_files_given_directory(mgf_read_dir_path)
        text = json.dumps(files)
        return text
    except:
        return "Error selecting mgf files, make sure you have a proper mgf directory name", 500
示例#3
0
def getMGFFiles():
    try:
        mgf_read_dir_path = str(request.form['mgfReadDirPath'])
        if utility.check_if_summary_exists(mgf_read_dir_path):
            return "Temp summary file still exists, remove and rerun", 500
        files = utility.get_mgf_files_given_directory(mgf_read_dir_path)
        text = json.dumps(files)
        return text
    except:
        return "Error selecting mgf files, make sure you have a proper mgf directory name", 500
示例#4
0
def tab_2_helper_function():
    valid, validation_error = validation.validate_tab_2(request.form)
    if not valid:
        return validation_error, 500

    xml_read_path = request.form['xmlReadPath']
    log_error_threshold = request.form['logErrorThreshold']
    reporter_type = request.form['reporterIonType']
    geneFile = request.form['geneFile']
    should_use_unacceptable = request.form['assignUnacceptableModifications']
    unacceptable_mods = request.form.getlist('unacceptableMods[]')
    normalize_intensities = request.form.getlist('normalizeIntensities')
    timestamp = request.form['timestamp']
    keep_na = request.form['writeAllSpectra']

    if request.form['mgfOperationToPerform'] == '1':
        mgf_txt_foldername = makeFolderNames.construct_reporter_folder_path(
            request.form)
    else:
        mgf_txt_foldername = request.form["mgfTxtReadDirPath"]
        previous_ion_type = check_if_previous_summary_exists_and_get_reporter_type(
            mgf_txt_foldername)
        if not previous_ion_type:
            return "No previous summary found.  Please reselect reporters and keep the summary.", 500
        if previous_ion_type != reporter_type:
            return "Ion type from summary does not match current selection.", 500

    mgf_read_dir_path = request.form['mgfReadDirPath']
    mgf_list = ",".join(
        utility.get_mgf_files_given_directory(mgf_read_dir_path))

    if should_use_unacceptable == "1":
        unacceptable_mods = []

    a = call_xml_parser.parse_xtandem_combine_with_mgf(
        xml_read_path, log_error_threshold, reporter_type, geneFile,
        mgf_txt_foldername, unacceptable_mods, normalize_intensities,
        timestamp, keep_na, mgf_list)

    if a:
        print("Error in tab 2. Cleaning up.")
        try:
            clean_up_after_tab_2()
        finally:  #In case it breaks
            return a, 500
    else:
        return "Looks good"