Skip to content

Commit de9dd06

Browse files
committed
updated contribution guide
1 parent fbecb6f commit de9dd06

File tree

2 files changed

+29
-36
lines changed

2 files changed

+29
-36
lines changed

CONTRIBUTING.md

+21-29
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,29 @@
22

33
Welcome to the ``gReLU`` contributor's guide.
44

5-
This document focuses on getting any potential contributor familiarized with the development processes,
6-
but [other kinds of contributions](https://opensource.guide/how-to-contribute) are also appreciated.
5+
This document focuses on getting any potential contributor familiarized with the development processes, but [other kinds of contributions](https://opensource.guide/how-to-contribute) are also appreciated.
76

87
If you are new to using git or have never collaborated in a project previously, please have a look at
98
[contribution-guide.org](https://www.contribution-guide.org/). Other resources are also listed in the
109
excellent [guide created by FreeCodeCamp](https://github.com/FreeCodeCamp/how-to-contribute).
1110

1211
Please notice, all users and contributors are expected to be **open, considerate, reasonable, and
13-
respectful**. When in doubt, [Python Software Foundation's Code of Conduct](https://www.python.org/psf/conduct/)
14-
is a good reference in terms of behavior guidelines.
12+
respectful**. When in doubt, [Python Software Foundation's Code of Conduct](https://www.python.org/psf/conduct/) is a good reference in terms of behavior guidelines.
1513

1614
## Issue Reports
1715

1816
If you experience bugs or general issues with ``gReLU``, please have a look at the
19-
[issue tracker](https://github.com/Genentech/gReLU/issues). If you don't see anything useful there, please
20-
file a new issue report.
17+
[issue tracker](https://github.com/Genentech/gReLU/issues). If you don't see anything useful there, please file a new issue report.
2118

22-
(Don't forget to include the closed issues in your search. Sometimes a solution was already reported, and
23-
the problem is considered solved.)
19+
(Don't forget to include the closed issues in your search. Sometimes a solution was already reported, and the problem is considered solved.)
2420

2521
You can file a new issue by clicking the "New issue" button at the top right of the issue tracker.
2622
![New Issue](media/new_issue.jpg)
2723

2824
Your new issue report should include the following information:
2925

3026
1. Information about your programming environment (e.g., operating system, Python version)
31-
2. Steps to reproduce the problem. Please try to simplify the reproduction steps to a very minimal example
32-
that still illustrates the problem you are facing. By removing other factors, you help us to identify the
33-
root cause of the issue.
27+
2. Steps to reproduce the problem. Please try to simplify the reproduction steps to a very minimal example that still illustrates the problem you are facing. By removing other factors, you help us to identify the root cause of the issue.
3428
4. The full error message that you encountered, if any.
3529
5. Any steps that you took to diagnose or fix the issue, and their outcomes.
3630
6. Any suggestions for resolving the issue.
@@ -40,33 +34,25 @@ root cause of the issue.
4034

4135
### Coding resources
4236

43-
``gReLU`` uses pytorch and pytorch-lightning. The below tutorials are good starting points to become familiar
44-
with these frameworks:
37+
``gReLU`` uses pytorch and pytorch-lightning. The below tutorials are good starting points to become familiar with these frameworks:
4538

4639
[PyTorch tutorials](https://pytorch.org/tutorials/beginner/basics/intro.html)
4740

4841
[Lightning tutorials](https://lightning.ai/docs/pytorch/stable/levels/core_skills.html)
4942

5043
### Understanding project structure
5144

52-
We welcome external contributions to ``gReLU``. Before planning changes to the code, we suggest carefully
53-
examining the current structure and organization of the package.
45+
We welcome external contributions to ``gReLU``. Before planning changes to the code, we suggest carefully examining the current structure and organization of the package.
5446

55-
The [API reference](https://genentech.github.io/gReLU/autoapi/index.html) lists all the modules and submodules
56-
available in gReLU. Clicking on individual modules on this list will reveal a description of the module and
57-
what kinds of functions it is meant to contain. The descriptions also contain more detailed explanations of the
58-
expected structure of each module and how to contribute to it. This will help you find the appropriate location
59-
to make changes.
47+
The [API reference](https://genentech.github.io/gReLU/autoapi/index.html) lists all the modules and submodules available in gReLU. Clicking on individual modules on this list will reveal a description of the module and what kinds of functions it is meant to contain. The descriptions also contain more detailed explanations of the expected structure of each module. This will help you find the appropriate location to make changes.
6048

61-
For instance, the table below lists some different types of functionality that contributors may want to add
62-
or change, and the corresponding module / submodule of ``gReLU``. Click on the name of a module for more details
63-
on its structure.
49+
For instance, the table below lists some different types of functionality that contributors may want to add or change, and the corresponding module / submodule of ``gReLU``. Click on the name of a module for more details on its structure.
6450

6551
| Functionality | Module |
6652
| ---------------- | ------- |
6753
| Functions to read / write genomic data | [`grelu.io`](https://genentech.github.io/gReLU/autoapi/grelu/io/index.html) |
6854
| Functions to preprocess genomic data after it is loaded | [`grelu.data.preprocess`](https://genentech.github.io/gReLU/autoapi/grelu/data/preprocess/index.html) |
69-
| New augmentation functions for training models | [`grelu.data.augment`](https://genentech.github.io/gReLU/autoapi/grelu/data/augment/index.html) |
55+
| New data augmentation methods | [`grelu.data.augment`](https://genentech.github.io/gReLU/autoapi/grelu/data/augment/index.html) |
7056
| Functions to introduce various types of in silico mutations into DNA sequences | [`grelu.sequence.mutate`](https://genentech.github.io/gReLU/autoapi/grelu/sequence/mutate/index.html) |
7157
| Other functions to manipulate DNA sequences | [`grelu.sequence.utils`](https://genentech.github.io/gReLU/autoapi/grelu/sequence/utils/index.html) |
7258
| Functions to score DNA sequences based on their content | [`grelu.transforms.seq_transforms`](https://genentech.github.io/gReLU/autoapi/grelu/transforms/seq_transforms/index.html) |
@@ -76,9 +62,12 @@ on its structure.
7662
| New loss functions | [`grelu.lightning.losses`](https://genentech.github.io/gReLU/autoapi/grelu/lightning/losses/index.html)|
7763
| New metrics to calculate model performance | [`grelu.lightning.metrics`](https://genentech.github.io/gReLU/autoapi/grelu/lightning/metrics/index.html) |
7864
| New plots and visualizations | [`grelu.visualize`](https://genentech.github.io/gReLU/autoapi/grelu/visualize/index.html) |
65+
| Unit tests for new functions | [`tests`](https://github.com/Genentech/gReLU/tree/main/tests) |
7966

80-
For complex changes that may not fit clearly within the established package structure, it is important to first
81-
raise an issue (see instructions below).
67+
Two ex
68+
69+
70+
For complex changes that may not fit clearly within the established package structure, it is important to first raise an issue (see instructions below).
8271

8372

8473
## Step-by-step instructions to contribute new code
@@ -92,8 +81,7 @@ This often provides additional considerations and avoids unnecessary work.
9281
### Create an environment
9382

9483
Before you start coding, we recommend creating an isolated [virtual
95-
environment](https://realpython.com/python-virtual-environments-a-primer/) to avoid any problems with your
96-
installed Python packages. This can easily be done via either [virtualenv](https://virtualenv.pypa.io/en/stable/):
84+
environment](https://realpython.com/python-virtual-environments-a-primer/) to avoid any problems with your installed Python packages. This can easily be done via either [virtualenv](https://virtualenv.pypa.io/en/stable/):
9785
```
9886
virtualenv <PATH TO VENV>
9987
source <PATH TO VENV>/bin/activate
@@ -142,7 +130,7 @@ or [Miniconda](https://docs.conda.io/en/latest/miniconda.html):
142130

143131
3. If you change or add any functions, modules and classes, don't forget to update or add docstrings to describe these changes.
144132

145-
4. If your contribution adds an additional feature and is not just a bugfix, we suggest also adding unit tests.
133+
4. If your contribution adds an additional feature and is not just a bugfix, we suggest also adding unit tests in https://github.com/Genentech/gReLU/tree/main/tests.
146134

147135
5. Add yourself to the list of contributors in ``AUTHORS.rst``.
148136

@@ -246,3 +234,7 @@ the following steps can be used to release a new version for ``grelu``:
246234
500KB), unwanted clutter may have been accidentally included.
247235
6. Run ``tox -e publish -- --repository pypi`` and check that everything was
248236
uploaded to PyPI_ correctly.
237+
238+
## Contributing to the model zoo
239+
240+
gReLU's [model zoo](https://wandb.ai/grelu) is intended to host a curated set of models which are likely to be broadly useful to many users of the package. If you would like to contribute such a model, please let us know via a GitHub issue (see instructions above). Note that it is not necessary to contribute a model to the zoo in order to share it with the community, as gReLU saves checkpoint files that contain exhaustive metadata and can be easily shared and reused.

src/grelu/data/augment.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77
(2) a 2-D numpy array containing a label of shape (tasks, length).
88
99
The augmented output must be returned in the same format. All augmentation functions also
10-
require an index (idx) which is an integer or boolean value.
10+
require an index (idx) which is an integer or boolean value and determines the specific
11+
augmentation to be applied (for example, the number of bases by which to shift the sequence).
1112
1213
This module also contains the `Augmenter` class which is responsible for applying multiple
13-
augmentations to a given DNA sequence or (sequence, label) pair.
14+
augmentations to a given DNA sequence or (sequence, label) pair.
1415
"""
1516

1617
import warnings
@@ -70,8 +71,8 @@ def rc_seq(seq: np.ndarray, idx: bool) -> np.ndarray:
7071
idx: If True, the reverse complement sequence will be returned.
7172
If False, the sequence will be returned unchanged.
7273
73-
Returns:
7474
Same or reverse complemented sequence
75+
Returns:
7576
"""
7677
return reverse_complement(seq, input_type="indices") if idx else seq
7778

@@ -212,10 +213,6 @@ def __call__(
212213
if self.shift_seq:
213214
seq = shift(seq, seq_len=self.seq_len, idx=seq_shift_idx + pair_shift_idx)
214215

215-
# Reverse complement sequence
216-
if self.rc:
217-
seq = rc_seq(seq, idx=rc_idx)
218-
219216
# Introduce random mutations into the sequence
220217
if self.mutate:
221218
for _ in range(self.n_mutated_bases):
@@ -228,6 +225,10 @@ def __call__(
228225
rng=self.rng,
229226
)
230227

228+
# Reverse complement sequence
229+
if self.rc:
230+
seq = rc_seq(seq, idx=rc_idx)
231+
231232
# If no label is provided, return only the sequence
232233
if label is None:
233234
return seq

0 commit comments

Comments
 (0)