Skip to content

About

A python tool to construct anchors from a pangenome using read alignments

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

VG_ANCHORS

DOWNLOAD

git clone --recursive https://github.com/shlokanegi/vg_anchors.git
cd vg_anchors

INSTALL

From the vg_anchors folder, run the following command to install all dependencies and set up the environment:

make init

This will:

  1. Compile the sdust dependency.
  2. Compile and install the bdsg graph library dependency.
  3. Install all required Python packages, including Click, matplotlib, seaborn, pandas, numpy, flask, and biopython.
  4. Install the assembler package itself in an editable mode, suitable for development.

Prerequisites: Before running the installation, please ensure you have the following software installed:

  • Python 3.6+
  • pip
  • make
  • A C/C++ compiler (like gcc)
  • cmake
  • git

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:

  1. Check for conflicting installations:

    pip list | grep -i assembler
    find ~/.local/lib/python*/site-packages -name "*assembler*" -o -name "*vg_assembly*" 2>/dev/null
  2. Remove conflicting installations:

    pip uninstall assembler -y
    rm -rf ~/.local/lib/python*/site-packages/assembler*
  3. 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
  4. 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:

  1. Clean and rebuild the bdsg module:

    pip uninstall bdsg -y
    cd libbdsg
    rm -rf build/ dist/ *.egg-info/
    pip install -e .
    cd ..
  2. 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.

RUN

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

DEVELOPMENT

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.py

Then open http://localhost:8000 in your browser.

Build a standalone executable

To produce a single-file executable with all dependencies (including sdust, bdsg, and shared libraries) bundled:

bash scripts/build_executable.sh

The executable will be at dist/vg-anchors-0.1.0. You can run it directly:

./dist/vg-anchors-0.1.0 --help

Notes:

  • Build runs in an isolated virtual environment under .venv to ensure reproducibility.
  • sdust is compiled from third_party/sdust into bin/sdust.
  • libbdsg is built with CMake and installed into the venv; its .so files are bundled under lib/ in the executable.
  • The PyInstaller spec vg-anchors-0.1.0.spec explicitly collects bdsg and sets a runtime hook (pyi_rth_vg_anchors_libpath.py) to add the bundled lib/ to LD_LIBRARY_PATH at runtime.

About

A python tool to construct anchors from a pangenome using read alignments

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages