Skip to content

Commit

Permalink
added initializing docs
Browse files Browse the repository at this point in the history
  • Loading branch information
khoroshevskyi committed Dec 7, 2023
1 parent 922aba9 commit 2b3cc39
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 2 deletions.
4 changes: 4 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

_Due to the changes mentioned above, a few item functionalities may be disabled. For example, the `name` and `description` properties can now be accessed and modified using attribute functionality_

### Added
- Constructor methods: `from_dict`, `from_pandas`, `from_yaml`


## [0.35.7] -- 2023-07-19
### Fixed
- incorrect setting of sample and subsample indexes using from_dict function (#452)
Expand Down
46 changes: 46 additions & 0 deletions docs/initialize.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# How to initiate peppy using different methods

peppy supports multiple ways to initiate a project. The most common way is to use a configuration file.
However, peppy also supports using a csv file (sample sheet), and a yaml file (sample sheet).
Additionally, peppy can be initiated using Python objects such as a pandas dataframe or a dictionary.

## 1. Using a configuration file
```python
import peppy
project = peppy.Project("path/to/project/config.yaml")
```

## 2. Using csv file (sample sheet)
```python
import peppy
project = peppy.Project("path/to/project/sample_sheet.csv")
```

## 3. Using yaml sample sheet
```python
import peppy
project = peppy.Project.from_yaml("path/to/project/sample_sheet.yaml")
```


## 4. Using a pandas dataframe
```python
import pandas as pd
import peppy
df = pd.read_csv("path/to/project/sample_sheet.csv")
project = peppy.Project.from_pandas(df)
```

## 5. Using a peppy generated dict
```python
import peppy
project = peppy.Project.from_dict({`_config`: str,
`_samples`: list | dict,
`_subsamples`: list[list | dict]})
```

## 6. Using a csv file from a url
```python
import peppy
project = peppy.Project("example_url.csv")
```
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ nav:
- How to use append sample modifier: feature1_append.md
- How to use imply sample modifier: feature2_imply.md
- How to validate a PEP: validating.md
- How to initialize a peppy: initialize.md
- Reference:
- API: autodoc_build/peppy.md
- Support: support.md
Expand Down
2 changes: 1 addition & 1 deletion peppy/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.40.0a5"
__version__ = "0.40.0a6"
2 changes: 1 addition & 1 deletion peppy/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def create_samples(self, modify: bool = False):
"""
self._samples: List[Sample] = self.load_samples()
if self.samples is None:
_LOGGER.info("No samples found in the project.")
_LOGGER.debug("No samples found in the project.")

if modify:
self.modify_samples()
Expand Down

0 comments on commit 2b3cc39

Please sign in to comment.