Pre-processing of mass spectrometry-based metabolomics data with quantification and identification based on MS1 and MS2 data.

public public 1yr ago Version: 1.0.1 0 bookmarks

Pre-processing of mass spectrometry-based metabolomics data with quantification and identification based on MS1 and MS2 data .

Introduction

nf-core/metaboigniter is bioinformatics pipeline for pre-processing of mass spectrometry-based metabolomics data.

The workflow performs MS1 based quantification and MS2 based identification using combination of different modules. The following steps can be performed using the workflow:

nf-core/metaboigniter-workflow

  • Centroiding (optional): Also referred to as peak pickering is a step that reduce the distribution of ions derived from a single mass to the peak of the distribution.

  • parameter tuning using IPO: MS1 quantification and library characterization parameters can be tuned using IPO

  • mass trace detection: The ions derived from the same analytes are clustered together forming a mass trace. These are the entities that will be used for quantification.

  • mass trace matching and retention time (RT) correction: The mass traces across different samples will be match against each other and RT shift between the samples will be adjusted.

  • filtering (optional): The mass traces will be filtered out based on the QC samples.

  • Annotation: The isotopes and adducts will be annotated in this step.

  • MS2 (identification): At the moment we support two types of identification: in-silico and identificaiton based on internal library. This will be expanded in the corresponding section. At the moment we do not support MS1-based identification.

The pipeline is built using Nextflow , a workflow tool to run tasks across multiple compute infrastructures in a very portable manner. It comes with docker containers making installation trivial and results highly reproducible.

Quick Start

  1. Install nextflow ( >=20.04.0 )

  2. Install any of Docker , Singularity , Podman , Shifter or Charliecloud for full pipeline reproducibility (please only use Conda as a last resort; see docs )

  3. Download the pipeline and test it on a minimal dataset with a single command

    nextflow run nf-core/metaboigniter -profile test,<docker/singularity/podman/shifter/charliecloud/conda/institute>
    

    Please check nf-core/configs to see if a custom config file to run nf-core pipelines already exists for your Institute. If so, you can simply use -profile <institute> in your command. This will enable either docker or singularity and set the appropriate execution settings for your local compute environment.

  4. Start running your own analysis!

    We highly recommend that you follow our usage documentation . Since the number of parameters is large, it's going to be a fairly complex bash command to run the workflow. Nevertheless, the parameters can always be passed to the workflow as argument using two dashes "--".

    See usage docs for all of the available options when running the pipeline.

Documentation

The nf-core/metaboigniter pipeline comes with documentation about the pipeline: usage and output .

Credits

nf-core/metaboigniter was originally written by Payam Emami.

Contributions and Support

If you would like to contribute to this pipeline, please see the contributing guidelines .

For further information or help, don't hesitate to get in touch on Slack (you can join with this invite ).

Citation

If you use nf-core/metaboigniter for your analysis, please cite it using the following doi: 10.5281/zenodo.4743790

You can cite the nf-core publication as follows:

The nf-core framework for community-curated bioinformatics pipelines.

Philip Ewels, Alexander Peltzer, Sven Fillinger, Harshil Patel, Johannes Alneberg, Andreas Wilm, Maxime Ulysse Garcia, Paolo Di Tommaso & Sven Nahnsen.

Nat Biotechnol. 2020 Feb 13. doi: 10.1038/s41587-020-0439-x .

In addition, references of tools and data used in this pipeline are as follows:

  1. Kuhl C, Tautenhahn R, Boettcher C, Larson TR and Neumann S: CAMERA: an integrated strategy for compound spectra extraction and annotation of liquid chromatography/mass spectrometry data sets. Anal Chem 84:283-289.

  2. Benton HP, Wong DM, Trauger SA, Siuzdak G: XCMS2: Processing Tandem Mass Spectrometry Data for Metabolite Identification and Structural Characterization. Anal Chem 80(16):6382-6389. doi:10.1021/ac800795f.

  3. Sturm M, Bertsch A, Gröpl C, Hildebrandt A, Hussong R, Lange E, Pfeifer N, Schulz-Trieglaff O, Zerck A, Reinert K, Kohlbacher O. OpenMS – an Open-Source Software Framework for Mass Spectrometry. BMC Bioinformatics. 2008;9:163. doi:10.1186/1471-2105-9-163.

  4. Libiseller G, Dvorzak M, Kleb U, Gander E, Eisenberg T, Madeo F, Neumann S, Trausinger G, Sinner F, Pieber T, Magnes C ((2015)). “IPO: a tool for automated optimization of XCMS parameters.” BMC Bioinformatics, 16, 118.

  5. Kai Dührkop, Huibin Shen, Marvin Meusel, Juho Rousu, and Sebastian Böcker. Searching molecular structure databases with tandem mass spectra using CSI:FingerID. Proc Natl Acad Sci U S A, 112(41):12580-12585, 2015. (cite this when using CSI:FingerID)

  6. Ruttkies C., Schymanski E.L. et al, MetFrag relaunched: incorporating strategies beyond in silico fragmentation. Journal of Cheminformatics, 2016, 8:3.

  7. Allen F, Greiner R, and Wishart D. Computational prediction of electron ionization mass spectra to assist in GC-MS compound identification. Submitted, 2016.

  8. Kerstin Scheubert, Franziska Hufsky, Daniel Petras, Mingxun Wang, Louis-Felix Nothias, Kai Dührkop, Nuno Bandeira, Pieter C Dorrestein, Sebastian Böcker. Significance estimation enabling large scale untargeted metabolomics annotations. Nature Communications, 2017. 8(1494)

Third party software copyright

nf-core/metaboigniter contains several scripts for performing various pre-processing steps.

The following software have not been written by us:

  • MetFrag (GNU LGPL v2.1 or later). Files included:

    • bin/metfrag

    • bin/metfrag.jar

  • jni-inchi (GNU LGPL v3). Files include:

    • bin/jni-inchi-0.8.jar

The rest of the scripts has been originally written by Payam Emami as part of PhenoMeNal (Phenome and Metabolome aNalysis) consortium .

Code Snippets

