Mercurial > repos > galaxyp > maldi_quant_preprocessing
comparison maldi_quant_preprocessing.xml @ 4:82b1de5c142b draft default tip
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/MALDIquant commit f1e1cd260ef2884d0ba12e2b614df3c72d0934dc
| author | galaxyp |
|---|---|
| date | Sat, 04 Mar 2023 19:13:31 +0000 |
| parents | aa81463e21ea |
| children |
comparison
equal
deleted
inserted
replaced
| 3:aa81463e21ea | 4:82b1de5c142b |
|---|---|
| 1 <tool id="maldi_quant_preprocessing" name="MALDIquant preprocessing" version="@VERSION@.3"> | 1 <tool id="maldi_quant_preprocessing" name="MALDIquant preprocessing" version="@VERSION@.0"> |
| 2 <description> | 2 <description> |
| 3 Preprocessing of mass-spectrometry imaging data | 3 Preprocessing of mass-spectrometry imaging data |
| 4 </description> | 4 </description> |
| 5 <macros> | 5 <macros> |
| 6 <import>maldi_macros.xml</import> | 6 <import>maldi_macros.xml</import> |
| 17 cp '${infile.extra_files_path}/img' infile.img && | 17 cp '${infile.extra_files_path}/img' infile.img && |
| 18 cp '${infile.extra_files_path}/t2m' infile.t2m && | 18 cp '${infile.extra_files_path}/t2m' infile.t2m && |
| 19 du infile.hdr && | 19 du infile.hdr && |
| 20 du infile.img && | 20 du infile.img && |
| 21 du -s -B1 infile.hdr && | 21 du -s -B1 infile.hdr && |
| 22 #else | |
| 23 ln -s $infile infile.RData && | |
| 24 #end if | 22 #end if |
| 25 Rscript "${maldi_quant_preprocessing}" && | 23 Rscript "${maldi_quant_preprocessing}" && |
| 26 | 24 |
| 27 mkdir $outfile_imzml.files_path && | 25 mkdir $outfile_imzml.files_path && |
| 28 mv ./out.imzMl "${os.path.join($outfile_imzml.files_path, 'imzml')}" | true && | 26 mv ./out.imzMl "${os.path.join($outfile_imzml.files_path, 'imzml')}" | true && |
| 57 coordinates_info = cbind(coordinates(maldi_data)[,1:2], c(1:length(maldi_data))) | 55 coordinates_info = cbind(coordinates(maldi_data)[,1:2], c(1:length(maldi_data))) |
| 58 #elif $infile.ext == 'analyze75' | 56 #elif $infile.ext == 'analyze75' |
| 59 ## Import analyze7.5 file | 57 ## Import analyze7.5 file |
| 60 maldi_data = importAnalyze( 'infile.hdr' ) | 58 maldi_data = importAnalyze( 'infile.hdr' ) |
| 61 coordinates_info = cbind(coordinates(maldi_data)[,1:2], c(1:length(maldi_data))) | 59 coordinates_info = cbind(coordinates(maldi_data)[,1:2], c(1:length(maldi_data))) |
| 62 #else | |
| 63 loadRData <- function(fileName){ | |
| 64 ##loads an RData file, and returns it | |
| 65 load(fileName) | |
| 66 get(ls()[ls() != "fileName"]) | |
| 67 } | |
| 68 msidata = loadRData('infile.RData') | |
| 69 ## save coordinates | |
| 70 cardinal_coordinates = as.matrix(Cardinal::coord(msidata)[,1:2]) | |
| 71 ## save mz values | |
| 72 cardinal_mzs = Cardinal::mz(msidata) | |
| 73 ## create MALDIquant MassSpectrum object, order of pixels in iData is same as in coord(msidata): | |
| 74 maldi_data = list() | |
| 75 for(number_spectra in 1:ncol(msidata)){ | |
| 76 maldi_data[[number_spectra]] = MALDIquant::createMassSpectrum(mass = cardinal_mzs, intensity = iData(msidata)[,number_spectra]) | |
| 77 } | |
| 78 #end if | 60 #end if |
| 79 | 61 |
| 80 #end if | 62 #end if |
| 81 | 63 |
| 82 ## Quality control plots during preprocessing | 64 ## Quality control plots during preprocessing |
| 342 ## only if there are empty spectra to remove | 324 ## only if there are empty spectra to remove |
| 343 | 325 |
| 344 if (length(findEmptyMassObjects(maldi_data))>0) | 326 if (length(findEmptyMassObjects(maldi_data))>0) |
| 345 | 327 |
| 346 { | 328 { |
| 347 #if $infile.ext == 'rdata' | |
| 348 cardinal_coordinates = cardinal_coordinates[-findEmptyMassObjects(maldi_data),,drop=FALSE] ## remove coordinates of empty spectra for Cardinal RData input | |
| 349 #end if | |
| 350 | |
| 351 maldi_data = removeEmptyMassObjects(maldi_data) | 329 maldi_data = removeEmptyMassObjects(maldi_data) |
| 352 } | 330 } |
| 353 #end if | 331 #end if |
| 354 | 332 |
| 355 ## QC plot | 333 ## QC plot |
| 384 | 362 |
| 385 dev.off() | 363 dev.off() |
| 386 | 364 |
| 387 ## export imzML file | 365 ## export imzML file |
| 388 if (length(maldi_data)>0){ | 366 if (length(maldi_data)>0){ |
| 389 #if $infile.ext == 'rdata' | |
| 390 MALDIquantForeign::exportImzMl(maldi_data, file="out.imzMl", processed=$export_processed, coordinates=cardinal_coordinates) | |
| 391 #else | |
| 392 MALDIquantForeign::exportImzMl(maldi_data, file="out.imzMl", processed=$export_processed) | 367 MALDIquantForeign::exportImzMl(maldi_data, file="out.imzMl", processed=$export_processed) |
| 393 #end if | |
| 394 | 368 |
| 395 }else{"All spectra are empty, outputfiles will be empty,too."} | 369 }else{"All spectra are empty, outputfiles will be empty,too."} |
| 396 | 370 |
| 397 ]]> | 371 ]]> |
| 398 </configfile> | 372 </configfile> |
| 399 </configfiles> | 373 </configfiles> |
| 400 <inputs> | 374 <inputs> |
| 401 <param name="infile" type="data" format="imzml,rdata,analyze75" label="MSI data" help="Input file as imzML (composite upload), or Cardinal MSImageSet saved as RData (regular upload). The file must be in profile mode, not centroided."/> | 375 <param name="infile" type="data" format="imzml,analyze75" label="MSI data" help="Input file as imzML (composite upload). The file must be in profile mode, not centroided."/> |
| 402 <conditional name="restriction_conditional"> | 376 <conditional name="restriction_conditional"> |
| 403 <param name="restriction" type="select" label="Use only spectra of interest" help="This option only works for imzML files"> | 377 <param name="restriction" type="select" label="Use only spectra of interest" help="This option only works for imzML files"> |
| 404 <option value="no_restriction" selected="True">No, calculate on entire file</option> | 378 <option value="no_restriction" selected="True">No, calculate on entire file</option> |
| 405 <option value="restrict">Yes, restrict to spectra of interest</option> | 379 <option value="restrict">Yes, restrict to spectra of interest</option> |
| 406 </param> | 380 </param> |
| 527 </param> | 501 </param> |
| 528 | 502 |
| 529 <param name="snr" type="integer" value="2" label="Signal-to-noise-ratio"/> | 503 <param name="snr" type="integer" value="2" label="Signal-to-noise-ratio"/> |
| 530 <param name="allow_nomatch" type="boolean" label="Allow no matches" help="Don't throw an error when less than 2 reference m/z were found in a spectrum" truevalue="TRUE" falsevalue="FALSE"/> | 504 <param name="allow_nomatch" type="boolean" label="Allow no matches" help="Don't throw an error when less than 2 reference m/z were found in a spectrum" truevalue="TRUE" falsevalue="FALSE"/> |
| 531 <param name="empty_nomatch" type="boolean" label="Empty no matches" help="If TRUE the intensity values of MassSpectrum or MassPeaks objects with missing (NA) warping functions are set to zero" truevalue="TRUE" falsevalue="FALSE"/> | 505 <param name="empty_nomatch" type="boolean" label="Empty no matches" help="If TRUE the intensity values of MassSpectrum or MassPeaks objects with missing (NA) warping functions are set to zero" truevalue="TRUE" falsevalue="FALSE"/> |
| 532 <param name="remove_empty" type="boolean" label="Remove empty spectra" truevalue="TRUE" falsevalue="FALSE" help="For Cardinal RData files this step can only be performed if pixel annotations were provided"/> | 506 <param name="remove_empty" type="boolean" label="Remove empty spectra" truevalue="TRUE" falsevalue="FALSE"/> |
| 533 | 507 |
| 534 <conditional name="reference_for_alignment"> | 508 <conditional name="reference_for_alignment"> |
| 535 <param name="align_ref" type="select" label="Reference" help="If given, samples will be aligned to reference, use internal calibrants to perform m/z calibration"> | 509 <param name="align_ref" type="select" label="Reference" help="If given, samples will be aligned to reference, use internal calibrants to perform m/z calibration"> |
| 536 <option value="no_reference" selected="True">no reference</option> | 510 <option value="no_reference" selected="True">no reference</option> |
| 537 <option value="yes_reference">reference from tabular file</option> | 511 <option value="yes_reference">reference from tabular file</option> |
| 577 <param name="smooth_method" value="SavitzkyGolay"/> | 551 <param name="smooth_method" value="SavitzkyGolay"/> |
| 578 <param name="method" value="Basline"/> | 552 <param name="method" value="Basline"/> |
| 579 <param name="baseline_method" value ="TopHat"/> | 553 <param name="baseline_method" value ="TopHat"/> |
| 580 </conditional> | 554 </conditional> |
| 581 <output name="outfile_imzml" ftype="imzml" file="preprocessing1.imzml.txt" lines_diff="4"> | 555 <output name="outfile_imzml" ftype="imzml" file="preprocessing1.imzml.txt" lines_diff="4"> |
| 582 <extra_files type="file" file="outfile1.imzml" name="imzml" lines_diff="6"/> | 556 <extra_files type="file" file="outfile1.imzml" name="imzml" lines_diff="8"/> |
| 583 <extra_files type="file" file="outfile1.ibd" name="ibd" compare="sim_size"/> | 557 <extra_files type="file" file="outfile1.ibd" name="ibd" compare="sim_size"/> |
| 584 </output> | 558 </output> |
| 585 <output name="plots" file="Preprocessing1_QC.pdf" compare="sim_size"/> | 559 <output name="plots" file="Preprocessing1_QC.pdf" compare="sim_size"/> |
| 586 </test> | |
| 587 <test> | |
| 588 <param name="infile" value="msidata_1.RData" ftype="rdata"/> | |
| 589 <conditional name="methods_conditional"> | |
| 590 <param name="method" value="Align"/> | |
| 591 <param name="warping_method" value="lowess"/> | |
| 592 <param name="halfWindowSize" value="5"/> | |
| 593 <param name="tolerance" value="0.001"/> | |
| 594 <param name="allow_nomatch" value="TRUE"/> | |
| 595 <param name="remove_empty" value="TRUE"/> | |
| 596 <param name="empty_nomatch" value="TRUE"/> | |
| 597 <conditional name="reference_for_alignment"> | |
| 598 <param name="align_ref" value="yes_reference"/> | |
| 599 <param name="reference_file" value="inputpeptides.tabular" ftype="tabular"/> | |
| 600 </conditional> | |
| 601 </conditional> | |
| 602 <output name="outfile_imzml" ftype="imzml" file="preprocessing2.imzml.txt" lines_diff="4"> | |
| 603 <extra_files type="file" file="outfile2.imzml" name="imzml" lines_diff="6"/> | |
| 604 <extra_files type="file" file="outfile2.ibd" name="ibd" compare="sim_size"/> | |
| 605 </output> | |
| 606 <output name="plots" file="Preprocessing2_QC.pdf" compare="sim_size"/> | |
| 607 </test> | 560 </test> |
| 608 <test> | 561 <test> |
| 609 <param name="infile" value="" ftype="imzml"> | 562 <param name="infile" value="" ftype="imzml"> |
| 610 <composite_data value="Example_Continuous.imzML"/> | 563 <composite_data value="Example_Continuous.imzML"/> |
| 611 <composite_data value="Example_Continuous.ibd"/> | 564 <composite_data value="Example_Continuous.ibd"/> |
| 613 <conditional name="methods_conditional"> | 566 <conditional name="methods_conditional"> |
| 614 <param name="method" value="Calibrate"/> | 567 <param name="method" value="Calibrate"/> |
| 615 <param name="calibrate_method" value="median"/> | 568 <param name="calibrate_method" value="median"/> |
| 616 </conditional> | 569 </conditional> |
| 617 <output name="outfile_imzml" ftype="imzml" file="preprocessing3.imzml.txt" lines_diff="4"> | 570 <output name="outfile_imzml" ftype="imzml" file="preprocessing3.imzml.txt" lines_diff="4"> |
| 618 <extra_files type="file" file="outfile3.imzml" name="imzml" lines_diff="6"/> | 571 <extra_files type="file" file="outfile3.imzml" name="imzml" lines_diff="8"/> |
| 619 <extra_files type="file" file="outfile3.ibd" name="ibd" compare="sim_size"/> | 572 <extra_files type="file" file="outfile3.ibd" name="ibd" compare="sim_size"/> |
| 620 </output> | 573 </output> |
| 621 <output name="plots" file="Preprocessing3_QC.pdf" compare="sim_size"/> | 574 <output name="plots" file="Preprocessing3_QC.pdf" compare="sim_size"/> |
| 622 </test> | 575 </test> |
| 623 </tests> | 576 </tests> |
| 629 | 582 |
| 630 **Input data** | 583 **Input data** |
| 631 | 584 |
| 632 - MSI data: 2 types of input data can be used: | 585 - MSI data: 2 types of input data can be used: |
| 633 | 586 |
| 634 - imzml file (upload imzml and ibd file via the "composite" function) `Introduction to the imzml format <https://ms-imaging.org/wp/imzml/>`_ | 587 - imzml file (upload imzml and ibd file via the "composite" function) `Introduction to the imzml format <https://ms-imaging.org/imzml/>`_ |
| 635 - Cardinal "MSImageSet" data saved as .RData | |
| 636 | 588 |
| 637 - Optional: Tabular file with pixel coordinates to restrict reading of imzML files to coordinates of interest. Tabular files with any header name or no header at all are supported. | 589 - Optional: Tabular file with pixel coordinates to restrict reading of imzML files to coordinates of interest. Tabular files with any header name or no header at all are supported. |
| 638 | 590 |
| 639 :: | 591 :: |
| 640 | 592 |
