Opened 3 years ago

Last modified 3 years ago

#7254 assigned defect

Use arbitrary folder with cxcmd link

Reported by: Tristan Croll Owned by: Greg Couch
Priority: normal Milestone:
Component: Help System Version:
Keywords: Cc: Tom Goddard, Eric Pettersen
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

The following bug report has been submitted:
Platform:        Windows-10-10.0.19041
ChimeraX Version: 1.4 (2022-06-03 23:39:42 UTC)
Description
Is there a way to get commands launched from `cxcmd:` links to use the ChimeraX working directory? I've been putting together a tutorial using pre-generated AlphaFold multimer predictions for builidng into a cryo-EM map, and to make things a little more realistic I want to copy the predictions and their PAE matrix files to a user-chosen scratch directory. The problem is that all commands launched from the help browser seem to work in their own little environment - `cd browse` *appears* to work but effectively does nothing, the `pwd` command returns the directory containing the help file, and any Python code calling `os.getcwd()` does the same. So far the only solution I've found is to tell the user to copy those particular commands manually into the ChimeraX command line - but is there a better way?

OpenGL version: 3.3.0 NVIDIA 497.29
OpenGL renderer: NVIDIA GeForce RTX 2080/PCIe/SSE2
OpenGL vendor: NVIDIA Corporation

Python: 3.9.11
Locale: en_GB.cp1252
Qt version: PyQt6 6.3.0, Qt 6.3.0
Qt runtime version: 6.3.0
Qt platform: windows

Manufacturer: Notebook                        
Model: P7xxTM1
OS: Microsoft Windows 10 Education (Build 19041)
Memory: 68,654,501,888
MaxProcessMemory: 137,438,953,344
CPU: 16 Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz
OSLanguage: en-GB

Installed Packages:
    -: imerax-isolde
    -himerax-clipper: 0.18.0
    -himerax-isolde: 1.4b2
    absl-py: 1.0.0
    alabaster: 0.7.12
    appdirs: 1.4.4
    Babel: 2.10.1
    backcall: 0.2.0
    blockdiag: 3.0.0
    certifi: 2022.5.18.1
    cftime: 1.6.0
    charset-normalizer: 2.0.12
    ChimeraX-AddCharge: 1.2.3
    ChimeraX-AddH: 2.1.11
    ChimeraX-AlignmentAlgorithms: 2.0
    ChimeraX-AlignmentHdrs: 3.2.1
    ChimeraX-AlignmentMatrices: 2.0
    ChimeraX-Alignments: 2.4.3
    ChimeraX-AlphaFold: 1.0
    ChimeraX-AltlocExplorer: 1.0.2
    ChimeraX-AmberInfo: 1.0
    ChimeraX-Arrays: 1.0
    ChimeraX-Atomic: 1.39.1
    ChimeraX-AtomicLibrary: 7.0
    ChimeraX-AtomSearch: 2.0.1
    ChimeraX-AxesPlanes: 2.1
    ChimeraX-BasicActions: 1.1
    ChimeraX-BILD: 1.0
    ChimeraX-BlastProtein: 2.1.1
    ChimeraX-BondRot: 2.0
    ChimeraX-BugReporter: 1.0
    ChimeraX-BuildStructure: 2.7
    ChimeraX-Bumps: 1.0
    ChimeraX-BundleBuilder: 1.1
    ChimeraX-ButtonPanel: 1.0
    ChimeraX-CageBuilder: 1.0
    ChimeraX-CellPack: 1.0
    ChimeraX-Centroids: 1.2
    ChimeraX-ChemGroup: 2.0
    ChimeraX-Clashes: 2.2.4
    ChimeraX-Clipper: 0.18.0
    ChimeraX-ColorActions: 1.0
    ChimeraX-ColorGlobe: 1.0
    ChimeraX-ColorKey: 1.5.1
    ChimeraX-CommandLine: 1.2.3
    ChimeraX-ConnectStructure: 2.0.1
    ChimeraX-Contacts: 1.0
    ChimeraX-Core: 1.4
    ChimeraX-CoreFormats: 1.1
    ChimeraX-coulombic: 1.3.2
    ChimeraX-Crosslinks: 1.0
    ChimeraX-Crystal: 1.0
    ChimeraX-CrystalContacts: 1.0
    ChimeraX-DataFormats: 1.2.2
    ChimeraX-Dicom: 1.1
    ChimeraX-DistMonitor: 1.1.5
    ChimeraX-Dssp: 2.0
    ChimeraX-EMDB-SFF: 1.0
    ChimeraX-ExperimentalCommands: 1.0
    ChimeraX-FileHistory: 1.0
    ChimeraX-FunctionKey: 1.0
    ChimeraX-Geometry: 1.2
    ChimeraX-gltf: 1.0
    ChimeraX-Graphics: 1.1
    ChimeraX-Hbonds: 2.1.2
    ChimeraX-Help: 1.2
    ChimeraX-HKCage: 1.3
    ChimeraX-IHM: 1.1
    ChimeraX-ImageFormats: 1.2
    ChimeraX-IMOD: 1.0
    ChimeraX-IO: 1.0.1
    ChimeraX-ISOLDE: 1.4b2
    ChimeraX-ItemsInspection: 1.0
    ChimeraX-Label: 1.1.1
    ChimeraX-ListInfo: 1.1.1
    ChimeraX-Log: 1.1.5
    ChimeraX-LookingGlass: 1.1
    ChimeraX-Maestro: 1.8.1
    ChimeraX-Map: 1.1
    ChimeraX-MapData: 2.0
    ChimeraX-MapEraser: 1.0
    ChimeraX-MapFilter: 2.0
    ChimeraX-MapFit: 2.0
    ChimeraX-MapSeries: 2.1
    ChimeraX-Markers: 1.0
    ChimeraX-Mask: 1.0
    ChimeraX-MatchMaker: 2.0.6
    ChimeraX-MDcrds: 2.6
    ChimeraX-MedicalToolbar: 1.0.1
    ChimeraX-Meeting: 1.0
    ChimeraX-MLP: 1.1
    ChimeraX-mmCIF: 2.7
    ChimeraX-MMTF: 2.1
    ChimeraX-Modeller: 1.5.5
    ChimeraX-ModelPanel: 1.3.2
    ChimeraX-ModelSeries: 1.0
    ChimeraX-Mol2: 2.0
    ChimeraX-Morph: 1.0
    ChimeraX-MouseModes: 1.1
    ChimeraX-Movie: 1.0
    ChimeraX-Neuron: 1.0
    ChimeraX-Nucleotides: 2.0.2
    ChimeraX-OpenCommand: 1.9
    ChimeraX-PDB: 2.6.6
    ChimeraX-PDBBio: 1.0
    ChimeraX-PDBLibrary: 1.0.2
    ChimeraX-PDBMatrices: 1.0
    ChimeraX-PickBlobs: 1.0
    ChimeraX-Positions: 1.0
    ChimeraX-PresetMgr: 1.1
    ChimeraX-PubChem: 2.1
    ChimeraX-ReadPbonds: 1.0.1
    ChimeraX-Registration: 1.1
    ChimeraX-RemoteControl: 1.0
    ChimeraX-ResidueFit: 1.0
    ChimeraX-RestServer: 1.1
    ChimeraX-RNALayout: 1.0
    ChimeraX-RotamerLibMgr: 2.0.1
    ChimeraX-RotamerLibsDunbrack: 2.0
    ChimeraX-RotamerLibsDynameomics: 2.0
    ChimeraX-RotamerLibsRichardson: 2.0
    ChimeraX-SaveCommand: 1.5.1
    ChimeraX-SchemeMgr: 1.0
    ChimeraX-SDF: 2.0
    ChimeraX-Segger: 1.0
    ChimeraX-Segment: 1.0
    ChimeraX-SelInspector: 1.0
    ChimeraX-SeqView: 2.6
    ChimeraX-Shape: 1.0.1
    ChimeraX-Shell: 1.0
    ChimeraX-Shortcuts: 1.1
    ChimeraX-ShowAttr: 1.0
    ChimeraX-ShowSequences: 1.0
    ChimeraX-SideView: 1.0
    ChimeraX-Smiles: 2.1
    ChimeraX-SmoothLines: 1.0
    ChimeraX-SpaceNavigator: 1.0
    ChimeraX-StdCommands: 1.8
    ChimeraX-STL: 1.0
    ChimeraX-Storm: 1.0
    ChimeraX-StructMeasure: 1.0.1
    ChimeraX-Struts: 1.0.1
    ChimeraX-Surface: 1.0
    ChimeraX-SwapAA: 2.0
    ChimeraX-SwapRes: 2.1.1
    ChimeraX-TapeMeasure: 1.0
    ChimeraX-Test: 1.0
    ChimeraX-Toolbar: 1.1.1
    ChimeraX-ToolshedUtils: 1.2.1
    ChimeraX-Tug: 1.0
    ChimeraX-UI: 1.18.3
    ChimeraX-uniprot: 2.2
    ChimeraX-UnitCell: 1.0
    ChimeraX-ViewDockX: 1.1.2
    ChimeraX-VIPERdb: 1.0
    ChimeraX-Vive: 1.1
    ChimeraX-VolumeMenu: 1.0
    ChimeraX-VTK: 1.0
    ChimeraX-WavefrontOBJ: 1.0
    ChimeraX-WebCam: 1.0
    ChimeraX-WebServices: 1.1.0
    ChimeraX-Zone: 1.0
    colorama: 0.4.4
    comtypes: 1.1.10
    cxservices: 1.2
    cycler: 0.11.0
    Cython: 0.29.26
    debugpy: 1.6.0
    decorator: 5.1.1
    docutils: 0.17.1
    entrypoints: 0.4
    filelock: 3.4.2
    fonttools: 4.33.3
    funcparserlib: 1.0.0
    grako: 3.16.5
    h5py: 3.7.0
    html2text: 2020.1.16
    idna: 3.3
    ihm: 0.27
    imagecodecs: 2021.11.20
    imagesize: 1.3.0
    ipykernel: 6.6.1
    ipython: 7.31.1
    ipython-genutils: 0.2.0
    jax: 0.2.27
    jedi: 0.18.1
    Jinja2: 3.0.3
    jupyter-client: 7.1.0
    jupyter-core: 4.10.0
    kiwisolver: 1.4.2
    line-profiler: 3.4.0
    lxml: 4.7.1
    lz4: 3.1.10
    MarkupSafe: 2.1.1
    matplotlib: 3.5.1
    matplotlib-inline: 0.1.3
    mpmath: 1.2.1
    msgpack: 1.0.3
    nest-asyncio: 1.5.5
    netCDF4: 1.5.8
    networkx: 2.6.3
    numexpr: 2.8.1
    numpy: 1.22.1
    OpenMM: 7.7.0
    openvr: 1.16.802
    opt-einsum: 3.3.0
    packaging: 21.3
    ParmEd: 3.4.3
    parso: 0.8.3
    pickleshare: 0.7.5
    Pillow: 9.0.1
    pip: 21.3.1
    pkginfo: 1.8.2
    prompt-toolkit: 3.0.29
    psutil: 5.9.0
    pycollada: 0.7.2
    pydicom: 2.2.2
    Pygments: 2.11.2
    PyOpenGL: 3.1.5
    PyOpenGL-accelerate: 3.1.5
    pyparsing: 3.0.9
    PyQt6-commercial: 6.3.0
    PyQt6-Qt6: 6.3.0
    PyQt6-sip: 13.3.1
    PyQt6-WebEngine-commercial: 6.3.0
    PyQt6-WebEngine-Qt6: 6.3.0
    python-dateutil: 2.8.2
    pytz: 2022.1
    pywin32: 303
    pyzmq: 23.1.0
    qtconsole: 5.3.0
    QtPy: 2.1.0
    RandomWords: 0.3.0
    requests: 2.27.1
    scipy: 1.7.3
    setuptools: 59.8.0
    sfftk-rw: 0.7.2
    six: 1.16.0
    snowballstemmer: 2.2.0
    sortedcontainers: 2.4.0
    Sphinx: 4.3.2
    sphinx-autodoc-typehints: 1.15.2
    sphinxcontrib-applehelp: 1.0.2
    sphinxcontrib-blockdiag: 3.0.0
    sphinxcontrib-devhelp: 1.0.2
    sphinxcontrib-htmlhelp: 2.0.0
    sphinxcontrib-jsmath: 1.0.1
    sphinxcontrib-qthelp: 1.0.3
    sphinxcontrib-serializinghtml: 1.1.5
    suds-community: 1.0.0
    sympy: 1.10.1
    tables: 3.7.0
    tifffile: 2021.11.2
    tinyarray: 1.2.4
    tornado: 6.1
    traitlets: 5.1.1
    typing-extensions: 4.0.1
    urllib3: 1.26.9
    versioneer: 0.21
    wcwidth: 0.2.5
    webcolors: 1.11.1
    wheel: 0.37.1
    wheel-filename: 1.3.0
    WMI: 1.5.1

Attachments (1)

ISOLDE_AlphaFold_Multimer_CryoEM.pdf (10.9 MB ) - added by Tristan Croll 3 years ago.
Added by email2trac

Change History (16)

comment:1 by Eric Pettersen, 3 years ago

Cc: Tom Goddard Eric Pettersen added
Component: UnassignedHelp System
Owner: set to Greg Couch
Platform: all
Project: ChimeraX
Status: newassigned
Summary: ChimeraX bug report submissionUse arbitrary folder with cxcmd link

comment:2 by Eric Pettersen, 3 years ago

Hi Tristan,

The problem is that the cxcmd link will hop over to the folder containing the HTML file before running the command. This is very much the right thing to do in the large majority of cases, since tutorials and help pages usually want to find their files relative to the location of the tutorial/help page itself, but in your specific case it isn't the desired behavior.
I *think* the only option is for us to implement an alternative scheme to cxcmd that doesn't do the folder hopping, but maybe Greg or Tom will have better ideas.

--Eric

comment:3 by Tom Goddard, 3 years ago

I don't understand how you intend to copy files. There isn't a ChimeraX command to do that as far as I know.

But in my test using cd and pwd separated by semicolon in the same cxcmd command link worked. The current working directory will revert to the location of the html file on the next cxcmd since every cxcmd link sets the current working directory.

<a href="cxcmd:cd browse ; pwd ; echo Now somehow magically copy to current directory">Choose scratch directory</a>

logging the following when I clicked the link

cd /Users/goddard/Downloads/gases
Current working directory is: /Users/goddard/Downloads/gases

pwd
Current working directory is: /Users/goddard/Downloads/gases

echo Now somehow magically copy to current directory
Now somehow magically copy to current directory

comment:4 by Tom Goddard, 3 years ago

I'd suggest not to fight the ChimeraX tutorial organization. The idea is the html with links and the data files are in the same directory. If the user has downloaded your tutorial it is reasonable for them to use the tutorial directory as the scratch directory.

It is some trouble for the user to download your tutorial. So why not have them access it online and when it needs a precomputed alphafold model that is part of your tutorial have the cxcmd link open it using something like

<a href="cxcmd: open https://where-tutorial-lives/data/afexample.pdb">Open precomputed AlphaFold model</a>

comment:5 by Eric Pettersen, 3 years ago

Alternatively, you could have them copy a "second half" tutorial page into the scratch directory and open that. That page could then use relative locations.

in reply to:  6 ; comment:6 by Tristan Croll, 3 years ago