423
424
425
426
427
428
429
430
431
432
433
434
435
"""

echo $workflow.manifest.version > v_pipeline.txt
echo $workflow.nextflow.version > v_nextflow.txt
Rscript -e "cat(as.character(packageVersion('CAMERA')),'\\n')" &> v_camera.txt
Rscript -e "cat(as.character(packageVersion('xcms')),'\\n')" &> v_xcms.txt
Rscript -e "cat(as.character(packageVersion('MSnbase')),'\\n')" &> v_msnbase.txt
Rscript -e "cat(as.character(packageVersion('IPO')),'\\n')" &> v_ipo.txt
OpenMSInfo |  grep -oP -m 1 '([0-9][.][0-9][.][0-9])' &> v_openms.txt
sh /usr/bin/CSI/bin/sirius.sh --loglevel=OFF --version 2>1 | grep -oP -m 1 '([0-9][.][0-9][.][0-9])' &> v_sirius.txt

scrape_software_versions.py &> software_versions_mqc.yaml
"""
NextFlow From line 423 of 1.0.1/main.nf
463
464
465
"""
PeakPickerHiRes -in $mzMLFile -out $mzMLFile -ini $setting_file
"""
NextFlow From line 463 of 1.0.1/main.nf
492
493
494
"""
FeatureFinderMetabo -in $mzMLFile -out ${mzMLFile.baseName}.featureXML -ini $setting_file
"""
NextFlow From line 492 of 1.0.1/main.nf
516
517
518
519
520
521
522
523
524
525
526
527
"""
featurexmlToCamera.r \\
    input=$mzMLFile \\
    realFileName=$mzMLFile \\
    mzMLfiles=\$PWD/$mzMLFile2 \\
    polarity=positive \\
    output=${mzMLFile.baseName}.rdata \\
    phenoFile=$phenotype_file  \\
    phenoDataColumn=$params.phenodatacolumn_quant_pos \\
    sampleClass=$params.sampleclass_quant_pos_xcms \\
    changeNameTO=${mzMLFile.baseName}.mzML
"""
NextFlow From line 516 of 1.0.1/main.nf
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
"""
touch quant_params_pos.json
touch rt_params_pos.json

ipo.r \\
    input=$inputs_aggregated \\
    quantOnly=$ipo_pos_globalAvoidRT \\
    allSamples=$params.ipo_allSamples_pos \\
    columnToSelect=$params.ipo_columnToSelect_pos  \\
    valueToSelect=$params.ipo_valueToSelect_pos \\
    phenoFile=$phenotype_file  \\
    methodXset=$params.ipo_methodXset_pos \\
    methodRT=$params.ipo_methodRT_pos \\
    noise_l=$params.ipo_noise_l_pos  \\
    noise_h=$params.ipo_noise_h_pos \\
    prefilter_l_l=$params.ipo_prefilter_l_l_pos \\
    prefilter_l_h=$params.ipo_prefilter_l_h_pos  \\
    prefilter_h_l=$params.ipo_prefilter_h_l_pos \\
    prefilter_h_h=$params.ipo_prefilter_h_h_pos  \\
    snthresh_l=$params.ipo_snthresh_l_pos \\
    snthresh_h=$params.ipo_snthresh_h_pos \\
    mzCenterFun=$params.ipo_mzCenterFun_pos  \\
    integrate=$params.ipo_integrate_pos \\
    fitgauss=$params.ipo_fitgauss_pos \\
    ipo_min_peakwidth_l=$params.ipo_min_peakwidth_l_pos  \\
    ipo_min_peakwidth_h=$params.ipo_min_peakwidth_h_pos \\
    ipo_max_peakwidth_l=$params.ipo_max_peakwidth_l_pos \\
    ipo_max_peakwidth_h=$params.ipo_max_peakwidth_h_pos \\
    ipo_ppm_l=$params.ipo_ppm_l_pos  \\
    ipo_ppm_h=$params.ipo_ppm_h_pos \\
    ipo_mzdiff_l=$params.ipo_mzdiff_l_pos \\
    ipo_mzdiff_h=$params.ipo_mzdiff_h_pos \\
    ipo_charge_camera=$params.ipo_charge_camera_pos \\
    ipo_max_ppm_camera=$params.ipo_max_ppm_camera_pos  \\
    response_l=$params.ipo_response_l_pos \\
    response_h=$params.ipo_response_h_pos \\
    distFunc=$params.ipo_distFunc_pos \\
    factorDiag_l=$params.ipo_factorDiag_l_pos \\
    factorDiag_h=$params.ipo_factorDiag_h_pos \\
    factorGap_l=$params.ipo_factorGap_l_pos  \\
    factorGap_h=$params.ipo_factorGap_h_pos \\
    localAlignment=$params.ipo_localAlignment_pos \\
    ipo_gapInit_l=$params.ipo_gapInit_l_pos \\
    ipo_gapInit_h=$params.ipo_gapInit_h_pos \\
    ipo_gapExtend_l=$params.ipo_gapExtend_l_pos  \\
    ipo_gapExtend_h=$params.ipo_gapExtend_h_pos \\
    ipo_profStep_l=$params.ipo_profStep_l_pos \\
    ipo_profStep_h=$params.ipo_profStep_h_pos \\
    bw_l=$params.ipo_bw_l_pos \\
    bw_h=$params.ipo_bw_h_pos \\
    minfrac_l=$params.ipo_minfrac_l_pos  \\
    minfrac_h=$params.ipo_minfrac_h_pos \\
    mzwid_l=$params.ipo_mzwid_l_pos \\
    mzwid_h=$params.ipo_mzwid_h_pos \\
    minsamp_l=$params.ipo_minsamp_l_pos  \\
    minsamp_h=$params.ipo_minsamp_h_pos \\
    max_l=$params.ipo_max_l_pos \\
    max_h=$params.ipo_max_h_pos \\
    ncores=$params.ipo_ncores_pos \\
    outputxset=quant_params_pos.json \\
    outputrt=rt_params_pos.json
"""
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
"""
findPeaks.r \\
    input=\$PWD/$mzMLFile \\
    output=\$PWD/${mzMLFile.baseName}.rdata \\
    ppm=$params.masstrace_ppm_pos_xcms \\
    peakwidthLow=$params.peakwidthlow_quant_pos_xcms  \\
    peakwidthHigh=$params.peakwidthhigh_quant_pos_xcms \\
    noise=$params.noise_quant_pos_xcms \\
    polarity=positive \\
    realFileName=$mzMLFile \\
    phenoFile=$phenotype_file  \\
    phenoDataColumn=$params.phenodatacolumn_quant_pos \\
    sampleClass=$params.sampleclass_quant_pos_xcms \\
    mzdiff=$params.mzdiff_quant_pos_xcms \\
    snthresh=$params.snthresh_quant_pos_xcms  \\
    prefilter_l=$params.prefilter_quant_pos_xcms \\
    prefilter_h=$params.value_of_prefilter_quant_pos_xcms \\
    mzCenterFun=$params.mzCenterFun_quant_pos_xcms \\
    integrate=$params.integrate_quant_pos_xcms  \\
    fitgauss=$params.fitgauss_quant_pos_xcms \\
    methodXset=$params.ipo_methodXset_pos \\
    methodRT=$params.ipo_methodRT_pos \\
    noise_l=$params.ipo_noise_l_pos  \\
    noise_h=$params.ipo_noise_h_pos \\
    prefilter_l_l=$params.ipo_prefilter_l_l_pos \\
    prefilter_l_h=$params.ipo_prefilter_l_h_pos  \\
    prefilter_h_l=$params.ipo_prefilter_h_l_pos \\
    prefilter_h_h=$params.ipo_prefilter_h_h_pos \\
    snthresh_l=$params.ipo_snthresh_l_pos \\
    snthresh_h=$params.ipo_snthresh_h_pos  \\
    mzCenterFun=$params.ipo_mzCenterFun_pos \\
    integrate=$params.ipo_integrate_pos \\
    fitgauss=$params.ipo_fitgauss_pos \\
    ipo_min_peakwidth_l=$params.ipo_min_peakwidth_l_pos  \\
    ipo_min_peakwidth_h=$params.ipo_min_peakwidth_h_pos \\
    ipo_max_peakwidth_l=$params.ipo_max_peakwidth_l_pos \\
    ipo_max_peakwidth_h=$params.ipo_max_peakwidth_h_pos \\
    ipo_ppm_l=$params.ipo_ppm_l_pos  \\
    ipo_ppm_h=$params.ipo_ppm_h_pos \\
    ipo_mzdiff_l=$params.ipo_mzdiff_l_pos \\
    ipo_mzdiff_h=$params.ipo_mzdiff_h_pos \\
    ipo_charge_camera=$params.ipo_charge_camera_pos \\
    ipo_max_ppm_camera=$params.ipo_max_ppm_camera_pos  \\
    ipo_inv=$ipo_pos_localQ \\
    $filter_argument
"""
NextFlow From line 639 of 1.0.1/main.nf
710
711
712
"""
FeatureFinderMetabo -in $mzMLFile -out ${mzMLFile.baseName}.featureXML -ini $setting_file
"""
NextFlow From line 710 of 1.0.1/main.nf
733
734
735
736
737
738
739
740
741
742
743
744
"""
featurexmlToCamera.r \\
    input=$mzMLFile \\
    realFileName=$mzMLFile \\
    mzMLfiles=\$PWD/$mzMLFile2 \\
    polarity=positive \\
    output=${mzMLFile.baseName}.rdata \\
    phenoFile=$phenotype_file \\
    phenoDataColumn=$params.phenodatacolumn_quant_pos  \\
    sampleClass=$params.sampleclass_quant_pos_xcms \\
    changeNameTO=${mzMLFile.baseName}.mzML
"""
NextFlow From line 733 of 1.0.1/main.nf
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
"""
touch quant_params_pos.json
touch rt_params_pos.json

ipo.r \\
    input=$inputs_aggregated \\
    quantOnly=$ipo_pos_globalAvoidRT \\
    allSamples=$params.ipo_allSamples_pos \\
    columnToSelect=$params.ipo_columnToSelect_pos  \\
    valueToSelect=$params.ipo_valueToSelect_pos \\
    phenoFile=$phenotype_file  \\
    methodXset=$params.ipo_methodXset_pos \\
    methodRT=$params.ipo_methodRT_pos \\
    noise_l=$params.ipo_noise_l_pos  \\
    noise_h=$params.ipo_noise_h_pos \\
    prefilter_l_l=$params.ipo_prefilter_l_l_pos \\
    prefilter_l_h=$params.ipo_prefilter_l_h_pos  \\
    prefilter_h_l=$params.ipo_prefilter_h_l_pos \\
    prefilter_h_h=$params.ipo_prefilter_h_h_pos  \\
    snthresh_l=$params.ipo_snthresh_l_pos \\
    snthresh_h=$params.ipo_snthresh_h_pos \\
    mzCenterFun=$params.ipo_mzCenterFun_pos  \\
    integrate=$params.ipo_integrate_pos \\
    fitgauss=$params.ipo_fitgauss_pos \\
    ipo_min_peakwidth_l=$params.ipo_min_peakwidth_l_pos  \\
    ipo_min_peakwidth_h=$params.ipo_min_peakwidth_h_pos \\
    ipo_max_peakwidth_l=$params.ipo_max_peakwidth_l_pos \\
    ipo_max_peakwidth_h=$params.ipo_max_peakwidth_h_pos \\
    ipo_ppm_l=$params.ipo_ppm_l_pos  \\
    ipo_ppm_h=$params.ipo_ppm_h_pos \\
    ipo_mzdiff_l=$params.ipo_mzdiff_l_pos \\
    ipo_mzdiff_h=$params.ipo_mzdiff_h_pos \\
    ipo_charge_camera=$params.ipo_charge_camera_pos \\
    ipo_max_ppm_camera=$params.ipo_max_ppm_camera_pos  \\
    response_l=$params.ipo_response_l_pos \\
    response_h=$params.ipo_response_h_pos \\
    distFunc=$params.ipo_distFunc_pos \\
    factorDiag_l=$params.ipo_factorDiag_l_pos \\
    factorDiag_h=$params.ipo_factorDiag_h_pos \\
    factorGap_l=$params.ipo_factorGap_l_pos  \\
    factorGap_h=$params.ipo_factorGap_h_pos \\
    localAlignment=$params.ipo_localAlignment_pos \\
    ipo_gapInit_l=$params.ipo_gapInit_l_pos \\
    ipo_gapInit_h=$params.ipo_gapInit_h_pos \\
    ipo_gapExtend_l=$params.ipo_gapExtend_l_pos  \\
    ipo_gapExtend_h=$params.ipo_gapExtend_h_pos \\
    ipo_profStep_l=$params.ipo_profStep_l_pos \\
    ipo_profStep_h=$params.ipo_profStep_h_pos \\
    bw_l=$params.ipo_bw_l_pos \\
    bw_h=$params.ipo_bw_h_pos \\
    minfrac_l=$params.ipo_minfrac_l_pos  \\
    minfrac_h=$params.ipo_minfrac_h_pos \\
    mzwid_l=$params.ipo_mzwid_l_pos \\
    mzwid_h=$params.ipo_mzwid_h_pos \\
    minsamp_l=$params.ipo_minsamp_l_pos  \\
    minsamp_h=$params.ipo_minsamp_h_pos \\
    max_l=$params.ipo_max_l_pos \\
    max_h=$params.ipo_max_h_pos \\
    ncores=$params.ipo_ncores_pos \\
    outputxset=quant_params_pos.json \\
    outputrt=rt_params_pos.json
"""
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
"""
findPeaks.r \\
    input=\$PWD/$mzMLFile \\
    output=\$PWD/${mzMLFile.baseName}.rdata \\
    ppm=$params.masstrace_ppm_pos_xcms \\
    peakwidthLow=$params.peakwidthlow_quant_pos_xcms \\
    peakwidthHigh=$params.peakwidthhigh_quant_pos_xcms  \\
    noise=$params.noise_quant_pos_xcms \\
    polarity=positive \\
    realFileName=$mzMLFile \\
    phenoFile=$phenotype_file \\
    phenoDataColumn=$params.phenodatacolumn_quant_pos  \\
    sampleClass=$params.sampleclass_quant_pos_xcms \\
    mzdiff=$params.mzdiff_quant_pos_xcms \\
    snthresh=$params.snthresh_quant_pos_xcms \\
    prefilter_l=$params.prefilter_quant_pos_xcms  \\
    prefilter_h=$params.value_of_prefilter_quant_pos_xcms \\
    mzCenterFun=$params.mzCenterFun_quant_pos_xcms \\
    integrate=$params.integrate_quant_pos_xcms  \\
    fitgauss=$params.fitgauss_quant_pos_xcms \\
    methodXset=$params.ipo_methodXset_pos \\
    methodRT=$params.ipo_methodRT_pos \\
    noise_l=$params.ipo_noise_l_pos  \\
    noise_h=$params.ipo_noise_h_pos \\
    prefilter_l_l=$params.ipo_prefilter_l_l_pos \\
    prefilter_l_h=$params.ipo_prefilter_l_h_pos  \\
    prefilter_h_l=$params.ipo_prefilter_h_l_pos \\
    prefilter_h_h=$params.ipo_prefilter_h_h_pos  \\
    snthresh_l=$params.ipo_snthresh_l_pos \\
    snthresh_h=$params.ipo_snthresh_h_pos \\
    mzCenterFun=$params.ipo_mzCenterFun_pos  \\
    integrate=$params.ipo_integrate_pos \\
    fitgauss=$params.ipo_fitgauss_pos \\
    ipo_min_peakwidth_l=$params.ipo_min_peakwidth_l_pos  \\
    ipo_min_peakwidth_h=$params.ipo_min_peakwidth_h_pos \\
    ipo_max_peakwidth_l=$params.ipo_max_peakwidth_l_pos \\
    ipo_max_peakwidth_h=$params.ipo_max_peakwidth_h_pos \\
    ipo_ppm_l=$params.ipo_ppm_l_pos  \\
    ipo_ppm_h=$params.ipo_ppm_h_pos \\
    ipo_mzdiff_l=$params.ipo_mzdiff_l_pos \\
    ipo_mzdiff_h=$params.ipo_mzdiff_h_pos \\
    ipo_charge_camera=$params.ipo_charge_camera_pos \\
    ipo_max_ppm_camera=$params.ipo_max_ppm_camera_pos  \\
    ipo_inv=$ipo_pos_localQ \\
    $filter_argument
"""
NextFlow From line 854 of 1.0.1/main.nf
921
922
923
924
"""
nextFlowDIR=\$PWD
xcmsCollect.r input=$inputs_aggregated output=collection_pos.rdata
"""
NextFlow From line 921 of 1.0.1/main.nf
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
"""
retCor.r \\
    input=\$PWD/$rdata_files \\
    output=RTcorrected_pos.rdata \\
    method=obiwarp \\
    response_l=$params.ipo_response_l_pos \\
    response_h=$params.ipo_response_h_pos \\
    distFunc=$params.ipo_distFunc_pos  \\
    factorDiag_l=$params.ipo_factorDiag_l_pos \\
    factorDiag_h=$params.ipo_factorDiag_h_pos \\
    factorGap_l=$params.ipo_factorGap_l_pos  \\
    factorGap_h=$params.ipo_factorGap_h_pos \\
    localAlignment=$params.ipo_localAlignment_pos \\
    ipo_gapInit_l=$params.ipo_gapInit_l_pos \\
    ipo_gapInit_h=$params.ipo_gapInit_h_pos \\
    ipo_gapExtend_l=$params.ipo_gapExtend_l_pos  \\
    ipo_gapExtend_h=$params.ipo_gapExtend_h_pos \\
    ipo_profStep_l=$params.ipo_profStep_l_pos \\
    ipo_profStep_h=$params.ipo_profStep_h_pos \\
    bw_l=$params.ipo_bw_l_pos \\
    bw_h=$params.ipo_bw_h_pos \\
    minfrac_l=$params.ipo_minfrac_l_pos  \\
    minfrac_h=$params.ipo_minfrac_h_pos \\
    mzwid_l=$params.ipo_mzwid_l_pos \\
    mzwid_h=$params.ipo_mzwid_h_pos \\
    minsamp_l=$params.ipo_minsamp_l_pos  \\
    minsamp_h=$params.ipo_minsamp_h_pos \\
    max_l=$params.ipo_max_l_pos \\
    max_h=$params.ipo_max_h_pos \\
    ipo_inv=$ipo_pos_localRT \\
    ncores=$params.ipo_ncores_pos  \\
    profStep=$params.profStep_align_N1_pos_xcms \\
    center=$params.center_align_N1_pos_xcms \\
    response=$params.response_align_N1_pos_xcms  \\
    distFunc=$params.distFunc_align_N1_pos_xcms \\
    gapInit=$params.gapInit_align_N1_pos_xcms \\
    gapExtend=$params.gapExtend_align_N1_pos_xcms  \\
    factorDiag=$params.factorDiag_align_N1_pos_xcms \\
    factorGap=$params.factorGap_align_N1_pos_xcms \\
    localAlignment=$params.localAlignment_align_N1_pos_xcms \\
    $filter_argument \\
    inputraw=$inputs_aggregated
"""
NextFlow From line 948 of 1.0.1/main.nf
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
"""
group.r \\
    input=$rdata_files \\
    output=groupN1_pos.rdata \\
    bandwidth=$params.bandwidth_group_N1_pos_xcms \\
    minfrac=$params.minfrac_group_N1_pos_xcms \\
    minsamp=$params.minsamp_group_N1_pos_xcms \\
    max=$params.max_group_N1_pos_xcms  \\
    mzwid=$params.mzwid_group_N1_pos_xcms
"""
NextFlow From line 1010 of 1.0.1/main.nf
1042
1043
1044
1045
1046
1047
1048
1049
1050
"""
blankfilter.r \\
    input=$rdata_files \\
    output=blankFiltered_pos.rdata \\
    method=$params.method_blankfilter_pos_xcms \\
    blank=$params.blank_blankfilter_pos_xcms \\
    sample=$params.sample_blankfilter_pos_xcms \\
    rest=$params.rest_blankfilter_pos_xcms
"""
NextFlow From line 1042 of 1.0.1/main.nf
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
"""
dilutionfilter.r \\
    input=$rdata_files \\
    output=dilutionFiltered_pos.rdata \\
    Corto=$params.corto_dilutionfilter_pos_xcms  \\
    dilution=$params.dilution_dilutionfilter_pos_xcms \\
    pvalue=$params.pvalue_dilutionfilter_pos_xcms \\
    corcut=$params.corcut_dilutionfilter_pos_xcms \\
    abs=$params.abs_dilutionfilter_pos_xcms
"""
NextFlow From line 1074 of 1.0.1/main.nf
1108
1109
1110
1111
1112
1113
1114
"""
cvfilter.r \\
    input=$rdata_files \\
    output=cvFiltered_pos.rdata \\
    qc=$params.qc_cvfilter_pos_xcms \\
    cvcut=$params.cvcut_cvfilter_pos_xcms
"""
NextFlow From line 1108 of 1.0.1/main.nf
1137
1138
1139
"""
xsAnnotate.r  input=$rdata_files output=CameraAnnotatePeaks_pos.rdata
"""
NextFlow From line 1137 of 1.0.1/main.nf
1158
1159
1160
1161
1162
1163
1164
1165
"""
groupFWHM.r \\
    input=$rdata_files \\
    output=CameraGroup_pos.rdata \\
    sigma=$params.sigma_group_pos_camera \\
    perfwhm=$params.perfwhm_group_pos_camera \\
    intval=$params.intval_group_pos_camera
"""
NextFlow From line 1158 of 1.0.1/main.nf
1185
1186
1187
1188
1189
1190
1191
"""
findAdducts.r \\
    input=$rdata_files \\
    output=CameraFindAdducts_pos.rdata \\
    ppm=$params.ppm_findaddcuts_pos_camera \\
    polarity=$params.polarity_findaddcuts_pos_camera
"""
NextFlow From line 1185 of 1.0.1/main.nf
1210
1211
1212
1213
1214
1215
"""
findIsotopes.r \\
    input=$rdata_files \\
    output=CameraFindIsotopes_pos.rdata \\
    maxcharge=$params.maxcharge_findisotopes_pos_camera
"""
NextFlow From line 1210 of 1.0.1/main.nf
1241
1242
1243
1244
1245
1246
"""
readMS2MSnBase.r \\
    input=$mzMLFile \\
    output=${mzMLFile.baseName}.rdata \\
    inputname=${mzMLFile.baseName}
"""
NextFlow From line 1241 of 1.0.1/main.nf
1268
1269
1270
1271
1272
1273
1274
1275
"""
mapMS2ToCamera.r \\
    inputCAMERA=$rdata_files_ms1 \\
    inputMS2=$input_args \\
    output=MapMsms2Camera_pos.rdata \\
    ppm=$params.ppm_mapmsmstocamera_pos_msnbase \\
    rt=$params.rt_mapmsmstocamera_pos_msnbase
"""
NextFlow From line 1268 of 1.0.1/main.nf
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
"""
mkdir out

MS2ToMetFrag.r \\
    inputCAMERA=$rdata_files_ms1 \\
    inputMS2=$rdata_files_ms2 \\
    output=out  \\
    precursorppm=$params.precursorppm_msmstoparam_pos_msnbase \\
    fragmentppm=$params.fragmentppm_msmstoparam_pos_msnbase \\
    fragmentabs=$params.fragmentabs_msmstoparam_pos_msnbase  \\
    database=$params.database_msmstoparam_pos_msnbase \\
    mode=$params.mode_msmstoparam_pos_msnbase \\
    adductRules=$params.adductRules_msmstoparam_pos_msnbase \\
    minPeaks=$params.minPeaks_msmstoparam_pos_msnbase

ls out/ -A -1  | cut -d'_' -f4- | tr ' ' '\n' | sort -u | xargs -I %  find out/ -type f -iname *% -exec zip %.zip {} +
"""
NextFlow From line 1296 of 1.0.1/main.nf
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
"""
mkdir inputs
mkdir outputs
unzip  -j $parameters -d inputs/
touch ${parameters.baseName}_class_Csifingerid_pos.csv

fingerID.r \\
    input=\$PWD/inputs \\
    database=$params.database_csifingerid_pos_csifingerid \\
    tryOffline=T  \\
    output=\$PWD/outputs/ \\
    ncores=$params.ncore_csifingerid_pos_csifingerid \\
    timeout=$params.timeout_csifingerid_pos_csifingerid \\
    canopus=T \\
    canopusOutput=\$PWD/${parameters.baseName}_class_Csifingerid_pos.csv

zip -j -r ${parameters.baseName}_Csifingerid_pos.zip outputs/*.csv
"""
NextFlow From line 1341 of 1.0.1/main.nf
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
"""
ulimit -s unlimited
mkdir all
for x in *.zip ; do unzip -d all -o -u \$x ; done
zip -r Csifingerid_pos.zip all

aggregateMetfrag.r \\
    inputs=Csifingerid_pos.zip \\
    realNames=Csifingerid_pos.zip \\
    output=aggregated_identification_csifingerid_pos.csv \\
    filetype=zip \\
    outTable=T

sed -i '/^\$/d' aggregated_identification_csifingerid_pos.csv
"""
NextFlow From line 1377 of 1.0.1/main.nf
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
"""
if [ -s $identification_result ]; then
    metfragPEP.r \\
        input=$identification_result \\
        score=score \\
        output=pep_identification_csifingerid_pos.csv \\
        readTable=T
else
    touch pep_identification_csifingerid_pos.csv
fi
"""
NextFlow From line 1410 of 1.0.1/main.nf
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
"""
if [ -s $csifingerid_input_identification ]; then

    prepareOutput.r \\
        inputcamera=$camera_input_quant \\
        inputscores=$csifingerid_input_identification \\
        inputpheno=$phenotype_file \\
        ppm=$params.ppm_output_pos_camera  \\
        rt=$params.rt_output_pos_camera \\
        higherTheBetter=true \\
        scoreColumn=score \\
        impute=$params.impute_output_pos_camera \\
        typeColumn=$params.type_column_output_pos_camera  \\
        selectedType=$params.selected_type_output_pos_camera \\
        rename=$params.rename_output_pos_camera \\
        renameCol=$params.rename_col_output_pos_camera  \\
        onlyReportWithID=$params.only_report_with_id_output_pos_camera \\
        combineReplicate=$params.combine_replicate_output_pos_camera  \\
        combineReplicateColumn=$params.combine_replicate_column_output_pos_camera \\
        log=$params.log_output_pos_camera \\
        sampleCoverage=$params.sample_coverage_output_pos_camera  \\
        outputPeakTable=peaktablePOSout_pos_csifingerid.txt \\
        outputVariables=varsPOSout_pos_csifingerid.txt \\
        outputMetaData=metadataPOSout_pos_csifingerid.txt \\
        Ifnormalize=$params.normalize_output_pos_camera

else

    prepareOutput.r \\
        inputcamera=$camera_input_quant \\
        inputpheno=$phenotype_file \\
        ppm=$params.ppm_output_pos_camera \\
        rt=$params.rt_output_pos_camera  \\
        higherTheBetter=true \\
        scoreColumn=score \\
        impute=$params.impute_output_pos_camera \\
        typeColumn=$params.type_column_output_pos_camera \\
        selectedType=$params.selected_type_output_pos_camera  \\
        rename=$params.rename_output_pos_camera \\
        renameCol=$params.rename_col_output_pos_camera \\
        onlyReportWithID=$params.only_report_with_id_output_pos_camera \\
        combineReplicate=$params.combine_replicate_output_pos_camera  \\
        combineReplicateColumn=$params.combine_replicate_column_output_pos_camera \\
        log=$params.log_output_pos_camera \\
        sampleCoverage=$params.sample_coverage_output_pos_camera \\
        outputPeakTable=peaktablePOSout_pos_csifingerid.txt  \\
        outputVariables=varsPOSout_pos_csifingerid.txt \\
        outputMetaData=metadataPOSout_pos_csifingerid.txt \\
        Ifnormalize=$params.normalize_output_pos_camera

fi
"""
NextFlow From line 1440 of 1.0.1/main.nf
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
"""
mkdir inputs
mkdir outputs
unzip  -j $parameters -d inputs/
touch ${parameters.baseName}.csv
find "\$PWD/inputs" -type f | \\
    parallel \\
        -j $params.ncore_pos_metfrag \\
        run_metfrag.sh \\
        -p {} \\
        -f \$PWD/outputs/{/.}.csv \\
        -l "\$PWD/$metfrag_database" \\
        -s "OfflineMetFusionScore"
zip -j -r ${parameters.baseName}_metfrag_pos.zip outputs/*.csv
"""
NextFlow From line 1536 of 1.0.1/main.nf
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
"""
ulimit -s unlimited
mkdir all
for x in *.zip ; do unzip -d all -o -u \$x ; done
zip -r metfrag_pos.zip all

aggregateMetfrag.r \\
    inputs=metfrag_pos.zip \\
    realNames=metfrag_pos.zip \\
    output=aggregated_identification_metfrag_pos.csv \\
    filetype=zip \\
    outTable=T

sed -i '/^\$/d' aggregated_identification_metfrag_pos.csv
"""
NextFlow From line 1569 of 1.0.1/main.nf
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
"""
if [ -s $identification_result ];then
    metfragPEP.r \\
        input=$identification_result \\
        score=FragmenterScore \\
        output=pep_identification_metfrag_pos.csv \\
        readTable=T
else
    touch pep_identification_metfrag_pos.csv
fi
"""
NextFlow From line 1601 of 1.0.1/main.nf
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
"""
if [ -s $metfrag_input_identification ]; then

    prepareOutput.r \\
        inputcamera=$camera_input_quant \\
        inputscores=$metfrag_input_identification \\
        inputpheno=$phenotype_file \\
        ppm=$params.ppm_output_pos_camera  \\
        rt=$params.rt_output_pos_camera \\
        higherTheBetter=true \\
        scoreColumn=FragmenterScore \\
        impute=$params.impute_output_pos_camera \\
        typeColumn=$params.type_column_output_pos_camera  \\
        selectedType=$params.selected_type_output_pos_camera \\
        rename=$params.rename_output_pos_camera \\
        renameCol=$params.rename_col_output_pos_camera \\
        onlyReportWithID=$params.only_report_with_id_output_pos_camera  \\
        combineReplicate=$params.combine_replicate_output_pos_camera \\
        combineReplicateColumn=$params.combine_replicate_column_output_pos_camera \\
        log=$params.log_output_pos_camera \\
        sampleCoverage=$params.sample_coverage_output_pos_camera  \\
        outputPeakTable=peaktablePOSout_pos_metfrag.txt \\
        outputVariables=varsPOSout_pos_metfrag.txt \\
        outputMetaData=metadataPOSout_pos_metfrag.txt \\
        Ifnormalize=$params.normalize_output_pos_camera

else

    prepareOutput.r \\
        inputcamera=$camera_input_quant \\
        inputpheno=$phenotype_file \\
        ppm=$params.ppm_output_pos_camera \\
        rt=$params.rt_output_pos_camera \\
        higherTheBetter=true \\
        scoreColumn=FragmenterScore  \\
        impute=$params.impute_output_pos_camera \\
        typeColumn=$params.type_column_output_pos_camera \\
        selectedType=$params.selected_type_output_pos_camera \\
        rename=$params.rename_output_pos_camera  \\
        renameCol=$params.rename_col_output_pos_camera \\
        onlyReportWithID=$params.only_report_with_id_output_pos_camera \\
        combineReplicate=$params.combine_replicate_output_pos_camera  \\
        combineReplicateColumn=$params.combine_replicate_column_output_pos_camera \\
        log=$params.log_output_pos_camera \\
        sampleCoverage=$params.sample_coverage_output_pos_camera  \\
        outputPeakTable=peaktablePOSout_pos_metfrag.txt \\
        outputVariables=varsPOSout_pos_metfrag.txt \\
        outputMetaData=metadataPOSout_pos_metfrag.txt \\
        Ifnormalize=$params.normalize_output_pos_camera

fi
"""
NextFlow From line 1633 of 1.0.1/main.nf
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
"""
mkdir inputs
mkdir outputs
unzip  -j $parameters -d inputs/
touch ${parameters.baseName}.csv
find "\$PWD/inputs" -type f | \\
    parallel \\
        -j $params.ncore_pos_cfmid cfmid.r \\
        input={} \\
        realName={/} \\
        databaseFile=\$PWD/$cfmid_database  \\
        output=\$PWD/outputs/{/.}.csv \\
        candidate_id=$params.candidate_id_identification_pos_cfmid \\
        candidate_inchi_smiles=$params.candidate_inchi_smiles_identification_pos_cfmid \\
        candidate_mass=$params.candidate_mass_identification_pos_cfmid \\
        databaseNameColumn=$params.database_name_column_identification_pos_cfmid \\
        databaseInChIColumn=$params.database_inchI_column_identification_pos_cfmid \\
        scoreType=Jaccard

zip -j -r ${parameters.baseName}_cfmid_pos.zip outputs/*.csv
"""
NextFlow From line 1718 of 1.0.1/main.nf
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
"""
ulimit -s unlimited
mkdir all
for x in *.zip ; do unzip -d all -o -u \$x ; done
zip -r cfmid_pos.zip all

aggregateMetfrag.r \\
    inputs=cfmid_pos.zip \\
    realNames=cfmid_pos.zip \\
    output=aggregated_identification_cfmid_pos.csv \\
    filetype=zip \\
    outTable=T

sed -i '/^\$/d' aggregated_identification_cfmid_pos.csv
"""
NextFlow From line 1757 of 1.0.1/main.nf
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
"""
if [ -s $identification_result ]; then
    metfragPEP.r \\
        input=$identification_result \\
        score=Jaccard_Score \\
        output=pep_identification_cfmid_pos.csv \\
        readTable=T
else
    touch pep_identification_cfmid_pos.csv
fi
"""
NextFlow From line 1789 of 1.0.1/main.nf
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
"""
if [ -s $cfmid_input_identification ]; then

    prepareOutput.r \\
        inputcamera=$camera_input_quant \\
        inputscores=$cfmid_input_identification \\
        inputpheno=$phenotype_file \\
        ppm=$params.ppm_output_pos_camera \\
        rt=$params.rt_output_pos_camera  \\
        higherTheBetter=true \\
        scoreColumn=Jaccard_Score \\
        impute=$params.impute_output_pos_camera \\
        typeColumn=$params.type_column_output_pos_camera \\
        selectedType=$params.selected_type_output_pos_camera  \\
        rename=$params.rename_output_pos_camera \\
        renameCol=$params.rename_col_output_pos_camera \\
        onlyReportWithID=$params.only_report_with_id_output_pos_camera \\
        combineReplicate=$params.combine_replicate_output_pos_camera  \\
        combineReplicateColumn=$params.combine_replicate_column_output_pos_camera \\
        log=$params.log_output_pos_camera \\
        sampleCoverage=$params.sample_coverage_output_pos_camera  \\
        outputPeakTable=peaktablePOSout_pos_cfmid.txt \\
        outputVariables=varsPOSout_pos_cfmid.txt \\
        outputMetaData=metadataPOSout_pos_cfmid.txt \\
        Ifnormalize=$params.normalize_output_pos_camera

else

    prepareOutput.r \\
        inputcamera=$camera_input_quant \\
        inputpheno=$phenotype_file \\
        ppm=$params.ppm_output_pos_camera \\
        rt=$params.rt_output_pos_camera  \\
        higherTheBetter=true \\
        scoreColumn=Jaccard_Score \\
        impute=$params.impute_output_pos_camera \\
        typeColumn=$params.type_column_output_pos_camera \\
        selectedType=$params.selected_type_output_pos_camera  \\
        rename=$params.rename_output_pos_camera \\
        renameCol=$params.rename_col_output_pos_camera \\
        onlyReportWithID=$params.only_report_with_id_output_pos_camera \\
        combineReplicate=$params.combine_replicate_output_pos_camera  \\
        combineReplicateColumn=$params.combine_replicate_column_output_pos_camera \\
        log=$params.log_output_pos_camera \\
        sampleCoverage=$params.sample_coverage_output_pos_camera \\
        outputPeakTable=peaktablePOSout_pos_cfmid.txt  \\
        outputVariables=varsPOSout_pos_cfmid.txt \\
        outputMetaData=metadataPOSout_pos_cfmid.txt \\
        Ifnormalize=$params.normalize_output_pos_camera

fi
"""
NextFlow From line 1821 of 1.0.1/main.nf
1907
1908
1909
"""
PeakPickerHiRes -in $mzMLFile -out $mzMLFile -ini $setting_file
"""
NextFlow From line 1907 of 1.0.1/main.nf
1930
1931
1932
"""
FeatureFinderMetabo -in $mzMLFile -out ${mzMLFile.baseName}.featureXML -ini $setting_file
"""
NextFlow From line 1930 of 1.0.1/main.nf
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
"""
featurexmlToCamera.r \\
    input=$mzMLFile \\
    realFileName=$mzMLFile \\
    mzMLfiles=\$PWD/$mzMLFile2 \\
    polarity=positive \\
    output=${mzMLFile.baseName}.rdata \\
    sampleClass=library \\
    changeNameTO=${mzMLFile.baseName}.mzML
"""
NextFlow From line 1953 of 1.0.1/main.nf
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
"""
touch quant_params_library_pos.json
touch rt_params_library_pos.json

ipo.r \\
    input=$inputs_aggregated \\
    quantOnly=TRUE \\
    allSamples=TRUE  \\
    methodXset=$params.ipo_methodXset_library_pos \\
    methodRT=$params.ipo_methodRT_library_pos \\
    noise_l=$params.ipo_noise_l_library_pos  \\
    noise_h=$params.ipo_noise_h_library_pos \\
    prefilter_l_l=$params.ipo_prefilter_l_l_library_pos \\
    prefilter_l_h=$params.ipo_prefilter_l_h_library_pos  \\
    prefilter_h_l=$params.ipo_prefilter_h_l_library_pos \\
    prefilter_h_h=$params.ipo_prefilter_h_h_library_pos  \\
    snthresh_l=$params.ipo_snthresh_l_library_pos \\
    snthresh_h=$params.ipo_snthresh_h_library_pos \\
    mzCenterFun=$params.ipo_mzCenterFun_library_pos  \\
    integrate=$params.ipo_integrate_library_pos \\
    fitgauss=$params.ipo_fitgauss_library_pos \\
    ipo_min_peakwidth_l=$params.ipo_min_peakwidth_l_library_pos  \\
    ipo_min_peakwidth_h=$params.ipo_min_peakwidth_h_library_pos \\
    ipo_max_peakwidth_l=$params.ipo_max_peakwidth_l_library_pos \\
    ipo_max_peakwidth_h=$params.ipo_max_peakwidth_h_library_pos \\
    ipo_ppm_l=$params.ipo_ppm_l_library_pos  \\
    ipo_ppm_h=$params.ipo_ppm_h_library_pos \\
    ipo_mzdiff_l=$params.ipo_mzdiff_l_library_pos \\
    ipo_mzdiff_h=$params.ipo_mzdiff_h_library_pos \\
    ipo_charge_camera=$params.ipo_charge_camera_library_pos \\
    ipo_max_ppm_camera=$params.ipo_max_ppm_camera_library_pos  \\
    response_l=$params.ipo_response_l_library_pos \\
    response_h=$params.ipo_response_h_library_pos \\
    distFunc=$params.ipo_distFunc_library_pos \\
    factorDiag_l=$params.ipo_factorDiag_l_library_pos \\
    factorDiag_h=$params.ipo_factorDiag_h_library_pos \\
    factorGap_l=$params.ipo_factorGap_l_library_pos  \\
    factorGap_h=$params.ipo_factorGap_h_library_pos \\
    localAlignment=$params.ipo_localAlignment_library_pos \\
    ipo_gapInit_l=$params.ipo_gapInit_l_library_pos \\
    ipo_gapInit_h=$params.ipo_gapInit_h_library_pos \\
    ipo_gapExtend_l=$params.ipo_gapExtend_l_library_pos  \\
    ipo_gapExtend_h=$params.ipo_gapExtend_h_library_pos \\
    ipo_profStep_l=$params.ipo_profStep_l_library_pos \\
    ipo_profStep_h=$params.ipo_profStep_h_library_pos \\
    bw_l=$params.ipo_bw_l_library_pos \\
    bw_h=$params.ipo_bw_h_library_pos \\
    minfrac_l=$params.ipo_minfrac_l_library_pos  \\
    minfrac_h=$params.ipo_minfrac_h_library_pos \\
    mzwid_l=$params.ipo_mzwid_l_library_pos \\
    mzwid_h=$params.ipo_mzwid_h_library_pos \\
    minsamp_l=$params.ipo_minsamp_l_library_pos  \\
    minsamp_h=$params.ipo_minsamp_h_library_pos \\
    max_l=$params.ipo_max_l_library_pos \\
    max_h=$params.ipo_max_h_library_pos \\
    ncores=$params.ipo_ncores_library_pos \\
    outputxset=quant_params_library_pos.json \\
    outputrt=rt_params_library_pos.json
"""
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
"""
findPeaks.r \\
    input=\$PWD/$mzMLFile \\
    output=\$PWD/${mzMLFile.baseName}.rdata \\
    ppm=$params.masstrace_ppm_library_pos_xcms \\
    peakwidthLow=$params.peakwidthlow_quant_library_pos_xcms  \\
    peakwidthHigh=$params.peakwidthhigh_quant_library_pos_xcms \\
    noise=$params.noise_quant_library_pos_xcms \\
    polarity=positive \\
    realFileName=$mzMLFile \\
    sampleClass=$params.sampleclass_quant_library_pos_xcms  \\
    mzdiff=$params.mzdiff_quant_library_pos_xcms \\
    snthresh=$params.snthresh_quant_library_pos_xcms \\
    prefilter_l=$params.prefilter_quant_library_pos_xcms \\
    prefilter_h=$params.value_of_prefilter_quant_library_pos_xcms  \\
    mzCenterFun=$params.mzCenterFun_quant_library_pos_xcms \\
    integrate=$params.integrate_quant_library_pos_xcms \\
    fitgauss=$params.fitgauss_quant_library_pos_xcms  \\
    methodXset=$params.ipo_methodXset_library_pos \\
    methodRT=$params.ipo_methodRT_library_pos \\
    noise_l=$params.ipo_noise_l_library_pos  \\
    noise_h=$params.ipo_noise_h_library_pos \\
    prefilter_l_l=$params.ipo_prefilter_l_l_library_pos \\
    prefilter_l_h=$params.ipo_prefilter_l_h_library_pos  \\
    prefilter_h_l=$params.ipo_prefilter_h_l_library_pos \\
    prefilter_h_h=$params.ipo_prefilter_h_h_library_pos  \\
    snthresh_l=$params.ipo_snthresh_l_library_pos \\
    snthresh_h=$params.ipo_snthresh_h_library_pos \\
    mzCenterFun=$params.ipo_mzCenterFun_library_pos  \\
    integrate=$params.ipo_integrate_library_pos \\
    fitgauss=$params.ipo_fitgauss_library_pos \\
    ipo_min_peakwidth_l=$params.ipo_min_peakwidth_l_library_pos  \\
    ipo_min_peakwidth_h=$params.ipo_min_peakwidth_h_library_pos \\
    ipo_max_peakwidth_l=$params.ipo_max_peakwidth_l_library_pos \\
    ipo_max_peakwidth_h=$params.ipo_max_peakwidth_h_library_pos \\
    ipo_ppm_l=$params.ipo_ppm_l_library_pos  \\
    ipo_ppm_h=$params.ipo_ppm_h_library_pos \\
    ipo_mzdiff_l=$params.ipo_mzdiff_l_library_pos \\
    ipo_mzdiff_h=$params.ipo_mzdiff_h_library_pos \\
    ipo_charge_camera=$params.ipo_charge_camera_library_pos  \\
    ipo_max_ppm_camera=$params.ipo_max_ppm_camera_library_pos  \\
    ipo_inv=$ipo_library_pos_localQ \\
    $filter_argument
"""
NextFlow From line 2065 of 1.0.1/main.nf
2131
2132
2133
"""
FeatureFinderMetabo -in $mzMLFile -out ${mzMLFile.baseName}.featureXML -ini $setting_file
"""
NextFlow From line 2131 of 1.0.1/main.nf
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
"""
featurexmlToCamera.r \\
    input=$mzMLFile \\
    realFileName=$mzMLFile \\
    mzMLfiles=\$PWD/$mzMLFile2 \\
    polarity=positive \\
    output=${mzMLFile.baseName}.rdata \\
    sampleClass=library \\
    changeNameTO=${mzMLFile.baseName}.mzML
"""
NextFlow From line 2152 of 1.0.1/main.nf
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
"""
touch quant_params_library_pos.json
touch rt_params_library_pos.json

ipo.r \\
    input=$inputs_aggregated \\
    quantOnly=TRUE \\
    allSamples=TRUE  \\
    methodXset=$params.ipo_methodXset_library_pos \\
    methodRT=$params.ipo_methodRT_library_pos \\
    noise_l=$params.ipo_noise_l_library_pos  \\
    noise_h=$params.ipo_noise_h_library_pos \\
    prefilter_l_l=$params.ipo_prefilter_l_l_library_pos \\
    prefilter_l_h=$params.ipo_prefilter_l_h_library_pos  \\
    prefilter_h_l=$params.ipo_prefilter_h_l_library_pos \\
    prefilter_h_h=$params.ipo_prefilter_h_h_library_pos  \\
    snthresh_l=$params.ipo_snthresh_l_library_pos \\
    snthresh_h=$params.ipo_snthresh_h_library_pos \\
    mzCenterFun=$params.ipo_mzCenterFun_library_pos  \\
    integrate=$params.ipo_integrate_library_pos \\
    fitgauss=$params.ipo_fitgauss_library_pos \\
    ipo_min_peakwidth_l=$params.ipo_min_peakwidth_l_library_pos  \\
    ipo_min_peakwidth_h=$params.ipo_min_peakwidth_h_library_pos \\
    ipo_max_peakwidth_l=$params.ipo_max_peakwidth_l_library_pos \\
    ipo_max_peakwidth_h=$params.ipo_max_peakwidth_h_library_pos \\
    ipo_ppm_l=$params.ipo_ppm_l_library_pos  \\
    ipo_ppm_h=$params.ipo_ppm_h_library_pos \\
    ipo_mzdiff_l=$params.ipo_mzdiff_l_library_pos \\
    ipo_mzdiff_h=$params.ipo_mzdiff_h_library_pos  \\
    ipo_charge_camera=$params.ipo_charge_camera_library_pos \\
    ipo_max_ppm_camera=$params.ipo_max_ppm_camera_library_pos  \\
    response_l=$params.ipo_response_l_library_pos \\
    response_h=$params.ipo_response_h_library_pos \\
    distFunc=$params.ipo_distFunc_library_pos  \\
    factorDiag_l=$params.ipo_factorDiag_l_library_pos \\
    factorDiag_h=$params.ipo_factorDiag_h_library_pos \\
    factorGap_l=$params.ipo_factorGap_l_library_pos  \\
    factorGap_h=$params.ipo_factorGap_h_library_pos \\
    localAlignment=$params.ipo_localAlignment_library_pos \\
    ipo_gapInit_l=$params.ipo_gapInit_l_library_pos  \\
    ipo_gapInit_h=$params.ipo_gapInit_h_library_pos \\
    ipo_gapExtend_l=$params.ipo_gapExtend_l_library_pos  \\
    ipo_gapExtend_h=$params.ipo_gapExtend_h_library_pos \\
    ipo_profStep_l=$params.ipo_profStep_l_library_pos \\
    ipo_profStep_h=$params.ipo_profStep_h_library_pos  \\
    bw_l=$params.ipo_bw_l_library_pos \\
    bw_h=$params.ipo_bw_h_library_pos \\
    minfrac_l=$params.ipo_minfrac_l_library_pos  \\
    minfrac_h=$params.ipo_minfrac_h_library_pos \\
    mzwid_l=$params.ipo_mzwid_l_library_pos \\
    mzwid_h=$params.ipo_mzwid_h_library_pos \\
    minsamp_l=$params.ipo_minsamp_l_library_pos  \\
    minsamp_h=$params.ipo_minsamp_h_library_pos \\
    max_l=$params.ipo_max_l_library_pos \\
    max_h=$params.ipo_max_h_library_pos \\
    ncores=$params.ipo_ncores_library_pos \\
    outputxset=quant_params_library_pos.json \\
    outputrt=rt_params_library_pos.json
"""
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
"""
findPeaks.r \\
    input=\$PWD/$mzMLFile \\
    output=\$PWD/${mzMLFile.baseName}.rdata \\
    ppm=$params.masstrace_ppm_library_pos_xcms \\
    peakwidthLow=$params.peakwidthlow_quant_library_pos_xcms  \\
    peakwidthHigh=$params.peakwidthhigh_quant_library_pos_xcms \\
    noise=$params.noise_quant_library_pos_xcms \\
    polarity=positive \\
    realFileName=$mzMLFile \\
    sampleClass=$params.sampleclass_quant_library_pos_xcms  \\
    mzdiff=$params.mzdiff_quant_library_pos_xcms \\
    snthresh=$params.snthresh_quant_library_pos_xcms \\
    prefilter_l=$params.prefilter_quant_library_pos_xcms \\
    prefilter_h=$params.value_of_prefilter_quant_library_pos_xcms  \\
    mzCenterFun=$params.mzCenterFun_quant_library_pos_xcms \\
    integrate=$params.integrate_quant_library_pos_xcms \\
    fitgauss=$params.fitgauss_quant_library_pos_xcms  \\
    methodXset=$params.ipo_methodXset_library_pos \\
    methodRT=$params.ipo_methodRT_library_pos \\
    noise_l=$params.ipo_noise_l_library_pos  \\
    noise_h=$params.ipo_noise_h_library_pos \\
    prefilter_l_l=$params.ipo_prefilter_l_l_library_pos \\
    prefilter_l_h=$params.ipo_prefilter_l_h_library_pos  \\
    prefilter_h_l=$params.ipo_prefilter_h_l_library_pos \\
    prefilter_h_h=$params.ipo_prefilter_h_h_library_pos  \\
    snthresh_l=$params.ipo_snthresh_l_library_pos \\
    snthresh_h=$params.ipo_snthresh_h_library_pos \\
    mzCenterFun=$params.ipo_mzCenterFun_library_pos  \\
    integrate=$params.ipo_integrate_library_pos \\
    fitgauss=$params.ipo_fitgauss_library_pos \\
    ipo_min_peakwidth_l=$params.ipo_min_peakwidth_l_library_pos  \\
    ipo_min_peakwidth_h=$params.ipo_min_peakwidth_h_library_pos \\
    ipo_max_peakwidth_l=$params.ipo_max_peakwidth_l_library_pos \\
    ipo_max_peakwidth_h=$params.ipo_max_peakwidth_h_library_pos \\
    ipo_ppm_l=$params.ipo_ppm_l_library_pos  \\
    ipo_ppm_h=$params.ipo_ppm_h_library_pos \\
    ipo_mzdiff_l=$params.ipo_mzdiff_l_library_pos \\
    ipo_mzdiff_h=$params.ipo_mzdiff_h_library_pos \\
    ipo_charge_camera=$params.ipo_charge_camera_library_pos  \\
    ipo_max_ppm_camera=$params.ipo_max_ppm_camera_library_pos  \\
    ipo_inv=$ipo_library_pos_localQ \\
    $filter_argument
"""
NextFlow From line 2266 of 1.0.1/main.nf
2332
2333
2334
"""
xsAnnotate.r input=$rdata_files output=${rdata_files.baseName}.rdata
"""
NextFlow From line 2332 of 1.0.1/main.nf
2353
2354
2355
2356
2357
2358
2359
2360
"""
groupFWHM.r \\
    input=$rdata_files \\
    output=${rdata_files.baseName}.rdata \\
    sigma=$params.sigma_group_library_pos_camera \\
    perfwhm=$params.perfwhm_group_library_pos_camera \\
    intval=$params.intval_group_library_pos_camera
"""
NextFlow From line 2353 of 1.0.1/main.nf
2380
2381
2382
2383
2384
2385
2386
"""
findAdducts.r \\
    input=$rdata_files \\
    output=${rdata_files.baseName}.rdata \\
    ppm=$params.ppm_findaddcuts_library_pos_camera \\
    polarity=$params.polarity_findaddcuts_library_pos_camera
"""
NextFlow From line 2380 of 1.0.1/main.nf
2406
2407
2408
2409
2410
2411
"""
findIsotopes.r \\
    input=$rdata_files \\
    output=${rdata_files.baseName}.rdata \\
    maxcharge=$params.maxcharge_findisotopes_library_pos_camera
"""
NextFlow From line 2406 of 1.0.1/main.nf
2432
2433
2434
2435
2436
2437
"""
readMS2MSnBase.r \\
    input=$mzMLFile \\
    output=${mzMLFile.baseName}_ReadMsmsLibrary.rdata \\
    inputname=${mzMLFile.baseName}
"""
NextFlow From line 2432 of 1.0.1/main.nf
2462
2463
2464
2465
2466
2467
2468
2469
"""
mapMS2ToCamera.r \\
    inputCAMERA=$rdata_files_ms1 \\
    inputMS2=$rdata_files_ms2 \\
    output=${rdata_files_ms1.baseName}_MapMsms2Camera_library_pos.rdata  \\
    ppm=$params.ppm_mapmsmstocamera_library_pos_msnbase \\
    rt=$params.rt_mapmsmstocamera_library_pos_msnbase
"""
NextFlow From line 2462 of 1.0.1/main.nf
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
"""
mkdir out

createLibrary.r \\
    inputCAMERA=$rdata_camera \\
    precursorppm=$params.ppm_create_library_pos_msnbase \\
    inputMS2=$ms2_data \\
    output=${rdata_camera.baseName}.csv \\
    inputLibrary=$library_desc  \\
    rawFileName=$params.raw_file_name_preparelibrary_pos_msnbase \\
    compundID=$params.compund_id_preparelibrary_pos_msnbase \\
    compoundName=$params.compound_name_preparelibrary_pos_msnbase  \\
    mzCol=$params.mz_col_preparelibrary_pos_msnbase \\
    whichmz=$params.which_mz_preparelibrary_pos_msnbase
"""
NextFlow From line 2494 of 1.0.1/main.nf
2530
2531
2532
2533
2534
2535
"""
collectLibrary.r \\
    inputs=$aggregatecdlibrary \\
    realNames=$aggregatecdlibrary \\
    output=library_pos.csv
"""
NextFlow From line 2530 of 1.0.1/main.nf
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
"""
#!env Rscript
Files<-list.files(,pattern = "zip",full.names=T)
Files_org<-list.files(,pattern = "zip")
for(f in Files){
    zip::unzip(zipfile = f,junkpaths = T)
}
Files<-list.files(,pattern = "txt",full.names=T)
FilesTMP<-sapply(strsplit(split = "_",fixed = T,x = basename(Files)),function(x){paste(x[-1],collapse = "_")})
    FileDub<-Files[duplicated(FilesTMP)]
for(x in FileDub){
    file.remove(x)
}
files_to_pass<-list.files(pattern="txt")
files_to_pass<-files_to_pass[!files_to_pass%in%Files_org]
zip::zip(zipfile="mappedtometfrag_pos.zip",files=files_to_pass)
"""
NextFlow From line 2555 of 1.0.1/main.nf
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
"""
librarySearchEngine.r \\
    -l $libraryFile \\
    -i $parameters \\
    -out aggregated_identification_library_pos.csv \\
    -th "-1" \\
    -im pos \\
    -ts Scoredotproduct \\
    -rs 1000 \\
    -ncore $params.ncore_searchengine_library_pos_msnbase

sed -i '/^\$/d' aggregated_identification_library_pos.csv
"""
NextFlow From line 2593 of 1.0.1/main.nf
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
"""
librarySearchEngine.r \\
    -l $libraryFile \\
    -i $parameters \\
    -out aggregated_identification_library_pos.csv \\
    -th "-1" \\
    -im pos \\
    -ts Scoredotproduct \\
    -rs 1000 \\
    -ncore $params.ncore_searchengine_library_pos_msnbase

sed -i '/^\$/d' aggregated_identification_library_pos.csv
"""
NextFlow From line 2627 of 1.0.1/main.nf
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
"""
if [ -s $identification_result ]; then
    metfragPEP.r \\
        input=$identification_result \\
        score=score \\
        output=pep_identification_library_pos.csv \\
        readTable=T
else
    touch pep_identification_library_pos.csv
fi
"""
NextFlow From line 2659 of 1.0.1/main.nf
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
"""
if [ -s $library_input_identification ]; then

    prepareOutput.r \\
        inputcamera=$camera_input_quant \\
        inputscores=$library_input_identification \\
        inputpheno=$phenotype_file \\
        ppm=$params.ppm_output_pos_camera  \\
        rt=$params.rt_output_pos_camera \\
        higherTheBetter=true \\
        scoreColumn=score \\
        impute=$params.impute_output_pos_camera \\
        typeColumn=$params.type_column_output_pos_camera  \\
        selectedType=$params.selected_type_output_pos_camera \\
        rename=$params.rename_output_pos_camera \\
        renameCol=$params.rename_col_output_pos_camera \\
        onlyReportWithID=$params.only_report_with_id_output_pos_camera  \\
        combineReplicate=$params.combine_replicate_output_pos_camera \\
        combineReplicateColumn=$params.combine_replicate_column_output_pos_camera \\
        log=$params.log_output_pos_camera  \\
        sampleCoverage=$params.sample_coverage_output_pos_camera \\
        outputPeakTable=peaktablePOSout_pos_library.txt \\
        outputVariables=varsPOSout_pos_library.txt \\
        outputMetaData=metadataPOSout_pos_library.txt \\
        Ifnormalize=$params.normalize_output_pos_camera

else

    prepareOutput.r \\
        inputcamera=$camera_input_quant \\
        inputpheno=$phenotype_file \\
        ppm=$params.ppm_output_pos_camera \\
        rt=$params.rt_output_pos_camera \\
        higherTheBetter=true \\
        scoreColumn=score  \\
        impute=$params.impute_output_pos_camera \\
        typeColumn=$params.type_column_output_pos_camera \\
        selectedType=$params.selected_type_output_pos_camera \\
        rename=$params.rename_output_pos_camera  \\
        renameCol=$params.rename_col_output_pos_camera \\
        onlyReportWithID=$params.only_report_with_id_output_pos_camera \\
        combineReplicate=$params.combine_replicate_output_pos_camera  \\
        combineReplicateColumn=$params.combine_replicate_column_output_pos_camera \\
        log=$params.log_output_pos_camera \\
        sampleCoverage=$params.sample_coverage_output_pos_camera  \\
        outputPeakTable=peaktablePOSout_pos_library.txt \\
        outputVariables=varsPOSout_pos_library.txt \\
        outputMetaData=metadataPOSout_pos_library.txt \\
        Ifnormalize=$params.normalize_output_pos_camera

fi
"""
NextFlow From line 2692 of 1.0.1/main.nf
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
"""
prepareOutput.r \\
    inputcamera=$camera_input_quant \\
    inputpheno=$phenotype_file \\
    ppm=$params.ppm_output_pos_camera \\
    rt=$params.rt_output_pos_camera  \\
    higherTheBetter=true \\
    scoreColumn=score \\
    impute=$params.impute_output_pos_camera \\
    typeColumn=$params.type_column_output_pos_camera \\
    selectedType=$params.selected_type_output_pos_camera  \\
    rename=$params.rename_output_pos_camera \\
    renameCol=$params.rename_col_output_pos_camera \\
    onlyReportWithID=$params.only_report_with_id_output_pos_camera  \\
    combineReplicate=$params.combine_replicate_output_pos_camera \\
    combineReplicateColumn=$params.combine_replicate_column_output_pos_camera \\
    log=$params.log_output_pos_camera  \\
    sampleCoverage=$params.sample_coverage_output_pos_camera \\
    outputPeakTable=peaktablePOSout_POS_noid.txt \\
    outputVariables=varsPOSout_pos_noid.txt \\
    outputMetaData=metadataPOSout_pos_noid.txt \\
    Ifnormalize=$params.normalize_output_pos_camera
"""
NextFlow From line 2764 of 1.0.1/main.nf
2816
2817
2818
"""
PeakPickerHiRes -in $mzMLFile -out $mzMLFile -ini $setting_file
"""
NextFlow From line 2816 of 1.0.1/main.nf
2844
2845
2846
"""
FeatureFinderMetabo -in $mzMLFile -out ${mzMLFile.baseName}.featureXML -ini $setting_file
"""
NextFlow From line 2844 of 1.0.1/main.nf
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
"""
featurexmlToCamera.r \\
    input=$mzMLFile \\
    realFileName=$mzMLFile \\
    mzMLfiles=\$PWD/$mzMLFile2 \\
    polarity=negative \\
    output=${mzMLFile.baseName}.rdata \\
    phenoFile=$phenotype_file  \\
    phenoDataColumn=$params.phenodatacolumn_quant_neg \\
    sampleClass=$params.sampleclass_quant_neg_xcms \\
    changeNameTO=${mzMLFile.baseName}.mzML
"""
NextFlow From line 2866 of 1.0.1/main.nf
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
"""
touch quant_params_neg.json
touch rt_params_neg.json

ipo.r \\
    input=$inputs_aggregated \\
    quantOnly=$ipo_neg_globalAvoidRT \\
    allSamples=$params.ipo_allSamples_neg \\
    columnToSelect=$params.ipo_columnToSelect_neg  \\
    valueToSelect=$params.ipo_valueToSelect_neg \\
    phenoFile=$phenotype_file  \\
    methodXset=$params.ipo_methodXset_neg \\
    methodRT=$params.ipo_methodRT_neg \\
    noise_l=$params.ipo_noise_l_neg  \\
    noise_h=$params.ipo_noise_h_neg \\
    prefilter_l_l=$params.ipo_prefilter_l_l_neg \\
    prefilter_l_h=$params.ipo_prefilter_l_h_neg  \\
    prefilter_h_l=$params.ipo_prefilter_h_l_neg \\
    prefilter_h_h=$params.ipo_prefilter_h_h_neg  \\
    snthresh_l=$params.ipo_snthresh_l_neg \\
    snthresh_h=$params.ipo_snthresh_h_neg \\
    mzCenterFun=$params.ipo_mzCenterFun_neg  \\
    integrate=$params.ipo_integrate_neg \\
    fitgauss=$params.ipo_fitgauss_neg \\
    ipo_min_peakwidth_l=$params.ipo_min_peakwidth_l_neg  \\
    ipo_min_peakwidth_h=$params.ipo_min_peakwidth_h_neg \\
    ipo_max_peakwidth_l=$params.ipo_max_peakwidth_l_neg \\
    ipo_max_peakwidth_h=$params.ipo_max_peakwidth_h_neg \\
    ipo_ppm_l=$params.ipo_ppm_l_neg  \\
    ipo_ppm_h=$params.ipo_ppm_h_neg \\
    ipo_mzdiff_l=$params.ipo_mzdiff_l_neg \\
    ipo_mzdiff_h=$params.ipo_mzdiff_h_neg \\
    ipo_charge_camera=$params.ipo_charge_camera_neg \\
    ipo_max_ppm_camera=$params.ipo_max_ppm_camera_neg  \\
    response_l=$params.ipo_response_l_neg \\
    response_h=$params.ipo_response_h_neg \\
    distFunc=$params.ipo_distFunc_neg \\
    factorDiag_l=$params.ipo_factorDiag_l_neg \\
    factorDiag_h=$params.ipo_factorDiag_h_neg \\
    factorGap_l=$params.ipo_factorGap_l_neg  \\
    factorGap_h=$params.ipo_factorGap_h_neg \\
    localAlignment=$params.ipo_localAlignment_neg \\
    ipo_gapInit_l=$params.ipo_gapInit_l_neg \\
    ipo_gapInit_h=$params.ipo_gapInit_h_neg \\
    ipo_gapExtend_l=$params.ipo_gapExtend_l_neg  \\
    ipo_gapExtend_h=$params.ipo_gapExtend_h_neg \\
    ipo_profStep_l=$params.ipo_profStep_l_neg \\
    ipo_profStep_h=$params.ipo_profStep_h_neg \\
    bw_l=$params.ipo_bw_l_neg \\
    bw_h=$params.ipo_bw_h_neg \\
    minfrac_l=$params.ipo_minfrac_l_neg  \\
    minfrac_h=$params.ipo_minfrac_h_neg \\
    mzwid_l=$params.ipo_mzwid_l_neg \\
    mzwid_h=$params.ipo_mzwid_h_neg \\
    minsamp_l=$params.ipo_minsamp_l_neg  \\
    minsamp_h=$params.ipo_minsamp_h_neg \\
    max_l=$params.ipo_max_l_neg \\
    max_h=$params.ipo_max_h_neg \\
    ncores=$params.ipo_ncores_neg \\
    outputxset=quant_params_neg.json \\
    outputrt=rt_params_neg.json
"""
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
"""
findPeaks.r \\
    input=\$PWD/$mzMLFile \\
    output=\$PWD/${mzMLFile.baseName}.rdata \\
    ppm=$params.masstrace_ppm_neg_xcms \\
    peakwidthLow=$params.peakwidthlow_quant_neg_xcms  \\
    peakwidthHigh=$params.peakwidthhigh_quant_neg_xcms \\
    noise=$params.noise_quant_neg_xcms \\
    polarity=negative \\
    realFileName=$mzMLFile \\
    phenoFile=$phenotype_file \\
    phenoDataColumn=$params.phenodatacolumn_quant_neg  \\
    sampleClass=$params.sampleclass_quant_neg_xcms \\
    mzdiff=$params.mzdiff_quant_neg_xcms \\
    snthresh=$params.snthresh_quant_neg_xcms \\
    prefilter_l=$params.prefilter_quant_neg_xcms  \\
    prefilter_h=$params.value_of_prefilter_quant_neg_xcms \\
    mzCenterFun=$params.mzCenterFun_quant_neg_xcms \\
    integrate=$params.integrate_quant_neg_xcms \\
    fitgauss=$params.fitgauss_quant_neg_xcms  \\
    methodXset=$params.ipo_methodXset_neg \\
    methodRT=$params.ipo_methodRT_neg \\
    noise_l=$params.ipo_noise_l_neg  \\
    noise_h=$params.ipo_noise_h_neg \\
    prefilter_l_l=$params.ipo_prefilter_l_l_neg \\
    prefilter_l_h=$params.ipo_prefilter_l_h_neg  \\
    prefilter_h_l=$params.ipo_prefilter_h_l_neg \\
    prefilter_h_h=$params.ipo_prefilter_h_h_neg  \\
    snthresh_l=$params.ipo_snthresh_l_neg \\
    snthresh_h=$params.ipo_snthresh_h_neg \\
    mzCenterFun=$params.ipo_mzCenterFun_neg  \\
    integrate=$params.ipo_integrate_neg \\
    fitgauss=$params.ipo_fitgauss_neg \\
    ipo_min_peakwidth_l=$params.ipo_min_peakwidth_l_neg  \\
    ipo_min_peakwidth_h=$params.ipo_min_peakwidth_h_neg \\
    ipo_max_peakwidth_l=$params.ipo_max_peakwidth_l_neg \\
    ipo_max_peakwidth_h=$params.ipo_max_peakwidth_h_neg \\
    ipo_ppm_l=$params.ipo_ppm_l_neg  \\
    ipo_ppm_h=$params.ipo_ppm_h_neg \\
    ipo_mzdiff_l=$params.ipo_mzdiff_l_neg \\
    ipo_mzdiff_h=$params.ipo_mzdiff_h_neg \\
    ipo_charge_camera=$params.ipo_charge_camera_neg \\
    ipo_max_ppm_camera=$params.ipo_max_ppm_camera_neg  \\
    ipo_inv=$ipo_neg_localQ \\
    $filter_argument
"""
NextFlow From line 2987 of 1.0.1/main.nf
3057
3058
3059
"""
FeatureFinderMetabo -in $mzMLFile -out ${mzMLFile.baseName}.featureXML -ini $setting_file
"""
NextFlow From line 3057 of 1.0.1/main.nf
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
"""
featurexmlToCamera.r \\
    input=$mzMLFile \\
    realFileName=$mzMLFile \\
    mzMLfiles=\$PWD/$mzMLFile2 \\
    polarity=negative \\
    output=${mzMLFile.baseName}.rdata \\
    phenoFile=$phenotype_file  \\
    phenoDataColumn=$params.phenodatacolumn_quant_neg \\
    sampleClass=$params.sampleclass_quant_neg_xcms \\
    changeNameTO=${mzMLFile.baseName}.mzML
"""
NextFlow From line 3079 of 1.0.1/main.nf
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
"""
touch quant_params_neg.json
touch rt_params_neg.json

ipo.r \\
    input=$inputs_aggregated \\
    quantOnly=$ipo_neg_globalAvoidRT \\
    allSamples=$params.ipo_allSamples_neg \\
    columnToSelect=$params.ipo_columnToSelect_neg  \\
    valueToSelect=$params.ipo_valueToSelect_neg \\
    phenoFile=$phenotype_file  \\
    methodXset=$params.ipo_methodXset_neg \\
    methodRT=$params.ipo_methodRT_neg \\
    noise_l=$params.ipo_noise_l_neg  \\
    noise_h=$params.ipo_noise_h_neg \\
    prefilter_l_l=$params.ipo_prefilter_l_l_neg \\
    prefilter_l_h=$params.ipo_prefilter_l_h_neg  \\
    prefilter_h_l=$params.ipo_prefilter_h_l_neg \\
    prefilter_h_h=$params.ipo_prefilter_h_h_neg  \\
    snthresh_l=$params.ipo_snthresh_l_neg \\
    snthresh_h=$params.ipo_snthresh_h_neg \\
    mzCenterFun=$params.ipo_mzCenterFun_neg  \\
    integrate=$params.ipo_integrate_neg \\
    fitgauss=$params.ipo_fitgauss_neg \\
    ipo_min_peakwidth_l=$params.ipo_min_peakwidth_l_neg  \\
    ipo_min_peakwidth_h=$params.ipo_min_peakwidth_h_neg \\
    ipo_max_peakwidth_l=$params.ipo_max_peakwidth_l_neg \\
    ipo_max_peakwidth_h=$params.ipo_max_peakwidth_h_neg \\
    ipo_ppm_l=$params.ipo_ppm_l_neg  \\
    ipo_ppm_h=$params.ipo_ppm_h_neg \\
    ipo_mzdiff_l=$params.ipo_mzdiff_l_neg \\
    ipo_mzdiff_h=$params.ipo_mzdiff_h_neg \\
    ipo_charge_camera=$params.ipo_charge_camera_neg \\
    ipo_max_ppm_camera=$params.ipo_max_ppm_camera_neg  \\
    response_l=$params.ipo_response_l_neg \\
    response_h=$params.ipo_response_h_neg \\
    distFunc=$params.ipo_distFunc_neg \\
    factorDiag_l=$params.ipo_factorDiag_l_neg \\
    factorDiag_h=$params.ipo_factorDiag_h_neg \\
    factorGap_l=$params.ipo_factorGap_l_neg  \\
    factorGap_h=$params.ipo_factorGap_h_neg \\
    localAlignment=$params.ipo_localAlignment_neg \\
    ipo_gapInit_l=$params.ipo_gapInit_l_neg \\
    ipo_gapInit_h=$params.ipo_gapInit_h_neg \\
    ipo_gapExtend_l=$params.ipo_gapExtend_l_neg  \\
    ipo_gapExtend_h=$params.ipo_gapExtend_h_neg \\
    ipo_profStep_l=$params.ipo_profStep_l_neg \\
    ipo_profStep_h=$params.ipo_profStep_h_neg \\
    bw_l=$params.ipo_bw_l_neg \\
    bw_h=$params.ipo_bw_h_neg \\
    minfrac_l=$params.ipo_minfrac_l_neg  \\
    minfrac_h=$params.ipo_minfrac_h_neg \\
    mzwid_l=$params.ipo_mzwid_l_neg \\
    mzwid_h=$params.ipo_mzwid_h_neg \\
    minsamp_l=$params.ipo_minsamp_l_neg  \\
    minsamp_h=$params.ipo_minsamp_h_neg \\
    max_l=$params.ipo_max_l_neg \\
    max_h=$params.ipo_max_h_neg \\
    ncores=$params.ipo_ncores_neg \\
    outputxset=quant_params_neg.json \\
    outputrt=rt_params_neg.json
"""
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
"""
findPeaks.r \\
    input=\$PWD/$mzMLFile \\
    output=\$PWD/${mzMLFile.baseName}.rdata \\
    ppm=$params.masstrace_ppm_neg_xcms \\
    peakwidthLow=$params.peakwidthlow_quant_neg_xcms  \\
    peakwidthHigh=$params.peakwidthhigh_quant_neg_xcms \\
    noise=$params.noise_quant_neg_xcms \\
    polarity=negative \\
    realFileName=$mzMLFile \\
    phenoFile=$phenotype_file \\
    phenoDataColumn=$params.phenodatacolumn_quant_neg  \\
    sampleClass=$params.sampleclass_quant_neg_xcms \\
    mzdiff=$params.mzdiff_quant_neg_xcms \\
    snthresh=$params.snthresh_quant_neg_xcms \\
    prefilter_l=$params.prefilter_quant_neg_xcms  \\
    prefilter_h=$params.value_of_prefilter_quant_neg_xcms \\
    mzCenterFun=$params.mzCenterFun_quant_neg_xcms \\
    integrate=$params.integrate_quant_neg_xcms \\
    fitgauss=$params.fitgauss_quant_neg_xcms  \\
    methodXset=$params.ipo_methodXset_neg \\
    methodRT=$params.ipo_methodRT_neg \\
    noise_l=$params.ipo_noise_l_neg  \\
    noise_h=$params.ipo_noise_h_neg \\
    prefilter_l_l=$params.ipo_prefilter_l_l_neg \\
    prefilter_l_h=$params.ipo_prefilter_l_h_neg  \\
    prefilter_h_l=$params.ipo_prefilter_h_l_neg \\
    prefilter_h_h=$params.ipo_prefilter_h_h_neg  \\
    snthresh_l=$params.ipo_snthresh_l_neg \\
    snthresh_h=$params.ipo_snthresh_h_neg \\
    mzCenterFun=$params.ipo_mzCenterFun_neg  \\
    integrate=$params.ipo_integrate_neg \\
    fitgauss=$params.ipo_fitgauss_neg \\
    ipo_min_peakwidth_l=$params.ipo_min_peakwidth_l_neg  \\
    ipo_min_peakwidth_h=$params.ipo_min_peakwidth_h_neg \\
    ipo_max_peakwidth_l=$params.ipo_max_peakwidth_l_neg \\
    ipo_max_peakwidth_h=$params.ipo_max_peakwidth_h_neg \\
    ipo_ppm_l=$params.ipo_ppm_l_neg  \\
    ipo_ppm_h=$params.ipo_ppm_h_neg \\
    ipo_mzdiff_l=$params.ipo_mzdiff_l_neg \\
    ipo_mzdiff_h=$params.ipo_mzdiff_h_neg \\
    ipo_charge_camera=$params.ipo_charge_camera_neg \\
    ipo_max_ppm_camera=$params.ipo_max_ppm_camera_neg  \\
    ipo_inv=$ipo_neg_localQ \\
    $filter_argument
"""
NextFlow From line 3200 of 1.0.1/main.nf
3267
3268
3269
3270
"""
nextFlowDIR=\$PWD
xcmsCollect.r input=$inputs_aggregated output=collection_neg.rdata
"""
NextFlow From line 3267 of 1.0.1/main.nf
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
"""
retCor.r \\
    input=\$PWD/$rdata_files \\
    output=RTcorrected_neg.rdata \\
    method=obiwarp \\
    response_l=$params.ipo_response_l_neg \\
    response_h=$params.ipo_response_h_neg \\
    distFunc=$params.ipo_distFunc_neg \\
    factorDiag_l=$params.ipo_factorDiag_l_neg \\
    factorDiag_h=$params.ipo_factorDiag_h_neg \\
    factorGap_l=$params.ipo_factorGap_l_neg  \\
    factorGap_h=$params.ipo_factorGap_h_neg \\
    localAlignment=$params.ipo_localAlignment_neg \\
    ipo_gapInit_l=$params.ipo_gapInit_l_neg \\
    ipo_gapInit_h=$params.ipo_gapInit_h_neg \\
    ipo_gapExtend_l=$params.ipo_gapExtend_l_neg  \\
    ipo_gapExtend_h=$params.ipo_gapExtend_h_neg \\
    ipo_profStep_l=$params.ipo_profStep_l_neg \\
    ipo_profStep_h=$params.ipo_profStep_h_neg \\
    bw_l=$params.ipo_bw_l_neg \\
    bw_h=$params.ipo_bw_h_neg \\
    minfrac_l=$params.ipo_minfrac_l_neg  \\
    minfrac_h=$params.ipo_minfrac_h_neg \\
    mzwid_l=$params.ipo_mzwid_l_neg \\
    mzwid_h=$params.ipo_mzwid_h_neg \\
    minsamp_l=$params.ipo_minsamp_l_neg  \\
    minsamp_h=$params.ipo_minsamp_h_neg \\
    max_l=$params.ipo_max_l_neg \\
    max_h=$params.ipo_max_h_neg \\
    ipo_inv=$ipo_neg_localRT \\
    ncores=$params.ipo_ncores_neg  \\
    profStep=$params.profStep_align_N1_neg_xcms \\
    center=$params.center_align_N1_neg_xcms \\
    response=$params.response_align_N1_neg_xcms  \\
    distFunc=$params.distFunc_align_N1_neg_xcms \\
    gapInit=$params.gapInit_align_N1_neg_xcms \\
    gapExtend=$params.gapExtend_align_N1_neg_xcms  \\
    factorDiag=$params.factorDiag_align_N1_neg_xcms \\
    factorGap=$params.factorGap_align_N1_neg_xcms \\
    localAlignment=$params.localAlignment_align_N1_neg_xcms \\
    $filter_argument \\
    inputraw=$inputs_aggregated
"""
NextFlow From line 3294 of 1.0.1/main.nf
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
"""
group.r \\
    input=$rdata_files \\
    output=groupN1_neg.rdata \\
    bandwidth=$params.bandwidth_group_N1_neg_xcms \\
    minfrac=$params.minfrac_group_N1_neg_xcms \\
    minsamp=$params.minsamp_group_N1_neg_xcms \\
    max=$params.max_group_N1_neg_xcms  \\
    mzwid=$params.mzwid_group_N1_neg_xcms
"""
NextFlow From line 3354 of 1.0.1/main.nf
3386
3387
3388
3389
3390
3391
3392
3393
3394
"""
blankfilter.r \\
    input=$rdata_files \\
    output=blankFiltered_neg.rdata \\
    method=$params.method_blankfilter_neg_xcms \\
    blank=$params.blank_blankfilter_neg_xcms \\
    sample=$params.sample_blankfilter_neg_xcms \\
    rest=$params.rest_blankfilter_neg_xcms
"""
NextFlow From line 3386 of 1.0.1/main.nf
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
"""
dilutionfilter.r \\
    input=$rdata_files \\
    output=dilutionFiltered_neg.rdata \\
    Corto=$params.corto_dilutionfilter_neg_xcms  \\
    dilution=$params.dilution_dilutionfilter_neg_xcms \\
    pvalue=$params.pvalue_dilutionfilter_neg_xcms \\
    corcut=$params.corcut_dilutionfilter_neg_xcms \\
    abs=$params.abs_dilutionfilter_neg_xcms
"""
NextFlow From line 3419 of 1.0.1/main.nf
3452
3453
3454
3455
3456
3457
3458
"""
cvfilter.r \\
    input=$rdata_files \\
    output=cvFiltered_neg.rdata \\
    qc=$params.qc_cvfilter_neg_xcms \\
    cvcut=$params.cvcut_cvfilter_neg_xcms
"""
NextFlow From line 3452 of 1.0.1/main.nf
3481
3482
3483
"""
xsAnnotate.r input=$rdata_files output=CameraAnnotatePeaks_neg.rdata
"""
NextFlow From line 3481 of 1.0.1/main.nf
3502
3503
3504
3505
3506
3507
3508
3509
"""
groupFWHM.r \\
    input=$rdata_files \\
    output=CameraGroup_neg.rdata \\
    sigma=$params.sigma_group_neg_camera \\
    perfwhm=$params.perfwhm_group_neg_camera \\
    intval=$params.intval_group_neg_camera
"""
NextFlow From line 3502 of 1.0.1/main.nf
3528
3529
3530
3531
3532
3533
3534
"""
findAdducts.r \\
    input=$rdata_files \\
    output=CameraFindAdducts_neg.rdata \\
    ppm=$params.ppm_findaddcuts_neg_camera \\
    polarity=$params.polarity_findaddcuts_neg_camera
"""
NextFlow From line 3528 of 1.0.1/main.nf
3553
3554
3555
3556
3557
3558
"""
findIsotopes.r \\
    input=$rdata_files \\
    output=CameraFindIsotopes_neg.rdata \\
    maxcharge=$params.maxcharge_findisotopes_neg_camera
"""
NextFlow From line 3553 of 1.0.1/main.nf
3584
3585
3586
3587
3588
3589
"""
readMS2MSnBase.r \\
    input=$mzMLFile \\
    output=${mzMLFile.baseName}.rdata \\
    inputname=${mzMLFile.baseName}
"""
NextFlow From line 3584 of 1.0.1/main.nf
3611
3612
3613
3614
3615
3616
3617
3618
"""
mapMS2ToCamera.r \\
    inputCAMERA=$rdata_files_ms1 \\
    inputMS2=$input_args \\
    output=MapMsms2Camera_neg.rdata  \\
    ppm=$params.ppm_mapmsmstocamera_neg_msnbase \\
    rt=$params.rt_mapmsmstocamera_neg_msnbase
"""
NextFlow From line 3611 of 1.0.1/main.nf
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
"""
mkdir out

MS2ToMetFrag.r \\
    inputCAMERA=$rdata_files_ms1 \\
    inputMS2=$rdata_files_ms2 \\
    output=out \\
    precursorppm=$params.precursorppm_msmstoparam_neg_msnbase  \\
    fragmentppm=$params.fragmentppm_msmstoparam_neg_msnbase \\
    fragmentabs=$params.fragmentabs_msmstoparam_neg_msnbase \\
    database=$params.database_msmstoparam_neg_msnbase  \\
    mode=$params.mode_msmstoparam_neg_msnbase \\
    adductRules=$params.adductRules_msmstoparam_neg_msnbase \\
    minPeaks=$params.minPeaks_msmstoparam_neg_msnbase

ls out/ -A -1  | cut -d'_' -f4- | tr ' ' '\n' | sort -u | xargs -I %  find out/ -type f -iname *% -exec zip %.zip {} +
"""
NextFlow From line 3638 of 1.0.1/main.nf
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
"""
mkdir inputs
mkdir outputs
unzip  -j $parameters -d inputs/
touch ${parameters.baseName}_class_Csifingerid_neg.csv

fingerID.r \\
    input=\$PWD/inputs \\
    database=$params.database_csifingerid_neg_csifingerid \\
    tryOffline=T \\
    output=\$PWD/outputs/ \\
    ncores=$params.ncore_csifingerid_neg_csifingerid  \\
    timeout=$params.timeout_csifingerid_neg_csifingerid \\
    canopus=T \\
    canopusOutput=\$PWD/${parameters.baseName}_class_Csifingerid_neg.csv

zip -j -r ${parameters.baseName}_Csifingerid_neg.zip outputs/*.csv
"""
NextFlow From line 3682 of 1.0.1/main.nf
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
"""
ulimit -s unlimited
mkdir all
for x in *.zip ; do unzip -d all -o -u \$x ; done
zip -r Csifingerid_neg.zip all

aggregateMetfrag.r \\
    inputs=Csifingerid_neg.zip \\
    realNames=Csifingerid_neg.zip \\
    output=aggregated_identification_csifingerid_neg.csv \\
    filetype=zip \\
    outTable=T

sed -i '/^\$/d' aggregated_identification_csifingerid_neg.csv
"""
NextFlow From line 3717 of 1.0.1/main.nf
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
"""
if [ -s $identification_result ]; then
    metfragPEP.r \\
        input=$identification_result \\
        score=score \\
        output=pep_identification_csifingerid_neg.csv \\
        readTable=T
else
    touch pep_identification_csifingerid_neg.csv
fi
"""
NextFlow From line 3751 of 1.0.1/main.nf
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
"""
if [ -s $csifingerid_input_identification ]; then

    prepareOutput.r \\
        inputcamera=$camera_input_quant \\
        inputscores=$csifingerid_input_identification \\
        inputpheno=$phenotype_file \\
        ppm=$params.ppm_output_neg_camera  \\
        rt=$params.rt_output_neg_camera \\
        higherTheBetter=true \\
        scoreColumn=score \\
        impute=$params.impute_output_neg_camera \\
        typeColumn=$params.type_column_output_neg_camera \\
        selectedType=$params.selected_type_output_neg_camera  \\
        rename=$params.rename_output_neg_camera \\
        renameCol=$params.rename_col_output_neg_camera \\
        onlyReportWithID=$params.only_report_with_id_output_neg_camera \\
        combineReplicate=$params.combine_replicate_output_neg_camera  \\
        combineReplicateColumn=$params.combine_replicate_column_output_neg_camera \\
        log=$params.log_output_neg_camera \\
        sampleCoverage=$params.sample_coverage_output_neg_camera \\
        outputPeakTable=peaktableNEGout_neg_csifingerid.txt  \\
        outputVariables=varsNEGout_neg_csifingerid.txt \\
        outputMetaData=metadataNEGout_neg_csifingerid.txt \\
        Ifnormalize=$params.normalize_output_neg_camera

else

    prepareOutput.r \\
        inputcamera=$camera_input_quant \\
        inputpheno=$phenotype_file \\
        ppm=$params.ppm_output_neg_camera \\
        rt=$params.rt_output_neg_camera \\
        higherTheBetter=true \\
        scoreColumn=score  \\
        impute=$params.impute_output_neg_camera \\
        typeColumn=$params.type_column_output_neg_camera \\
        selectedType=$params.selected_type_output_neg_camera \\
        rename=$params.rename_output_neg_camera \\
        renameCol=$params.rename_col_output_neg_camera  \\
        onlyReportWithID=$params.only_report_with_id_output_neg_camera \\
        combineReplicate=$params.combine_replicate_output_neg_camera \\
        combineReplicateColumn=$params.combine_replicate_column_output_neg_camera  \\
        log=$params.log_output_neg_camera \\
        sampleCoverage=$params.sample_coverage_output_neg_camera \\
        outputPeakTable=peaktableNEGout_neg_csifingerid.txt \\
        outputVariables=varsNEGout_neg_csifingerid.txt  \\
        outputMetaData=metadataNEGout_neg_csifingerid.txt \\
        Ifnormalize=$params.normalize_output_neg_camera

fi
"""
NextFlow From line 3782 of 1.0.1/main.nf
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
"""
mkdir inputs
mkdir outputs
unzip  -j $parameters -d inputs/
touch ${parameters.baseName}.csv
find "\$PWD/inputs" -type f | \\
    parallel \\
        -j $params.ncore_neg_metfrag \\
        run_metfrag.sh  \\
        -p {} \\
        -f \$PWD/outputs/{/.}.csv \\
        -l "\$PWD/$metfrag_database" \\
        -s "OfflineMetFusionScore"
zip -j -r ${parameters.baseName}_metfrag_neg.zip outputs/*.csv
"""
NextFlow From line 3878 of 1.0.1/main.nf
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
"""
ulimit -s unlimited
mkdir all
for x in *.zip ; do unzip -d all -o -u \$x ; done
zip -r metfrag_neg.zip all

aggregateMetfrag.r \\
    inputs=metfrag_neg.zip \\
    realNames=metfrag_neg.zip \\
    output=aggregated_identification_metfrag_neg.csv \\
    filetype=zip \\
    outTable=T

sed -i '/^\$/d' aggregated_identification_metfrag_neg.csv
"""
NextFlow From line 3911 of 1.0.1/main.nf
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
"""
if [ -s $identification_result ]; then
    metfragPEP.r \\
        input=$identification_result \\
        score=FragmenterScore \\
        output=pep_identification_metfrag_neg.csv \\
        readTable=T
else
    touch pep_identification_metfrag_neg.csv
fi
"""
NextFlow From line 3943 of 1.0.1/main.nf
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
"""
if [ -s $metfrag_input_identification ]; then

    prepareOutput.r \\
        inputcamera=$camera_input_quant \\
        inputscores=$metfrag_input_identification \\
        inputpheno=$phenotype_file \\
        ppm=$params.ppm_output_neg_camera \\
        rt=$params.rt_output_neg_camera  \\
        higherTheBetter=true \\
        scoreColumn=FragmenterScore \\
        impute=$params.impute_output_neg_camera \\
        typeColumn=$params.type_column_output_neg_camera \\
        selectedType=$params.selected_type_output_neg_camera  \\
        rename=$params.rename_output_neg_camera \\
        renameCol=$params.rename_col_output_neg_camera \\
        onlyReportWithID=$params.only_report_with_id_output_neg_camera \\
        combineReplicate=$params.combine_replicate_output_neg_camera  \\
        combineReplicateColumn=$params.combine_replicate_column_output_neg_camera \\
        log=$params.log_output_neg_camera \\
        sampleCoverage=$params.sample_coverage_output_neg_camera \\
        outputPeakTable=peaktableNEGout_neg_metfrag.txt  \\
        outputVariables=varsNEGout_neg_metfrag.txt \\
        outputMetaData=metadataNEGout_neg_metfrag.txt \\
        Ifnormalize=$params.normalize_output_neg_camera

else

    prepareOutput.r \\
        inputcamera=$camera_input_quant \\
        inputpheno=$phenotype_file \\
        ppm=$params.ppm_output_neg_camera \\
        rt=$params.rt_output_neg_camera \\
        higherTheBetter=true \\
        scoreColumn=FragmenterScore  \\
        impute=$params.impute_output_neg_camera \\
        typeColumn=$params.type_column_output_neg_camera \\
        selectedType=$params.selected_type_output_neg_camera \\
        rename=$params.rename_output_neg_camera \\
        renameCol=$params.rename_col_output_neg_camera  \\
        onlyReportWithID=$params.only_report_with_id_output_neg_camera \\
        combineReplicate=$params.combine_replicate_output_neg_camera \\
        combineReplicateColumn=$params.combine_replicate_column_output_neg_camera \\
        log=$params.log_output_neg_camera  \\
        sampleCoverage=$params.sample_coverage_output_neg_camera \\
        outputPeakTable=peaktableNEGout_neg_metfrag.txt \\
        outputVariables=varsNEGout_neg_metfrag.txt \\
        outputMetaData=metadataNEGout_neg_metfrag.txt \\
        Ifnormalize=$params.normalize_output_neg_camera

fi
"""
NextFlow From line 3975 of 1.0.1/main.nf
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
"""
mkdir inputs
mkdir outputs
unzip  -j $parameters -d inputs/
touch ${parameters.baseName}.csv

find "\$PWD/inputs" -type f | \\
    parallel \\
        -j $params.ncore_neg_cfmid \\
        cfmid.r \\
        input={} \\
        realName={/} \\
        databaseFile=\$PWD/$cfmid_database \\
        output=\$PWD/outputs/{/.}.csv \\
        candidate_id=$params.candidate_id_identification_neg_cfmid \\
        candidate_inchi_smiles=$params.candidate_inchi_smiles_identification_neg_cfmid  \\
        candidate_mass=$params.candidate_mass_identification_neg_cfmid \\
        databaseNameColumn=$params.database_name_column_identification_neg_cfmid \\
        databaseInChIColumn=$params.database_inchI_column_identification_neg_cfmid \\
        scoreType=Jaccard

zip -j -r ${parameters.baseName}_cfmid_neg.zip outputs/*.csv
"""
NextFlow From line 4060 of 1.0.1/main.nf
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
"""
ulimit -s unlimited
mkdir all
for x in *.zip ; do unzip -d all -o -u \$x ; done
zip -r cfmid_neg.zip all

aggregateMetfrag.r \\
    inputs=cfmid_neg.zip \\
    realNames=cfmid_neg.zip \\
    output=aggregated_identification_cfmid_neg.csv \\
    filetype=zip \\
    outTable=T

sed -i '/^\$/d' aggregated_identification_cfmid_neg.csv
"""
NextFlow From line 4101 of 1.0.1/main.nf
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
"""
if [ -s $identification_result ]; then
    metfragPEP.r \\
        input=$identification_result \\
        score=Jaccard_Score \\
        output=pep_identification_cfmid_neg.csv \\
        readTable=T
else
    touch pep_identification_cfmid_neg.csv
fi
"""
NextFlow From line 4134 of 1.0.1/main.nf
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
"""
if [ -s $cfmid_input_identification ]; then
    prepareOutput.r \\
        inputcamera=$camera_input_quant \\
        inputscores=$cfmid_input_identification \\
        inputpheno=$phenotype_file \\
        ppm=$params.ppm_output_neg_camera \\
        rt=$params.rt_output_neg_camera  \\
        higherTheBetter=true \\
        scoreColumn=Jaccard_Score \\
        impute=$params.impute_output_neg_camera \\
        typeColumn=$params.type_column_output_neg_camera \\
        selectedType=$params.selected_type_output_neg_camera  \\
        rename=$params.rename_output_neg_camera \\
        renameCol=$params.rename_col_output_neg_camera \\
        onlyReportWithID=$params.only_report_with_id_output_neg_camera \\
        combineReplicate=$params.combine_replicate_output_neg_camera  \\
        combineReplicateColumn=$params.combine_replicate_column_output_neg_camera \\
        log=$params.log_output_neg_camera \\
        sampleCoverage=$params.sample_coverage_output_neg_camera \\
        outputPeakTable=peaktableNEGout_neg_cfmid.txt  \\
        outputVariables=varsNEGout_neg_cfmid.txt \\
        outputMetaData=metadataNEGout_neg_cfmid.txt \\
        Ifnormalize=$params.normalize_output_neg_camera

else

    prepareOutput.r \\
        inputcamera=$camera_input_quant \\
        inputpheno=$phenotype_file \\
        ppm=$params.ppm_output_neg_camera \\
        rt=$params.rt_output_neg_camera \\
        higherTheBetter=true \\
        scoreColumn=Jaccard_Score  \\
        impute=$params.impute_output_neg_camera \\
        typeColumn=$params.type_column_output_neg_camera \\
        selectedType=$params.selected_type_output_neg_camera \\
        rename=$params.rename_output_neg_camera \\
        renameCol=$params.rename_col_output_neg_camera  \\
        onlyReportWithID=$params.only_report_with_id_output_neg_camera \\
        combineReplicate=$params.combine_replicate_output_neg_camera \\
        combineReplicateColumn=$params.combine_replicate_column_output_neg_camera \\
        log=$params.log_output_neg_camera  \\
        sampleCoverage=$params.sample_coverage_output_neg_camera \\
        outputPeakTable=peaktableNEGout_neg_cfmid.txt \\
        outputVariables=varsNEGout_neg_cfmid.txt \\
        outputMetaData=metadataNEGout_neg_cfmid.txt \\
        Ifnormalize=$params.normalize_output_neg_camera

fi
"""
NextFlow From line 4166 of 1.0.1/main.nf
4244
4245
4246
"""
PeakPickerHiRes -in $mzMLFile -out $mzMLFile -ini $setting_file
"""
NextFlow From line 4244 of 1.0.1/main.nf
4267
4268
4269
"""
FeatureFinderMetabo -in $mzMLFile -out ${mzMLFile.baseName}.featureXML -ini $setting_file
"""
NextFlow From line 4267 of 1.0.1/main.nf
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
"""
featurexmlToCamera.r \\
    input=$mzMLFile \\
    realFileName=$mzMLFile \\
    mzMLfiles=\$PWD/$mzMLFile2 \\
    polarity=negative \\
    output=${mzMLFile.baseName}.rdata \\
    sampleClass=library \\
    changeNameTO=${mzMLFile.baseName}.mzML
"""
NextFlow From line 4288 of 1.0.1/main.nf
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
"""
touch quant_params_library_neg.json
touch rt_params_library_neg.json

ipo.r \\
    input=$inputs_aggregated \\
    quantOnly=TRUE \\
    allSamples=TRUE  \\
    methodXset=$params.ipo_methodXset_library_neg \\
    methodRT=$params.ipo_methodRT_library_neg \\
    noise_l=$params.ipo_noise_l_library_neg  \\
    noise_h=$params.ipo_noise_h_library_neg \\
    prefilter_l_l=$params.ipo_prefilter_l_l_library_neg \\
    prefilter_l_h=$params.ipo_prefilter_l_h_library_neg  \\
    prefilter_h_l=$params.ipo_prefilter_h_l_library_neg \\
    prefilter_h_h=$params.ipo_prefilter_h_h_library_neg  \\
    snthresh_l=$params.ipo_snthresh_l_library_neg \\
    snthresh_h=$params.ipo_snthresh_h_library_neg \\
    mzCenterFun=$params.ipo_mzCenterFun_library_neg  \\
    integrate=$params.ipo_integrate_library_neg \\
    fitgauss=$params.ipo_fitgauss_library_neg \\
    ipo_min_peakwidth_l=$params.ipo_min_peakwidth_l_library_neg  \\
    ipo_min_peakwidth_h=$params.ipo_min_peakwidth_h_library_neg \\
    ipo_max_peakwidth_l=$params.ipo_max_peakwidth_l_library_neg \\
    ipo_max_peakwidth_h=$params.ipo_max_peakwidth_h_library_neg \\
    ipo_ppm_l=$params.ipo_ppm_l_library_neg  \\
    ipo_ppm_h=$params.ipo_ppm_h_library_neg \\
    ipo_mzdiff_l=$params.ipo_mzdiff_l_library_neg \\
    ipo_mzdiff_h=$params.ipo_mzdiff_h_library_neg \\
    ipo_charge_camera=$params.ipo_charge_camera_library_neg \\
    ipo_max_ppm_camera=$params.ipo_max_ppm_camera_library_neg  \\
    response_l=$params.ipo_response_l_library_neg \\
    response_h=$params.ipo_response_h_library_neg \\
    distFunc=$params.ipo_distFunc_library_neg \\
    factorDiag_l=$params.ipo_factorDiag_l_library_neg \\
    factorDiag_h=$params.ipo_factorDiag_h_library_neg \\
    factorGap_l=$params.ipo_factorGap_l_library_neg  \\
    factorGap_h=$params.ipo_factorGap_h_library_neg \\
    localAlignment=$params.ipo_localAlignment_library_neg \\
    ipo_gapInit_l=$params.ipo_gapInit_l_library_neg \\
    ipo_gapInit_h=$params.ipo_gapInit_h_library_neg \\
    ipo_gapExtend_l=$params.ipo_gapExtend_l_library_neg  \\
    ipo_gapExtend_h=$params.ipo_gapExtend_h_library_neg \\
    ipo_profStep_l=$params.ipo_profStep_l_library_neg \\
    ipo_profStep_h=$params.ipo_profStep_h_library_neg \\
    bw_l=$params.ipo_bw_l_library_neg \\
    bw_h=$params.ipo_bw_h_library_neg \\
    minfrac_l=$params.ipo_minfrac_l_library_neg  \\
    minfrac_h=$params.ipo_minfrac_h_library_neg \\
    mzwid_l=$params.ipo_mzwid_l_library_neg \\
    mzwid_h=$params.ipo_mzwid_h_library_neg \\
    minsamp_l=$params.ipo_minsamp_l_library_neg  \\
    minsamp_h=$params.ipo_minsamp_h_library_neg \\
    max_l=$params.ipo_max_l_library_neg \\
    max_h=$params.ipo_max_h_library_neg \\
    ncores=$params.ipo_ncores_library_neg \\
    outputxset=quant_params_library_neg.json \\
    outputrt=rt_params_library_neg.json
"""
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
"""
findPeaks.r \\
    input=\$PWD/$mzMLFile \\
    output=\$PWD/${mzMLFile.baseName}.rdata \\
    ppm=$params.masstrace_ppm_library_neg_xcms \\
    peakwidthLow=$params.peakwidthlow_quant_library_neg_xcms  \\
    peakwidthHigh=$params.peakwidthhigh_quant_library_neg_xcms \\
    noise=$params.noise_quant_library_neg_xcms \\
    polarity=negative \\
    realFileName=$mzMLFile \\
    sampleClass=$params.sampleclass_quant_library_neg_xcms  \\
    mzdiff=$params.mzdiff_quant_library_neg_xcms \\
    snthresh=$params.snthresh_quant_library_neg_xcms \\
    prefilter_l=$params.prefilter_quant_library_neg_xcms \\
    prefilter_h=$params.value_of_prefilter_quant_library_neg_xcms  \\
    mzCenterFun=$params.mzCenterFun_quant_library_neg_xcms \\
    integrate=$params.integrate_quant_library_neg_xcms \\
    fitgauss=$params.fitgauss_quant_library_neg_xcms  \\
    methodXset=$params.ipo_methodXset_library_neg \\
    methodRT=$params.ipo_methodRT_library_neg \\
    noise_l=$params.ipo_noise_l_library_neg  \\
    noise_h=$params.ipo_noise_h_library_neg \\
    prefilter_l_l=$params.ipo_prefilter_l_l_library_neg \\
    prefilter_l_h=$params.ipo_prefilter_l_h_library_neg  \\
    prefilter_h_l=$params.ipo_prefilter_h_l_library_neg \\
    prefilter_h_h=$params.ipo_prefilter_h_h_library_neg  \\
    snthresh_l=$params.ipo_snthresh_l_library_neg \\
    snthresh_h=$params.ipo_snthresh_h_library_neg \\
    mzCenterFun=$params.ipo_mzCenterFun_library_neg  \\
    integrate=$params.ipo_integrate_library_neg \\
    fitgauss=$params.ipo_fitgauss_library_neg \\
    ipo_min_peakwidth_l=$params.ipo_min_peakwidth_l_library_neg  \\
    ipo_min_peakwidth_h=$params.ipo_min_peakwidth_h_library_neg \\
    ipo_max_peakwidth_l=$params.ipo_max_peakwidth_l_library_neg \\
    ipo_max_peakwidth_h=$params.ipo_max_peakwidth_h_library_neg \\
    ipo_ppm_l=$params.ipo_ppm_l_library_neg  \\
    ipo_ppm_h=$params.ipo_ppm_h_library_neg \\
    ipo_mzdiff_l=$params.ipo_mzdiff_l_library_neg \\
    ipo_mzdiff_h=$params.ipo_mzdiff_h_library_neg \\
    ipo_charge_camera=$params.ipo_charge_camera_library_neg  \\
    ipo_max_ppm_camera=$params.ipo_max_ppm_camera_library_neg  \\
    ipo_inv=$ipo_library_neg_localQ \\
    $filter_argument
"""
NextFlow From line 4401 of 1.0.1/main.nf
4467
4468
4469
"""
FeatureFinderMetabo -in $mzMLFile -out ${mzMLFile.baseName}.featureXML -ini $setting_file
"""
NextFlow From line 4467 of 1.0.1/main.nf
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
"""
featurexmlToCamera.r \\
    input=$mzMLFile \\
    realFileName=$mzMLFile \\
    mzMLfiles=\$PWD/$mzMLFile2 \\
    polarity=negative \\
    output=${mzMLFile.baseName}.rdata \\
    sampleClass=library \\
    changeNameTO=${mzMLFile.baseName}.mzML
"""
NextFlow From line 4488 of 1.0.1/main.nf
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
"""
touch quant_params_library_neg.json
touch rt_params_library_neg.json

ipo.r \\
    input=$inputs_aggregated \\
    quantOnly=TRUE \\
    allSamples=TRUE  \\
    methodXset=$params.ipo_methodXset_library_neg \\
    methodRT=$params.ipo_methodRT_library_neg \\
    noise_l=$params.ipo_noise_l_library_neg  \\
    noise_h=$params.ipo_noise_h_library_neg \\
    prefilter_l_l=$params.ipo_prefilter_l_l_library_neg \\
    prefilter_l_h=$params.ipo_prefilter_l_h_library_neg  \\
    prefilter_h_l=$params.ipo_prefilter_h_l_library_neg \\
    prefilter_h_h=$params.ipo_prefilter_h_h_library_neg  \\
    snthresh_l=$params.ipo_snthresh_l_library_neg \\
    snthresh_h=$params.ipo_snthresh_h_library_neg \\
    mzCenterFun=$params.ipo_mzCenterFun_library_neg  \\
    integrate=$params.ipo_integrate_library_neg \\
    fitgauss=$params.ipo_fitgauss_library_neg \\
    ipo_min_peakwidth_l=$params.ipo_min_peakwidth_l_library_neg  \\
    ipo_min_peakwidth_h=$params.ipo_min_peakwidth_h_library_neg \\
    ipo_max_peakwidth_l=$params.ipo_max_peakwidth_l_library_neg \\
    ipo_max_peakwidth_h=$params.ipo_max_peakwidth_h_library_neg \\
    ipo_ppm_l=$params.ipo_ppm_l_library_neg  \\
    ipo_ppm_h=$params.ipo_ppm_h_library_neg \\
    ipo_mzdiff_l=$params.ipo_mzdiff_l_library_neg \\
    ipo_mzdiff_h=$params.ipo_mzdiff_h_library_neg \\
    ipo_charge_camera=$params.ipo_charge_camera_library_neg \\
    ipo_max_ppm_camera=$params.ipo_max_ppm_camera_library_neg  \\
    response_l=$params.ipo_response_l_library_neg \\
    response_h=$params.ipo_response_h_library_neg \\
    distFunc=$params.ipo_distFunc_library_neg \\
    factorDiag_l=$params.ipo_factorDiag_l_library_neg \\
    factorDiag_h=$params.ipo_factorDiag_h_library_neg \\
    factorGap_l=$params.ipo_factorGap_l_library_neg  \\
    factorGap_h=$params.ipo_factorGap_h_library_neg \\
    localAlignment=$params.ipo_localAlignment_library_neg \\
    ipo_gapInit_l=$params.ipo_gapInit_l_library_neg \\
    ipo_gapInit_h=$params.ipo_gapInit_h_library_neg \\
    ipo_gapExtend_l=$params.ipo_gapExtend_l_library_neg  \\
    ipo_gapExtend_h=$params.ipo_gapExtend_h_library_neg \\
    ipo_profStep_l=$params.ipo_profStep_l_library_neg \\
    ipo_profStep_h=$params.ipo_profStep_h_library_neg \\
    bw_l=$params.ipo_bw_l_library_neg \\
    bw_h=$params.ipo_bw_h_library_neg \\
    minfrac_l=$params.ipo_minfrac_l_library_neg  \\
    minfrac_h=$params.ipo_minfrac_h_library_neg \\
    mzwid_l=$params.ipo_mzwid_l_library_neg \\
    mzwid_h=$params.ipo_mzwid_h_library_neg \\
    minsamp_l=$params.ipo_minsamp_l_library_neg  \\
    minsamp_h=$params.ipo_minsamp_h_library_neg \\
    max_l=$params.ipo_max_l_library_neg \\
    max_h=$params.ipo_max_h_library_neg \\
    ncores=$params.ipo_ncores_library_neg \\
    outputxset=quant_params_library_neg.json \\
    outputrt=rt_params_library_neg.json
"""
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
"""
findPeaks.r \\
    input=\$PWD/$mzMLFile \\
    output=\$PWD/${mzMLFile.baseName}.rdata \\
    ppm=$params.masstrace_ppm_library_neg_xcms \\
    peakwidthLow=$params.peakwidthlow_quant_library_neg_xcms  \\
    peakwidthHigh=$params.peakwidthhigh_quant_library_neg_xcms \\
    noise=$params.noise_quant_library_neg_xcms \\
    polarity=negative \\
    realFileName=$mzMLFile \\
    sampleClass=$params.sampleclass_quant_library_neg_xcms  \\
    mzdiff=$params.mzdiff_quant_library_neg_xcms \\
    snthresh=$params.snthresh_quant_library_neg_xcms \\
    prefilter_l=$params.prefilter_quant_library_neg_xcms \\
    prefilter_h=$params.value_of_prefilter_quant_library_neg_xcms  \\
    mzCenterFun=$params.mzCenterFun_quant_library_neg_xcms \\
    integrate=$params.integrate_quant_library_neg_xcms \\
    fitgauss=$params.fitgauss_quant_library_neg_xcms  \\
    methodXset=$params.ipo_methodXset_library_neg \\
    methodRT=$params.ipo_methodRT_library_neg \\
    noise_l=$params.ipo_noise_l_library_neg  \\
    noise_h=$params.ipo_noise_h_library_neg \\
    prefilter_l_l=$params.ipo_prefilter_l_l_library_neg \\
    prefilter_l_h=$params.ipo_prefilter_l_h_library_neg  \\
    prefilter_h_l=$params.ipo_prefilter_h_l_library_neg \\
    prefilter_h_h=$params.ipo_prefilter_h_h_library_neg  \\
    snthresh_l=$params.ipo_snthresh_l_library_neg \\
    snthresh_h=$params.ipo_snthresh_h_library_neg \\
    mzCenterFun=$params.ipo_mzCenterFun_library_neg  \\
    integrate=$params.ipo_integrate_library_neg \\
    fitgauss=$params.ipo_fitgauss_library_neg \\
    ipo_min_peakwidth_l=$params.ipo_min_peakwidth_l_library_neg  \\
    ipo_min_peakwidth_h=$params.ipo_min_peakwidth_h_library_neg \\
    ipo_max_peakwidth_l=$params.ipo_max_peakwidth_l_library_neg \\
    ipo_max_peakwidth_h=$params.ipo_max_peakwidth_h_library_neg \\
    ipo_ppm_l=$params.ipo_ppm_l_library_neg  \\
    ipo_ppm_h=$params.ipo_ppm_h_library_neg \\
    ipo_mzdiff_l=$params.ipo_mzdiff_l_library_neg \\
    ipo_mzdiff_h=$params.ipo_mzdiff_h_library_neg \\
    ipo_charge_camera=$params.ipo_charge_camera_library_neg  \\
    ipo_max_ppm_camera=$params.ipo_max_ppm_camera_library_neg  \\
    ipo_inv=$ipo_library_neg_localQ \\
    $filter_argument
"""
NextFlow From line 4600 of 1.0.1/main.nf
4664
4665
4666
"""
xsAnnotate.r input=$rdata_files output=${rdata_files.baseName}.rdata
"""
NextFlow From line 4664 of 1.0.1/main.nf
4685
4686
4687
4688
4689
4690
4691
4692
"""
groupFWHM.r \\
    input=$rdata_files \\
    output=${rdata_files.baseName}.rdata \\
    sigma=$params.sigma_group_library_neg_camera \\
    perfwhm=$params.perfwhm_group_library_neg_camera \\
    intval=$params.intval_group_library_neg_camera
"""
NextFlow From line 4685 of 1.0.1/main.nf
4711
4712
4713
4714
4715
4716
4717
"""
findAdducts.r \\
    input=$rdata_files \\
    output=${rdata_files.baseName}.rdata \\
    ppm=$params.ppm_findaddcuts_library_neg_camera \\
    polarity=$params.polarity_findaddcuts_library_neg_camera
"""
NextFlow From line 4711 of 1.0.1/main.nf
4737
4738
4739
4740
4741
4742
"""
findIsotopes.r \\
    input=$rdata_files \\
    output=${rdata_files.baseName}.rdata \\
    maxcharge=$params.maxcharge_findisotopes_library_neg_camera
"""
NextFlow From line 4737 of 1.0.1/main.nf
4761
4762
4763
4764
4765
4766
"""
readMS2MSnBase.r \\
    input=$mzMLFile \\
    output=${mzMLFile.baseName}_ReadMsmsLibrary.rdata \\
    inputname=${mzMLFile.baseName}
"""
NextFlow From line 4761 of 1.0.1/main.nf
4790
4791
4792
4793
4794
4795
4796
4797
"""
mapMS2ToCamera.r \\
    inputCAMERA=$rdata_files_ms1 \\
    inputMS2=$rdata_files_ms2 \\
    output=${rdata_files_ms1.baseName}_MapMsms2Camera_library_neg.rdata  \\
    ppm=$params.ppm_mapmsmstocamera_library_neg_msnbase \\
    rt=$params.rt_mapmsmstocamera_library_neg_msnbase
"""
NextFlow From line 4790 of 1.0.1/main.nf
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
"""
mkdir out
createLibrary.r \\
    inputCAMERA=$rdata_camera \\
    precursorppm=$params.ppm_create_library_neg_msnbase \\
    inputMS2=$ms2_data \\
    output=${rdata_camera.baseName}.csv  \\
    inputLibrary=$library_desc \\
    rawFileName=$params.raw_file_name_preparelibrary_neg_msnbase \\
    compundID=$params.compund_id_preparelibrary_neg_msnbase  \\
    compoundName=$params.compound_name_preparelibrary_neg_msnbase \\
    mzCol=$params.mz_col_preparelibrary_neg_msnbase \\
    whichmz=$params.which_mz_preparelibrary_neg_msnbase
"""
NextFlow From line 4822 of 1.0.1/main.nf
4855
4856
4857
4858
4859
4860
"""
collectLibrary.r \\
    inputs=$aggregatecdlibrary \\
    realNames=$aggregatecdlibrary \\
    output=library_neg.csv
"""
NextFlow From line 4855 of 1.0.1/main.nf
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
"""
#!env Rscript
Files<-list.files(,pattern = "zip",full.names=T)
Files_org<-list.files(,pattern = "zip")
for(f in Files){
    zip::unzip(zipfile = f,junkpaths = T)
}
Files<-list.files(,pattern = "txt",full.names=T)
FilesTMP<-sapply(strsplit(split = "_",fixed = T,x = basename(Files)),function(x){paste(x[-1],collapse = "_")})
FileDub<-Files[duplicated(FilesTMP)]
for(x in FileDub){
    file.remove(x)
}
files_to_pass<-list.files(pattern="txt")
files_to_pass<-files_to_pass[!files_to_pass%in%Files_org]
zip::zip(zipfile="mappedtometfrag_neg.zip",files=files_to_pass)
"""
NextFlow From line 4879 of 1.0.1/main.nf
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
"""
librarySearchEngine.r \\
    -l $libraryFile \\
    -i $parameters  \\
    -out aggregated_identification_library_neg.csv \\
    -th "-1" \\
    -im neg  \\
    -ts Scoredotproduct \\
    -rs 1000 \\
    -ncore $params.ncore_searchengine_library_neg_msnbase
sed -i '/^\$/d' aggregated_identification_library_neg.csv
"""
NextFlow From line 4918 of 1.0.1/main.nf
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
"""
librarySearchEngine.r \\
    -l $libraryFile \\
    -i $parameters \\
    -out aggregated_identification_library_neg.csv \\
    -th "-1" \\
    -im neg \\
    -ts Scoredotproduct \\
    -rs 1000 \\
    -ncore $params.ncore_searchengine_library_neg_msnbase
sed -i '/^\$/d' aggregated_identification_library_neg.csv
"""
NextFlow From line 4950 of 1.0.1/main.nf
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
"""
if [ -s $identification_result ]; then
    metfragPEP.r \\
        input=$identification_result \\
        score=score \\
        output=pep_identification_library_neg.csv \\
        readTable=T
else
    touch pep_identification_library_neg.csv
fi
"""
NextFlow From line 4981 of 1.0.1/main.nf
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
"""
if [ -s $library_input_identification ]; then

    prepareOutput.r \\
        inputcamera=$camera_input_quant \\
        inputscores=$library_input_identification \\
        inputpheno=$phenotype_file \\
        ppm=$params.ppm_output_neg_camera  \\
        rt=$params.rt_output_neg_camera \\
        higherTheBetter=true \\
        scoreColumn=score \\
        impute=$params.impute_output_neg_camera \\
        typeColumn=$params.type_column_output_neg_camera \\
        selectedType=$params.selected_type_output_neg_camera  \\
        rename=$params.rename_output_neg_camera \\
        renameCol=$params.rename_col_output_neg_camera \\
        onlyReportWithID=$params.only_report_with_id_output_neg_camera \\
        combineReplicate=$params.combine_replicate_output_neg_camera  \\
        combineReplicateColumn=$params.combine_replicate_column_output_neg_camera \\
        log=$params.log_output_neg_camera \\
        sampleCoverage=$params.sample_coverage_output_neg_camera \\
        outputPeakTable=peaktableNEGout_neg_library.txt  \\
        outputVariables=varsNEGout_neg_library.txt \\
        outputMetaData=metadataNEGout_neg_library.txt \\
        Ifnormalize=$params.normalize_output_neg_camera

else

    prepareOutput.r \\
        inputcamera=$camera_input_quant \\
        inputpheno=$phenotype_file  \\
        ppm=$params.ppm_output_neg_camera \\
        rt=$params.rt_output_neg_camera \\
        higherTheBetter=true  \\
        scoreColumn=score \\
        impute=$params.impute_output_neg_camera \\
        typeColumn=$params.type_column_output_neg_camera  \\
        selectedType=$params.selected_type_output_neg_camera \\
        rename=$params.rename_output_neg_camera  \\
        renameCol=$params.rename_col_output_neg_camera \\
        onlyReportWithID=$params.only_report_with_id_output_neg_camera  \\
        combineReplicate=$params.combine_replicate_output_neg_camera \\
        combineReplicateColumn=$params.combine_replicate_column_output_neg_camera  \\
        log=$params.log_output_neg_camera \\
        sampleCoverage=$params.sample_coverage_output_neg_camera \\
        outputPeakTable=peaktableNEGout_neg_library.txt  \\
        outputVariables=varsNEGout_neg_library.txt \\
        outputMetaData=metadataNEGout_neg_library.txt \\
        Ifnormalize=$params.normalize_output_neg_camera

fi
"""
NextFlow From line 5014 of 1.0.1/main.nf
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
"""
prepareOutput.r \\
    inputcamera=$camera_input_quant \\
    inputpheno=$phenotype_file \\
    ppm=$params.ppm_output_neg_camera \\
    rt=$params.rt_output_neg_camera \\
    higherTheBetter=true \\
    scoreColumn=score  \\
    impute=$params.impute_output_neg_camera \\
    typeColumn=$params.type_column_output_neg_camera \\
    selectedType=$params.selected_type_output_neg_camera \\
    rename=$params.rename_output_neg_camera  \\
    renameCol=$params.rename_col_output_neg_camera \\
    onlyReportWithID=$params.only_report_with_id_output_neg_camera \\
    combineReplicate=$params.combine_replicate_output_neg_camera  \\
    combineReplicateColumn=$params.combine_replicate_column_output_neg_camera \\
    log=$params.log_output_neg_camera \\
    sampleCoverage=$params.sample_coverage_output_neg_camera  \\
    outputPeakTable=peaktableNEGout_NEG_noid.txt \\
    outputVariables=varsNEGout_neg_noid.txt \\
    outputMetaData=metadataNEGout_neg_noid.txt \\
    Ifnormalize=$params.normalize_output_neg_camera
"""
NextFlow From line 5086 of 1.0.1/main.nf
423
424
425
426
427
428
429
430
431
432
433
434
435
"""

echo $workflow.manifest.version > v_pipeline.txt
echo $workflow.nextflow.version > v_nextflow.txt
Rscript -e "cat(as.character(packageVersion('CAMERA')),'\\n')" &> v_camera.txt
Rscript -e "cat(as.character(packageVersion('xcms')),'\\n')" &> v_xcms.txt
Rscript -e "cat(as.character(packageVersion('MSnbase')),'\\n')" &> v_msnbase.txt
Rscript -e "cat(as.character(packageVersion('IPO')),'\\n')" &> v_ipo.txt
OpenMSInfo |  grep -oP -m 1 '([0-9][.][0-9][.][0-9])' &> v_openms.txt
sh /usr/bin/CSI/bin/sirius.sh --loglevel=OFF --version 2>1 | grep -oP -m 1 '([0-9][.][0-9][.][0-9])' &> v_sirius.txt

scrape_software_versions.py &> software_versions_mqc.yaml
"""
NextFlow From line 423 of master/main.nf
463
464
465
"""
PeakPickerHiRes -in $mzMLFile -out $mzMLFile -ini $setting_file
"""
NextFlow From line 463 of master/main.nf
492
493
494
"""
FeatureFinderMetabo -in $mzMLFile -out ${mzMLFile.baseName}.featureXML -ini $setting_file
"""
NextFlow From line 492 of master/main.nf
516
517
518
519
520
521
522
523
524
525
526
527
"""
featurexmlToCamera.r \\
    input=$mzMLFile \\
    realFileName=$mzMLFile \\
    mzMLfiles=\$PWD/$mzMLFile2 \\
    polarity=positive \\
    output=${mzMLFile.baseName}.rdata \\
    phenoFile=$phenotype_file  \\
    phenoDataColumn=$params.phenodatacolumn_quant_pos \\
    sampleClass=$params.sampleclass_quant_pos_xcms \\
    changeNameTO=${mzMLFile.baseName}.mzML
"""
NextFlow From line 516 of master/main.nf
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
"""
touch quant_params_pos.json
touch rt_params_pos.json

ipo.r \\
    input=$inputs_aggregated \\
    quantOnly=$ipo_pos_globalAvoidRT \\
    allSamples=$params.ipo_allSamples_pos \\
    columnToSelect=$params.ipo_columnToSelect_pos  \\
    valueToSelect=$params.ipo_valueToSelect_pos \\
    phenoFile=$phenotype_file  \\
    methodXset=$params.ipo_methodXset_pos \\
    methodRT=$params.ipo_methodRT_pos \\
    noise_l=$params.ipo_noise_l_pos  \\
    noise_h=$params.ipo_noise_h_pos \\
    prefilter_l_l=$params.ipo_prefilter_l_l_pos \\
    prefilter_l_h=$params.ipo_prefilter_l_h_pos  \\
    prefilter_h_l=$params.ipo_prefilter_h_l_pos \\
    prefilter_h_h=$params.ipo_prefilter_h_h_pos  \\
    snthresh_l=$params.ipo_snthresh_l_pos \\
    snthresh_h=$params.ipo_snthresh_h_pos \\
    mzCenterFun=$params.ipo_mzCenterFun_pos  \\
    integrate=$params.ipo_integrate_pos \\
    fitgauss=$params.ipo_fitgauss_pos \\
    ipo_min_peakwidth_l=$params.ipo_min_peakwidth_l_pos  \\
    ipo_min_peakwidth_h=$params.ipo_min_peakwidth_h_pos \\
    ipo_max_peakwidth_l=$params.ipo_max_peakwidth_l_pos \\
    ipo_max_peakwidth_h=$params.ipo_max_peakwidth_h_pos \\
    ipo_ppm_l=$params.ipo_ppm_l_pos  \\
    ipo_ppm_h=$params.ipo_ppm_h_pos \\
    ipo_mzdiff_l=$params.ipo_mzdiff_l_pos \\
    ipo_mzdiff_h=$params.ipo_mzdiff_h_pos \\
    ipo_charge_camera=$params.ipo_charge_camera_pos \\
    ipo_max_ppm_camera=$params.ipo_max_ppm_camera_pos  \\
    response_l=$params.ipo_response_l_pos \\
    response_h=$params.ipo_response_h_pos \\
    distFunc=$params.ipo_distFunc_pos \\
    factorDiag_l=$params.ipo_factorDiag_l_pos \\
    factorDiag_h=$params.ipo_factorDiag_h_pos \\
    factorGap_l=$params.ipo_factorGap_l_pos  \\
    factorGap_h=$params.ipo_factorGap_h_pos \\
    localAlignment=$params.ipo_localAlignment_pos \\
    ipo_gapInit_l=$params.ipo_gapInit_l_pos \\
    ipo_gapInit_h=$params.ipo_gapInit_h_pos \\
    ipo_gapExtend_l=$params.ipo_gapExtend_l_pos  \\
    ipo_gapExtend_h=$params.ipo_gapExtend_h_pos \\
    ipo_profStep_l=$params.ipo_profStep_l_pos \\
    ipo_profStep_h=$params.ipo_profStep_h_pos \\
    bw_l=$params.ipo_bw_l_pos \\
    bw_h=$params.ipo_bw_h_pos \\
    minfrac_l=$params.ipo_minfrac_l_pos  \\
    minfrac_h=$params.ipo_minfrac_h_pos \\
    mzwid_l=$params.ipo_mzwid_l_pos \\
    mzwid_h=$params.ipo_mzwid_h_pos \\
    minsamp_l=$params.ipo_minsamp_l_pos  \\
    minsamp_h=$params.ipo_minsamp_h_pos \\
    max_l=$params.ipo_max_l_pos \\
    max_h=$params.ipo_max_h_pos \\
    ncores=$params.ipo_ncores_pos \\
    outputxset=quant_params_pos.json \\
    outputrt=rt_params_pos.json
"""
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
"""
findPeaks.r \\
    input=\$PWD/$mzMLFile \\
    output=\$PWD/${mzMLFile.baseName}.rdata \\
    ppm=$params.masstrace_ppm_pos_xcms \\
    peakwidthLow=$params.peakwidthlow_quant_pos_xcms  \\
    peakwidthHigh=$params.peakwidthhigh_quant_pos_xcms \\
    noise=$params.noise_quant_pos_xcms \\
    polarity=positive \\
    realFileName=$mzMLFile \\
    phenoFile=$phenotype_file  \\
    phenoDataColumn=$params.phenodatacolumn_quant_pos \\
    sampleClass=$params.sampleclass_quant_pos_xcms \\
    mzdiff=$params.mzdiff_quant_pos_xcms \\
    snthresh=$params.snthresh_quant_pos_xcms  \\
    prefilter_l=$params.prefilter_quant_pos_xcms \\
    prefilter_h=$params.value_of_prefilter_quant_pos_xcms \\
    mzCenterFun=$params.mzCenterFun_quant_pos_xcms \\
    integrate=$params.integrate_quant_pos_xcms  \\
    fitgauss=$params.fitgauss_quant_pos_xcms \\
    methodXset=$params.ipo_methodXset_pos \\
    methodRT=$params.ipo_methodRT_pos \\
    noise_l=$params.ipo_noise_l_pos  \\
    noise_h=$params.ipo_noise_h_pos \\
    prefilter_l_l=$params.ipo_prefilter_l_l_pos \\
    prefilter_l_h=$params.ipo_prefilter_l_h_pos  \\
    prefilter_h_l=$params.ipo_prefilter_h_l_pos \\
    prefilter_h_h=$params.ipo_prefilter_h_h_pos \\
    snthresh_l=$params.ipo_snthresh_l_pos \\
    snthresh_h=$params.ipo_snthresh_h_pos  \\
    mzCenterFun=$params.ipo_mzCenterFun_pos \\
    integrate=$params.ipo_integrate_pos \\
    fitgauss=$params.ipo_fitgauss_pos \\
    ipo_min_peakwidth_l=$params.ipo_min_peakwidth_l_pos  \\
    ipo_min_peakwidth_h=$params.ipo_min_peakwidth_h_pos \\
    ipo_max_peakwidth_l=$params.ipo_max_peakwidth_l_pos \\
    ipo_max_peakwidth_h=$params.ipo_max_peakwidth_h_pos \\
    ipo_ppm_l=$params.ipo_ppm_l_pos  \\
    ipo_ppm_h=$params.ipo_ppm_h_pos \\
    ipo_mzdiff_l=$params.ipo_mzdiff_l_pos \\
    ipo_mzdiff_h=$params.ipo_mzdiff_h_pos \\
    ipo_charge_camera=$params.ipo_charge_camera_pos \\
    ipo_max_ppm_camera=$params.ipo_max_ppm_camera_pos  \\
    ipo_inv=$ipo_pos_localQ \\
    $filter_argument
"""
NextFlow From line 639 of master/main.nf
710
711
712
"""
FeatureFinderMetabo -in $mzMLFile -out ${mzMLFile.baseName}.featureXML -ini $setting_file
"""
NextFlow From line 710 of master/main.nf
733
734
735
736
737
738
739
740
741
742
743
744
"""
featurexmlToCamera.r \\
    input=$mzMLFile \\
    realFileName=$mzMLFile \\
    mzMLfiles=\$PWD/$mzMLFile2 \\
    polarity=positive \\
    output=${mzMLFile.baseName}.rdata \\
    phenoFile=$phenotype_file \\
    phenoDataColumn=$params.phenodatacolumn_quant_pos  \\
    sampleClass=$params.sampleclass_quant_pos_xcms \\
    changeNameTO=${mzMLFile.baseName}.mzML
"""
NextFlow From line 733 of master/main.nf
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
"""
touch quant_params_pos.json
touch rt_params_pos.json

ipo.r \\
    input=$inputs_aggregated \\
    quantOnly=$ipo_pos_globalAvoidRT \\
    allSamples=$params.ipo_allSamples_pos \\
    columnToSelect=$params.ipo_columnToSelect_pos  \\
    valueToSelect=$params.ipo_valueToSelect_pos \\
    phenoFile=$phenotype_file  \\
    methodXset=$params.ipo_methodXset_pos \\
    methodRT=$params.ipo_methodRT_pos \\
    noise_l=$params.ipo_noise_l_pos  \\
    noise_h=$params.ipo_noise_h_pos \\
    prefilter_l_l=$params.ipo_prefilter_l_l_pos \\
    prefilter_l_h=$params.ipo_prefilter_l_h_pos  \\
    prefilter_h_l=$params.ipo_prefilter_h_l_pos \\
    prefilter_h_h=$params.ipo_prefilter_h_h_pos  \\
    snthresh_l=$params.ipo_snthresh_l_pos \\
    snthresh_h=$params.ipo_snthresh_h_pos \\
    mzCenterFun=$params.ipo_mzCenterFun_pos  \\
    integrate=$params.ipo_integrate_pos \\
    fitgauss=$params.ipo_fitgauss_pos \\
    ipo_min_peakwidth_l=$params.ipo_min_peakwidth_l_pos  \\
    ipo_min_peakwidth_h=$params.ipo_min_peakwidth_h_pos \\
    ipo_max_peakwidth_l=$params.ipo_max_peakwidth_l_pos \\
    ipo_max_peakwidth_h=$params.ipo_max_peakwidth_h_pos \\
    ipo_ppm_l=$params.ipo_ppm_l_pos  \\
    ipo_ppm_h=$params.ipo_ppm_h_pos \\
    ipo_mzdiff_l=$params.ipo_mzdiff_l_pos \\
    ipo_mzdiff_h=$params.ipo_mzdiff_h_pos \\
    ipo_charge_camera=$params.ipo_charge_camera_pos \\
    ipo_max_ppm_camera=$params.ipo_max_ppm_camera_pos  \\
    response_l=$params.ipo_response_l_pos \\
    response_h=$params.ipo_response_h_pos \\
    distFunc=$params.ipo_distFunc_pos \\
    factorDiag_l=$params.ipo_factorDiag_l_pos \\
    factorDiag_h=$params.ipo_factorDiag_h_pos \\
    factorGap_l=$params.ipo_factorGap_l_pos  \\
    factorGap_h=$params.ipo_factorGap_h_pos \\
    localAlignment=$params.ipo_localAlignment_pos \\
    ipo_gapInit_l=$params.ipo_gapInit_l_pos \\
    ipo_gapInit_h=$params.ipo_gapInit_h_pos \\
    ipo_gapExtend_l=$params.ipo_gapExtend_l_pos  \\
    ipo_gapExtend_h=$params.ipo_gapExtend_h_pos \\
    ipo_profStep_l=$params.ipo_profStep_l_pos \\
    ipo_profStep_h=$params.ipo_profStep_h_pos \\
    bw_l=$params.ipo_bw_l_pos \\
    bw_h=$params.ipo_bw_h_pos \\
    minfrac_l=$params.ipo_minfrac_l_pos  \\
    minfrac_h=$params.ipo_minfrac_h_pos \\
    mzwid_l=$params.ipo_mzwid_l_pos \\
    mzwid_h=$params.ipo_mzwid_h_pos \\
    minsamp_l=$params.ipo_minsamp_l_pos  \\
    minsamp_h=$params.ipo_minsamp_h_pos \\
    max_l=$params.ipo_max_l_pos \\
    max_h=$params.ipo_max_h_pos \\
    ncores=$params.ipo_ncores_pos \\
    outputxset=quant_params_pos.json \\
    outputrt=rt_params_pos.json
"""
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
"""
findPeaks.r \\
    input=\$PWD/$mzMLFile \\
    output=\$PWD/${mzMLFile.baseName}.rdata \\
    ppm=$params.masstrace_ppm_pos_xcms \\
    peakwidthLow=$params.peakwidthlow_quant_pos_xcms \\
    peakwidthHigh=$params.peakwidthhigh_quant_pos_xcms  \\
    noise=$params.noise_quant_pos_xcms \\
    polarity=positive \\
    realFileName=$mzMLFile \\
    phenoFile=$phenotype_file \\
    phenoDataColumn=$params.phenodatacolumn_quant_pos  \\
    sampleClass=$params.sampleclass_quant_pos_xcms \\
    mzdiff=$params.mzdiff_quant_pos_xcms \\
    snthresh=$params.snthresh_quant_pos_xcms \\
    prefilter_l=$params.prefilter_quant_pos_xcms  \\
    prefilter_h=$params.value_of_prefilter_quant_pos_xcms \\
    mzCenterFun=$params.mzCenterFun_quant_pos_xcms \\
    integrate=$params.integrate_quant_pos_xcms  \\
    fitgauss=$params.fitgauss_quant_pos_xcms \\
    methodXset=$params.ipo_methodXset_pos \\
    methodRT=$params.ipo_methodRT_pos \\
    noise_l=$params.ipo_noise_l_pos  \\
    noise_h=$params.ipo_noise_h_pos \\
    prefilter_l_l=$params.ipo_prefilter_l_l_pos \\
    prefilter_l_h=$params.ipo_prefilter_l_h_pos  \\
    prefilter_h_l=$params.ipo_prefilter_h_l_pos \\
    prefilter_h_h=$params.ipo_prefilter_h_h_pos  \\
    snthresh_l=$params.ipo_snthresh_l_pos \\
    snthresh_h=$params.ipo_snthresh_h_pos \\
    mzCenterFun=$params.ipo_mzCenterFun_pos  \\
    integrate=$params.ipo_integrate_pos \\
    fitgauss=$params.ipo_fitgauss_pos \\
    ipo_min_peakwidth_l=$params.ipo_min_peakwidth_l_pos  \\
    ipo_min_peakwidth_h=$params.ipo_min_peakwidth_h_pos \\
    ipo_max_peakwidth_l=$params.ipo_max_peakwidth_l_pos \\
    ipo_max_peakwidth_h=$params.ipo_max_peakwidth_h_pos \\
    ipo_ppm_l=$params.ipo_ppm_l_pos  \\
    ipo_ppm_h=$params.ipo_ppm_h_pos \\
    ipo_mzdiff_l=$params.ipo_mzdiff_l_pos \\
    ipo_mzdiff_h=$params.ipo_mzdiff_h_pos \\
    ipo_charge_camera=$params.ipo_charge_camera_pos \\
    ipo_max_ppm_camera=$params.ipo_max_ppm_camera_pos  \\
    ipo_inv=$ipo_pos_localQ \\
    $filter_argument
"""
NextFlow From line 854 of master/main.nf
921
922
923
924
"""
nextFlowDIR=\$PWD
xcmsCollect.r input=$inputs_aggregated output=collection_pos.rdata
"""
NextFlow From line 921 of master/main.nf
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
"""
retCor.r \\
    input=\$PWD/$rdata_files \\
    output=RTcorrected_pos.rdata \\
    method=obiwarp \\
    response_l=$params.ipo_response_l_pos \\
    response_h=$params.ipo_response_h_pos \\
    distFunc=$params.ipo_distFunc_pos  \\
    factorDiag_l=$params.ipo_factorDiag_l_pos \\
    factorDiag_h=$params.ipo_factorDiag_h_pos \\
    factorGap_l=$params.ipo_factorGap_l_pos  \\
    factorGap_h=$params.ipo_factorGap_h_pos \\
    localAlignment=$params.ipo_localAlignment_pos \\
    ipo_gapInit_l=$params.ipo_gapInit_l_pos \\
    ipo_gapInit_h=$params.ipo_gapInit_h_pos \\
    ipo_gapExtend_l=$params.ipo_gapExtend_l_pos  \\
    ipo_gapExtend_h=$params.ipo_gapExtend_h_pos \\
    ipo_profStep_l=$params.ipo_profStep_l_pos \\
    ipo_profStep_h=$params.ipo_profStep_h_pos \\
    bw_l=$params.ipo_bw_l_pos \\
    bw_h=$params.ipo_bw_h_pos \\
    minfrac_l=$params.ipo_minfrac_l_pos  \\
    minfrac_h=$params.ipo_minfrac_h_pos \\
    mzwid_l=$params.ipo_mzwid_l_pos \\
    mzwid_h=$params.ipo_mzwid_h_pos \\
    minsamp_l=$params.ipo_minsamp_l_pos  \\
    minsamp_h=$params.ipo_minsamp_h_pos \\
    max_l=$params.ipo_max_l_pos \\
    max_h=$params.ipo_max_h_pos \\
    ipo_inv=$ipo_pos_localRT \\
    ncores=$params.ipo_ncores_pos  \\
    profStep=$params.profStep_align_N1_pos_xcms \\
    center=$params.center_align_N1_pos_xcms \\
    response=$params.response_align_N1_pos_xcms  \\
    distFunc=$params.distFunc_align_N1_pos_xcms \\
    gapInit=$params.gapInit_align_N1_pos_xcms \\
    gapExtend=$params.gapExtend_align_N1_pos_xcms  \\
    factorDiag=$params.factorDiag_align_N1_pos_xcms \\
    factorGap=$params.factorGap_align_N1_pos_xcms \\
    localAlignment=$params.localAlignment_align_N1_pos_xcms \\
    $filter_argument \\
    inputraw=$inputs_aggregated
"""
NextFlow From line 948 of master/main.nf
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
"""
group.r \\
    input=$rdata_files \\
    output=groupN1_pos.rdata \\
    bandwidth=$params.bandwidth_group_N1_pos_xcms \\
    minfrac=$params.minfrac_group_N1_pos_xcms \\
    minsamp=$params.minsamp_group_N1_pos_xcms \\
    max=$params.max_group_N1_pos_xcms  \\
    mzwid=$params.mzwid_group_N1_pos_xcms
"""
NextFlow From line 1010 of master/main.nf
1042
1043
1044
1045
1046
1047
1048
1049
1050
"""
blankfilter.r \\
    input=$rdata_files \\
    output=blankFiltered_pos.rdata \\
    method=$params.method_blankfilter_pos_xcms \\
    blank=$params.blank_blankfilter_pos_xcms \\
    sample=$params.sample_blankfilter_pos_xcms \\
    rest=$params.rest_blankfilter_pos_xcms
"""
NextFlow From line 1042 of master/main.nf
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
"""
dilutionfilter.r \\
    input=$rdata_files \\
    output=dilutionFiltered_pos.rdata \\
    Corto=$params.corto_dilutionfilter_pos_xcms  \\
    dilution=$params.dilution_dilutionfilter_pos_xcms \\
    pvalue=$params.pvalue_dilutionfilter_pos_xcms \\
    corcut=$params.corcut_dilutionfilter_pos_xcms \\
    abs=$params.abs_dilutionfilter_pos_xcms
"""
NextFlow From line 1074 of master/main.nf
1108
1109
1110
1111
1112
1113
1114
"""
cvfilter.r \\
    input=$rdata_files \\
    output=cvFiltered_pos.rdata \\
    qc=$params.qc_cvfilter_pos_xcms \\
    cvcut=$params.cvcut_cvfilter_pos_xcms
"""
NextFlow From line 1108 of master/main.nf
1137
1138
1139
"""
xsAnnotate.r  input=$rdata_files output=CameraAnnotatePeaks_pos.rdata
"""
NextFlow From line 1137 of master/main.nf
1158
1159
1160
1161
1162
1163
1164
1165
"""
groupFWHM.r \\
    input=$rdata_files \\
    output=CameraGroup_pos.rdata \\
    sigma=$params.sigma_group_pos_camera \\
    perfwhm=$params.perfwhm_group_pos_camera \\
    intval=$params.intval_group_pos_camera
"""
NextFlow From line 1158 of master/main.nf
1185
1186
1187
1188
1189
1190
1191
"""
findAdducts.r \\
    input=$rdata_files \\
    output=CameraFindAdducts_pos.rdata \\
    ppm=$params.ppm_findaddcuts_pos_camera \\
    polarity=$params.polarity_findaddcuts_pos_camera
"""
NextFlow From line 1185 of master/main.nf
1210
1211
1212
1213
1214
1215
"""
findIsotopes.r \\
    input=$rdata_files \\
    output=CameraFindIsotopes_pos.rdata \\
    maxcharge=$params.maxcharge_findisotopes_pos_camera
"""
NextFlow From line 1210 of master/main.nf
1241
1242
1243
1244
1245
1246
"""
readMS2MSnBase.r \\
    input=$mzMLFile \\
    output=${mzMLFile.baseName}.rdata \\
    inputname=${mzMLFile.baseName}
"""
NextFlow From line 1241 of master/main.nf
1268
1269
1270
1271
1272
1273
1274
1275
"""
mapMS2ToCamera.r \\
    inputCAMERA=$rdata_files_ms1 \\
    inputMS2=$input_args \\
    output=MapMsms2Camera_pos.rdata \\
    ppm=$params.ppm_mapmsmstocamera_pos_msnbase \\
    rt=$params.rt_mapmsmstocamera_pos_msnbase
"""
NextFlow From line 1268 of master/main.nf
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
"""
mkdir out

MS2ToMetFrag.r \\
    inputCAMERA=$rdata_files_ms1 \\
    inputMS2=$rdata_files_ms2 \\
    output=out  \\
    precursorppm=$params.precursorppm_msmstoparam_pos_msnbase \\
    fragmentppm=$params.fragmentppm_msmstoparam_pos_msnbase \\
    fragmentabs=$params.fragmentabs_msmstoparam_pos_msnbase  \\
    database=$params.database_msmstoparam_pos_msnbase \\
    mode=$params.mode_msmstoparam_pos_msnbase \\
    adductRules=$params.adductRules_msmstoparam_pos_msnbase \\
    minPeaks=$params.minPeaks_msmstoparam_pos_msnbase

ls out/ -A -1  | cut -d'_' -f4- | tr ' ' '\n' | sort -u | xargs -I %  find out/ -type f -iname *% -exec zip %.zip {} +
"""
NextFlow From line 1296 of master/main.nf
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
"""
mkdir inputs
mkdir outputs
unzip  -j $parameters -d inputs/
touch ${parameters.baseName}_class_Csifingerid_pos.csv

fingerID.r \\
    input=\$PWD/inputs \\
    database=$params.database_csifingerid_pos_csifingerid \\
    tryOffline=T  \\
    output=\$PWD/outputs/ \\
    ncores=$params.ncore_csifingerid_pos_csifingerid \\
    timeout=$params.timeout_csifingerid_pos_csifingerid \\
    canopus=T \\
    canopusOutput=\$PWD/${parameters.baseName}_class_Csifingerid_pos.csv

zip -j -r ${parameters.baseName}_Csifingerid_pos.zip outputs/*.csv
"""
NextFlow From line 1341 of master/main.nf
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
"""
ulimit -s unlimited
mkdir all
for x in *.zip ; do unzip -d all -o -u \$x ; done
zip -r Csifingerid_pos.zip all

aggregateMetfrag.r \\
    inputs=Csifingerid_pos.zip \\
    realNames=Csifingerid_pos.zip \\
    output=aggregated_identification_csifingerid_pos.csv \\
    filetype=zip \\
    outTable=T

sed -i '/^\$/d' aggregated_identification_csifingerid_pos.csv
"""
NextFlow From line 1377 of master/main.nf
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
"""
if [ -s $identification_result ]; then
    metfragPEP.r \\
        input=$identification_result \\
        score=score \\
        output=pep_identification_csifingerid_pos.csv \\
        readTable=T
else
    touch pep_identification_csifingerid_pos.csv
fi
"""
NextFlow From line 1410 of master/main.nf
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
"""
if [ -s $csifingerid_input_identification ]; then

    prepareOutput.r \\
        inputcamera=$camera_input_quant \\
        inputscores=$csifingerid_input_identification \\
        inputpheno=$phenotype_file \\
        ppm=$params.ppm_output_pos_camera  \\
        rt=$params.rt_output_pos_camera \\
        higherTheBetter=true \\
        scoreColumn=score \\
        impute=$params.impute_output_pos_camera \\
        typeColumn=$params.type_column_output_pos_camera  \\
        selectedType=$params.selected_type_output_pos_camera \\
        rename=$params.rename_output_pos_camera \\
        renameCol=$params.rename_col_output_pos_camera  \\
        onlyReportWithID=$params.only_report_with_id_output_pos_camera \\
        combineReplicate=$params.combine_replicate_output_pos_camera  \\
        combineReplicateColumn=$params.combine_replicate_column_output_pos_camera \\
        log=$params.log_output_pos_camera \\
        sampleCoverage=$params.sample_coverage_output_pos_camera  \\
        outputPeakTable=peaktablePOSout_pos_csifingerid.txt \\
        outputVariables=varsPOSout_pos_csifingerid.txt \\
        outputMetaData=metadataPOSout_pos_csifingerid.txt \\
        Ifnormalize=$params.normalize_output_pos_camera

else

    prepareOutput.r \\
        inputcamera=$camera_input_quant \\
        inputpheno=$phenotype_file \\
        ppm=$params.ppm_output_pos_camera \\
        rt=$params.rt_output_pos_camera  \\
        higherTheBetter=true \\
        scoreColumn=score \\
        impute=$params.impute_output_pos_camera \\
        typeColumn=$params.type_column_output_pos_camera \\
        selectedType=$params.selected_type_output_pos_camera  \\
        rename=$params.rename_output_pos_camera \\
        renameCol=$params.rename_col_output_pos_camera \\
        onlyReportWithID=$params.only_report_with_id_output_pos_camera \\
        combineReplicate=$params.combine_replicate_output_pos_camera  \\
        combineReplicateColumn=$params.combine_replicate_column_output_pos_camera \\
        log=$params.log_output_pos_camera \\
        sampleCoverage=$params.sample_coverage_output_pos_camera \\
        outputPeakTable=peaktablePOSout_pos_csifingerid.txt  \\
        outputVariables=varsPOSout_pos_csifingerid.txt \\
        outputMetaData=metadataPOSout_pos_csifingerid.txt \\
        Ifnormalize=$params.normalize_output_pos_camera

fi
"""
NextFlow From line 1440 of master/main.nf
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
"""
mkdir inputs
mkdir outputs
unzip  -j $parameters -d inputs/
touch ${parameters.baseName}.csv
find "\$PWD/inputs" -type f | \\
    parallel \\
        -j $params.ncore_pos_metfrag \\
        run_metfrag.sh \\
        -p {} \\
        -f \$PWD/outputs/{/.}.csv \\
        -l "\$PWD/$metfrag_database" \\
        -s "OfflineMetFusionScore"
zip -j -r ${parameters.baseName}_metfrag_pos.zip outputs/*.csv
"""
NextFlow From line 1536 of master/main.nf
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
"""
ulimit -s unlimited
mkdir all
for x in *.zip ; do unzip -d all -o -u \$x ; done
zip -r metfrag_pos.zip all

aggregateMetfrag.r \\
    inputs=metfrag_pos.zip \\
    realNames=metfrag_pos.zip \\
    output=aggregated_identification_metfrag_pos.csv \\
    filetype=zip \\
    outTable=T

sed -i '/^\$/d' aggregated_identification_metfrag_pos.csv
"""
NextFlow From line 1569 of master/main.nf
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
"""
if [ -s $identification_result ];then
    metfragPEP.r \\
        input=$identification_result \\
        score=FragmenterScore \\
        output=pep_identification_metfrag_pos.csv \\
        readTable=T
else
    touch pep_identification_metfrag_pos.csv
fi
"""
NextFlow From line 1601 of master/main.nf
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
"""
if [ -s $metfrag_input_identification ]; then

    prepareOutput.r \\
        inputcamera=$camera_input_quant \\
        inputscores=$metfrag_input_identification \\
        inputpheno=$phenotype_file \\
        ppm=$params.ppm_output_pos_camera  \\
        rt=$params.rt_output_pos_camera \\
        higherTheBetter=true \\
        scoreColumn=FragmenterScore \\
        impute=$params.impute_output_pos_camera \\
        typeColumn=$params.type_column_output_pos_camera  \\
        selectedType=$params.selected_type_output_pos_camera \\
        rename=$params.rename_output_pos_camera \\
        renameCol=$params.rename_col_output_pos_camera \\
        onlyReportWithID=$params.only_report_with_id_output_pos_camera  \\
        combineReplicate=$params.combine_replicate_output_pos_camera \\
        combineReplicateColumn=$params.combine_replicate_column_output_pos_camera \\
        log=$params.log_output_pos_camera \\
        sampleCoverage=$params.sample_coverage_output_pos_camera  \\
        outputPeakTable=peaktablePOSout_pos_metfrag.txt \\
        outputVariables=varsPOSout_pos_metfrag.txt \\
        outputMetaData=metadataPOSout_pos_metfrag.txt \\
        Ifnormalize=$params.normalize_output_pos_camera

else

    prepareOutput.r \\
        inputcamera=$camera_input_quant \\
        inputpheno=$phenotype_file \\
        ppm=$params.ppm_output_pos_camera \\
        rt=$params.rt_output_pos_camera \\
        higherTheBetter=true \\
        scoreColumn=FragmenterScore  \\
        impute=$params.impute_output_pos_camera \\
        typeColumn=$params.type_column_output_pos_camera \\
        selectedType=$params.selected_type_output_pos_camera \\
        rename=$params.rename_output_pos_camera  \\
        renameCol=$params.rename_col_output_pos_camera \\
        onlyReportWithID=$params.only_report_with_id_output_pos_camera \\
        combineReplicate=$params.combine_replicate_output_pos_camera  \\
        combineReplicateColumn=$params.combine_replicate_column_output_pos_camera \\
        log=$params.log_output_pos_camera \\
        sampleCoverage=$params.sample_coverage_output_pos_camera  \\
        outputPeakTable=peaktablePOSout_pos_metfrag.txt \\
        outputVariables=varsPOSout_pos_metfrag.txt \\
        outputMetaData=metadataPOSout_pos_metfrag.txt \\
        Ifnormalize=$params.normalize_output_pos_camera

fi
"""
NextFlow From line 1633 of master/main.nf
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
"""
mkdir inputs
mkdir outputs
unzip  -j $parameters -d inputs/
touch ${parameters.baseName}.csv
find "\$PWD/inputs" -type f | \\
    parallel \\
        -j $params.ncore_pos_cfmid cfmid.r \\
        input={} \\
        realName={/} \\
        databaseFile=\$PWD/$cfmid_database  \\
        output=\$PWD/outputs/{/.}.csv \\
        candidate_id=$params.candidate_id_identification_pos_cfmid \\
        candidate_inchi_smiles=$params.candidate_inchi_smiles_identification_pos_cfmid \\
        candidate_mass=$params.candidate_mass_identification_pos_cfmid \\
        databaseNameColumn=$params.database_name_column_identification_pos_cfmid \\
        databaseInChIColumn=$params.database_inchI_column_identification_pos_cfmid \\
        scoreType=Jaccard

zip -j -r ${parameters.baseName}_cfmid_pos.zip outputs/*.csv
"""
NextFlow From line 1718 of master/main.nf
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
"""
ulimit -s unlimited
mkdir all
for x in *.zip ; do unzip -d all -o -u \$x ; done
zip -r cfmid_pos.zip all

aggregateMetfrag.r \\
    inputs=cfmid_pos.zip \\
    realNames=cfmid_pos.zip \\
    output=aggregated_identification_cfmid_pos.csv \\
    filetype=zip \\
    outTable=T

sed -i '/^\$/d' aggregated_identification_cfmid_pos.csv
"""
NextFlow From line 1757 of master/main.nf
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
"""
if [ -s $identification_result ]; then
    metfragPEP.r \\
        input=$identification_result \\
        score=Jaccard_Score \\
        output=pep_identification_cfmid_pos.csv \\
        readTable=T
else
    touch pep_identification_cfmid_pos.csv
fi
"""
NextFlow From line 1789 of master/main.nf
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
"""
if [ -s $cfmid_input_identification ]; then

    prepareOutput.r \\
        inputcamera=$camera_input_quant \\
        inputscores=$cfmid_input_identification \\
        inputpheno=$phenotype_file \\
        ppm=$params.ppm_output_pos_camera \\
        rt=$params.rt_output_pos_camera  \\
        higherTheBetter=true \\
        scoreColumn=Jaccard_Score \\
        impute=$params.impute_output_pos_camera \\
        typeColumn=$params.type_column_output_pos_camera \\
        selectedType=$params.selected_type_output_pos_camera  \\
        rename=$params.rename_output_pos_camera \\
        renameCol=$params.rename_col_output_pos_camera \\
        onlyReportWithID=$params.only_report_with_id_output_pos_camera \\
        combineReplicate=$params.combine_replicate_output_pos_camera  \\
        combineReplicateColumn=$params.combine_replicate_column_output_pos_camera \\
        log=$params.log_output_pos_camera \\
        sampleCoverage=$params.sample_coverage_output_pos_camera  \\
        outputPeakTable=peaktablePOSout_pos_cfmid.txt \\
        outputVariables=varsPOSout_pos_cfmid.txt \\
        outputMetaData=metadataPOSout_pos_cfmid.txt \\
        Ifnormalize=$params.normalize_output_pos_camera

else

    prepareOutput.r \\
        inputcamera=$camera_input_quant \\
        inputpheno=$phenotype_file \\
        ppm=$params.ppm_output_pos_camera \\
        rt=$params.rt_output_pos_camera  \\
        higherTheBetter=true \\
        scoreColumn=Jaccard_Score \\
        impute=$params.impute_output_pos_camera \\
        typeColumn=$params.type_column_output_pos_camera \\
        selectedType=$params.selected_type_output_pos_camera  \\
        rename=$params.rename_output_pos_camera \\
        renameCol=$params.rename_col_output_pos_camera \\
        onlyReportWithID=$params.only_report_with_id_output_pos_camera \\
        combineReplicate=$params.combine_replicate_output_pos_camera  \\
        combineReplicateColumn=$params.combine_replicate_column_output_pos_camera \\
        log=$params.log_output_pos_camera \\
        sampleCoverage=$params.sample_coverage_output_pos_camera \\
        outputPeakTable=peaktablePOSout_pos_cfmid.txt  \\
        outputVariables=varsPOSout_pos_cfmid.txt \\
        outputMetaData=metadataPOSout_pos_cfmid.txt \\
        Ifnormalize=$params.normalize_output_pos_camera

fi
"""
NextFlow From line 1821 of master/main.nf
1907
1908
1909
"""
PeakPickerHiRes -in $mzMLFile -out $mzMLFile -ini $setting_file
"""
NextFlow From line 1907 of master/main.nf
1930
1931
1932
"""
FeatureFinderMetabo -in $mzMLFile -out ${mzMLFile.baseName}.featureXML -ini $setting_file
"""
NextFlow From line 1930 of master/main.nf
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
"""
featurexmlToCamera.r \\
    input=$mzMLFile \\
    realFileName=$mzMLFile \\
    mzMLfiles=\$PWD/$mzMLFile2 \\
    polarity=positive \\
    output=${mzMLFile.baseName}.rdata \\
    sampleClass=library \\
    changeNameTO=${mzMLFile.baseName}.mzML
"""
NextFlow From line 1953 of master/main.nf
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
"""
touch quant_params_library_pos.json
touch rt_params_library_pos.json

ipo.r \\
    input=$inputs_aggregated \\
    quantOnly=TRUE \\
    allSamples=TRUE  \\
    methodXset=$params.ipo_methodXset_library_pos \\
    methodRT=$params.ipo_methodRT_library_pos \\
    noise_l=$params.ipo_noise_l_library_pos  \\
    noise_h=$params.ipo_noise_h_library_pos \\
    prefilter_l_l=$params.ipo_prefilter_l_l_library_pos \\
    prefilter_l_h=$params.ipo_prefilter_l_h_library_pos  \\
    prefilter_h_l=$params.ipo_prefilter_h_l_library_pos \\
    prefilter_h_h=$params.ipo_prefilter_h_h_library_pos  \\
    snthresh_l=$params.ipo_snthresh_l_library_pos \\
    snthresh_h=$params.ipo_snthresh_h_library_pos \\
    mzCenterFun=$params.ipo_mzCenterFun_library_pos  \\
    integrate=$params.ipo_integrate_library_pos \\
    fitgauss=$params.ipo_fitgauss_library_pos \\
    ipo_min_peakwidth_l=$params.ipo_min_peakwidth_l_library_pos  \\
    ipo_min_peakwidth_h=$params.ipo_min_peakwidth_h_library_pos \\
    ipo_max_peakwidth_l=$params.ipo_max_peakwidth_l_library_pos \\
    ipo_max_peakwidth_h=$params.ipo_max_peakwidth_h_library_pos \\
    ipo_ppm_l=$params.ipo_ppm_l_library_pos  \\
    ipo_ppm_h=$params.ipo_ppm_h_library_pos \\
    ipo_mzdiff_l=$params.ipo_mzdiff_l_library_pos \\
    ipo_mzdiff_h=$params.ipo_mzdiff_h_library_pos \\
    ipo_charge_camera=$params.ipo_charge_camera_library_pos \\
    ipo_max_ppm_camera=$params.ipo_max_ppm_camera_library_pos  \\
    response_l=$params.ipo_response_l_library_pos \\
    response_h=$params.ipo_response_h_library_pos \\
    distFunc=$params.ipo_distFunc_library_pos \\
    factorDiag_l=$params.ipo_factorDiag_l_library_pos \\
    factorDiag_h=$params.ipo_factorDiag_h_library_pos \\
    factorGap_l=$params.ipo_factorGap_l_library_pos  \\
    factorGap_h=$params.ipo_factorGap_h_library_pos \\
    localAlignment=$params.ipo_localAlignment_library_pos \\
    ipo_gapInit_l=$params.ipo_gapInit_l_library_pos \\
    ipo_gapInit_h=$params.ipo_gapInit_h_library_pos \\
    ipo_gapExtend_l=$params.ipo_gapExtend_l_library_pos  \\
    ipo_gapExtend_h=$params.ipo_gapExtend_h_library_pos \\
    ipo_profStep_l=$params.ipo_profStep_l_library_pos \\
    ipo_profStep_h=$params.ipo_profStep_h_library_pos \\
    bw_l=$params.ipo_bw_l_library_pos \\
    bw_h=$params.ipo_bw_h_library_pos \\
    minfrac_l=$params.ipo_minfrac_l_library_pos  \\
    minfrac_h=$params.ipo_minfrac_h_library_pos \\
    mzwid_l=$params.ipo_mzwid_l_library_pos \\
    mzwid_h=$params.ipo_mzwid_h_library_pos \\
    minsamp_l=$params.ipo_minsamp_l_library_pos  \\
    minsamp_h=$params.ipo_minsamp_h_library_pos \\
    max_l=$params.ipo_max_l_library_pos \\
    max_h=$params.ipo_max_h_library_pos \\
    ncores=$params.ipo_ncores_library_pos \\
    outputxset=quant_params_library_pos.json \\
    outputrt=rt_params_library_pos.json
"""
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
"""
findPeaks.r \\
    input=\$PWD/$mzMLFile \\
    output=\$PWD/${mzMLFile.baseName}.rdata \\
    ppm=$params.masstrace_ppm_library_pos_xcms \\
    peakwidthLow=$params.peakwidthlow_quant_library_pos_xcms  \\
    peakwidthHigh=$params.peakwidthhigh_quant_library_pos_xcms \\
    noise=$params.noise_quant_library_pos_xcms \\
    polarity=positive \\
    realFileName=$mzMLFile \\
    sampleClass=$params.sampleclass_quant_library_pos_xcms  \\
    mzdiff=$params.mzdiff_quant_library_pos_xcms \\
    snthresh=$params.snthresh_quant_library_pos_xcms \\
    prefilter_l=$params.prefilter_quant_library_pos_xcms \\
    prefilter_h=$params.value_of_prefilter_quant_library_pos_xcms  \\
    mzCenterFun=$params.mzCenterFun_quant_library_pos_xcms \\
    integrate=$params.integrate_quant_library_pos_xcms \\
    fitgauss=$params.fitgauss_quant_library_pos_xcms  \\
    methodXset=$params.ipo_methodXset_library_pos \\
    methodRT=$params.ipo_methodRT_library_pos \\
    noise_l=$params.ipo_noise_l_library_pos  \\
    noise_h=$params.ipo_noise_h_library_pos \\
    prefilter_l_l=$params.ipo_prefilter_l_l_library_pos \\
    prefilter_l_h=$params.ipo_prefilter_l_h_library_pos  \\
    prefilter_h_l=$params.ipo_prefilter_h_l_library_pos \\
    prefilter_h_h=$params.ipo_prefilter_h_h_library_pos  \\
    snthresh_l=$params.ipo_snthresh_l_library_pos \\
    snthresh_h=$params.ipo_snthresh_h_library_pos \\
    mzCenterFun=$params.ipo_mzCenterFun_library_pos  \\
    integrate=$params.ipo_integrate_library_pos \\
    fitgauss=$params.ipo_fitgauss_library_pos \\
    ipo_min_peakwidth_l=$params.ipo_min_peakwidth_l_library_pos  \\
    ipo_min_peakwidth_h=$params.ipo_min_peakwidth_h_library_pos \\
    ipo_max_peakwidth_l=$params.ipo_max_peakwidth_l_library_pos \\
    ipo_max_peakwidth_h=$params.ipo_max_peakwidth_h_library_pos \\
    ipo_ppm_l=$params.ipo_ppm_l_library_pos  \\
    ipo_ppm_h=$params.ipo_ppm_h_library_pos \\
    ipo_mzdiff_l=$params.ipo_mzdiff_l_library_pos \\
    ipo_mzdiff_h=$params.ipo_mzdiff_h_library_pos \\
    ipo_charge_camera=$params.ipo_charge_camera_library_pos  \\
    ipo_max_ppm_camera=$params.ipo_max_ppm_camera_library_pos  \\
    ipo_inv=$ipo_library_pos_localQ \\
    $filter_argument
"""
NextFlow From line 2065 of master/main.nf
2131
2132
2133
"""
FeatureFinderMetabo -in $mzMLFile -out ${mzMLFile.baseName}.featureXML -ini $setting_file
"""
NextFlow From line 2131 of master/main.nf
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
"""
featurexmlToCamera.r \\
    input=$mzMLFile \\
    realFileName=$mzMLFile \\
    mzMLfiles=\$PWD/$mzMLFile2 \\
    polarity=positive \\
    output=${mzMLFile.baseName}.rdata \\
    sampleClass=library \\
    changeNameTO=${mzMLFile.baseName}.mzML
"""
NextFlow From line 2152 of master/main.nf
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
"""
touch quant_params_library_pos.json
touch rt_params_library_pos.json

ipo.r \\
    input=$inputs_aggregated \\
    quantOnly=TRUE \\
    allSamples=TRUE  \\
    methodXset=$params.ipo_methodXset_library_pos \\
    methodRT=$params.ipo_methodRT_library_pos \\
    noise_l=$params.ipo_noise_l_library_pos  \\
    noise_h=$params.ipo_noise_h_library_pos \\
    prefilter_l_l=$params.ipo_prefilter_l_l_library_pos \\
    prefilter_l_h=$params.ipo_prefilter_l_h_library_pos  \\
    prefilter_h_l=$params.ipo_prefilter_h_l_library_pos \\
    prefilter_h_h=$params.ipo_prefilter_h_h_library_pos  \\
    snthresh_l=$params.ipo_snthresh_l_library_pos \\
    snthresh_h=$params.ipo_snthresh_h_library_pos \\
    mzCenterFun=$params.ipo_mzCenterFun_library_pos  \\
    integrate=$params.ipo_integrate_library_pos \\
    fitgauss=$params.ipo_fitgauss_library_pos \\
    ipo_min_peakwidth_l=$params.ipo_min_peakwidth_l_library_pos  \\
    ipo_min_peakwidth_h=$params.ipo_min_peakwidth_h_library_pos \\
    ipo_max_peakwidth_l=$params.ipo_max_peakwidth_l_library_pos \\
    ipo_max_peakwidth_h=$params.ipo_max_peakwidth_h_library_pos \\
    ipo_ppm_l=$params.ipo_ppm_l_library_pos  \\
    ipo_ppm_h=$params.ipo_ppm_h_library_pos \\
    ipo_mzdiff_l=$params.ipo_mzdiff_l_library_pos \\
    ipo_mzdiff_h=$params.ipo_mzdiff_h_library_pos  \\
    ipo_charge_camera=$params.ipo_charge_camera_library_pos \\
    ipo_max_ppm_camera=$params.ipo_max_ppm_camera_library_pos  \\
    response_l=$params.ipo_response_l_library_pos \\
    response_h=$params.ipo_response_h_library_pos \\
    distFunc=$params.ipo_distFunc_library_pos  \\
    factorDiag_l=$params.ipo_factorDiag_l_library_pos \\
    factorDiag_h=$params.ipo_factorDiag_h_library_pos \\
    factorGap_l=$params.ipo_factorGap_l_library_pos  \\
    factorGap_h=$params.ipo_factorGap_h_library_pos \\
    localAlignment=$params.ipo_localAlignment_library_pos \\
    ipo_gapInit_l=$params.ipo_gapInit_l_library_pos  \\
    ipo_gapInit_h=$params.ipo_gapInit_h_library_pos \\
    ipo_gapExtend_l=$params.ipo_gapExtend_l_library_pos  \\
    ipo_gapExtend_h=$params.ipo_gapExtend_h_library_pos \\
    ipo_profStep_l=$params.ipo_profStep_l_library_pos \\
    ipo_profStep_h=$params.ipo_profStep_h_library_pos  \\
    bw_l=$params.ipo_bw_l_library_pos \\
    bw_h=$params.ipo_bw_h_library_pos \\
    minfrac_l=$params.ipo_minfrac_l_library_pos  \\
    minfrac_h=$params.ipo_minfrac_h_library_pos \\
    mzwid_l=$params.ipo_mzwid_l_library_pos \\
    mzwid_h=$params.ipo_mzwid_h_library_pos \\
    minsamp_l=$params.ipo_minsamp_l_library_pos  \\
    minsamp_h=$params.ipo_minsamp_h_library_pos \\
    max_l=$params.ipo_max_l_library_pos \\
    max_h=$params.ipo_max_h_library_pos \\
    ncores=$params.ipo_ncores_library_pos \\
    outputxset=quant_params_library_pos.json \\
    outputrt=rt_params_library_pos.json
"""
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
"""
findPeaks.r \\
    input=\$PWD/$mzMLFile \\
    output=\$PWD/${mzMLFile.baseName}.rdata \\
    ppm=$params.masstrace_ppm_library_pos_xcms \\
    peakwidthLow=$params.peakwidthlow_quant_library_pos_xcms  \\
    peakwidthHigh=$params.peakwidthhigh_quant_library_pos_xcms \\
    noise=$params.noise_quant_library_pos_xcms \\
    polarity=positive \\
    realFileName=$mzMLFile \\
    sampleClass=$params.sampleclass_quant_library_pos_xcms  \\
    mzdiff=$params.mzdiff_quant_library_pos_xcms \\
    snthresh=$params.snthresh_quant_library_pos_xcms \\
    prefilter_l=$params.prefilter_quant_library_pos_xcms \\
    prefilter_h=$params.value_of_prefilter_quant_library_pos_xcms  \\
    mzCenterFun=$params.mzCenterFun_quant_library_pos_xcms \\
    integrate=$params.integrate_quant_library_pos_xcms \\
    fitgauss=$params.fitgauss_quant_library_pos_xcms  \\
    methodXset=$params.ipo_methodXset_library_pos \\
    methodRT=$params.ipo_methodRT_library_pos \\
    noise_l=$params.ipo_noise_l_library_pos  \\
    noise_h=$params.ipo_noise_h_library_pos \\
    prefilter_l_l=$params.ipo_prefilter_l_l_library_pos \\
    prefilter_l_h=$params.ipo_prefilter_l_h_library_pos  \\
    prefilter_h_l=$params.ipo_prefilter_h_l_library_pos \\
    prefilter_h_h=$params.ipo_prefilter_h_h_library_pos  \\
    snthresh_l=$params.ipo_snthresh_l_library_pos \\
    snthresh_h=$params.ipo_snthresh_h_library_pos \\
    mzCenterFun=$params.ipo_mzCenterFun_library_pos  \\
    integrate=$params.ipo_integrate_library_pos \\
    fitgauss=$params.ipo_fitgauss_library_pos \\
    ipo_min_peakwidth_l=$params.ipo_min_peakwidth_l_library_pos  \\
    ipo_min_peakwidth_h=$params.ipo_min_peakwidth_h_library_pos \\
    ipo_max_peakwidth_l=$params.ipo_max_peakwidth_l_library_pos \\
    ipo_max_peakwidth_h=$params.ipo_max_peakwidth_h_library_pos \\
    ipo_ppm_l=$params.ipo_ppm_l_library_pos  \\
    ipo_ppm_h=$params.ipo_ppm_h_library_pos \\
    ipo_mzdiff_l=$params.ipo_mzdiff_l_library_pos \\
    ipo_mzdiff_h=$params.ipo_mzdiff_h_library_pos \\
    ipo_charge_camera=$params.ipo_charge_camera_library_pos  \\
    ipo_max_ppm_camera=$params.ipo_max_ppm_camera_library_pos  \\
    ipo_inv=$ipo_library_pos_localQ \\
    $filter_argument
"""
NextFlow From line 2266 of master/main.nf
2332
2333
2334
"""
xsAnnotate.r input=$rdata_files output=${rdata_files.baseName}.rdata
"""
NextFlow From line 2332 of master/main.nf
2353
2354
2355
2356
2357
2358
2359
2360
"""
groupFWHM.r \\
    input=$rdata_files \\
    output=${rdata_files.baseName}.rdata \\
    sigma=$params.sigma_group_library_pos_camera \\
    perfwhm=$params.perfwhm_group_library_pos_camera \\
    intval=$params.intval_group_library_pos_camera
"""
NextFlow From line 2353 of master/main.nf
2380
2381
2382
2383
2384
2385
2386
"""
findAdducts.r \\
    input=$rdata_files \\
    output=${rdata_files.baseName}.rdata \\
    ppm=$params.ppm_findaddcuts_library_pos_camera \\
    polarity=$params.polarity_findaddcuts_library_pos_camera
"""
NextFlow From line 2380 of master/main.nf
2406
2407
2408
2409
2410
2411
"""
findIsotopes.r \\
    input=$rdata_files \\
    output=${rdata_files.baseName}.rdata \\
    maxcharge=$params.maxcharge_findisotopes_library_pos_camera
"""
NextFlow From line 2406 of master/main.nf
2432
2433
2434
2435
2436
2437
"""
readMS2MSnBase.r \\
    input=$mzMLFile \\
    output=${mzMLFile.baseName}_ReadMsmsLibrary.rdata \\
    inputname=${mzMLFile.baseName}
"""
NextFlow From line 2432 of master/main.nf
2462
2463
2464
2465
2466
2467
2468
2469
"""
mapMS2ToCamera.r \\
    inputCAMERA=$rdata_files_ms1 \\
    inputMS2=$rdata_files_ms2 \\
    output=${rdata_files_ms1.baseName}_MapMsms2Camera_library_pos.rdata  \\
    ppm=$params.ppm_mapmsmstocamera_library_pos_msnbase \\
    rt=$params.rt_mapmsmstocamera_library_pos_msnbase
"""
NextFlow From line 2462 of master/main.nf
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
"""
mkdir out

createLibrary.r \\
    inputCAMERA=$rdata_camera \\
    precursorppm=$params.ppm_create_library_pos_msnbase \\
    inputMS2=$ms2_data \\
    output=${rdata_camera.baseName}.csv \\
    inputLibrary=$library_desc  \\
    rawFileName=$params.raw_file_name_preparelibrary_pos_msnbase \\
    compundID=$params.compund_id_preparelibrary_pos_msnbase \\
    compoundName=$params.compound_name_preparelibrary_pos_msnbase  \\
    mzCol=$params.mz_col_preparelibrary_pos_msnbase \\
    whichmz=$params.which_mz_preparelibrary_pos_msnbase
"""
NextFlow From line 2494 of master/main.nf
2530
2531
2532
2533
2534
2535
"""
collectLibrary.r \\
    inputs=$aggregatecdlibrary \\
    realNames=$aggregatecdlibrary \\
    output=library_pos.csv
"""
NextFlow From line 2530 of master/main.nf
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
"""
#!env Rscript
Files<-list.files(,pattern = "zip",full.names=T)
Files_org<-list.files(,pattern = "zip")
for(f in Files){
    zip::unzip(zipfile = f,junkpaths = T)
}
Files<-list.files(,pattern = "txt",full.names=T)
FilesTMP<-sapply(strsplit(split = "_",fixed = T,x = basename(Files)),function(x){paste(x[-1],collapse = "_")})
    FileDub<-Files[duplicated(FilesTMP)]
for(x in FileDub){
    file.remove(x)
}
files_to_pass<-list.files(pattern="txt")
files_to_pass<-files_to_pass[!files_to_pass%in%Files_org]
zip::zip(zipfile="mappedtometfrag_pos.zip",files=files_to_pass)
"""
NextFlow From line 2555 of master/main.nf
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
"""
librarySearchEngine.r \\
    -l $libraryFile \\
    -i $parameters \\
    -out aggregated_identification_library_pos.csv \\
    -th "-1" \\
    -im pos \\
    -ts Scoredotproduct \\
    -rs 1000 \\
    -ncore $params.ncore_searchengine_library_pos_msnbase

sed -i '/^\$/d' aggregated_identification_library_pos.csv
"""
NextFlow From line 2593 of master/main.nf
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
"""
librarySearchEngine.r \\
    -l $libraryFile \\
    -i $parameters \\
    -out aggregated_identification_library_pos.csv \\
    -th "-1" \\
    -im pos \\
    -ts Scoredotproduct \\
    -rs 1000 \\
    -ncore $params.ncore_searchengine_library_pos_msnbase

sed -i '/^\$/d' aggregated_identification_library_pos.csv
"""
NextFlow From line 2627 of master/main.nf
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
"""
if [ -s $identification_result ]; then
    metfragPEP.r \\
        input=$identification_result \\
        score=score \\
        output=pep_identification_library_pos.csv \\
        readTable=T
else
    touch pep_identification_library_pos.csv
fi
"""
NextFlow From line 2659 of master/main.nf
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
"""
if [ -s $library_input_identification ]; then

    prepareOutput.r \\
        inputcamera=$camera_input_quant \\
        inputscores=$library_input_identification \\
        inputpheno=$phenotype_file \\
        ppm=$params.ppm_output_pos_camera  \\
        rt=$params.rt_output_pos_camera \\
        higherTheBetter=true \\
        scoreColumn=score \\
        impute=$params.impute_output_pos_camera \\
        typeColumn=$params.type_column_output_pos_camera  \\
        selectedType=$params.selected_type_output_pos_camera \\
        rename=$params.rename_output_pos_camera \\
        renameCol=$params.rename_col_output_pos_camera \\
        onlyReportWithID=$params.only_report_with_id_output_pos_camera  \\
        combineReplicate=$params.combine_replicate_output_pos_camera \\
        combineReplicateColumn=$params.combine_replicate_column_output_pos_camera \\
        log=$params.log_output_pos_camera  \\
        sampleCoverage=$params.sample_coverage_output_pos_camera \\
        outputPeakTable=peaktablePOSout_pos_library.txt \\
        outputVariables=varsPOSout_pos_library.txt \\
        outputMetaData=metadataPOSout_pos_library.txt \\
        Ifnormalize=$params.normalize_output_pos_camera

else

    prepareOutput.r \\
        inputcamera=$camera_input_quant \\
        inputpheno=$phenotype_file \\
        ppm=$params.ppm_output_pos_camera \\
        rt=$params.rt_output_pos_camera \\
        higherTheBetter=true \\
        scoreColumn=score  \\
        impute=$params.impute_output_pos_camera \\
        typeColumn=$params.type_column_output_pos_camera \\
        selectedType=$params.selected_type_output_pos_camera \\
        rename=$params.rename_output_pos_camera  \\
        renameCol=$params.rename_col_output_pos_camera \\
        onlyReportWithID=$params.only_report_with_id_output_pos_camera \\
        combineReplicate=$params.combine_replicate_output_pos_camera  \\
        combineReplicateColumn=$params.combine_replicate_column_output_pos_camera \\
        log=$params.log_output_pos_camera \\
        sampleCoverage=$params.sample_coverage_output_pos_camera  \\
        outputPeakTable=peaktablePOSout_pos_library.txt \\
        outputVariables=varsPOSout_pos_library.txt \\
        outputMetaData=metadataPOSout_pos_library.txt \\
        Ifnormalize=$params.normalize_output_pos_camera

fi
"""
NextFlow From line 2692 of master/main.nf
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
"""
prepareOutput.r \\
    inputcamera=$camera_input_quant \\
    inputpheno=$phenotype_file \\
    ppm=$params.ppm_output_pos_camera \\
    rt=$params.rt_output_pos_camera  \\
    higherTheBetter=true \\
    scoreColumn=score \\
    impute=$params.impute_output_pos_camera \\
    typeColumn=$params.type_column_output_pos_camera \\
    selectedType=$params.selected_type_output_pos_camera  \\
    rename=$params.rename_output_pos_camera \\
    renameCol=$params.rename_col_output_pos_camera \\
    onlyReportWithID=$params.only_report_with_id_output_pos_camera  \\
    combineReplicate=$params.combine_replicate_output_pos_camera \\
    combineReplicateColumn=$params.combine_replicate_column_output_pos_camera \\
    log=$params.log_output_pos_camera  \\
    sampleCoverage=$params.sample_coverage_output_pos_camera \\
    outputPeakTable=peaktablePOSout_POS_noid.txt \\
    outputVariables=varsPOSout_pos_noid.txt \\
    outputMetaData=metadataPOSout_pos_noid.txt \\
    Ifnormalize=$params.normalize_output_pos_camera
"""
NextFlow From line 2764 of master/main.nf
2816
2817
2818
"""
PeakPickerHiRes -in $mzMLFile -out $mzMLFile -ini $setting_file
"""
NextFlow From line 2816 of master/main.nf
2844
2845
2846
"""
FeatureFinderMetabo -in $mzMLFile -out ${mzMLFile.baseName}.featureXML -ini $setting_file
"""
NextFlow From line 2844 of master/main.nf
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
"""
featurexmlToCamera.r \\
    input=$mzMLFile \\
    realFileName=$mzMLFile \\
    mzMLfiles=\$PWD/$mzMLFile2 \\
    polarity=negative \\
    output=${mzMLFile.baseName}.rdata \\
    phenoFile=$phenotype_file  \\
    phenoDataColumn=$params.phenodatacolumn_quant_neg \\
    sampleClass=$params.sampleclass_quant_neg_xcms \\
    changeNameTO=${mzMLFile.baseName}.mzML
"""
NextFlow From line 2866 of master/main.nf
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
"""
touch quant_params_neg.json
touch rt_params_neg.json

ipo.r \\
    input=$inputs_aggregated \\
    quantOnly=$ipo_neg_globalAvoidRT \\
    allSamples=$params.ipo_allSamples_neg \\
    columnToSelect=$params.ipo_columnToSelect_neg  \\
    valueToSelect=$params.ipo_valueToSelect_neg \\
    phenoFile=$phenotype_file  \\
    methodXset=$params.ipo_methodXset_neg \\
    methodRT=$params.ipo_methodRT_neg \\
    noise_l=$params.ipo_noise_l_neg  \\
    noise_h=$params.ipo_noise_h_neg \\
    prefilter_l_l=$params.ipo_prefilter_l_l_neg \\
    prefilter_l_h=$params.ipo_prefilter_l_h_neg  \\
    prefilter_h_l=$params.ipo_prefilter_h_l_neg \\
    prefilter_h_h=$params.ipo_prefilter_h_h_neg  \\
    snthresh_l=$params.ipo_snthresh_l_neg \\
    snthresh_h=$params.ipo_snthresh_h_neg \\
    mzCenterFun=$params.ipo_mzCenterFun_neg  \\
    integrate=$params.ipo_integrate_neg \\
    fitgauss=$params.ipo_fitgauss_neg \\
    ipo_min_peakwidth_l=$params.ipo_min_peakwidth_l_neg  \\
    ipo_min_peakwidth_h=$params.ipo_min_peakwidth_h_neg \\
    ipo_max_peakwidth_l=$params.ipo_max_peakwidth_l_neg \\
    ipo_max_peakwidth_h=$params.ipo_max_peakwidth_h_neg \\
    ipo_ppm_l=$params.ipo_ppm_l_neg  \\
    ipo_ppm_h=$params.ipo_ppm_h_neg \\
    ipo_mzdiff_l=$params.ipo_mzdiff_l_neg \\
    ipo_mzdiff_h=$params.ipo_mzdiff_h_neg \\
    ipo_charge_camera=$params.ipo_charge_camera_neg \\
    ipo_max_ppm_camera=$params.ipo_max_ppm_camera_neg  \\
    response_l=$params.ipo_response_l_neg \\
    response_h=$params.ipo_response_h_neg \\
    distFunc=$params.ipo_distFunc_neg \\
    factorDiag_l=$params.ipo_factorDiag_l_neg \\
    factorDiag_h=$params.ipo_factorDiag_h_neg \\
    factorGap_l=$params.ipo_factorGap_l_neg  \\
    factorGap_h=$params.ipo_factorGap_h_neg \\
    localAlignment=$params.ipo_localAlignment_neg \\
    ipo_gapInit_l=$params.ipo_gapInit_l_neg \\
    ipo_gapInit_h=$params.ipo_gapInit_h_neg \\
    ipo_gapExtend_l=$params.ipo_gapExtend_l_neg  \\
    ipo_gapExtend_h=$params.ipo_gapExtend_h_neg \\
    ipo_profStep_l=$params.ipo_profStep_l_neg \\
    ipo_profStep_h=$params.ipo_profStep_h_neg \\
    bw_l=$params.ipo_bw_l_neg \\
    bw_h=$params.ipo_bw_h_neg \\
    minfrac_l=$params.ipo_minfrac_l_neg  \\
    minfrac_h=$params.ipo_minfrac_h_neg \\
    mzwid_l=$params.ipo_mzwid_l_neg \\
    mzwid_h=$params.ipo_mzwid_h_neg \\
    minsamp_l=$params.ipo_minsamp_l_neg  \\
    minsamp_h=$params.ipo_minsamp_h_neg \\
    max_l=$params.ipo_max_l_neg \\
    max_h=$params.ipo_max_h_neg \\
    ncores=$params.ipo_ncores_neg \\
    outputxset=quant_params_neg.json \\
    outputrt=rt_params_neg.json
"""
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
"""
findPeaks.r \\
    input=\$PWD/$mzMLFile \\
    output=\$PWD/${mzMLFile.baseName}.rdata \\
    ppm=$params.masstrace_ppm_neg_xcms \\
    peakwidthLow=$params.peakwidthlow_quant_neg_xcms  \\
    peakwidthHigh=$params.peakwidthhigh_quant_neg_xcms \\
    noise=$params.noise_quant_neg_xcms \\
    polarity=negative \\
    realFileName=$mzMLFile \\
    phenoFile=$phenotype_file \\
    phenoDataColumn=$params.phenodatacolumn_quant_neg  \\
    sampleClass=$params.sampleclass_quant_neg_xcms \\
    mzdiff=$params.mzdiff_quant_neg_xcms \\
    snthresh=$params.snthresh_quant_neg_xcms \\
    prefilter_l=$params.prefilter_quant_neg_xcms  \\
    prefilter_h=$params.value_of_prefilter_quant_neg_xcms \\
    mzCenterFun=$params.mzCenterFun_quant_neg_xcms \\
    integrate=$params.integrate_quant_neg_xcms \\
    fitgauss=$params.fitgauss_quant_neg_xcms  \\
    methodXset=$params.ipo_methodXset_neg \\
    methodRT=$params.ipo_methodRT_neg \\
    noise_l=$params.ipo_noise_l_neg  \\
    noise_h=$params.ipo_noise_h_neg \\
    prefilter_l_l=$params.ipo_prefilter_l_l_neg \\
    prefilter_l_h=$params.ipo_prefilter_l_h_neg  \\
    prefilter_h_l=$params.ipo_prefilter_h_l_neg \\
    prefilter_h_h=$params.ipo_prefilter_h_h_neg  \\
    snthresh_l=$params.ipo_snthresh_l_neg \\
    snthresh_h=$params.ipo_snthresh_h_neg \\
    mzCenterFun=$params.ipo_mzCenterFun_neg  \\
    integrate=$params.ipo_integrate_neg \\
    fitgauss=$params.ipo_fitgauss_neg \\
    ipo_min_peakwidth_l=$params.ipo_min_peakwidth_l_neg  \\
    ipo_min_peakwidth_h=$params.ipo_min_peakwidth_h_neg \\
    ipo_max_peakwidth_l=$params.ipo_max_peakwidth_l_neg \\
    ipo_max_peakwidth_h=$params.ipo_max_peakwidth_h_neg \\
    ipo_ppm_l=$params.ipo_ppm_l_neg  \\
    ipo_ppm_h=$params.ipo_ppm_h_neg \\
    ipo_mzdiff_l=$params.ipo_mzdiff_l_neg \\
    ipo_mzdiff_h=$params.ipo_mzdiff_h_neg \\
    ipo_charge_camera=$params.ipo_charge_camera_neg \\
    ipo_max_ppm_camera=$params.ipo_max_ppm_camera_neg  \\
    ipo_inv=$ipo_neg_localQ \\
    $filter_argument
"""
NextFlow From line 2987 of master/main.nf
3057
3058
3059
"""
FeatureFinderMetabo -in $mzMLFile -out ${mzMLFile.baseName}.featureXML -ini $setting_file
"""
NextFlow From line 3057 of master/main.nf
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
"""
featurexmlToCamera.r \\
    input=$mzMLFile \\
    realFileName=$mzMLFile \\
    mzMLfiles=\$PWD/$mzMLFile2 \\
    polarity=negative \\
    output=${mzMLFile.baseName}.rdata \\
    phenoFile=$phenotype_file  \\
    phenoDataColumn=$params.phenodatacolumn_quant_neg \\
    sampleClass=$params.sampleclass_quant_neg_xcms \\
    changeNameTO=${mzMLFile.baseName}.mzML
"""
NextFlow From line 3079 of master/main.nf
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
"""
touch quant_params_neg.json
touch rt_params_neg.json

ipo.r \\
    input=$inputs_aggregated \\
    quantOnly=$ipo_neg_globalAvoidRT \\
    allSamples=$params.ipo_allSamples_neg \\
    columnToSelect=$params.ipo_columnToSelect_neg  \\
    valueToSelect=$params.ipo_valueToSelect_neg \\
    phenoFile=$phenotype_file  \\
    methodXset=$params.ipo_methodXset_neg \\
    methodRT=$params.ipo_methodRT_neg \\
    noise_l=$params.ipo_noise_l_neg  \\
    noise_h=$params.ipo_noise_h_neg \\
    prefilter_l_l=$params.ipo_prefilter_l_l_neg \\
    prefilter_l_h=$params.ipo_prefilter_l_h_neg  \\
    prefilter_h_l=$params.ipo_prefilter_h_l_neg \\
    prefilter_h_h=$params.ipo_prefilter_h_h_neg  \\
    snthresh_l=$params.ipo_snthresh_l_neg \\
    snthresh_h=$params.ipo_snthresh_h_neg \\
    mzCenterFun=$params.ipo_mzCenterFun_neg  \\
    integrate=$params.ipo_integrate_neg \\
    fitgauss=$params.ipo_fitgauss_neg \\
    ipo_min_peakwidth_l=$params.ipo_min_peakwidth_l_neg  \\
    ipo_min_peakwidth_h=$params.ipo_min_peakwidth_h_neg \\
    ipo_max_peakwidth_l=$params.ipo_max_peakwidth_l_neg \\
    ipo_max_peakwidth_h=$params.ipo_max_peakwidth_h_neg \\
    ipo_ppm_l=$params.ipo_ppm_l_neg  \\
    ipo_ppm_h=$params.ipo_ppm_h_neg \\
    ipo_mzdiff_l=$params.ipo_mzdiff_l_neg \\
    ipo_mzdiff_h=$params.ipo_mzdiff_h_neg \\
    ipo_charge_camera=$params.ipo_charge_camera_neg \\
    ipo_max_ppm_camera=$params.ipo_max_ppm_camera_neg  \\
    response_l=$params.ipo_response_l_neg \\
    response_h=$params.ipo_response_h_neg \\
    distFunc=$params.ipo_distFunc_neg \\
    factorDiag_l=$params.ipo_factorDiag_l_neg \\
    factorDiag_h=$params.ipo_factorDiag_h_neg \\
    factorGap_l=$params.ipo_factorGap_l_neg  \\
    factorGap_h=$params.ipo_factorGap_h_neg \\
    localAlignment=$params.ipo_localAlignment_neg \\
    ipo_gapInit_l=$params.ipo_gapInit_l_neg \\
    ipo_gapInit_h=$params.ipo_gapInit_h_neg \\
    ipo_gapExtend_l=$params.ipo_gapExtend_l_neg  \\
    ipo_gapExtend_h=$params.ipo_gapExtend_h_neg \\
    ipo_profStep_l=$params.ipo_profStep_l_neg \\
    ipo_profStep_h=$params.ipo_profStep_h_neg \\
    bw_l=$params.ipo_bw_l_neg \\
    bw_h=$params.ipo_bw_h_neg \\
    minfrac_l=$params.ipo_minfrac_l_neg  \\
    minfrac_h=$params.ipo_minfrac_h_neg \\
    mzwid_l=$params.ipo_mzwid_l_neg \\
    mzwid_h=$params.ipo_mzwid_h_neg \\
    minsamp_l=$params.ipo_minsamp_l_neg  \\
    minsamp_h=$params.ipo_minsamp_h_neg \\
    max_l=$params.ipo_max_l_neg \\
    max_h=$params.ipo_max_h_neg \\
    ncores=$params.ipo_ncores_neg \\
    outputxset=quant_params_neg.json \\
    outputrt=rt_params_neg.json
"""
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
"""
findPeaks.r \\
    input=\$PWD/$mzMLFile \\
    output=\$PWD/${mzMLFile.baseName}.rdata \\
    ppm=$params.masstrace_ppm_neg_xcms \\
    peakwidthLow=$params.peakwidthlow_quant_neg_xcms  \\
    peakwidthHigh=$params.peakwidthhigh_quant_neg_xcms \\
    noise=$params.noise_quant_neg_xcms \\
    polarity=negative \\
    realFileName=$mzMLFile \\
    phenoFile=$phenotype_file \\
    phenoDataColumn=$params.phenodatacolumn_quant_neg  \\
    sampleClass=$params.sampleclass_quant_neg_xcms \\
    mzdiff=$params.mzdiff_quant_neg_xcms \\
    snthresh=$params.snthresh_quant_neg_xcms \\
    prefilter_l=$params.prefilter_quant_neg_xcms  \\
    prefilter_h=$params.value_of_prefilter_quant_neg_xcms \\
    mzCenterFun=$params.mzCenterFun_quant_neg_xcms \\
    integrate=$params.integrate_quant_neg_xcms \\
    fitgauss=$params.fitgauss_quant_neg_xcms  \\
    methodXset=$params.ipo_methodXset_neg \\
    methodRT=$params.ipo_methodRT_neg \\
    noise_l=$params.ipo_noise_l_neg  \\
    noise_h=$params.ipo_noise_h_neg \\
    prefilter_l_l=$params.ipo_prefilter_l_l_neg \\
    prefilter_l_h=$params.ipo_prefilter_l_h_neg  \\
    prefilter_h_l=$params.ipo_prefilter_h_l_neg \\
    prefilter_h_h=$params.ipo_prefilter_h_h_neg  \\
    snthresh_l=$params.ipo_snthresh_l_neg \\
    snthresh_h=$params.ipo_snthresh_h_neg \\
    mzCenterFun=$params.ipo_mzCenterFun_neg  \\
    integrate=$params.ipo_integrate_neg \\
    fitgauss=$params.ipo_fitgauss_neg \\
    ipo_min_peakwidth_l=$params.ipo_min_peakwidth_l_neg  \\
    ipo_min_peakwidth_h=$params.ipo_min_peakwidth_h_neg \\
    ipo_max_peakwidth_l=$params.ipo_max_peakwidth_l_neg \\
    ipo_max_peakwidth_h=$params.ipo_max_peakwidth_h_neg \\
    ipo_ppm_l=$params.ipo_ppm_l_neg  \\
    ipo_ppm_h=$params.ipo_ppm_h_neg \\
    ipo_mzdiff_l=$params.ipo_mzdiff_l_neg \\
    ipo_mzdiff_h=$params.ipo_mzdiff_h_neg \\
    ipo_charge_camera=$params.ipo_charge_camera_neg \\
    ipo_max_ppm_camera=$params.ipo_max_ppm_camera_neg  \\
    ipo_inv=$ipo_neg_localQ \\
    $filter_argument
"""
NextFlow From line 3200 of master/main.nf
3267
3268
3269
3270
"""
nextFlowDIR=\$PWD
xcmsCollect.r input=$inputs_aggregated output=collection_neg.rdata
"""
NextFlow From line 3267 of master/main.nf
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
"""
retCor.r \\
    input=\$PWD/$rdata_files \\
    output=RTcorrected_neg.rdata \\
    method=obiwarp \\
    response_l=$params.ipo_response_l_neg \\
    response_h=$params.ipo_response_h_neg \\
    distFunc=$params.ipo_distFunc_neg \\
    factorDiag_l=$params.ipo_factorDiag_l_neg \\
    factorDiag_h=$params.ipo_factorDiag_h_neg \\
    factorGap_l=$params.ipo_factorGap_l_neg  \\
    factorGap_h=$params.ipo_factorGap_h_neg \\
    localAlignment=$params.ipo_localAlignment_neg \\
    ipo_gapInit_l=$params.ipo_gapInit_l_neg \\
    ipo_gapInit_h=$params.ipo_gapInit_h_neg \\
    ipo_gapExtend_l=$params.ipo_gapExtend_l_neg  \\
    ipo_gapExtend_h=$params.ipo_gapExtend_h_neg \\
    ipo_profStep_l=$params.ipo_profStep_l_neg \\
    ipo_profStep_h=$params.ipo_profStep_h_neg \\
    bw_l=$params.ipo_bw_l_neg \\
    bw_h=$params.ipo_bw_h_neg \\
    minfrac_l=$params.ipo_minfrac_l_neg  \\
    minfrac_h=$params.ipo_minfrac_h_neg \\
    mzwid_l=$params.ipo_mzwid_l_neg \\
    mzwid_h=$params.ipo_mzwid_h_neg \\
    minsamp_l=$params.ipo_minsamp_l_neg  \\
    minsamp_h=$params.ipo_minsamp_h_neg \\
    max_l=$params.ipo_max_l_neg \\
    max_h=$params.ipo_max_h_neg \\
    ipo_inv=$ipo_neg_localRT \\
    ncores=$params.ipo_ncores_neg  \\
    profStep=$params.profStep_align_N1_neg_xcms \\
    center=$params.center_align_N1_neg_xcms \\
    response=$params.response_align_N1_neg_xcms  \\
    distFunc=$params.distFunc_align_N1_neg_xcms \\
    gapInit=$params.gapInit_align_N1_neg_xcms \\
    gapExtend=$params.gapExtend_align_N1_neg_xcms  \\
    factorDiag=$params.factorDiag_align_N1_neg_xcms \\
    factorGap=$params.factorGap_align_N1_neg_xcms \\
    localAlignment=$params.localAlignment_align_N1_neg_xcms \\
    $filter_argument \\
    inputraw=$inputs_aggregated
"""
NextFlow From line 3294 of master/main.nf
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
"""
group.r \\
    input=$rdata_files \\
    output=groupN1_neg.rdata \\
    bandwidth=$params.bandwidth_group_N1_neg_xcms \\
    minfrac=$params.minfrac_group_N1_neg_xcms \\
    minsamp=$params.minsamp_group_N1_neg_xcms \\
    max=$params.max_group_N1_neg_xcms  \\
    mzwid=$params.mzwid_group_N1_neg_xcms
"""
NextFlow From line 3354 of master/main.nf
3386
3387
3388
3389
3390
3391
3392
3393
3394
"""
blankfilter.r \\
    input=$rdata_files \\
    output=blankFiltered_neg.rdata \\
    method=$params.method_blankfilter_neg_xcms \\
    blank=$params.blank_blankfilter_neg_xcms \\
    sample=$params.sample_blankfilter_neg_xcms \\
    rest=$params.rest_blankfilter_neg_xcms
"""
NextFlow From line 3386 of master/main.nf
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
"""
dilutionfilter.r \\
    input=$rdata_files \\
    output=dilutionFiltered_neg.rdata \\
    Corto=$params.corto_dilutionfilter_neg_xcms  \\
    dilution=$params.dilution_dilutionfilter_neg_xcms \\
    pvalue=$params.pvalue_dilutionfilter_neg_xcms \\
    corcut=$params.corcut_dilutionfilter_neg_xcms \\
    abs=$params.abs_dilutionfilter_neg_xcms
"""
NextFlow From line 3419 of master/main.nf
3452
3453
3454
3455
3456
3457
3458
"""
cvfilter.r \\
    input=$rdata_files \\
    output=cvFiltered_neg.rdata \\
    qc=$params.qc_cvfilter_neg_xcms \\
    cvcut=$params.cvcut_cvfilter_neg_xcms
"""
NextFlow From line 3452 of master/main.nf
3481
3482
3483
"""
xsAnnotate.r input=$rdata_files output=CameraAnnotatePeaks_neg.rdata
"""
NextFlow From line 3481 of master/main.nf
3502
3503
3504
3505
3506
3507
3508
3509
"""
groupFWHM.r \\
    input=$rdata_files \\
    output=CameraGroup_neg.rdata \\
    sigma=$params.sigma_group_neg_camera \\
    perfwhm=$params.perfwhm_group_neg_camera \\
    intval=$params.intval_group_neg_camera
"""
NextFlow From line 3502 of master/main.nf
3528
3529
3530
3531
3532
3533
3534
"""
findAdducts.r \\
    input=$rdata_files \\
    output=CameraFindAdducts_neg.rdata \\
    ppm=$params.ppm_findaddcuts_neg_camera \\
    polarity=$params.polarity_findaddcuts_neg_camera
"""
NextFlow From line 3528 of master/main.nf
3553
3554
3555
3556
3557
3558
"""
findIsotopes.r \\
    input=$rdata_files \\
    output=CameraFindIsotopes_neg.rdata \\
    maxcharge=$params.maxcharge_findisotopes_neg_camera
"""
NextFlow From line 3553 of master/main.nf
3584
3585
3586
3587
3588
3589
"""
readMS2MSnBase.r \\
    input=$mzMLFile \\
    output=${mzMLFile.baseName}.rdata \\
    inputname=${mzMLFile.baseName}
"""
NextFlow From line 3584 of master/main.nf
3611
3612
3613
3614
3615
3616
3617
3618
"""
mapMS2ToCamera.r \\
    inputCAMERA=$rdata_files_ms1 \\
    inputMS2=$input_args \\
    output=MapMsms2Camera_neg.rdata  \\
    ppm=$params.ppm_mapmsmstocamera_neg_msnbase \\
    rt=$params.rt_mapmsmstocamera_neg_msnbase
"""
NextFlow From line 3611 of master/main.nf
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
"""
mkdir out

MS2ToMetFrag.r \\
    inputCAMERA=$rdata_files_ms1 \\
    inputMS2=$rdata_files_ms2 \\
    output=out \\
    precursorppm=$params.precursorppm_msmstoparam_neg_msnbase  \\
    fragmentppm=$params.fragmentppm_msmstoparam_neg_msnbase \\
    fragmentabs=$params.fragmentabs_msmstoparam_neg_msnbase \\
    database=$params.database_msmstoparam_neg_msnbase  \\
    mode=$params.mode_msmstoparam_neg_msnbase \\
    adductRules=$params.adductRules_msmstoparam_neg_msnbase \\
    minPeaks=$params.minPeaks_msmstoparam_neg_msnbase

ls out/ -A -1  | cut -d'_' -f4- | tr ' ' '\n' | sort -u | xargs -I %  find out/ -type f -iname *% -exec zip %.zip {} +
"""
NextFlow From line 3638 of master/main.nf
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
"""
mkdir inputs
mkdir outputs
unzip  -j $parameters -d inputs/
touch ${parameters.baseName}_class_Csifingerid_neg.csv

fingerID.r \\
    input=\$PWD/inputs \\
    database=$params.database_csifingerid_neg_csifingerid \\
    tryOffline=T \\
    output=\$PWD/outputs/ \\
    ncores=$params.ncore_csifingerid_neg_csifingerid  \\
    timeout=$params.timeout_csifingerid_neg_csifingerid \\
    canopus=T \\
    canopusOutput=\$PWD/${parameters.baseName}_class_Csifingerid_neg.csv

zip -j -r ${parameters.baseName}_Csifingerid_neg.zip outputs/*.csv
"""
NextFlow From line 3682 of master/main.nf
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
"""
ulimit -s unlimited
mkdir all
for x in *.zip ; do unzip -d all -o -u \$x ; done
zip -r Csifingerid_neg.zip all

aggregateMetfrag.r \\
    inputs=Csifingerid_neg.zip \\
    realNames=Csifingerid_neg.zip \\
    output=aggregated_identification_csifingerid_neg.csv \\
    filetype=zip \\
    outTable=T

sed -i '/^\$/d' aggregated_identification_csifingerid_neg.csv
"""
NextFlow From line 3717 of master/main.nf
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
"""
if [ -s $identification_result ]; then
    metfragPEP.r \\
        input=$identification_result \\
        score=score \\
        output=pep_identification_csifingerid_neg.csv \\
        readTable=T
else
    touch pep_identification_csifingerid_neg.csv
fi
"""
NextFlow From line 3751 of master/main.nf
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
"""
if [ -s $csifingerid_input_identification ]; then

    prepareOutput.r \\
        inputcamera=$camera_input_quant \\
        inputscores=$csifingerid_input_identification \\
        inputpheno=$phenotype_file \\
        ppm=$params.ppm_output_neg_camera  \\
        rt=$params.rt_output_neg_camera \\
        higherTheBetter=true \\
        scoreColumn=score \\
        impute=$params.impute_output_neg_camera \\
        typeColumn=$params.type_column_output_neg_camera \\
        selectedType=$params.selected_type_output_neg_camera  \\
        rename=$params.rename_output_neg_camera \\
        renameCol=$params.rename_col_output_neg_camera \\
        onlyReportWithID=$params.only_report_with_id_output_neg_camera \\
        combineReplicate=$params.combine_replicate_output_neg_camera  \\
        combineReplicateColumn=$params.combine_replicate_column_output_neg_camera \\
        log=$params.log_output_neg_camera \\
        sampleCoverage=$params.sample_coverage_output_neg_camera \\
        outputPeakTable=peaktableNEGout_neg_csifingerid.txt  \\
        outputVariables=varsNEGout_neg_csifingerid.txt \\
        outputMetaData=metadataNEGout_neg_csifingerid.txt \\
        Ifnormalize=$params.normalize_output_neg_camera

else

    prepareOutput.r \\
        inputcamera=$camera_input_quant \\
        inputpheno=$phenotype_file \\
        ppm=$params.ppm_output_neg_camera \\
        rt=$params.rt_output_neg_camera \\
        higherTheBetter=true \\
        scoreColumn=score  \\
        impute=$params.impute_output_neg_camera \\
        typeColumn=$params.type_column_output_neg_camera \\
        selectedType=$params.selected_type_output_neg_camera \\
        rename=$params.rename_output_neg_camera \\
        renameCol=$params.rename_col_output_neg_camera  \\
        onlyReportWithID=$params.only_report_with_id_output_neg_camera \\
        combineReplicate=$params.combine_replicate_output_neg_camera \\
        combineReplicateColumn=$params.combine_replicate_column_output_neg_camera  \\
        log=$params.log_output_neg_camera \\
        sampleCoverage=$params.sample_coverage_output_neg_camera \\
        outputPeakTable=peaktableNEGout_neg_csifingerid.txt \\
        outputVariables=varsNEGout_neg_csifingerid.txt  \\
        outputMetaData=metadataNEGout_neg_csifingerid.txt \\
        Ifnormalize=$params.normalize_output_neg_camera

fi
"""
NextFlow From line 3782 of master/main.nf
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
"""
mkdir inputs
mkdir outputs
unzip  -j $parameters -d inputs/
touch ${parameters.baseName}.csv
find "\$PWD/inputs" -type f | \\
    parallel \\
        -j $params.ncore_neg_metfrag \\
        run_metfrag.sh  \\
        -p {} \\
        -f \$PWD/outputs/{/.}.csv \\
        -l "\$PWD/$metfrag_database" \\
        -s "OfflineMetFusionScore"
zip -j -r ${parameters.baseName}_metfrag_neg.zip outputs/*.csv
"""
NextFlow From line 3878 of master/main.nf
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
"""
ulimit -s unlimited
mkdir all
for x in *.zip ; do unzip -d all -o -u \$x ; done
zip -r metfrag_neg.zip all

aggregateMetfrag.r \\
    inputs=metfrag_neg.zip \\
    realNames=metfrag_neg.zip \\
    output=aggregated_identification_metfrag_neg.csv \\
    filetype=zip \\
    outTable=T

sed -i '/^\$/d' aggregated_identification_metfrag_neg.csv
"""
NextFlow From line 3911 of master/main.nf
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
"""
if [ -s $identification_result ]; then
    metfragPEP.r \\
        input=$identification_result \\
        score=FragmenterScore \\
        output=pep_identification_metfrag_neg.csv \\
        readTable=T
else
    touch pep_identification_metfrag_neg.csv
fi
"""
NextFlow From line 3943 of master/main.nf
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
"""
if [ -s $metfrag_input_identification ]; then

    prepareOutput.r \\
        inputcamera=$camera_input_quant \\
        inputscores=$metfrag_input_identification \\
        inputpheno=$phenotype_file \\
        ppm=$params.ppm_output_neg_camera \\
        rt=$params.rt_output_neg_camera  \\
        higherTheBetter=true \\
        scoreColumn=FragmenterScore \\
        impute=$params.impute_output_neg_camera \\
        typeColumn=$params.type_column_output_neg_camera \\
        selectedType=$params.selected_type_output_neg_camera  \\
        rename=$params.rename_output_neg_camera \\
        renameCol=$params.rename_col_output_neg_camera \\
        onlyReportWithID=$params.only_report_with_id_output_neg_camera \\
        combineReplicate=$params.combine_replicate_output_neg_camera  \\
        combineReplicateColumn=$params.combine_replicate_column_output_neg_camera \\
        log=$params.log_output_neg_camera \\
        sampleCoverage=$params.sample_coverage_output_neg_camera \\
        outputPeakTable=peaktableNEGout_neg_metfrag.txt  \\
        outputVariables=varsNEGout_neg_metfrag.txt \\
        outputMetaData=metadataNEGout_neg_metfrag.txt \\
        Ifnormalize=$params.normalize_output_neg_camera

else

    prepareOutput.r \\
        inputcamera=$camera_input_quant \\
        inputpheno=$phenotype_file \\
        ppm=$params.ppm_output_neg_camera \\
        rt=$params.rt_output_neg_camera \\
        higherTheBetter=true \\
        scoreColumn=FragmenterScore  \\
        impute=$params.impute_output_neg_camera \\
        typeColumn=$params.type_column_output_neg_camera \\
        selectedType=$params.selected_type_output_neg_camera \\
        rename=$params.rename_output_neg_camera \\
        renameCol=$params.rename_col_output_neg_camera  \\
        onlyReportWithID=$params.only_report_with_id_output_neg_camera \\
        combineReplicate=$params.combine_replicate_output_neg_camera \\
        combineReplicateColumn=$params.combine_replicate_column_output_neg_camera \\
        log=$params.log_output_neg_camera  \\
        sampleCoverage=$params.sample_coverage_output_neg_camera \\
        outputPeakTable=peaktableNEGout_neg_metfrag.txt \\
        outputVariables=varsNEGout_neg_metfrag.txt \\
        outputMetaData=metadataNEGout_neg_metfrag.txt \\
        Ifnormalize=$params.normalize_output_neg_camera

fi
"""
NextFlow From line 3975 of master/main.nf
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
"""
mkdir inputs
mkdir outputs
unzip  -j $parameters -d inputs/
touch ${parameters.baseName}.csv

find "\$PWD/inputs" -type f | \\
    parallel \\
        -j $params.ncore_neg_cfmid \\
        cfmid.r \\
        input={} \\
        realName={/} \\
        databaseFile=\$PWD/$cfmid_database \\
        output=\$PWD/outputs/{/.}.csv \\
        candidate_id=$params.candidate_id_identification_neg_cfmid \\
        candidate_inchi_smiles=$params.candidate_inchi_smiles_identification_neg_cfmid  \\
        candidate_mass=$params.candidate_mass_identification_neg_cfmid \\
        databaseNameColumn=$params.database_name_column_identification_neg_cfmid \\
        databaseInChIColumn=$params.database_inchI_column_identification_neg_cfmid \\
        scoreType=Jaccard

zip -j -r ${parameters.baseName}_cfmid_neg.zip outputs/*.csv
"""
NextFlow From line 4060 of master/main.nf
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
"""
ulimit -s unlimited
mkdir all
for x in *.zip ; do unzip -d all -o -u \$x ; done
zip -r cfmid_neg.zip all

aggregateMetfrag.r \\
    inputs=cfmid_neg.zip \\
    realNames=cfmid_neg.zip \\
    output=aggregated_identification_cfmid_neg.csv \\
    filetype=zip \\
    outTable=T

sed -i '/^\$/d' aggregated_identification_cfmid_neg.csv
"""
NextFlow From line 4101 of master/main.nf
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
"""
if [ -s $identification_result ]; then
    metfragPEP.r \\
        input=$identification_result \\
        score=Jaccard_Score \\
        output=pep_identification_cfmid_neg.csv \\
        readTable=T
else
    touch pep_identification_cfmid_neg.csv
fi
"""
NextFlow From line 4134 of master/main.nf
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
"""
if [ -s $cfmid_input_identification ]; then
    prepareOutput.r \\
        inputcamera=$camera_input_quant \\
        inputscores=$cfmid_input_identification \\
        inputpheno=$phenotype_file \\
        ppm=$params.ppm_output_neg_camera \\
        rt=$params.rt_output_neg_camera  \\
        higherTheBetter=true \\
        scoreColumn=Jaccard_Score \\
        impute=$params.impute_output_neg_camera \\
        typeColumn=$params.type_column_output_neg_camera \\
        selectedType=$params.selected_type_output_neg_camera  \\
        rename=$params.rename_output_neg_camera \\
        renameCol=$params.rename_col_output_neg_camera \\
        onlyReportWithID=$params.only_report_with_id_output_neg_camera \\
        combineReplicate=$params.combine_replicate_output_neg_camera  \\
        combineReplicateColumn=$params.combine_replicate_column_output_neg_camera \\
        log=$params.log_output_neg_camera \\
        sampleCoverage=$params.sample_coverage_output_neg_camera \\
        outputPeakTable=peaktableNEGout_neg_cfmid.txt  \\
        outputVariables=varsNEGout_neg_cfmid.txt \\
        outputMetaData=metadataNEGout_neg_cfmid.txt \\
        Ifnormalize=$params.normalize_output_neg_camera

else

    prepareOutput.r \\
        inputcamera=$camera_input_quant \\
        inputpheno=$phenotype_file \\
        ppm=$params.ppm_output_neg_camera \\
        rt=$params.rt_output_neg_camera \\
        higherTheBetter=true \\
        scoreColumn=Jaccard_Score  \\
        impute=$params.impute_output_neg_camera \\
        typeColumn=$params.type_column_output_neg_camera \\
        selectedType=$params.selected_type_output_neg_camera \\
        rename=$params.rename_output_neg_camera \\
        renameCol=$params.rename_col_output_neg_camera  \\
        onlyReportWithID=$params.only_report_with_id_output_neg_camera \\
        combineReplicate=$params.combine_replicate_output_neg_camera \\
        combineReplicateColumn=$params.combine_replicate_column_output_neg_camera \\
        log=$params.log_output_neg_camera  \\
        sampleCoverage=$params.sample_coverage_output_neg_camera \\
        outputPeakTable=peaktableNEGout_neg_cfmid.txt \\
        outputVariables=varsNEGout_neg_cfmid.txt \\
        outputMetaData=metadataNEGout_neg_cfmid.txt \\
        Ifnormalize=$params.normalize_output_neg_camera

fi
"""
NextFlow From line 4166 of master/main.nf
4244
4245
4246
"""
PeakPickerHiRes -in $mzMLFile -out $mzMLFile -ini $setting_file
"""
NextFlow From line 4244 of master/main.nf
4267
4268
4269
"""
FeatureFinderMetabo -in $mzMLFile -out ${mzMLFile.baseName}.featureXML -ini $setting_file
"""
NextFlow From line 4267 of master/main.nf
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
"""
featurexmlToCamera.r \\
    input=$mzMLFile \\
    realFileName=$mzMLFile \\
    mzMLfiles=\$PWD/$mzMLFile2 \\
    polarity=negative \\
    output=${mzMLFile.baseName}.rdata \\
    sampleClass=library \\
    changeNameTO=${mzMLFile.baseName}.mzML
"""
NextFlow From line 4288 of master/main.nf
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
"""
touch quant_params_library_neg.json
touch rt_params_library_neg.json

ipo.r \\
    input=$inputs_aggregated \\
    quantOnly=TRUE \\
    allSamples=TRUE  \\
    methodXset=$params.ipo_methodXset_library_neg \\
    methodRT=$params.ipo_methodRT_library_neg \\
    noise_l=$params.ipo_noise_l_library_neg  \\
    noise_h=$params.ipo_noise_h_library_neg \\
    prefilter_l_l=$params.ipo_prefilter_l_l_library_neg \\
    prefilter_l_h=$params.ipo_prefilter_l_h_library_neg  \\
    prefilter_h_l=$params.ipo_prefilter_h_l_library_neg \\
    prefilter_h_h=$params.ipo_prefilter_h_h_library_neg  \\
    snthresh_l=$params.ipo_snthresh_l_library_neg \\
    snthresh_h=$params.ipo_snthresh_h_library_neg \\
    mzCenterFun=$params.ipo_mzCenterFun_library_neg  \\
    integrate=$params.ipo_integrate_library_neg \\
    fitgauss=$params.ipo_fitgauss_library_neg \\
    ipo_min_peakwidth_l=$params.ipo_min_peakwidth_l_library_neg  \\
    ipo_min_peakwidth_h=$params.ipo_min_peakwidth_h_library_neg \\
    ipo_max_peakwidth_l=$params.ipo_max_peakwidth_l_library_neg \\
    ipo_max_peakwidth_h=$params.ipo_max_peakwidth_h_library_neg \\
    ipo_ppm_l=$params.ipo_ppm_l_library_neg  \\
    ipo_ppm_h=$params.ipo_ppm_h_library_neg \\
    ipo_mzdiff_l=$params.ipo_mzdiff_l_library_neg \\
    ipo_mzdiff_h=$params.ipo_mzdiff_h_library_neg \\
    ipo_charge_camera=$params.ipo_charge_camera_library_neg \\
    ipo_max_ppm_camera=$params.ipo_max_ppm_camera_library_neg  \\
    response_l=$params.ipo_response_l_library_neg \\
    response_h=$params.ipo_response_h_library_neg \\
    distFunc=$params.ipo_distFunc_library_neg \\
    factorDiag_l=$params.ipo_factorDiag_l_library_neg \\
    factorDiag_h=$params.ipo_factorDiag_h_library_neg \\
    factorGap_l=$params.ipo_factorGap_l_library_neg  \\
    factorGap_h=$params.ipo_factorGap_h_library_neg \\
    localAlignment=$params.ipo_localAlignment_library_neg \\
    ipo_gapInit_l=$params.ipo_gapInit_l_library_neg \\
    ipo_gapInit_h=$params.ipo_gapInit_h_library_neg \\
    ipo_gapExtend_l=$params.ipo_gapExtend_l_library_neg  \\
    ipo_gapExtend_h=$params.ipo_gapExtend_h_library_neg \\
    ipo_profStep_l=$params.ipo_profStep_l_library_neg \\
    ipo_profStep_h=$params.ipo_profStep_h_library_neg \\
    bw_l=$params.ipo_bw_l_library_neg \\
    bw_h=$params.ipo_bw_h_library_neg \\
    minfrac_l=$params.ipo_minfrac_l_library_neg  \\
    minfrac_h=$params.ipo_minfrac_h_library_neg \\
    mzwid_l=$params.ipo_mzwid_l_library_neg \\
    mzwid_h=$params.ipo_mzwid_h_library_neg \\
    minsamp_l=$params.ipo_minsamp_l_library_neg  \\
    minsamp_h=$params.ipo_minsamp_h_library_neg \\
    max_l=$params.ipo_max_l_library_neg \\
    max_h=$params.ipo_max_h_library_neg \\
    ncores=$params.ipo_ncores_library_neg \\
    outputxset=quant_params_library_neg.json \\
    outputrt=rt_params_library_neg.json
"""
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
"""
findPeaks.r \\
    input=\$PWD/$mzMLFile \\
    output=\$PWD/${mzMLFile.baseName}.rdata \\
    ppm=$params.masstrace_ppm_library_neg_xcms \\
    peakwidthLow=$params.peakwidthlow_quant_library_neg_xcms  \\
    peakwidthHigh=$params.peakwidthhigh_quant_library_neg_xcms \\
    noise=$params.noise_quant_library_neg_xcms \\
    polarity=negative \\
    realFileName=$mzMLFile \\
    sampleClass=$params.sampleclass_quant_library_neg_xcms  \\
    mzdiff=$params.mzdiff_quant_library_neg_xcms \\
    snthresh=$params.snthresh_quant_library_neg_xcms \\
    prefilter_l=$params.prefilter_quant_library_neg_xcms \\
    prefilter_h=$params.value_of_prefilter_quant_library_neg_xcms  \\
    mzCenterFun=$params.mzCenterFun_quant_library_neg_xcms \\
    integrate=$params.integrate_quant_library_neg_xcms \\
    fitgauss=$params.fitgauss_quant_library_neg_xcms  \\
    methodXset=$params.ipo_methodXset_library_neg \\
    methodRT=$params.ipo_methodRT_library_neg \\
    noise_l=$params.ipo_noise_l_library_neg  \\
    noise_h=$params.ipo_noise_h_library_neg \\
    prefilter_l_l=$params.ipo_prefilter_l_l_library_neg \\
    prefilter_l_h=$params.ipo_prefilter_l_h_library_neg  \\
    prefilter_h_l=$params.ipo_prefilter_h_l_library_neg \\
    prefilter_h_h=$params.ipo_prefilter_h_h_library_neg  \\
    snthresh_l=$params.ipo_snthresh_l_library_neg \\
    snthresh_h=$params.ipo_snthresh_h_library_neg \\
    mzCenterFun=$params.ipo_mzCenterFun_library_neg  \\
    integrate=$params.ipo_integrate_library_neg \\
    fitgauss=$params.ipo_fitgauss_library_neg \\
    ipo_min_peakwidth_l=$params.ipo_min_peakwidth_l_library_neg  \\
    ipo_min_peakwidth_h=$params.ipo_min_peakwidth_h_library_neg \\
    ipo_max_peakwidth_l=$params.ipo_max_peakwidth_l_library_neg \\
    ipo_max_peakwidth_h=$params.ipo_max_peakwidth_h_library_neg \\
    ipo_ppm_l=$params.ipo_ppm_l_library_neg  \\
    ipo_ppm_h=$params.ipo_ppm_h_library_neg \\
    ipo_mzdiff_l=$params.ipo_mzdiff_l_library_neg \\
    ipo_mzdiff_h=$params.ipo_mzdiff_h_library_neg \\
    ipo_charge_camera=$params.ipo_charge_camera_library_neg  \\
    ipo_max_ppm_camera=$params.ipo_max_ppm_camera_library_neg  \\
    ipo_inv=$ipo_library_neg_localQ \\
    $filter_argument
"""
NextFlow From line 4401 of master/main.nf
4467
4468
4469
"""
FeatureFinderMetabo -in $mzMLFile -out ${mzMLFile.baseName}.featureXML -ini $setting_file
"""
NextFlow From line 4467 of master/main.nf
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
"""
featurexmlToCamera.r \\
    input=$mzMLFile \\
    realFileName=$mzMLFile \\
    mzMLfiles=\$PWD/$mzMLFile2 \\
    polarity=negative \\
    output=${mzMLFile.baseName}.rdata \\
    sampleClass=library \\
    changeNameTO=${mzMLFile.baseName}.mzML
"""
NextFlow From line 4488 of master/main.nf
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
"""
touch quant_params_library_neg.json
touch rt_params_library_neg.json

ipo.r \\
    input=$inputs_aggregated \\
    quantOnly=TRUE \\
    allSamples=TRUE  \\
    methodXset=$params.ipo_methodXset_library_neg \\
    methodRT=$params.ipo_methodRT_library_neg \\
    noise_l=$params.ipo_noise_l_library_neg  \\
    noise_h=$params.ipo_noise_h_library_neg \\
    prefilter_l_l=$params.ipo_prefilter_l_l_library_neg \\
    prefilter_l_h=$params.ipo_prefilter_l_h_library_neg  \\
    prefilter_h_l=$params.ipo_prefilter_h_l_library_neg \\
    prefilter_h_h=$params.ipo_prefilter_h_h_library_neg  \\
    snthresh_l=$params.ipo_snthresh_l_library_neg \\
    snthresh_h=$params.ipo_snthresh_h_library_neg \\
    mzCenterFun=$params.ipo_mzCenterFun_library_neg  \\
    integrate=$params.ipo_integrate_library_neg \\
    fitgauss=$params.ipo_fitgauss_library_neg \\
    ipo_min_peakwidth_l=$params.ipo_min_peakwidth_l_library_neg  \\
    ipo_min_peakwidth_h=$params.ipo_min_peakwidth_h_library_neg \\
    ipo_max_peakwidth_l=$params.ipo_max_peakwidth_l_library_neg \\
    ipo_max_peakwidth_h=$params.ipo_max_peakwidth_h_library_neg \\
    ipo_ppm_l=$params.ipo_ppm_l_library_neg  \\
    ipo_ppm_h=$params.ipo_ppm_h_library_neg \\
    ipo_mzdiff_l=$params.ipo_mzdiff_l_library_neg \\
    ipo_mzdiff_h=$params.ipo_mzdiff_h_library_neg \\
    ipo_charge_camera=$params.ipo_charge_camera_library_neg \\
    ipo_max_ppm_camera=$params.ipo_max_ppm_camera_library_neg  \\
    response_l=$params.ipo_response_l_library_neg \\
    response_h=$params.ipo_response_h_library_neg \\
    distFunc=$params.ipo_distFunc_library_neg \\
    factorDiag_l=$params.ipo_factorDiag_l_library_neg \\
    factorDiag_h=$params.ipo_factorDiag_h_library_neg \\
    factorGap_l=$params.ipo_factorGap_l_library_neg  \\
    factorGap_h=$params.ipo_factorGap_h_library_neg \\
    localAlignment=$params.ipo_localAlignment_library_neg \\
    ipo_gapInit_l=$params.ipo_gapInit_l_library_neg \\
    ipo_gapInit_h=$params.ipo_gapInit_h_library_neg \\
    ipo_gapExtend_l=$params.ipo_gapExtend_l_library_neg  \\
    ipo_gapExtend_h=$params.ipo_gapExtend_h_library_neg \\
    ipo_profStep_l=$params.ipo_profStep_l_library_neg \\
    ipo_profStep_h=$params.ipo_profStep_h_library_neg \\
    bw_l=$params.ipo_bw_l_library_neg \\
    bw_h=$params.ipo_bw_h_library_neg \\
    minfrac_l=$params.ipo_minfrac_l_library_neg  \\
    minfrac_h=$params.ipo_minfrac_h_library_neg \\
    mzwid_l=$params.ipo_mzwid_l_library_neg \\
    mzwid_h=$params.ipo_mzwid_h_library_neg \\
    minsamp_l=$params.ipo_minsamp_l_library_neg  \\
    minsamp_h=$params.ipo_minsamp_h_library_neg \\
    max_l=$params.ipo_max_l_library_neg \\
    max_h=$params.ipo_max_h_library_neg \\
    ncores=$params.ipo_ncores_library_neg \\
    outputxset=quant_params_library_neg.json \\
    outputrt=rt_params_library_neg.json
"""
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
"""
findPeaks.r \\
    input=\$PWD/$mzMLFile \\
    output=\$PWD/${mzMLFile.baseName}.rdata \\
    ppm=$params.masstrace_ppm_library_neg_xcms \\
    peakwidthLow=$params.peakwidthlow_quant_library_neg_xcms  \\
    peakwidthHigh=$params.peakwidthhigh_quant_library_neg_xcms \\
    noise=$params.noise_quant_library_neg_xcms \\
    polarity=negative \\
    realFileName=$mzMLFile \\
    sampleClass=$params.sampleclass_quant_library_neg_xcms  \\
    mzdiff=$params.mzdiff_quant_library_neg_xcms \\
    snthresh=$params.snthresh_quant_library_neg_xcms \\
    prefilter_l=$params.prefilter_quant_library_neg_xcms \\
    prefilter_h=$params.value_of_prefilter_quant_library_neg_xcms  \\
    mzCenterFun=$params.mzCenterFun_quant_library_neg_xcms \\
    integrate=$params.integrate_quant_library_neg_xcms \\
    fitgauss=$params.fitgauss_quant_library_neg_xcms  \\
    methodXset=$params.ipo_methodXset_library_neg \\
    methodRT=$params.ipo_methodRT_library_neg \\
    noise_l=$params.ipo_noise_l_library_neg  \\
    noise_h=$params.ipo_noise_h_library_neg \\
    prefilter_l_l=$params.ipo_prefilter_l_l_library_neg \\
    prefilter_l_h=$params.ipo_prefilter_l_h_library_neg  \\
    prefilter_h_l=$params.ipo_prefilter_h_l_library_neg \\
    prefilter_h_h=$params.ipo_prefilter_h_h_library_neg  \\
    snthresh_l=$params.ipo_snthresh_l_library_neg \\
    snthresh_h=$params.ipo_snthresh_h_library_neg \\
    mzCenterFun=$params.ipo_mzCenterFun_library_neg  \\
    integrate=$params.ipo_integrate_library_neg \\
    fitgauss=$params.ipo_fitgauss_library_neg \\
    ipo_min_peakwidth_l=$params.ipo_min_peakwidth_l_library_neg  \\
    ipo_min_peakwidth_h=$params.ipo_min_peakwidth_h_library_neg \\
    ipo_max_peakwidth_l=$params.ipo_max_peakwidth_l_library_neg \\
    ipo_max_peakwidth_h=$params.ipo_max_peakwidth_h_library_neg \\
    ipo_ppm_l=$params.ipo_ppm_l_library_neg  \\
    ipo_ppm_h=$params.ipo_ppm_h_library_neg \\
    ipo_mzdiff_l=$params.ipo_mzdiff_l_library_neg \\
    ipo_mzdiff_h=$params.ipo_mzdiff_h_library_neg \\
    ipo_charge_camera=$params.ipo_charge_camera_library_neg  \\
    ipo_max_ppm_camera=$params.ipo_max_ppm_camera_library_neg  \\
    ipo_inv=$ipo_library_neg_localQ \\
    $filter_argument
"""
NextFlow From line 4600 of master/main.nf
4664
4665
4666
"""
xsAnnotate.r input=$rdata_files output=${rdata_files.baseName}.rdata
"""
NextFlow From line 4664 of master/main.nf
4685
4686
4687
4688
4689
4690
4691
4692
"""
groupFWHM.r \\
    input=$rdata_files \\
    output=${rdata_files.baseName}.rdata \\
    sigma=$params.sigma_group_library_neg_camera \\
    perfwhm=$params.perfwhm_group_library_neg_camera \\
    intval=$params.intval_group_library_neg_camera
"""
NextFlow From line 4685 of master/main.nf
4711
4712
4713
4714
4715
4716
4717
"""
findAdducts.r \\
    input=$rdata_files \\
    output=${rdata_files.baseName}.rdata \\
    ppm=$params.ppm_findaddcuts_library_neg_camera \\
    polarity=$params.polarity_findaddcuts_library_neg_camera
"""
NextFlow From line 4711 of master/main.nf
4737
4738
4739
4740
4741
4742
"""
findIsotopes.r \\
    input=$rdata_files \\
    output=${rdata_files.baseName}.rdata \\
    maxcharge=$params.maxcharge_findisotopes_library_neg_camera
"""
NextFlow From line 4737 of master/main.nf
4761
4762
4763
4764
4765
4766
"""
readMS2MSnBase.r \\
    input=$mzMLFile \\
    output=${mzMLFile.baseName}_ReadMsmsLibrary.rdata \\
    inputname=${mzMLFile.baseName}
"""
NextFlow From line 4761 of master/main.nf
4790
4791
4792
4793
4794
4795
4796
4797
"""
mapMS2ToCamera.r \\
    inputCAMERA=$rdata_files_ms1 \\
    inputMS2=$rdata_files_ms2 \\
    output=${rdata_files_ms1.baseName}_MapMsms2Camera_library_neg.rdata  \\
    ppm=$params.ppm_mapmsmstocamera_library_neg_msnbase \\
    rt=$params.rt_mapmsmstocamera_library_neg_msnbase
"""
NextFlow From line 4790 of master/main.nf
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
"""
mkdir out
createLibrary.r \\
    inputCAMERA=$rdata_camera \\
    precursorppm=$params.ppm_create_library_neg_msnbase \\
    inputMS2=$ms2_data \\
    output=${rdata_camera.baseName}.csv  \\
    inputLibrary=$library_desc \\
    rawFileName=$params.raw_file_name_preparelibrary_neg_msnbase \\
    compundID=$params.compund_id_preparelibrary_neg_msnbase  \\
    compoundName=$params.compound_name_preparelibrary_neg_msnbase \\
    mzCol=$params.mz_col_preparelibrary_neg_msnbase \\
    whichmz=$params.which_mz_preparelibrary_neg_msnbase
"""
NextFlow From line 4822 of master/main.nf
4855
4856
4857
4858
4859
4860
"""
collectLibrary.r \\
    inputs=$aggregatecdlibrary \\
    realNames=$aggregatecdlibrary \\
    output=library_neg.csv
"""
NextFlow From line 4855 of master/main.nf
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
"""
#!env Rscript
Files<-list.files(,pattern = "zip",full.names=T)
Files_org<-list.files(,pattern = "zip")
for(f in Files){
    zip::unzip(zipfile = f,junkpaths = T)
}
Files<-list.files(,pattern = "txt",full.names=T)
FilesTMP<-sapply(strsplit(split = "_",fixed = T,x = basename(Files)),function(x){paste(x[-1],collapse = "_")})
FileDub<-Files[duplicated(FilesTMP)]
for(x in FileDub){
    file.remove(x)
}
files_to_pass<-list.files(pattern="txt")
files_to_pass<-files_to_pass[!files_to_pass%in%Files_org]
zip::zip(zipfile="mappedtometfrag_neg.zip",files=files_to_pass)
"""
NextFlow From line 4879 of master/main.nf
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
"""
librarySearchEngine.r \\
    -l $libraryFile \\
    -i $parameters  \\
    -out aggregated_identification_library_neg.csv \\
    -th "-1" \\
    -im neg  \\
    -ts Scoredotproduct \\
    -rs 1000 \\
    -ncore $params.ncore_searchengine_library_neg_msnbase
sed -i '/^\$/d' aggregated_identification_library_neg.csv
"""
NextFlow From line 4918 of master/main.nf
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
"""
librarySearchEngine.r \\
    -l $libraryFile \\
    -i $parameters \\
    -out aggregated_identification_library_neg.csv \\
    -th "-1" \\
    -im neg \\
    -ts Scoredotproduct \\
    -rs 1000 \\
    -ncore $params.ncore_searchengine_library_neg_msnbase
sed -i '/^\$/d' aggregated_identification_library_neg.csv
"""
NextFlow From line 4950 of master/main.nf
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
"""
if [ -s $identification_result ]; then
    metfragPEP.r \\
        input=$identification_result \\
        score=score \\
        output=pep_identification_library_neg.csv \\
        readTable=T
else
    touch pep_identification_library_neg.csv
fi
"""
NextFlow From line 4981 of master/main.nf
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
"""
if [ -s $library_input_identification ]; then

    prepareOutput.r \\
        inputcamera=$camera_input_quant \\
        inputscores=$library_input_identification \\
        inputpheno=$phenotype_file \\
        ppm=$params.ppm_output_neg_camera  \\
        rt=$params.rt_output_neg_camera \\
        higherTheBetter=true \\
        scoreColumn=score \\
        impute=$params.impute_output_neg_camera \\
        typeColumn=$params.type_column_output_neg_camera \\
        selectedType=$params.selected_type_output_neg_camera  \\
        rename=$params.rename_output_neg_camera \\
        renameCol=$params.rename_col_output_neg_camera \\
        onlyReportWithID=$params.only_report_with_id_output_neg_camera \\
        combineReplicate=$params.combine_replicate_output_neg_camera  \\
        combineReplicateColumn=$params.combine_replicate_column_output_neg_camera \\
        log=$params.log_output_neg_camera \\
        sampleCoverage=$params.sample_coverage_output_neg_camera \\
        outputPeakTable=peaktableNEGout_neg_library.txt  \\
        outputVariables=varsNEGout_neg_library.txt \\
        outputMetaData=metadataNEGout_neg_library.txt \\
        Ifnormalize=$params.normalize_output_neg_camera

else

    prepareOutput.r \\
        inputcamera=$camera_input_quant \\
        inputpheno=$phenotype_file  \\
        ppm=$params.ppm_output_neg_camera \\
        rt=$params.rt_output_neg_camera \\
        higherTheBetter=true  \\
        scoreColumn=score \\
        impute=$params.impute_output_neg_camera \\
        typeColumn=$params.type_column_output_neg_camera  \\
        selectedType=$params.selected_type_output_neg_camera \\
        rename=$params.rename_output_neg_camera  \\
        renameCol=$params.rename_col_output_neg_camera \\
        onlyReportWithID=$params.only_report_with_id_output_neg_camera  \\
        combineReplicate=$params.combine_replicate_output_neg_camera \\
        combineReplicateColumn=$params.combine_replicate_column_output_neg_camera  \\
        log=$params.log_output_neg_camera \\
        sampleCoverage=$params.sample_coverage_output_neg_camera \\
        outputPeakTable=peaktableNEGout_neg_library.txt  \\
        outputVariables=varsNEGout_neg_library.txt \\
        outputMetaData=metadataNEGout_neg_library.txt \\
        Ifnormalize=$params.normalize_output_neg_camera

fi
"""
NextFlow From line 5014 of master/main.nf
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
"""
prepareOutput.r \\
    inputcamera=$camera_input_quant \\
    inputpheno=$phenotype_file \\
    ppm=$params.ppm_output_neg_camera \\
    rt=$params.rt_output_neg_camera \\
    higherTheBetter=true \\
    scoreColumn=score  \\
    impute=$params.impute_output_neg_camera \\
    typeColumn=$params.type_column_output_neg_camera \\
    selectedType=$params.selected_type_output_neg_camera \\
    rename=$params.rename_output_neg_camera  \\
    renameCol=$params.rename_col_output_neg_camera \\
    onlyReportWithID=$params.only_report_with_id_output_neg_camera \\
    combineReplicate=$params.combine_replicate_output_neg_camera  \\
    combineReplicateColumn=$params.combine_replicate_column_output_neg_camera \\
    log=$params.log_output_neg_camera \\
    sampleCoverage=$params.sample_coverage_output_neg_camera  \\
    outputPeakTable=peaktableNEGout_NEG_noid.txt \\
    outputVariables=varsNEGout_neg_noid.txt \\
    outputMetaData=metadataNEGout_neg_noid.txt \\
    Ifnormalize=$params.normalize_output_neg_camera
"""
NextFlow From line 5086 of master/main.nf
ShowHide 229 more snippets with no or duplicated tags.

Login to post a comment if you would like to share your experience with this workflow.

Do you know this workflow well? If so, you can request seller status , and start supporting this workflow.

Free

Created: 1yr ago
Updated: 1yr ago
Maitainers: public
URL: https://nf-co.re/metaboigniter
Name: metaboigniter
Version: 1.0.1
Badge:
workflow icon

Insert copied code into your website to add a link to this workflow.

Downloaded: 0
Copyright: Public Domain
License: None
  • Future updates

Related Workflows

cellranger-snakemake-gke
snakemake workflow to run cellranger on a given bucket using gke.
A Snakemake workflow for running cellranger on a given bucket using Google Kubernetes Engine. The usage of this workflow ...