Contributing

Thank you for considering a contribution to HalogenGroups / PFASGroups!

How to contribute

  1. Open an issue to discuss bugs, feature requests, or new group definitions before submitting a pull request.

  2. Fork the repository on GitHub.

  3. Create a feature branch: git checkout -b my-feature

  4. Make your changes and add tests.

  5. Run the test suite (see below).

  6. Open a pull request against the main branch.

Setting up a development environment

git clone https://github.com/lucdecrem/PFASGroups.git
cd PFASGroups
conda create -n halogengroups-dev -c conda-forge python=3.10 rdkit networkx
conda activate halogengroups-dev
pip install -e ".[dev]"

Running tests

pytest

To run only unit tests (no slow benchmarks):

pytest -m "not slow"

To check coverage:

pytest --cov=HalogenGroups --cov-report=term-missing

Code style

The project uses Black for formatting and Flake8 for linting:

black HalogenGroups/ tests/
flake8 HalogenGroups/ tests/

Adding new halogen groups

New group definitions live in HalogenGroups/data/halogen_groups.json. Each entry must have:

{
  "group_id": 117,
  "name": "my_new_group",
  "category": "Generic",
  "smarts": "[CX4](F)(F)(F)[NX3]",
  "is_PFAS": true,
  "compute": true,
  "description": "Perfluoroalkyl amine"
}

After adding a group:

  1. Run pytest tests/test_groups.py to check that the new group loads and matches the expected test molecules.

  2. Add at least one positive and one negative test molecule to tests/_test_examples.py.

Reporting issues

Please include:

  • Python and RDKit versions (python --version, python -c "import rdkit; print(rdkit.__version__)").

  • The minimal SMILES that triggers the issue.

  • Expected vs actual output.

Contact