Hi Troels, Ah, right, that makes sense, the peak intensity data was all in one file. I'd completely forgotten that! I'm therefore thinking about expanding the capabilities of the user function by allowing multiple files to be loaded, as this is how many NMR people will have their data formatted - as simple peak lists from Sparky, Cara, CCPN, NMRView, etc. for each 2D spectrum.
So this does seem to be a deficiency in the user function in the GUI (and in the prompt/script UI). Therefore I am considering creating a special GUI element for selecting a list of files. I think that this will be similar to the spectrum ID string GUI element for the spectrum.read_intensities user function. My ideas are: 1) The main GUI element for the wizard page would be in 3 parts. a) The first is the GUI text "The file name(s):", similar to now. b) Then there will be a user editable text field, just as now. c) Then the last would be a button which would look the same as the current file selection button, but instead it would open a special window the same way the spectrum ID GUI element button does. d) The preview button would be removed. 2) The multiple file selection window would be based on the sequence data window. This sequence window is visible when clicking on the spectrum ID GUI element button. So the file selection window would look like the sequence window, except for the following modifications: a) Two buttons would be added for each row. The first would be a file selection button which opens the file selection dialog. b) The second button would be the preview button. I think that such a design would be much easier for a user to handle than allowing multiple files to be selected in the current design by setting the file selection dialog style to include wx.FD_MULTIPLE. The wx.FD_MULTIPLE style allows the user to select many files, and the file dialog will the return a list of file names. This design will allow for both one spectra data file containing all peak intensities (the NMRPipe seriesTab files), as well as each data set being in its one peak list file. Cheers, Edward On 20 February 2014 11:02, Troels Emtekær Linnet <[email protected]> wrote: > Dear Edward. > > The trick is to define a id list and intensity list of equal length. > (Even though the intensity list will not be used.) > > This is a script I setup for doing: > https://gna.org/bugs/?21665 > > ---------- > ####### Get experiment settings from procpar > # Path to Varian procpar file > path_procpar_1 = os.path.join(os.getcwd(), "..", "..", > "%s_060518"%(setup_pipe_bundle), > "%s_060518_%s.fid"%(setup_pipe_bundle, current_setup),"procpar_ori") > file_procpar_1 = open(path_procpar_1, "r") > lines_procpar_1 = file_procpar_1.readlines() > > path_procpar_2 = os.path.join(os.getcwd(), "..", "..", > "%s_060521"%(setup_pipe_bundle), > "%s_060521_%s.fid"%(setup_pipe_bundle, current_setup),"procpar_ori") > file_procpar_2 = open(path_procpar_2, "r") > lines_procpar_2 = file_procpar_2.readlines() > > # Define regular search terms > search_ncyc = "^ncyc " > search_time_T2 = "^time_T2 " > search_sfrq = "^sfrq " > > for i in range(len(lines_procpar_1)): > line = lines_procpar_1[i] > > # Search ncycs_1 > if re.search(search_ncyc, line): > ncycs_1 = map(int, lines_procpar_1[i+1].split(" ")[1:-1]) > print("Number of is:", ncycs_1) > > # Search time_T2_1 > if re.search(search_time_T2, line): > time_T2_1 = float(lines_procpar_1[i+1].split(" ")[1]) > print("time_T2_1 is:", time_T2_1) > > # Search spectrometer frequency > if re.search(search_sfrq, line): > sfrq_1 = float(lines_procpar_1[i+1].split(" ")[1]) > print("Spectrometer frequency is:", sfrq_1) > > for i in range(len(lines_procpar_2)): > line = lines_procpar_2[i] > > # Search ncycs_2 > if re.search(search_ncyc, line): > ncycs_2 = map(int, lines_procpar_2[i+1].split(" ")[1:-1]) > print("Number of is:", ncycs_2) > > # Search time_T2_2 > if re.search(search_time_T2, line): > time_T2_2 = float(lines_procpar_2[i+1].split(" ")[1]) > print("time_T2_2 is:", time_T2_2) > > # Search spectrometer frequency > if re.search(search_sfrq, line): > sfrq_2 = float(lines_procpar_2[i+1].split(" ")[1]) > print("Spectrometer frequency is:", sfrq_2) > > # Find dublicates of ncyc_1 > dublicates_1 = map(lambda val: (val, [i for i in xrange(len(ncycs_1)) > if ncycs_1[i] == val]), ncycs_1) > dublicates_2 = map(lambda val: (val, [i for i in xrange(len(ncycs_2)) > if ncycs_2[i] == val]), ncycs_2) > > # Sort dublicates_1 into list > dublicates_list_1 = [] > for ncyc, list_index_occur in dublicates_1: > if len(list_index_occur) > 1: > dub = [] > for list_index in list_index_occur: > dub.append(list_index) > dublicates_list_1.append(dub) > # Remove dublicate entries > dublicates_list_1.sort() > dublicates_list_1 = list(dublicates_list_1 for dublicates_list_1, _ in > itertools.groupby(dublicates_list_1)) > > # Sort dublicates_2 into list > dublicates_list_2 = [] > for ncyc, list_index_occur in dublicates_2: > if len(list_index_occur) > 1: > dub = [] > for list_index in list_index_occur: > dub.append(list_index) > dublicates_list_2.append(dub) > # Remove dublicate entries > dublicates_list_2.sort() > dublicates_list_2 = list(dublicates_list_2 for dublicates_list_2, _ in > itertools.groupby(dublicates_list_2)) > > # Test if dublicates is present > if len(dublicates_list_1) > 0: > dublicates_present_1 = True > print("Index list of dublicates of ncyc:", dublicates_list_1, > "From: ", ncycs_1) > else: > dublicates_present_1 = False > > # Test if dublicates is present > if len(dublicates_list_2) > 0: > dublicates_present_2 = True > print("Index list of dublicates of ncyc:", dublicates_list_2, > "From: ", ncycs_2) > else: > dublicates_present_2 = False > > ############ Define function to setup experiment in relax > def setup_exp(id_list, ncycs, time_T2, sfrq, dublicates_present, > dublicates_list, id_name): > list_of_ids = [] > for i in range(len(ncycs)): > ncyc = ncycs[i] > vcpmg = ncyc/time_T2 > > # Test if spectrum is a reference > if float(vcpmg) == 0.0: > vcpmg = None > else: > vcpmg = round(float(vcpmg),3) > > # Set the current spectrum id > current_id = id_list[i] > list_of_ids.append(current_id) > > # Set the current experiment type. > relax_disp.exp_type(spectrum_id=current_id, exp_type='SQ CPMG') > > # Set the NMR field strength of the spectrum. > spectrometer.frequency(id=current_id, frq=sfrq, units='MHz') > > # Relaxation dispersion CPMG constant time delay T (in s). > relax_disp.relax_time(spectrum_id=current_id, time=time_T2) > > # Set the relaxation dispersion CPMG frequencies. > relax_disp.cpmg_frq(spectrum_id=current_id, cpmg_frq=vcpmg) > > # Set the peak intensity errors, as defined as the baseplane RMSD. > #spectrum.baseplane_rmsd(error=rmsd_err, spectrum_id=current_id) > > # Specify the duplicated spectra. > if dublicates_present: > for dub_i in dublicates_list: > dub_list = [] > for dub in dub_i: > dub_list.append("%s%s"%(id_name, dub)) > spectrum.replicated(spectrum_ids=dub_list) > spectrum.error_analysis(subset=list_of_ids) > > ####### > ####### Define compare to > compare_filename_1 = os.path.join(os.getcwd(), "..", "..", > "%s_060518"%(setup_pipe_bundle), > "%s_060518_%s.fid"%(setup_pipe_bundle, current_setup),'analysis_FT', > 'ser_files', COMPARE, '%s_files.txt'%(COMPARE) ) > compare_file_1 = open(compare_filename_1, 'r') > compare_filelines_1 = compare_file_1.readlines() > # Take the first line in list of files > compare_ni_file_1 = os.path.join(os.getcwd(), "..", "..", > "%s_060518"%(setup_pipe_bundle), > "%s_060518_%s.fid"%(setup_pipe_bundle, current_setup),'analysis_FT', > 'ser_files', COMPARE, compare_filelines_1[0].strip()) > compare_ni_1 = int(compare_filelines_1[0].split('_')[0]) > compare_ni_pipe_name_1 = "compare_%s_%s"%(compare_ni_1, COMPARE) > print("compare file: %s"%compare_ni_file_1) > print("compare ni: %i"%compare_ni_1) > > ####### Define compare to > compare_filename_2 = os.path.join(os.getcwd(), "..", "..", > "%s_060521"%(setup_pipe_bundle), > "%s_060521_%s.fid"%(setup_pipe_bundle, current_setup),'analysis_FT', > 'ser_files', COMPARE, '%s_files.txt'%(COMPARE) ) > compare_file_2 = open(compare_filename_2, 'r') > compare_filelines_2 = compare_file_2.readlines() > # Take the first line in list of files > compare_ni_file_2 = os.path.join(os.getcwd(), "..", "..", > "%s_060521"%(setup_pipe_bundle), > "%s_060521_%s.fid"%(setup_pipe_bundle, current_setup),'analysis_FT', > 'ser_files', COMPARE, compare_filelines_2[0].strip()) > compare_ni_2 = int(compare_filelines_2[0].split('_')[0]) > compare_ni_pipe_name_2 = "compare_%s_%s"%(compare_ni_2, COMPARE) > print("compare file: %s"%compare_ni_file_2) > print("compare ni: %i"%compare_ni_2) > > ##### Setup initial pipe data > # Create the setup data pipe. > setup_pipe_name = 'setup pipe' > pipe.create(pipe_name=setup_pipe_name, bundle=setup_pipe_bundle, > pipe_type='relax_disp') > > # Create the spins > spectrum.read_spins(file=compare_ni_file_1) > spectrum.read_spins(file=compare_ni_file_2) > > # Name the isotope for field strength scaling. > spin.isotope(isotope='15N') > > # Save the variables to cdp > cdp.dublicates_list_1 = dublicates_list_1 > cdp.dublicates_list_2 = dublicates_list_2 > cdp.dublicates_present_1 = dublicates_present_1 > cdp.dublicates_present_2 = dublicates_present_2 > > # Save the spin ids > spin_ids = [] > for spin_cur, mol_name, res_num, res_name, spin_id in > spin_loop(full_info=True, return_id=True, skip_desel=True): > spin_ids.append(spin_id) > cdp.spin_ids = spin_ids > > ####### Now doing - The 'R2eff' model - for initial compare to > # Copy the settings in the spin setup pipe to its own pipe. > compare_ni_pipe_name = compare_ni_pipe_name_1 > > pipe.copy(pipe_from=setup_pipe_name, pipe_to=compare_ni_pipe_name, > bundle_to=setup_pipe_bundle ) > pipe.switch(pipe_name=compare_ni_pipe_name) > > id_list_1 = [] > int_col_1 = [] > for i in range(len(ncycs_1)): > id_list_1.append("Z_A%s"%i) > int_col_1.append(i) > spectrum.read_intensities(file=compare_ni_file_1, > spectrum_id=id_list_1, int_method='height', int_col=int_col_1) > setup_exp(id_list_1, ncycs_1, time_T2_1, sfrq_1, dublicates_present_1, > dublicates_list_1, "Z_A") > > id_list_2 = [] > int_col_2 = [] > for i in range(len(ncycs_2)): > id_list_2.append("Z_B%s"%i) > int_col_2.append(i) > spectrum.read_intensities(file=compare_ni_file_2, > spectrum_id=id_list_2, int_method='height', int_col=int_col_2) > setup_exp(id_list_2, ncycs_2, time_T2_2, sfrq_2, dublicates_present_2, > dublicates_list_2, "Z_B") > > print("- The 'R2eff' model -") > compare_ni_pipe_name_r2eff = "%s_R2eff"%(compare_ni_pipe_name) > pipe.copy(pipe_from=compare_ni_pipe_name, > pipe_to=compare_ni_pipe_name_r2eff, bundle_to=setup_pipe_bundle) > pipe.switch(pipe_name=compare_ni_pipe_name_r2eff) > relax_disp.select_model(model='R2eff') > > calc(verbosity=1) > > 2014-02-20 10:09 GMT+01:00 Edward d'Auvergne <[email protected]>: >> Hi, >> >> Troels, this question is mainly for you as I know you have looked at >> this before. I was wondering if you were able to simultaneously load >> multiple peak lists via the spectrum.read_intensities user function? >> I am busy making a tutorial for the manual for how to perform a >> relaxation dispersion analysis using the GUI, using Flemming Hansen's >> data in relax. >> >> I noticed that the peak intensity wizard in the GUI is having >> problems, specifically that the file selection dialog for the >> spectrum.read_intensities user function will only allow single files >> to be selected, but that the spectrum ID argument allows for a list of >> spectrum IDs to be supplied. Have you encountered the same problem? >> If so, how did you solve it? >> >> Cheers, >> >> Edward >> >> _______________________________________________ >> relax (http://www.nmr-relax.com) >> >> This is the relax-devel mailing list >> [email protected] >> >> To unsubscribe from this list, get a password >> reminder, or change your subscription options, >> visit the list information page at >> https://mail.gna.org/listinfo/relax-devel _______________________________________________ relax (http://www.nmr-relax.com) This is the relax-devel mailing list [email protected] To unsubscribe from this list, get a password reminder, or change your subscription options, visit the list information page at https://mail.gna.org/listinfo/relax-devel

