Skip to content

2. MetFrag

Mahnoor Zulfiqar edited this page Jun 29, 2023 · 5 revisions

Tutorial on usage of MetFrag within CWL

CWL integrates the docker image for MetFrag to run MetFrag using the parameters in JSON file generated by MAW-R.

cwlVersion: v1.0
class: CommandLineTool

baseCommand: ['java', '-jar', '/usr/src/myapp/MetFragCommandLine-2.5.0.jar']

requirements:
  DockerRequirement:
    dockerPull: docker.io/zmahnoor/maw-metfrag_2.5.0:1.0.5
  InlineJavascriptRequirement: {}
  InitialWorkDirRequirement:
    listing:
    - entryname: metfrag.inputs
      entry: |-
        PeakListPath = $(inputs.PeakList.path)
        IonizedPrecursorMass =  $(inputs.IonizedPrecursorMass)
        PrecursorIonMode = $(inputs.PrecursorIonMode)
        MetFragDatabaseType = LocalCSV
        LocalDatabasePath = $(inputs.LocalDatabasePath.path)
        DatabaseSearchRelativeMassDeviation = 5
        FragmentPeakMatchAbsoluteMassDeviation = 0.001
        FragmentPeakMatchRelativeMassDeviation = 15
        MetFragCandidateWriter = CSV
        SampleName = $(inputs.SampleName)
        #ResultsPath = $(runtime.outdir)/metfrag
        ResultsPath = $(runtime.outdir)
        MetFragPreProcessingCandidateFilter = UnconnectedCompoundFilter
        MetFragPostProcessingCandidateFilter = InChIKeyFilter
        MaximumTreeDepth = 2
        NumberThreads = 1


inputs: # additional inputs for all files; make them to show certain paths
  PeakList:
      type: File
  IonizedPrecursorMass:
      type: string
  PrecursorIonMode:
      type: int
  LocalDatabasePath:
      type: File
  SampleName:
      type: string

arguments: 
  - $(runtime.outdir)/metfrag.inputs

outputs:
  metfrag_candidate_list:
    type: File
    outputBinding:
        glob: "$(runtime.outdir)/*.csv"

The JSON file fills in the metfrag.inputs for each parameter file, and only few of these parameters are dynamic which are then listed in inputs section: PeakList which is MS2 peak list, IonizedPrecursorMass which precursor mass, PrecursorIonMode which is the ionisation mode, LocalDatabasePath which is path to COCONUT database, and SampleName which self given name.

Alternatively you can run the Run_MetFrag.r instead of CWL, but you will need the table from metfrag_param and the parameter files.

Clone this wiki locally