Making Your Molecular Workflows Portable with Embedded Python Scripts in SAMSON

Sharing reproducible, working molecular models with others—students, colleagues, or collaborators—can be a challenge when your workflow depends on multiple scripts, data files, or third-party tools. How often have you sent a Python script over email or GitHub, only to have the recipient struggle with file dependencies or incompatible environments?

Fortunately, SAMSON offers a practical solution to this: you can embed Python scripts (and even complete Python apps) directly within its documents. This makes complex computational workflows much easier to share—no need to set up separate script folders or explain additional dependencies. Everything travels with the molecular model, inside a single file.

What is Embedded Scripting?

In SAMSON, documents can store not only molecular models but also files and folders using a concept called Universal File Embedding. This means you can drag-and-drop Python scripts, Jupyter notebooks, research data, or even full-fledged machine learning apps into a SAMSON document—and they remain part of that document.

Once embedded, these scripts are immediately accessible to anyone who opens the document. Double-click a Python script inside the SAMSON user interface, and you can open and edit it directly in the integrated Code Editor.

How to Embed Scripts

To embed Python scripts or folders into a SAMSON document, you can:

  • Drag and drop the script or folder directly into the SAMSON window—you’ll be prompted to embed it.
  • Use the menu: go to Home > Embed files or Home > Embed folders.

Embed file dialog

Why This Matters

This feature is particularly useful when working on collaborative projects or preparing educational content. Here are a few examples:

  • As a researcher, you can attach scripts that perform calculations or visualizations directly to a model you’ve published. This increases transparency and helps others reproduce your work.
  • As a professor, you can distribute self-contained modules that include a molecular model and Python-based exercises. Students run the code directly in SAMSON without struggling to install packages or locate scripts.
  • As an educator creating interactive tutorials, you can embed visual presets and GUIs built with PyQt, facilitating hands-on exploration.

Portability and Sharing

Once you’ve embedded the files, they stay within the SAMSON document—so when you share it (via email, GitHub, or SAMSON Connect – Documents), all your scripts, data, and tools come along for the ride. No extra files. No broken paths.

Whether you’re trying to build reproducible pipelines, interactive simulations, or teaching materials, script embedding keeps your tools next to your models—right where they belong.

To see more ways you can embed and use Python in SAMSON workflows, visit the official scripting documentation.

SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON at https://www.samson-connect.net.

Comments are closed.