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

restructure peppy constructor function (init) #465

Open
khoroshevskyi opened this issue Dec 6, 2023 · 4 comments
Open

restructure peppy constructor function (init) #465

khoroshevskyi opened this issue Dec 6, 2023 · 4 comments

Comments

@khoroshevskyi
Copy link
Member

khoroshevskyi commented Dec 6, 2023

The peppy Project constructor was initially designed to expect a project in the form of a YAML+CSV file, a CSV file, or None. This approach was conceived before considering peppy as a dictionary or another Python representation.

With the introduction of Pephub and other new packages, there is now a need to initialize the Project using alternative methods, such as pandas, dictionaries, YAML, etc. To accommodate this, we should restructure the __init__ method to accept three Python objects instead of a configuration (cfg) string. For example:

    def __init__(self, 
                        project_config: dict, 
                        sample_table: pd.DataFrame,
                        subsample_list: Union[List, None] = None
                        amendments: Union[str, Iterable[str]] = None,
                        ...
                ):
        self.project_config = project_config
        self.sample_table = sample_table
        self.subsample_table = subsample_table
        self.amendments = amendments
        ...
@nsheff
Copy link
Contributor

nsheff commented Feb 16, 2024

actually, we should use class methods, like Project.from_pandas and Project.from_pephub, etc.

@nsheff
Copy link
Contributor

nsheff commented Jun 25, 2024

@donaldcampbelljr I think this may also be needed for your work using peppy's import to implement the looper config embedded pep.

@donaldcampbelljr
Copy link
Contributor

Yes, the issue I'm running into with pepkit/looper#270:

So, my workaround to create a temp PEP, convert to a dict, update the dict with the Looper-modified values, and then initialize Peppy project from dict still does not work as desired because the re-initialization using _from_dict() does not handle all import/ammendments unlike the main initialization via a cfg file.

@nsheff
Copy link
Contributor

nsheff commented Jul 6, 2024

I really want to be able to do something like this:

import peppy

prj = peppy.Project.from_pephub("nsheff/mypep:default")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants