Skip to content

Instantly share code, notes, and snippets.

@fomightez
Last active July 8, 2025 19:53
Show Gist options
  • Save fomightez/e65761a066f56cbbc4c9b5b882c87380 to your computer and use it in GitHub Desktop.
Save fomightez/e65761a066f56cbbc4c9b5b882c87380 to your computer and use it in GitHub Desktop.
Using mybinder dekstop to demo use of Fasta2Stucture that uses tkinter

Walkthrough for installation and trial use of Fasta2Structure in your browser in temporary remote sessions served via MyBinder

Benefits:

  • Runs remotely so nothing modified on your machine yet you can test Fasta2Structure use hands-on.
  • Almost everything is already prepared, only need to install one package (Biopython) and get the Fasta2Structure material to be demonstrated.
  • No login required.

Demo Fasta2Structure on a remote Linux-based desktop

Specifically, this will use a Linux-based desktop in your browser as a place to try Fasta2Structure.
Fasta2Structure prepares data in the specific format required by the population gentics software research program STRUCTURE that was developed by Pritchard et al. 2000. See more about that software here with the current version of the STRUCTURE software (v. 2.3.4) and documentation available here.
Fasta2Structure is described in Bessa-Silva 2024 'Fasta2Structure: a user-friendly tool for converting multiple aligned FASTA files to STRUCTURE format'.

Step-by-step demonstration:

  1. Go to the Spyder GitHub repository site and under 'Try Spyder online', click on the launch binder badge on top, or click here, to initiate launching a session.

  2. After the session spins up and shows a Linux desktop in your browser window, click on the 'Applications' tab in the upper left of the session desktop. The second entry should be 'Terminal Emulator'. You want to click on 'Terminal Emulator' to start a terminal on the desktop.

  3. To install the dependency of biopython, enter the text pip install biopython in the terminal and hit enter to run it.

  4. To get the Fasta2Structure materials, enter into the terminal git clone https://github.com/AdamBessa/Fasta2Structure.git. (Because you are workin a virtual computer behind your browser screen, you cannot copy and paste from your local machine to the virtual computer and so you gave to type.)

  5. Once the materials are cloned, you need to navigate to the location of the script in the retrieved materials. Enter in the terminal cd Fasta2Structure/ and hit enter.

  6. Now you are ready to run Fasta2Structure. Enter in the terminal python Fasta2Structure.py and hit enter.

  7. Next a window will pop up with 'Fasta to Structure' along the top.

  8. Try to follow the demo outlined after 'Usage' in the README for Fasta2Structure. Click on 'Select FASTA files' and then holding down shift, Use the file selector to select all three, ITS.fas, trnD-trnT.fas, and trnH-trnK.fas, at the same time, similar to illustrated below in this image found in the README here.

  1. Then with the three files chose, click on the 'Open' button to trigger the conversions to start.

  2. Open a new terminal and cd into Fasta2Structure again and type cat Structure.str to see the output. That's it! Feel free to add your own data and try it now. (To make it easy to upload copy the URL of the window that you are working in. It will be something like https://hub.ovh2.mybinder.org/user/spyder-ide-binder-environments-hlrcuvf7/desktop/. Paste that into another browser window, and change the /desktop/ at the end of the URL to /lab/ and hit enter to go to that page. You can drag-and-drop files from your local system into the file navigation pane on the left side to upload them to the remote session.) You'll want to first rename Structure.str to match the input before trying another example.

  3. Optional additional demonstrating use: next try to follow the simpler demo outlined at README for Fasta2Structure. Make a text file with the following content, using Spyder as your text editor (launchable from the virtual computer's desktop) and save it as test.fas in the Fasta2Structre directory (see more about that below):

>seq1
ATGCCGA
>seq2
AT-CCA

Originally, that was made short to make it easy to type because pasting into the session had to be done in the session. Now you can actually use the Clipboard Tool in the upper right to pass text into the running virutal machine. (Alternatively, you can get the text from this source in a browser window in the virtual computer. Getting a browser can be found on the desktop. Then go to google.com and search for gist and come here. Then right-click to copy and then righ-click to paste.)

Save test.fas in home/jovyan/Fasta2Structure. You can get to jovyan in Spyder's Save As window by clicking on the 'Computer' icon and drilling down.

  1. Back in the window with the 'Fasta to Structure' application running, click on the test.fas you just saved.

  2. Open a new terminal and cd into Fasta2Structure again and type cat Structure.str to see the output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment