Git Product home page Git Product logo

Comments (1)

HammadTheOne avatar HammadTheOne commented on June 16, 2024

Hi @GwydionJon - although the underlying Mol3d.js component does support .xyz files, the Molecule3dViewer component does not support them out of the box at this time. I have found occasional success using other tools like OpenBabel to convert other file formats to PDB and using those with our PDB parser utility to fill in the blanks between data.

If you specifically need to visualize xyz data, I would recommend the Speck component which does include direct support for this filetype, although it isn't as feature-rich as Mol3d.

As far as custom data, that will work as long as it's supplied in the exact format that the components expects. Here's a slightly modified version of your code above that displays the 3 atoms and a bond:

data = {"atoms":[{'serial': 0, 'name': 'C', 'elem': 'C', 'positions': [1.177, 31.824, -35.755], 'mass_magnitude': 32.065, 'residue_index': 0, 'residue_name': 'CYS', 'chain': 'A'},
 {'serial': 1, 'name': 'N', 'elem': 'N', 'positions': [0.029, 32.203, -34.096], 'mass_magnitude': 32.065, 'residue_index': 1, 'residue_name': 'CYS', 'chain': 'A'},
 {'serial': 2, 'name': 'H', 'elem': 'H', 'positions': [0.029, 32.203, -38.096], 'mass_magnitude': 32.065, 'residue_index': 1, 'residue_name': 'CYS', 'chain': 'A'}],
                "bonds":[{'atom1_index': 0, 'atom2_index': 1, 'bond_order': 1.0}]}


styles = create_mol3d_style(
    data['atoms'], visualization_type='sphere', color_element='atom'
)

app.layout = html.Div([
    dashbio.Molecule3dViewer(
        id='dashbio-default-molecule3d',
        modelData=data,
        styles=styles,
        backgroundColor='#4E0707',
        backgroundOpacity=1
    )
])

from dash-bio.

Related Issues (20)

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.