sulcgroup / oxdna-viewer

oxView: Visualization and editing tool for DNA/RNA nanotechnology and oxDNA/oxRNA configuration analysis
GNU General Public License v3.0
49 stars 19 forks source link

Questionson launching through command line and coordinate axis #56

Closed DurhamSmith closed 3 years ago

DurhamSmith commented 3 years ago

Hello,

Currently I am running a local version of oxdna-viewer using python -m http.server Is it possible to pass the .oxdna and .top file to the command line so that I do not need to manually select them through the toolbar? This would be extremely useful for me.

The other question I have is there a way to have the axis displayed at the (0,0,0) coordinate of the .oxdna file and have the displayed axis correspond to those of the .oxdna file? Current behavior looks more like is uses the center of mass all objects in the viewport to display axis location and orientation.

Thanks for the help and the great software! Durham

ErikPoppleton commented 3 years ago

Hi Durham,

There are a couple different options for passing in the .oxdna and .top files. The option that might work best for you is that you can include a path to a file in the URL with ?configuration=&topology=. See, for example: https://sulcgroup.github.io/oxdna-viewer/?configuration=examples%2Ficosahedron%2F7_icosahedron.json_post_dynamics.oxdna&topology=examples%2Ficosahedron%2F7_icosahedron.json.top . You can also drag and drop the two files rather than using the open button (this is what I use).

By default the structure is brought back in the simulation box and centered when loaded in the oxView scene. If you want to turn these off, click on the View tab and set PBC and Centering to None before loading your structure. I'm guessing that what you actually want is to keep the default PBC setting and turn off Centering. Note that you can use the apply button to change the PBC and centering on a loaded scene, but we do not save the original coordinates, so you can only go from not inboxed to inboxed and not centered to centered.

DurhamSmith commented 3 years ago

Hi Erik,

Thanks for the response. I prefer to not touch the mouse whenever that is an option. The ?configuration=&topology= work well when the .top and .oxdna file are in the same folder as the oxdna code. However when running locally and they are in a different directory this seems to not work. I tried correctly escaping the urls using;

files = { 'configuration' : '/home/dd/scratch/adjusted-helix.oxdna', 'topology' : '/home/dd/scratch/adjusted-helix.top'}

url = f"http://{ip}:{port}/?{urllib.parse.urlencode(files)}"

But still no luck.

Turning PCB and centering worked well for the other issue for the structures I have tried so far. Is there a way to include these as options as query parameters? I tried centering=None&PCB=None with no luck.

Best, D

ErikPoppleton commented 3 years ago

Hi Durham,

You're right about only being able to access files in the oxView file hierarchy, sorry I forgot about that caveat. @zoombya has been looking into a command line solution for you (this isn't the first time we've had this request) and it looks like he's close. Quick question, when you're using oxView, in this particular application, are you viewing single configurations or trajectories? The current solution seems to work pretty well for single configurations/small trajectories but it loses the streaming features that make it possible to load multigigabyte trajectories.

It would take me a while to set up a more robust URL parsing system, but we might need it if this new command line solution goes through. In the meantime, since you're running your own server you can change the default behavior by editing index.html. On lines 610-666 you will find the PBC and Centering controls, if you change them to the following:

                <div class="tight group">
                    <div class="group">
                        <div id="inboxing" class="ribbon-toggle-group toggleGroup_w1">
                            <button class="ribbon-icon-button active">
                                <span class="icon">
                                    <span class="mif-not"></span>
                                </span>
                                <span class="caption">None</span>
                            </button>

                            <button class="ribbon-icon-button">
                                <span class="icon">
                                    <span class="mif-location"></span>
                                </span>
                                <span class="caption">Monomer</span>
                            </button>

                            <button class="ribbon-icon-button">
                                <span class="icon">
                                    <span class="mif-flow-line"></span>
                                </span>
                                <span class="caption">Strand</span>
                            </button>
                        </div>
                        <span class="title">PBC</span>
                    </div>
                    <div class="group">
                        <div id="centering" class="ribbon-toggle-group toggleGroup_w1">
                            <button class="ribbon-icon-button  active">
                                <span class="icon">
                                    <span class="mif-not"></span>
                                </span>
                                <span class="caption">None</span>
                            </button>

                            <button class="ribbon-icon-button">
                                <span class="icon">
                                    <span class="mif-crop"></span>
                                </span>
                                <span class="caption">Box</span>
                            </button>

                            <button class="ribbon-icon-button">
                                <span class="icon">
                                    <span>+</span>
                                </span>
                                <span class="caption">Origin</span>
                            </button>
                        </div>
                        <span class="title">Centering</span>
                    </div>
                    <button class="ribbon-button" onclick="centerAndPBCBtnClick()" title="Note that this only works if you're going from none to something else or if you want to re-center after moving">
                        <span class="mif-done mif-3x"></span>
                        <span class="caption">Apply</span>
                    </button>
                </div>

The only change here is which button is active by default. The dynamic part of the code just checks which of these buttons is active when choosing settings for PBC and Centering.

ErikPoppleton commented 3 years ago

Hi Durham,

@zoombya managed to get the whole thing packaged in Electron so it can now be launched from the command line with arbitrary file paths. You can find install files for Windows and Linux in the releases page:

https://github.com/sulcgroup/oxdna-viewer/releases/tag/1.0.0

If you don't trust the dpgk requirement for root access (by default it installs at /usr/bin/oxview), you can install it locally with

dpkg -x oxview_1.0.0_amd64.deb /path/to/target/

You launch it with oxview topology configuration

zoombya commented 3 years ago

Hi Durham, we just updated the executable version to save the centering and inboxing options after a quit. So now you can use it the same way as the webpage - set those settings, quit and then the next opening will use the last set settings.

DurhamSmith commented 3 years ago

@ErikPoppleton, @zoombya Thanks for this! I greatly appreciate it. I haven't had the opportunity to look into it yet but I will close this for now and open it up again if needed!