Skip to content

Commit 3883bb7

Browse files
committed
doc edits. C++ rename.
1 parent 8912596 commit 3883bb7

File tree

3 files changed

+45
-41
lines changed

3 files changed

+45
-41
lines changed

README.md

Lines changed: 41 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,23 @@ Template Repo Combines:
1313
- GitHub Actions for CI, Docker/Conda release, styling, and documentation
1414

1515

16-
## [TODO] How to use this template
16+
## How to use this template
17+
- Use this repo [as a template](https://help.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-repository-from-a-template).
18+
- Replace all occurrences of "Aligncount" with the name of your project in the relevant CMakeLists.txt under `cpp/`.
19+
- Capitalization matters here: `Aligncount` means the name of the project, while `aligncount` is used in file names.
20+
- Remember to rename the `include/aligncount` directory to use your project's lowercase name and update all relevant `#include`s accordingly.
21+
- Replace instances of ALIGNCOUNT_VERSION with `[YOUR_PROJECT_NAME]_VERSION`
22+
- Set the name of the C++ executable (e.g. aligncount_cpp) to your liking in `cpp/standalone/CMakeLists.txt`
23+
- Replace the source files with your own
24+
- Set GitHub action secrets for:
25+
- ANACONDA_TOKEN
26+
- ANACONDA_USER
27+
- DOCKERHUB_TOKEN
28+
- DOCKERHUB_USERNAME
29+
- CODECOV_TOKEN (if making code coverage reports for the C++ tool)
1730

1831
---
19-
## Tool Descriptions
32+
## Example Tool Descriptions
2033
### Python Wrapper (aligncount)
2134
- Source: cli/entrypoint.py
2235
- Entry point: aligncount console script (configured in setup.py)
@@ -26,11 +39,12 @@ Template Repo Combines:
2639
- Calls `aligncount_cpp -a <path>` and writes to count stdout
2740
### C++ Executable (aligncount_cpp)
2841
- Source: cpp/standalone/source/main.cpp
42+
- Statically links HTSlib
2943
- Build system: CMake (CMakeLists.txt)
3044
- Functionality: Counts the number of SAM records
3145
---
3246
## Installation
33-
### Build and install the Python Wrapper and the C++ tool
47+
### Build and install the C++ tool and the Python Wrapper
3448
To install in a virtualenv while at repo root:
3549

3650
python3 -m venv venv
@@ -55,6 +69,18 @@ install the Python Wrapper by itself do (does not install aligncount_cpp):
5569
cd cli
5670
pip install .
5771

72+
### Manually build the C++ tool aligncount_cpp
73+
To build manually while at repo root:
74+
75+
mkdir build
76+
cd build
77+
cmake ../cpp/standalone -DCMAKE_BUILD_TYPE=Release
78+
cmake --build .
79+
80+
Now you have aligncount_cpp available in the build folder. Run the tool to counts SAM records:
81+
82+
./aligncount_cpp -a sample.sam
83+
5884
### Dockerfile
5985
A multi-stage Dockerfile builds and tests everything, then produces a minimal runtime image:
6086
1. Builder stage:
@@ -74,20 +100,6 @@ Build and test in one command:
74100
Run:
75101

76102
docker run --rm aligncount:latest --help
77-
78-
79-
### Manually build the C++ tool aligncount_cpp
80-
To build manually while at repo root:
81-
82-
mkdir build
83-
cd build
84-
cmake ../cpp/standalone -DCMAKE_BUILD_TYPE=Release
85-
cmake --build .
86-
87-
Now you have aligncount_cpp available in the build folder. Run the tool to counts SAM records:
88-
89-
./aligncount -a sample.sam
90-
91103
---
92104
## Unit Tests
93105

@@ -118,27 +130,8 @@ The export command is required if the wrapper is not installed.
118130
- `.github/workflows/cpp_install.yml` Builds, installs, and tests the C++ tool on ubuntu.
119131
- `.github/workflows/cpp_macos.yml` Builds and tests the C++ tool on MacOS.
120132
- `.github/workflows/cpp_standalone.yml` Builds the C++ tool on ubuntu.
121-
- `.github/workflows/cpp_ubuntu.yml` Tests the C++ tool on ubuntu.
133+
- `.github/workflows/cpp_ubuntu.yml` Tests and creates codecov reports for the C++ tool on ubuntu.
122134
- `.github/workflows/cpp_style.yml` Checks C++ and CMake source style.
123-
---
124-
### .github/workflows/docker_release.yml
125-
126-
This workflow is triggered whenever a new tag for the repo is released. It builds the docker image for linux/amd64
127-
and publishes it to the docker hub registry.
128-
129-
The workflow assumes your docker hub username and token are stored as repository secrets under `DOCKERHUB_USERNAME`
130-
and `DOCKERHUB_TOKEN`.
131-
132-
### .github/workflows/conda_release.yml
133-
134-
This workflow is triggered whenever a new tag for the repo is released. It uses the conda-build recipe to create and
135-
publish conda packages to your personal conda channel. The workflow builds conda packages for linux and mac platforms
136-
running on x86 and arm architecture. The workflow publishes the conda package under the repo name,
137-
e.g. cpp-python-tool-template.
138-
139-
The workflow assumes your anaconda username and token are stored as repository secrets under `ANACONDA_USER`
140-
and `ANACONDA_TOKEN`.
141-
142135
---
143136
## Conda-Build Recipe
144137

@@ -155,6 +148,17 @@ REPO_HOME # URL to the repo home, e.g. https://github.com/user/foo
155148
```
156149
---
157150
## Miscellaneous Notes
151+
### Template Sources
152+
- The development files for the C++ executable (under `cpp/`) were adapted from
153+
[ModernCppStarter](https://github.com/TheLartians/ModernCppStarter) after adding HTSlib support in
154+
a slim fork [htslib-cpp-starter](https://github.com/vr1087/htslib-cpp-starter). The contents of htslib-cpp-starter
155+
were added to this repo under `cpp/` via `git subtree` and further adapted.
156+
- The implementation pattern for HTSlib support was adapted from Yang Li’s blog post:
157+
[Building Cpp Development in Bioinformatics](https://yangli.hashnode.dev/building-cpp-development-in-bioinformatics)
158+
### Conda Release
159+
The conda release workflow publishes to your personal anacanda account. The workflow uses the repository name to name
160+
the conda package, which would equate to `cpp-python-tool-template` for this repo. Additionally, the workflow
161+
creates a conda package for the following platforms: linux-64, linux-aarch64, osx-64, and osx-arm64.
158162

159163
---
160164
## What’s Next

cli/entrypoint.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ def main():
3333
sys.exit(1)
3434

3535
try:
36-
raw = subprocess.check_output(["aligncount", "-a", args.alignments])
36+
raw = subprocess.check_output(["aligncount_cpp", "-a", args.alignments])
3737
except FileNotFoundError:
38-
print("Error: C++ binary 'aligncount' not found in PATH.", file=sys.stderr)
38+
print("Error: C++ binary 'aligncount_cpp' not found in PATH.", file=sys.stderr)
3939
sys.exit(1)
4040
except subprocess.CalledProcessError as e:
41-
print(f"Error: 'aligncount' failed (exit {e.returncode}).", file=sys.stderr)
41+
print(f"Error: 'aligncount_cpp' failed (exit {e.returncode}).", file=sys.stderr)
4242
sys.exit(e.returncode)
4343

4444
# Use our new helper to produce the final string to print

cpp/standalone/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ file(GLOB sources CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp)
2424

2525
add_executable(${PROJECT_NAME} ${sources})
2626

27-
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 20 OUTPUT_NAME "aligncount")
27+
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 20 OUTPUT_NAME "aligncount_cpp")
2828

2929
target_link_libraries(${PROJECT_NAME} Aligncount::Aligncount cxxopts)
3030

0 commit comments

Comments
 (0)