Code Monkey home page Code Monkey logo

st-speckmol's People

Contributors

avrabyt avatar avratanubiswas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

st-speckmol's Issues

🚀 Release v0.0.6

  • Deprecation notice for spec_plot and add_spec_param
  • Fixed function typos and implementation of speck_plot and add_speck_param
  • __version__ function ➡️ for version checked
  • v0.0.5.1 had all functions in utils.py , ➡️ now moved to __initi__.py

.pdb to .xyz coordinate structure

Since .pdb is the most commonly used format (correct me if I'm wrong) for playing around, how about an automation for seamless use ?

  • Automating .pdb (/other formats) to xyz coordinates
    So Openbabel works for the pub to xyz conversion . Refer to the function

However, error (check details reported here ) pops up which does not allow to deploy it as an app yet .

Script for Demo Gif with added Features - to be Implemented in the Component

https://github.com/avrabyt/Specklit/blob/8e13a969504dafede80f5672af92eba8a2dbe1b9/app.py

import streamlit as st
import ipywidgets as widgets
from ipywidgets import embed
import ipyspeck
import streamlit.components.v1 as components
import glob

st.set_page_config(
    layout="centered",
    page_title="Specklit",
    page_icon=":sparkles:")

def add_spec_param(spec_xyz,atom_Scale,bond_Scale,outline,atomShade,bonds,bondThreshold):
    #Modify atoms size
    spec_xyz.atomScale = atom_Scale
    #change bonds size
    spec_xyz.bondScale = bond_Scale
    #highlight borders
    spec_xyz.outline = outline
    spec_xyz.atomShade = atomShade
    spec_xyz.bonds = bonds
    spec_xyz.bondThreshold = bondThreshold
    return spec_xyz

def spec_plot(_xyz):
    spec_xyz = ipyspeck.speck.Speck(data=_xyz, title='')
    spec_xyz = add_spec_param(spec_xyz,atom_Scale,bond_Scale,outline,atom_Shade,bonds,bondThreshold)
    spec_xyz.setColorSchema(schema='newcpk')
    c = widgets.Box([spec_xyz], layout=widgets.Layout(width="800px",height="700px"))
    snippet = embed.embed_snippet(c)
    html = embed.html_template.format(title="", snippet=snippet)
    components.html(html,height = 1000, width = 900)
    return spec_xyz

ex_files = glob.glob("examples/*.xyz")

st.sidebar.title(" XYZ to SPECK-Structures :tada:")
with st.sidebar.expander(label = "Examples",expanded=True):
    st.markdown("[Source](https://github.com/wwwtyro/speck/tree/gh-pages/static/samples)")
    example_xyz = st.selectbox("Select a molecule",ex_files)
    f = open(example_xyz,"r")
    example_xyz = f.read()


st.sidebar.markdown("# Parameter section:")
st.sidebar.info("You can also add your own coordinates below. :coffee:")
_xyz = st.sidebar.text_area(
                label = "What are the Coordinates ?",
                value= example_xyz, height  = 200)

st.code(_xyz.splitlines()[1])


atom_Scale = st.sidebar.slider('Atom Scale', 0.1, 1.0, 0.35)
bond_Scale = st.sidebar.slider('Bond Scale', 0.1, 1.0, 0.5)
atom_Shade = st.sidebar.slider('Atom Shade', 0.1, 1.0, 0.0)
bondThreshold = st.sidebar.slider('Bond Threshold', 0.1, 5.0, 1.2)
bonds = st.sidebar.checkbox("Bonds",value = True)
outline = st.sidebar.checkbox('Outline',value = True)
res = spec_plot(_xyz)

with st.expander("References:",expanded=True):
    st.markdown("[Speck Online](http://wwwtyro.github.io/speck/)")
    st.markdown("[Speck Python package](https://pypi.org/project/ipyspeck/)")


Adding Features / Parameters for the molecules (argument : _PARAMETERS)

  • a new argument : _PARAMETERS within the spec_plot function allows to add parameters such as outline, bonds, brightness etc . Mainly a helper function add_spec_param(xyz, **kwargs) is called within the spec_plot function
  • add_spec_param(xyz, **kwargs) ♻️ needs to be rewritten later

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.