Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify custom model directory in MS2PIPFeatureGenerator #134

Closed
vrkosk opened this issue Mar 22, 2024 · 0 comments · Fixed by #138
Closed

Specify custom model directory in MS2PIPFeatureGenerator #134

vrkosk opened this issue Mar 22, 2024 · 0 comments · Fixed by #138
Assignees
Milestone

Comments

@vrkosk
Copy link

vrkosk commented Mar 22, 2024

I'd like to specify a directory where I keep MS2PIP models, rather than the default ~/.ms2pip. This is currently impossible when using MS2PIPFeatureGenerator. ms2pip.correlate() accepts model_dir argument, but MS2PIPFeatureGenerator has no code to pass it through. So, ms2pip.correlate() gets model_dir=None and defaults to ~/.ms2pip internally.

Proposal is to add it as constructor argument:

class MS2PIPFeatureGenerator(FeatureGeneratorBase):
    """Generate MS²PIP-based features."""

    def __init__(
        self,
        *args,
        model: str = "HCD",
        model_dir: Optional[str] = None,  ## one-line change here
        ms2_tolerance: float = 0.02,

Set it as attribute:

        super().__init__(*args, **kwargs)
        self.model = model
        self.model_dir = model_dir  ## one-line change here

Then in add_features(), pass it to correlate():

                    ms2pip_results = correlate(
                        psms=psm_list_run,
                        spectrum_file=spectrum_filename,
                        spectrum_id_pattern=self.spectrum_id_pattern,
                        model=self.model,
                        model_dir=self.model_dir,  ## one-line change here
@RalfG RalfG self-assigned this Mar 28, 2024
@RalfG RalfG added this to the v3.1.0 milestone Mar 28, 2024
@RalfG RalfG closed this as completed in eea7ef9 Mar 28, 2024
This was referenced Mar 28, 2024
@RalfG RalfG modified the milestones: v3.1.0, v3.0.3 Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants