git clone --recursive https://github.com/shlokanegi/vg_anchors.git
cd vg_anchors
From the vg_anchors folder, run the following command to install all dependencies and set up the environment:
make init
This will:
- Compile the
sdustdependency. - Compile and install the
bdsggraph library dependency. - Install all required Python packages, including
Click,matplotlib,seaborn,pandas,numpy,flask, andbiopython. - Install the
assemblerpackage itself in an editable mode, suitable for development.
Prerequisites: Before running the installation, please ensure you have the following software installed:
- Python 3.6+
pipmake- A C/C++ compiler (like
gcc) cmakegit
Alternative installation: If you prefer to install dependencies manually:
# Install Python dependencies
pip install -r requirements.txt
# Build and install libbdsg
cd libbdsg
pip install -e .
cd ..
# Install the assembler package
pip install -e .Troubleshooting Installation Conflicts: If you encounter errors like "Egg-link does not match installed location" during installation, it usually means there are conflicting installations from different directories. To resolve this:
-
Check for conflicting installations:
pip list | grep -i assembler find ~/.local/lib/python*/site-packages -name "*assembler*" -o -name "*vg_assembly*" 2>/dev/null
-
Remove conflicting installations:
pip uninstall assembler -y rm -rf ~/.local/lib/python*/site-packages/assembler*
-
Clean any egg-link files pointing to wrong directories:
find ~/.local/lib/python*/site-packages -name "*.egg-link" -exec grep -l "vg_assembly" {} \; # Remove any egg-link files that point to wrong directories
-
Re-run the installation:
make init
Troubleshooting Module Import Errors: If you encounter errors like "dynamic module does not define module export function (PyInit_bdsg)" or similar import errors:
-
Clean and rebuild the bdsg module:
pip uninstall bdsg -y cd libbdsg rm -rf build/ dist/ *.egg-info/ pip install -e . cd ..
-
Or use the clean target:
make clean make init
This usually happens when there's a mismatch between the Python version that built the module and the one trying to use it, or when build artifacts are corrupted.
Now you can use the tool. To build a sentinel to anchor dictionary from the graph use:
vg_anchor build --graph path/to/graph.vg --index path/to/index.dist --output-prefix path/to/output/prefix
To get the anchors associated to the alignment to the graph use:
vg_anchor get_anchors --dictionary path/to/dictionary.pkl --graph path/to/graph.vg --alignment path/to/alignment.gaf --fasta path/to/reads.fasta --output path/to/output
For development, the package is installed in editable mode. You can modify the code and the changes will be immediately available without reinstalling.
To run tests:
python -m unittest discover tests/To start the visualization server:
python server.pyThen open http://localhost:8000 in your browser.
To produce a single-file executable with all dependencies (including sdust, bdsg, and shared libraries) bundled:
bash scripts/build_executable.shThe executable will be at dist/vg-anchors-0.1.0. You can run it directly:
./dist/vg-anchors-0.1.0 --helpNotes:
- Build runs in an isolated virtual environment under
.venvto ensure reproducibility. sdustis compiled fromthird_party/sdustintobin/sdust.libbdsgis built with CMake and installed into the venv; its.sofiles are bundled underlib/in the executable.- The PyInstaller spec
vg-anchors-0.1.0.specexplicitly collectsbdsgand sets a runtime hook (pyi_rth_vg_anchors_libpath.py) to add the bundledlib/toLD_LIBRARY_PATHat runtime.