bittremieux / ANN-SoLo

Spectral library searching using approximate nearest neighbor techniques.
Apache License 2.0
42 stars 19 forks source link

ANN-SoLo as Python API #7

Closed bittremieux closed 4 years ago

bittremieux commented 4 years ago

Required arguments for the Python API are the positional command-line arguments. Optional command-line arguments can be specified and must exactly match the CMD arguments (including '--' prefix) while the values must be strings.

Example usage:

from ann_solo import ann_solo

ann_solo.ann_solo('human_yeast_targetdecoy.splib',
                  'iPRG2012.mgf',
                  'iPRG2012.mztab',
                  ['--precursor_tolerance_mass', '20',
                   '--precursor_tolerance_mode', 'ppm',
                   '--fragment_mz_tolerance', '0.02',
                   '--remove_precursor'])
wfondrie commented 4 years ago

I think your idea was a clever solution.

I did make a couple small changes:

  1. The args argument didn't seem very intuitive as a list. I've updated this to instead use **kwargs for the function. It is processed to a list before being used by main().
  2. I exported the ann_solo() function so that users can call it easily:
    
    import ann_solo

ann_solo.ann_solo('human_yeast_targetdecoy.splib', 'iPRG2012.mgf', 'iPRG2012.mztab', precursor_tolerance_mass=20, precursor_tolerance_mode='ppm', fragment_mz_tolerance=0.02, remove_precursor=True)