I seem to be locked out of Trac again, so replying by email (hope it doesn't generate a bunch of cruft). I've attached a PDF of the planned tutorial to give you a better picture of it. I like Tom's idea of hosting ISOLDE tutorials online somewhere (and have thought about that a bit) but don't have time to set that up for this release... it will just be rolled into the bundle.

The basic idea is that:


  *   it asks the user to navigate to (or create) a scratch directory for the tutorial. I don't want to use the tutorial's own directory for this, to avoid the user saving files there and then wondering where on earth they are. As far as I can tell that has to be done by them manually - when I did "cd browse" from a link in the help file, then typed "pwd" manually in the ChimeraX command line, ChimeraX was still in its original working directory.
  *   To actually copy the files, I added an argument to the "isolde tutorial" command: "isolde tut prep {tutorial name}". The reason for doing it this way is to make the tutorial experience as close as possible to working with their own pre-computed (downloaded) model.
  *   As long as I ask the user to do those two steps manually, everything else works out OK.

I do understand the rationale behind the current scheme, and it makes perfect sense. Just seemed like it might be nice to also have the option to work in ChimeraX's directory space as well.
________________________________
From: ChimeraX <ChimeraX-bugs-admin@cgl.ucsf.edu>
Sent: 11 July 2022 19:26
Cc: goddard@cgl.ucsf.edu <goddard@cgl.ucsf.edu>; gregc@cgl.ucsf.edu <gregc@cgl.ucsf.edu>; pett@cgl.ucsf.edu <pett@cgl.ucsf.edu>; Tristan Croll <tic20@cam.ac.uk>
Subject: Re: [ChimeraX] #7254: Use arbitrary folder with cxcmd link

#7254: Use arbitrary folder with cxcmd link
------------------------------------+------------------------
          Reporter:  Tristan Croll  |      Owner:  Greg Couch
              Type:  defect         |     Status:  assigned
          Priority:  normal         |  Milestone:
         Component:  Help System    |    Version:
        Resolution:                 |   Keywords:
        Blocked By:                 |   Blocking:
Notify when closed:                 |   Platform:  all
           Project:  ChimeraX       |
------------------------------------+------------------------

Comment (by Tom Goddard):

 I'd suggest not to fight the ChimeraX tutorial organization.  The idea is
 the html with links and the data files are in the same directory.  If the
 user has downloaded your tutorial it is reasonable for them to use the
 tutorial directory as the scratch directory.

 It is some trouble for the user to download your tutorial.  So why not
 have them access it online and when it needs a precomputed alphafold model
 that is part of your tutorial have the cxcmd link open it using something
 like

 {{{
 <a href="cxcmd: open https://where-tutorial-lives/data/afexample.pdb">Open
 precomputed AlphaFold model</a>
 }}}

--
Ticket URL: <https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.rbvi.ucsf.edu%2Ftrac%2FChimeraX%2Fticket%2F7254%23comment%3A4&amp;data=05%7C01%7Ctic20%40universityofcambridgecloud.onmicrosoft.com%7Cde19fb3510ce487d827208da636afcb9%7C49a50445bdfa4b79ade3547b4f3986e9%7C0%7C0%7C637931608415647958%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=cr2z%2FM0o%2Byel8SP6FIeC%2BBY9WylAszO5qUyC6rzZmk8%3D&amp;reserved=0>
ChimeraX <https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.rbvi.ucsf.edu%2Fchimerax%2F&amp;data=05%7C01%7Ctic20%40universityofcambridgecloud.onmicrosoft.com%7Cde19fb3510ce487d827208da636afcb9%7C49a50445bdfa4b79ade3547b4f3986e9%7C0%7C0%7C637931608415647958%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=L79wm%2BLeyqM4Qbd2J2CY6HqA213VqkktrbQIfAfTupo%3D&amp;reserved=0>
ChimeraX Issue Tracker

ISOLDE_AlphaFold_Multimer_CryoEM.pdf

by Tristan Croll, 3 years ago

Added by email2trac

in reply to:  8 comment:7 by Tristan Croll, 3 years ago

The other issue is that (unless I've missed something) Sphinx doesn't provide a way to bundle non-image files with its generated html, so links to the tutorial data would need to be hard-coded "../../../../some/new/path/to/file.pdb" monstrosities.
________________________________
From: ChimeraX <ChimeraX-bugs-admin@cgl.ucsf.edu>
Sent: 11 July 2022 19:44
Cc: goddard@cgl.ucsf.edu <goddard@cgl.ucsf.edu>; gregc@cgl.ucsf.edu <gregc@cgl.ucsf.edu>; pett@cgl.ucsf.edu <pett@cgl.ucsf.edu>; Tristan Croll <tic20@cam.ac.uk>
Subject: Re: [ChimeraX] #7254: Use arbitrary folder with cxcmd link

#7254: Use arbitrary folder with cxcmd link
------------------------------------+------------------------
          Reporter:  Tristan Croll  |      Owner:  Greg Couch
              Type:  defect         |     Status:  assigned
          Priority:  normal         |  Milestone:
         Component:  Help System    |    Version:
        Resolution:                 |   Keywords:
        Blocked By:                 |   Blocking:
Notify when closed:                 |   Platform:  all
           Project:  ChimeraX       |
------------------------------------+------------------------
Changes (by Tristan Croll):

 * Attachment "ISOLDE_AlphaFold_Multimer_CryoEM.pdf" added.

 Added by email2trac

--
Ticket URL: <https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.rbvi.ucsf.edu%2Ftrac%2FChimeraX%2Fticket%2F7254&amp;data=05%7C01%7Ctic20%40universityofcambridgecloud.onmicrosoft.com%7C214f1cd535954d39f47208da636d6aec%7C49a50445bdfa4b79ade3547b4f3986e9%7C0%7C0%7C637931618849002987%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=wPq1p3D6QmJpARpIIrd6pHOnID8B3HdggVpsZDNaOR8%3D&amp;reserved=0>
ChimeraX <https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.rbvi.ucsf.edu%2Fchimerax%2F&amp;data=05%7C01%7Ctic20%40universityofcambridgecloud.onmicrosoft.com%7C214f1cd535954d39f47208da636d6aec%7C49a50445bdfa4b79ade3547b4f3986e9%7C0%7C0%7C637931618849002987%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=N8bF%2BFY%2BBhNGF2YoOste5CzOn4WaRSt6FF3ZfVQ26oU%3D&amp;reserved=0>
ChimeraX Issue Tracker

in reply to:  9 ; comment:8 by goddard@…, 3 years ago

Ok, so you have an "isolde tutorial prep tutorial-name" command that copies the files.  Why not copy the tutorial html and data files with that command, ie copy the whole tutorial directory to the current directory, and then open the new copy of the html?

<a href="cxcmd: cd browse; isolde tutorial prep tutorial-name; open tutorial-name.html">Choose tutorial scratch directory</a>

Another idea don't have them choose the directory, have your prep command just make a scratch directory on the Desktop.


in reply to:  10 ; comment:9 by Tristan Croll, 3 years ago

Hmm... that's an interesting option -  although would still be a little challenging with the current architecture (all the documentation, including tutorials, is built as a single Sphinx project, which leads to all images ending up in the same _images directory). Would basically have to copy the entire directory tree. But it probably​ wouldn't be ridiculously difficult to make each tutorial its own self-contained project.
________________________________
From: ChimeraX <ChimeraX-bugs-admin@cgl.ucsf.edu>
Sent: 11 July 2022 19:57
To: gregc@cgl.ucsf.edu <gregc@cgl.ucsf.edu>; Tristan Croll <tic20@cam.ac.uk>
Cc: pett@cgl.ucsf.edu <pett@cgl.ucsf.edu>; goddard@cgl.ucsf.edu <goddard@cgl.ucsf.edu>
Subject: Re: [ChimeraX] #7254: Use arbitrary folder with cxcmd link

#7254: Use arbitrary folder with cxcmd link
------------------------------------+------------------------
          Reporter:  Tristan Croll  |      Owner:  Greg Couch
              Type:  defect         |     Status:  assigned
          Priority:  normal         |  Milestone:
         Component:  Help System    |    Version:
        Resolution:                 |   Keywords:
        Blocked By:                 |   Blocking:
Notify when closed:                 |   Platform:  all
           Project:  ChimeraX       |
------------------------------------+------------------------

Comment (by goddard@…):

 {{{
 Ok, so you have an "isolde tutorial prep tutorial-name" command that
 copies the files.  Why not copy the tutorial html and data files with that
 command, ie copy the whole tutorial directory to the current directory,
 and then open the new copy of the html?

 <a href="cxcmd: cd browse; isolde tutorial prep tutorial-name; open
 tutorial-name.html">Choose tutorial scratch directory</a>

 Another idea don't have them choose the directory, have your prep command
 just make a scratch directory on the Desktop.


 }}}

--
Ticket URL: <https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.rbvi.ucsf.edu%2Ftrac%2FChimeraX%2Fticket%2F7254%23comment%3A8&amp;data=05%7C01%7Ctic20%40universityofcambridgecloud.onmicrosoft.com%7Cf1a621a356684281c1d908da636f43e5%7C49a50445bdfa4b79ade3547b4f3986e9%7C0%7C0%7C637931626778540761%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=OBsXKgLMF4znCpRH5aQLsEYUJ1JAnygM%2FmpxkjA2SsU%3D&amp;reserved=0>
ChimeraX <https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.rbvi.ucsf.edu%2Fchimerax%2F&amp;data=05%7C01%7Ctic20%40universityofcambridgecloud.onmicrosoft.com%7Cf1a621a356684281c1d908da636f43e5%7C49a50445bdfa4b79ade3547b4f3986e9%7C0%7C0%7C637931626778540761%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=UpvUjtSOgwK3%2B%2FBWFWoU5MEtE%2BWIb4DunBP4512QCd4%3D&amp;reserved=0>
ChimeraX Issue Tracker

in reply to:  11 ; comment:10 by Tristan Croll, 3 years ago

One other problem: there is a step in the tutorial asking the user to click a button to browse for and load the PAE file. The button itself just calls the "alphafold pae" command on the file they choose - but given that the filenames from the various AlphaFold Colab flavours tend to be very long and convoluted, that seems the best approach. Problem is that this button's file browser would still open in the wrong directory.

A hack that might just work: if I do "cxcmd: cd browse; isolde tutorial prep tutorial-name", and then have the method underlying "isolde tutorial prep" attach a handler to do "cd {chosen directory}" on the next "new frame" trigger, then that should put ChimeraX properly into the chosen working directory, no?

Will try it out and see...
________________________________
From: ChimeraX <ChimeraX-bugs-admin@cgl.ucsf.edu>
Sent: 11 July 2022 20:08
To: gregc@cgl.ucsf.edu <gregc@cgl.ucsf.edu>; Tristan Croll <tic20@cam.ac.uk>
Cc: pett@cgl.ucsf.edu <pett@cgl.ucsf.edu>; goddard@cgl.ucsf.edu <goddard@cgl.ucsf.edu>
Subject: Re: [ChimeraX] #7254: Use arbitrary folder with cxcmd link

#7254: Use arbitrary folder with cxcmd link
------------------------------------+------------------------
          Reporter:  Tristan Croll  |      Owner:  Greg Couch
              Type:  defect         |     Status:  assigned
          Priority:  normal         |  Milestone:
         Component:  Help System    |    Version:
        Resolution:                 |   Keywords:
        Blocked By:                 |   Blocking:
Notify when closed:                 |   Platform:  all
           Project:  ChimeraX       |
------------------------------------+------------------------

Comment (by Tristan Croll):

 {{{
 Hmm... that's an interesting option -  although would still be a little
 challenging with the current architecture (all the documentation,
 including tutorials, is built as a single Sphinx project, which leads to
 all images ending up in the same _images directory). Would basically have
 to copy the entire directory tree. But it probably​ wouldn't be
 ridiculously difficult to make each tutorial its own self-contained
 project.
 ________________________________
 From: ChimeraX <ChimeraX-bugs-admin@cgl.ucsf.edu>
 Sent: 11 July 2022 19:57
 To: gregc@cgl.ucsf.edu <gregc@cgl.ucsf.edu>; Tristan Croll
 <tic20@cam.ac.uk>
 Cc: pett@cgl.ucsf.edu <pett@cgl.ucsf.edu>; goddard@cgl.ucsf.edu
 <goddard@cgl.ucsf.edu>
 Subject: Re: [ChimeraX] #7254: Use arbitrary folder with cxcmd link

 #7254: Use arbitrary folder with cxcmd link
 ------------------------------------+------------------------
           Reporter:  Tristan Croll  |      Owner:  Greg Couch
               Type:  defect         |     Status:  assigned
           Priority:  normal         |  Milestone:
          Component:  Help System    |    Version:
         Resolution:                 |   Keywords:
         Blocked By:                 |   Blocking:
 Notify when closed:                 |   Platform:  all
            Project:  ChimeraX       |
 ------------------------------------+------------------------

 Comment (by goddard@…):

  {{{
  Ok, so you have an "isolde tutorial prep tutorial-name" command that
  copies the files.  Why not copy the tutorial html and data files with
 that
  command, ie copy the whole tutorial directory to the current directory,
  and then open the new copy of the html?

  <a href="cxcmd: cd browse; isolde tutorial prep tutorial-name; open
  tutorial-name.html">Choose tutorial scratch directory</a>

  Another idea don't have them choose the directory, have your prep command
  just make a scratch directory on the Desktop.


  }}}

 --
 Ticket URL:
 <https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.rbvi.ucsf.edu%2Ftrac%2FChimeraX%2Fticket%2F7254%23comment%3A8&amp;data=05%7C01%7Ctic20%40universityofcambridgecloud.onmicrosoft.com%7C651f62eb9c494bd3e48208da6370c733%7C49a50445bdfa4b79ade3547b4f3986e9%7C0%7C0%7C637931633274909744%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=aqPBAx4GUIGKZsY%2F2P1ULTrdlTVSLFHRTnZvpmLXTTI%3D&amp;reserved=0>
 ChimeraX
 <https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.rbvi.ucsf.edu%2Fchimerax%2F&amp;data=05%7C01%7Ctic20%40universityofcambridgecloud.onmicrosoft.com%7C651f62eb9c494bd3e48208da6370c733%7C49a50445bdfa4b79ade3547b4f3986e9%7C0%7C0%7C637931633274909744%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=NzuY7sfEJMAY3bm0j%2BLGL0tJuW0%2FSJ0D1BYi71dVsnA%3D&amp;reserved=0>
 ChimeraX Issue Tracker
 }}}

--
Ticket URL: <https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.rbvi.ucsf.edu%2Ftrac%2FChimeraX%2Fticket%2F7254%23comment%3A9&amp;data=05%7C01%7Ctic20%40universityofcambridgecloud.onmicrosoft.com%7C651f62eb9c494bd3e48208da6370c733%7C49a50445bdfa4b79ade3547b4f3986e9%7C0%7C0%7C637931633274909744%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=nDHNiyo4LzwbA%2BC8TJz9zzlgmMeZCOJT7VujenoV%2FV0%3D&amp;reserved=0>
ChimeraX <https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.rbvi.ucsf.edu%2Fchimerax%2F&amp;data=05%7C01%7Ctic20%40universityofcambridgecloud.onmicrosoft.com%7C651f62eb9c494bd3e48208da6370c733%7C49a50445bdfa4b79ade3547b4f3986e9%7C0%7C0%7C637931633274909744%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=NzuY7sfEJMAY3bm0j%2BLGL0tJuW0%2FSJ0D1BYi71dVsnA%3D&amp;reserved=0>
ChimeraX Issue Tracker

in reply to:  12 ; comment:11 by Tristan Croll, 3 years ago

Yep - this works like a charm:

def _prep_tut_dir(session, tut_name, source_dir):
    import os, shutil
    dest_dir = os.path.join(os.getcwd(), os.path.split(source_dir)[-1])
    shutil.copytree(source_dir, dest_dir)
    session.logger.info(f'ISOLDE: Tutorial files for {tut_name} copied to {dest_dir}')
    def cd_on_next_new_frame(*_):
        from chimerax.core.commands import run
        run(session, f'cd "{dest_dir}"', log=False)
        from chimerax.core.triggerset import DEREGISTER
        return DEREGISTER
    session.triggers.add_handler('new frame', cd_on_next_new_frame)

________________________________
From: ChimeraX <ChimeraX-bugs-admin@cgl.ucsf.edu>
Sent: 11 July 2022 20:18
To: gregc@cgl.ucsf.edu <gregc@cgl.ucsf.edu>; Tristan Croll <tic20@cam.ac.uk>
Cc: pett@cgl.ucsf.edu <pett@cgl.ucsf.edu>; goddard@cgl.ucsf.edu <goddard@cgl.ucsf.edu>
Subject: Re: [ChimeraX] #7254: Use arbitrary folder with cxcmd link

#7254: Use arbitrary folder with cxcmd link
------------------------------------+------------------------
          Reporter:  Tristan Croll  |      Owner:  Greg Couch
              Type:  defect         |     Status:  assigned
          Priority:  normal         |  Milestone:
         Component:  Help System    |    Version:
        Resolution:                 |   Keywords:
        Blocked By:                 |   Blocking:
Notify when closed:                 |   Platform:  all
           Project:  ChimeraX       |
------------------------------------+------------------------

Comment (by Tristan Croll):

 {{{
 One other problem: there is a step in the tutorial asking the user to
 click a button to browse for and load the PAE file. The button itself just
 calls the "alphafold pae" command on the file they choose - but given that
 the filenames from the various AlphaFold Colab flavours tend to be very
 long and convoluted, that seems the best approach. Problem is that this
 button's file browser would still open in the wrong directory.

 A hack that might just work: if I do "cxcmd: cd browse; isolde tutorial
 prep tutorial-name", and then have the method underlying "isolde tutorial
 prep" attach a handler to do "cd {chosen directory}" on the next "new
 frame" trigger, then that should put ChimeraX properly into the chosen
 working directory, no?

 Will try it out and see...
 ________________________________
 From: ChimeraX <ChimeraX-bugs-admin@cgl.ucsf.edu>
 Sent: 11 July 2022 20:08
 To: gregc@cgl.ucsf.edu <gregc@cgl.ucsf.edu>; Tristan Croll
 <tic20@cam.ac.uk>
 Cc: pett@cgl.ucsf.edu <pett@cgl.ucsf.edu>; goddard@cgl.ucsf.edu
 <goddard@cgl.ucsf.edu>
 Subject: Re: [ChimeraX] #7254: Use arbitrary folder with cxcmd link

 #7254: Use arbitrary folder with cxcmd link
 ------------------------------------+------------------------
           Reporter:  Tristan Croll  |      Owner:  Greg Couch
               Type:  defect         |     Status:  assigned
           Priority:  normal         |  Milestone:
          Component:  Help System    |    Version:
         Resolution:                 |   Keywords:
         Blocked By:                 |   Blocking:
 Notify when closed:                 |   Platform:  all
            Project:  ChimeraX       |
 ------------------------------------+------------------------

 Comment (by Tristan Croll):

  {{{
  Hmm... that's an interesting option -  although would still be a little
  challenging with the current architecture (all the documentation,
  including tutorials, is built as a single Sphinx project, which leads to
  all images ending up in the same _images directory). Would basically have
  to copy the entire directory tree. But it probably​ wouldn't be
  ridiculously difficult to make each tutorial its own self-contained
  project.
  ________________________________
  From: ChimeraX <ChimeraX-bugs-admin@cgl.ucsf.edu>
  Sent: 11 July 2022 19:57
  To: gregc@cgl.ucsf.edu <gregc@cgl.ucsf.edu>; Tristan Croll
  <tic20@cam.ac.uk>
  Cc: pett@cgl.ucsf.edu <pett@cgl.ucsf.edu>; goddard@cgl.ucsf.edu
  <goddard@cgl.ucsf.edu>
  Subject: Re: [ChimeraX] #7254: Use arbitrary folder with cxcmd link

  #7254: Use arbitrary folder with cxcmd link
  ------------------------------------+------------------------
            Reporter:  Tristan Croll  |      Owner:  Greg Couch
                Type:  defect         |     Status:  assigned
            Priority:  normal         |  Milestone:
           Component:  Help System    |    Version:
          Resolution:                 |   Keywords:
          Blocked By:                 |   Blocking:
  Notify when closed:                 |   Platform:  all
             Project:  ChimeraX       |
  ------------------------------------+------------------------

  Comment (by goddard@…):

   {{{
   Ok, so you have an "isolde tutorial prep tutorial-name" command that
   copies the files.  Why not copy the tutorial html and data files with
  that
   command, ie copy the whole tutorial directory to the current directory,
   and then open the new copy of the html?

   <a href="cxcmd: cd browse; isolde tutorial prep tutorial-name; open
   tutorial-name.html">Choose tutorial scratch directory</a>

   Another idea don't have them choose the directory, have your prep
 command
   just make a scratch directory on the Desktop.


   }}}

  --
  Ticket URL:
 <https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.rbvi.ucsf.edu%2Ftrac%2FChimeraX%2Fticket%2F7254%23comment%3A8&amp;data=05%7C01%7Ctic20%40universityofcambridgecloud.onmicrosoft.com%7C0adae754446649b87ae208da637244e7%7C49a50445bdfa4b79ade3547b4f3986e9%7C0%7C0%7C637931640416281972%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=w3Td1ji0y8L1scAErDiw2GgQfyDevZ4sdtEZwO%2Fk4mE%3D&amp;reserved=0>
  ChimeraX
 <https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.rbvi.ucsf.edu%2Fchimerax%2F&amp;data=05%7C01%7Ctic20%40universityofcambridgecloud.onmicrosoft.com%7C0adae754446649b87ae208da637244e7%7C49a50445bdfa4b79ade3547b4f3986e9%7C0%7C0%7C637931640416281972%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=XLkQ7QHAcOTeHWuMqf4fTd%2FJ9N%2FA3iiZTxBMGQvtgXU%3D&amp;reserved=0>
  ChimeraX Issue Tracker
  }}}

 --
 Ticket URL:
 <https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.rbvi.ucsf.edu%2Ftrac%2FChimeraX%2Fticket%2F7254%23comment%3A9&amp;data=05%7C01%7Ctic20%40universityofcambridgecloud.onmicrosoft.com%7C0adae754446649b87ae208da637244e7%7C49a50445bdfa4b79ade3547b4f3986e9%7C0%7C0%7C637931640416281972%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=hn1jrLH54zm0pqy76EDH7nwK88emwac3xyY3e7Ez974%3D&amp;reserved=0>
 ChimeraX
 <https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.rbvi.ucsf.edu%2Fchimerax%2F&amp;data=05%7C01%7Ctic20%40universityofcambridgecloud.onmicrosoft.com%7C0adae754446649b87ae208da637244e7%7C49a50445bdfa4b79ade3547b4f3986e9%7C0%7C0%7C637931640416281972%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=XLkQ7QHAcOTeHWuMqf4fTd%2FJ9N%2FA3iiZTxBMGQvtgXU%3D&amp;reserved=0>
 ChimeraX Issue Tracker
 }}}

--
Ticket URL: <https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.rbvi.ucsf.edu%2Ftrac%2FChimeraX%2Fticket%2F7254%23comment%3A10&amp;data=05%7C01%7Ctic20%40universityofcambridgecloud.onmicrosoft.com%7C0adae754446649b87ae208da637244e7%7C49a50445bdfa4b79ade3547b4f3986e9%7C0%7C0%7C637931640416281972%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=0y%2BcwkngtgTPn5IxK30Y5QCsJkONNMfWTEtMbgUZcrc%3D&amp;reserved=0>
ChimeraX <https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.rbvi.ucsf.edu%2Fchimerax%2F&amp;data=05%7C01%7Ctic20%40universityofcambridgecloud.onmicrosoft.com%7C0adae754446649b87ae208da637244e7%7C49a50445bdfa4b79ade3547b4f3986e9%7C0%7C0%7C637931640416281972%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=XLkQ7QHAcOTeHWuMqf4fTd%2FJ9N%2FA3iiZTxBMGQvtgXU%3D&amp;reserved=0>
ChimeraX Issue Tracker

comment:12 by Tom Goddard, 3 years ago

Not sure if you mean you use the ChimeraX AlphaFold Error Plot tool which lets the user choose the PAE file. If that is what you are doing, that tool initially will set the file browser to the same directory that the AlphaFold PDB file was loaded from. It does not use the current ChimeraX directory.

comment:13 by Tom Goddard, 3 years ago

I am still puzzled. I didn't see any saving of data files using cxcmd links (or by other means) in the PDF tutorial you attached. The scratch folder only makes sense if they are going to use it.

in reply to:  15 comment:14 by Tristan Croll, 3 years ago

In order for the tutorial to work as it is (including opening the models via the ChimeraX File/Open menu and adding the PAE matrix to the reference model via a button on ISOLDE's GUI), ChimeraX's working directory needs to contain those files. If I change ChimeraX's working directory to wherever they happen to be, and then the user decides to use the save command, then they're going to end up wondering where the saved files actually ended up. To me, writing the starting files to a user-defined scratch directory and then working from there seems the next-cleanest solution to the approach you suggested (bundling the files with the html in a self-contained downloadable tutorial, which I just don't have the time to organise right now).

You reminded me, though, that I was planning to add a paragraph to the start explaining how they can save the session if they need to stop and come back later. I also need to add a paragraph to the end about writing input files for phenix.real_space_refine with the "isolde write phenixRsrInput" command.
________________________________
From: ChimeraX <ChimeraX-bugs-admin@cgl.ucsf.edu>
Sent: 11 July 2022 23:33
Cc: goddard@cgl.ucsf.edu <goddard@cgl.ucsf.edu>; gregc@cgl.ucsf.edu <gregc@cgl.ucsf.edu>; pett@cgl.ucsf.edu <pett@cgl.ucsf.edu>; Tristan Croll <tic20@cam.ac.uk>
Subject: Re: [ChimeraX] #7254: Use arbitrary folder with cxcmd link

#7254: Use arbitrary folder with cxcmd link
------------------------------------+------------------------
          Reporter:  Tristan Croll  |      Owner:  Greg Couch
              Type:  defect         |     Status:  assigned
          Priority:  normal         |  Milestone:
         Component:  Help System    |    Version:
        Resolution:                 |   Keywords:
        Blocked By:                 |   Blocking:
Notify when closed:                 |   Platform:  all
           Project:  ChimeraX       |
------------------------------------+------------------------

Comment (by Tom Goddard):

 I am still puzzled.  I didn't see any saving of data files using cxcmd
 links (or by other means) in the PDF tutorial you attached.  The scratch
 folder only makes sense if they are going to use it.

--
Ticket URL: <https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.rbvi.ucsf.edu%2Ftrac%2FChimeraX%2Fticket%2F7254%23comment%3A13&amp;data=05%7C01%7Ctic20%40universityofcambridgecloud.onmicrosoft.com%7C4609f78904aa453a946808da638d835c%7C49a50445bdfa4b79ade3547b4f3986e9%7C0%7C0%7C637931757271923184%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=DZpfIzwKgoS8WpggTQPLl9T1sP5TGHv3%2BL%2Bdgp7FcQw%3D&amp;reserved=0>
ChimeraX <https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.rbvi.ucsf.edu%2Fchimerax%2F&amp;data=05%7C01%7Ctic20%40universityofcambridgecloud.onmicrosoft.com%7C4609f78904aa453a946808da638d835c%7C49a50445bdfa4b79ade3547b4f3986e9%7C0%7C0%7C637931757271923184%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=nJ5shR8ad3fSMrzB9WfKRWI1d0nZFFlrHt66R%2FIiV%2FM%3D&amp;reserved=0>
ChimeraX Issue Tracker

in reply to:  16 ; comment:15 by goddard@…, 3 years ago

Sounds reasonable.  We have many ChimeraX tutorials with click-to-execute links written by me and Elaine and accessible through the Help / Tutorials menu entry.  Those work because the data is fetched from databases and we don't ask them to save anything other than images and movies to the desktop.  So your case is different.  I agree that copying the needed files including the html tutorial to a scratch directory and then showing that copied html sounds like the way to go.

Note: See TracTickets for help on using tickets.