MASHUOA / HiTMaP

An R package of High-resolution Informatics Toolbox for Maldi-imaging Proteomics
GNU General Public License v3.0
15 stars 12 forks source link

Error in "rowscale_int" function #12

Open sqian49 opened 3 months ago

sqian49 commented 3 months ago

Hi HiTMaP team,

Currently I have been running through your mouse brain example data. However, I encountered an error:

Codes I used:

fastafile <- 'uniprot_mouse_20210107.fasta'
datafile <- "Mouse_brain.imzML"

preprocess = list(force_preprocess=TRUE,
                  use_preprocessRDS=FALSE,
                  smoothSignal=list(method = "Disable"),
                  reduceBaseline=list(method = "locmin"),
                  peakPick=list(method= "mad"),
                  peakAlign=list(tolerance=5, units="ppm", level="local", method="Enable"))

imaging_identification(datafile=datafile,
                       Digestion_site="trypsin",
                       Fastadatabase="uniprot_mouse_20210107.fasta",
                       output_candidatelist=T,
                       preprocess=preprocess,
                       spectra_segments_per_file=9,
                       use_previous_candidates=F,
                       ppm=10,
                       FDR_cutoff = 0.05,
                       IMS_analysis=T,
                       mzrange = c(500,4000),
                       plot_cluster_image_grid=F)

Results:

16 Cores detected, 4 threads will be used for computing 1 files were selected and will be used for Searching uniprot_mouse_20210107.fasta was selected as database. Candidates will be generated through Proteomics mode Found enzyme: trypsin Found rule: "" Found customized rule: "" Testing fasta sequances for degestion site: (KR)|((?<=W)K(?=P))|((?<=M)R(?=P)) Generated 17080 Proteins in total. Computing exact masses... Generating peptide formula... Generating peptide formula with adducts: M+H Calculating peptide mz with adducts: M+H Candidate list has been exported. uniprot_mouse_20210107.fasta was selected as database Spectrum intensity threshold: 0.10% mz tolerance: 10 ppm Segmentation method: spatialKMeans Manual segmentation def file: None Bypass spectrum generation: FALSE Found rotation info Loading raw image data for statistical analysis: Mouse_brain.imzML parsing imzML file: ‘Z:\Data\peptide_HCCA\HiTMaP_analysis\Data_tar\MouseBrain_Trypsin_FT\Mouse_brain.imzML’ detected 'processed' imzML creating MSImagingExperiment applying profile m/z-values to all spectra using mass.range 500 to 4000 using resolution 5 ppm binning intensity from mz 500 to 3999.9938 with relative resolution 5e-06 returning MSImagingExperiment done. Preparing image data for statistical analysis: Mouse_brain.imzML queued: baseline reduction queued: baseline reduction, height peak picking processing: baseline reduction, height peak picking |==============================================================================================================================================================| 100%

output spectra: intensity Using image data: Mouse_brain.imzML parsing imzML file: ‘Z:\Data\peptide_HCCA\HiTMaP_analysis\Data_tar\MouseBrain_Trypsin_FT\Mouse_brain.imzML’ detected 'processed' imzML creating MSImagingExperiment applying profile m/z-values to all spectra using mass.range 500 to 4000 using resolution 5 ppm binning intensity from mz 500 to 3999.9938 with relative resolution 5e-06 returning MSImagingExperiment done. Segmentation in progress... Performing forced peak alignment before segmentation... preprocess$peakAlign$tolerance set as 5 detected ~0 peaks per spectrum binning peaks to create shared reference |==============================================================================================================================================================| 100%

aligned to 8 reference peaks with relative tolerance 5e-06 (5 ppm) centering data matrix |==============================================================================================================================================================| 100%

Error in rowscale_int(x, center = center, scale = scale, group = group, : length of 'center' must be equal to nrow of x In addition: Warning message: In .local(object, ...) : '.local' is deprecated. Use 'subsetFeatures' instead. See help("Deprecated")

traceback()

16: stop("length of 'center' must be equal to nrow of x") 15: rowscale_int(x, center = center, scale = scale, group = group, ..., BPPARAM = BPPARAM) 14: .local(x, center, scale, ...) 13: rowscale(x, center = center, scale = scale., verbose = verbose, nchunks = nchunks, BPPARAM = BPPARAM) 12: rowscale(x, center = center, scale = scale., verbose = verbose, nchunks = nchunks, BPPARAM = BPPARAM) 11: prcomp_lanczos(x, k = max(ncomp), center = center, scale. = scale, nchunks = nchunks, verbose = verbose, BPPARAM = BPPARAM, ...) 10: .local(x, ...) 9: PCA(spectra(x), ncomp = ncomp, transpose = TRUE, center = center, scale = scale, ...) 8: PCA(spectra(x), ncomp = ncomp, transpose = TRUE, center = center, scale = scale, ...) 7: .local(x, ...) 6: Cardinal::PCA(imdata, ncomp = 12) 5: Cardinal::PCA(imdata, ncomp = 12) 4: PCA_ncomp_selection(imdata_stats, variance_coverage = Segmentation_variance_coverage, outputdir = paste0(getwd(), "/")) 3: Preprocessing_segmentation(datafile = datafile[z], workdir = workdir[z], segmentation_num = segmentation_num, ppm = ppm, import_ppm = import_ppm, Bypass_Segmentation = Bypass_Segmentation, mzrange = mzrange, Segmentation = Segmentation, Segmentation_def = Segmentation_def, Segmentation_ncomp = Segmentation_ncomp, Segmentation_variance_coverage = Segmentation_variance_coverage, Smooth_range = Smooth_range, colorstyle = colorstyle, Virtual_segmentation_rankfile = Virtual_segmentation_rankfile, rotate = rotate, BPPARAM = BPPARAM, preprocess = preprocess) 2: IMS_data_process(datafile = datafile, workdir = workdir, Peptide_Summary_searchlist = Peptide_Summary_searchlist, segmentation_num = spectra_segments_per_file, threshold = threshold, rotate = Rotate_IMG, ppm = ppm, mzrange = mzrange, Segmentation = Segmentation, Segmentation_ncomp = Segmentation_ncomp, PMFsearch = PMFsearch, Virtual_segmentation_rankfile = Virtual_segmentation_rankfile, BPPARAM = BPPARAM, Bypass_generate_spectrum = Bypass_generate_spectrum, score_method = score_method, Decoy_mode = Decoy_mode, Decoy_search = Decoy_search, adjust_score = adjust_score, peptide_ID_filter = peptide_ID_filter, Protein_desc_of_interest = Protein_desc_of_interest, plot_matching_score_t = plot_matching_score, FDR_cutoff = FDR_cutoff, Segmentation_def = Segmentation_def, Segmentation_variance_coverage = Segmentation_variance_coverage, preprocess = preprocess) 1: imaging_identification(datafile = datafile, Digestion_site = "trypsin", Fastadatabase = "uniprot_mouse_20210107.fasta", output_candidatelist = T, preprocess = preprocess, spectra_segments_per_file = 9, use_previous_candidates = F, ppm = 10, FDR_cutoff = 0.05, IMS_analysis = T, mzrange = c(500, 4000), plot_cluster_image_grid = F)

Could you please provide some clues about how to solve it? Thanks.

Best, Shuo

MASHUOA commented 1 week ago

Hi, Shuo, The code is updated now. Please reinstall the package (tested in R 4.4.2). You can use the code in mouse-brain data example code to analyze the data. Hope that helps! Best George