Skip to main content

A python package for generating interactive views of chemical spaces.

Project description

Faerun (Python)

Faerun (Python) is based on the Lore.js 3D WebGL engine for interactive big data rendering and the FUn project. It facilitates the creation of interactive (2D and 3D) HTML plots of chemical data (or chemical spaces). Molecular structures are rendered using SmilesDrawer.

Associated Publication: https://academic.oup.com/bioinformatics/article/34/8/1433/4657075

Faerun Python

Installation

pip install faerun

Examples

The code of the examples shown above for creating interactive 2D and 3D maps from Drugbank can be found in the examples directory. Following, a simple example of plotting any data:

import numpy as np
from faerun import Faerun

faerun = Faerun(view='free', shader='circle')

t = np.linspace(0, 12.0, 326)
s = np.sin(np.pi * t)
c = np.cos(np.pi * t)

faerun.plot({ 'x': t, 'y': s, 'z': c, 'c': t / max(t) })

The code above writes two files to the current directory: index.html and data.js. These files can be used locally or be moved to a (even minimalistic) web server.

TODO

  • Add the abilty to draw shapes as well as colours
  • Make output templatable

Documentation

Faerun(title='python-faerun', point_size=5, tree_color='#aaaaaa', clear_color='#111111', fog_intensity=2.6, coords=True, coords_color='#888888', view='free', shader='circle')
Parameter Default Description
title 'python-faerun' The title of the HTML document.
point_size 5 The size of the points.
tree_color '#aaaaaa' Not yet implemented.
clear_color '#111111' The clear colour, or background colour is used to clear the canvas after each rendering step.
fog_intensity 2.6 Fog is used to darken / lighten far away points depending on the clear_color. This is a visual cue helpful for depth perception in orthogonal projections.
coords True Whether or not to draw the coordinate axes.
coords_color '#888888' The colour used to draw the coordinate axes.
view 'free' The view mode. Available options: free, front, back, left, right, bottom, top
shader circle The name of the shader used to draw the points. Available options: circle, legacyCircle, sphere
Faerun.plot(path, data, x='x', y='y', z='z', c='c', colormap='plasma', smiles='smiles', path='./', file_name='', tree=None)
Parameter Default Description
data A dict or a Pandas DataFrame containing the data.
x x The name of the column containing the x-coordinates.
y y The name of the column containing the y-coordinates.
z z The name of the column containing the z-coordinates.
c c The name of the column containing the values by which the points are coloured. Has to be normalized between 0.0 and 1.0 or (categorical) integers
s s The name of the column containing the point size values.
colormap 'plasma' The colour map to be used. Valid values are matplotlib colormap names.
smiles smiles The name of the column containing the SMILES strings with which the points are annotated.
path './' The path to which the HTML and data files will be written.
file_name '' The file name that is given to both the html and js file.
tree None Not yet implemented.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

faerun-0.1.12.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

faerun-0.1.12-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file faerun-0.1.12.tar.gz.

File metadata

  • Download URL: faerun-0.1.12.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.29.1 CPython/3.6.8

File hashes

Hashes for faerun-0.1.12.tar.gz
Algorithm Hash digest
SHA256 05bff8b0e5cf1280f64e6d0225a48f14f9cf5b687728d7f00f6b57874d29818c
MD5 441cb250f3cc419f43dd6e127fc15034
BLAKE2b-256 830fbcf4c26d719daecd7c3f832d6526a0c755354bce5c8a0f791edaf34a9f12

See more details on using hashes here.

File details

Details for the file faerun-0.1.12-py3-none-any.whl.

File metadata

  • Download URL: faerun-0.1.12-py3-none-any.whl
  • Upload date:
  • Size: 11.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.29.1 CPython/3.6.8

File hashes

Hashes for faerun-0.1.12-py3-none-any.whl
Algorithm Hash digest
SHA256 3225e35814d1c164ca1e91e005f2317e5541db69802f3d1312a8cd9300df73db
MD5 a5d67b96ef1463b6ae92344ff66f401c
BLAKE2b-256 b7a5c3c4081471c70c00bd5a836e6a35f4a1b4960b28f911bf30918a4edeb67b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page