Skip to content

alexallmont/arg-render

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

arg-render

Communication tool to generate 3D scenes from Ancestral Recombination Graphs (ARGs), in particular those generated by arg-needle-lib. This primarily for diagnosing and understanding the current threading behaviour in arg-needle-lib, and secondarily for visualising new potential threading operations to support polytomy.

TODO

  • Replace/tidy scaling code
  • Ensure ARG orientation matches original arg-needle-lib design notes
  • Add pyproject.toml
  • Add/public API docs
  • Add VTK render?
  • Render edge start/ends

Example usage

pip install -r requirements.txt
python example_sim.py
open sim.blend # Open in Blender

Example screenshot of internals of ARG in Blender. ARG nodes are rendered - somewhat counterintuitively - as lines, and ARG edges are rendered as quads between these lines. This represents arg-needle-lib's structure, where each nodes span a [start, end) range along the genome, and can have many edges to other nodes, where where each edge also has a [start, end) range.

screenshot

The sample nodes in the ARG are the blue lines, and internal nodes are green. The spanning edges between these nodes are rendered as translucent quads, blue if coming off a sample node, becoming redder higher up in the graph.

Export images and blender files

The ArgToBlender class processes the ARG and attempts to scale and position the nodes for an intuitive render. Setting blender_out_file will create a .blend file and set the viewport to this camera at startup. Setting png_out_file will create a .png file using this camera, for example:

screenshot

Animated threading

You can override the camera position and target which is useful when rendering an ARG changing over time. The example_threading.py does this to generate a series of images for particular threading cases, which are collated into an animated gif:

screenshot

About

Render and view ARGs in 3D

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages