Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

There will be 4 types of code blocks used throughout this class. Text inside of code blocks represent "right" answersat least 1 possible correct answer, and should either be typed EXACTLY into the terminal window as they are, or copy pasted with . There is a notable exception . Text that exist within text between <> symbols represent something that you need to replace before sending it to the terminal. Yes, the <> marks themselves also need to be replaced. We try to put informative text within the brackets so you know what to replace it with. If you are ever unsure of what to replace the <> text with, just ask.

  1. Visible
    1. These are code blocks that you would have no idea what to type without help. (like when a new command is being introduced)
    2. These will typically be associated with longer/more detailed text above the text box explaining things.
    3. An example code block showing you the command you need to type into the prompt to list what directory you are currently in:

      Code Block
      languagebash
      pwd
  2. Hinted
    1. These are code blocks that you can probably figure out what to type with a hint that goes beyond what the tutorial is requesting. Access the hint by clicking the triangle or hint hyperlink text.
    2. These exist to force you to think about what command you need, and hopefully make some connections to help you remember what you will need to type in the future.
    3. These should all come with additional explanation as to what is going on.
    4. Rather than just expanding these by reflex, I strongly suggest seeing if you can figure out what the command will be, and checking your work
    5. Example:

      Expand
      titlewhat command would you use to Print your current Working Directory

      In this example the letters P W and D are all capitalized to try to help you focus on the command itself

      Code Block
      languagebash
      pwd 
  3. Hidden:
    1. These code blocks represent things that you should have seen several times already, or things that can be succinctly explained.
    2. Example:

      Code Block
      languagebash
      titleuse the pwd command to print your current working directory
      collapsetrue
      pwd
  4. Speed bump:

    1. This combines the previous 2 types to deliberately slow you down and be cumbersome. 
    2. If you find yourself consistently wrong about what eventually shows up in the text box, slow down, step back, think about whats going on, and consider asking a question.
    3. These should only come after you have seen the same (or very similar) commands in the other formats previously
    4. Example:

      Expand
      titleprint your current working directory

      Remember, the command you need is "pwd".

      Code Block
      languagebash
      titleThis command needs no options
      collapsetrue
      pwd

...

Info
titleUnderstanding why some files start with a "."

In the above code box, you see that the names start with a . when a filename starts with a . it conveys a special meaning to the operating system/command line. Specifically, it prevents that file from being displayed when you use the ls command unless you specifically as for hidden files to be displayed using the -a option. Such files are termed "dot-files" if you are interested in researching them further.

Let's look at a few different ways we will use the ls command throughout the course. Compare the output of the following 4 commands:

Code Block
languagebash
titleStandard output
ls              #ignore everything that comes after the # mark. There is a problem on this wiki page but things after a # wont effect commands
Code Block
languagebash
titleStandard output plus hidden files
ls -a
Code Block
languagebash
titleStandard output plus hidden files in a single column
ls -a -1
Code Block
languagebash
titleStandard output plus hidden files in a single column with additional information
ls -a -l

Throughout the course you will notice that many options are supplied to commands via a single dash immediately followed by a single letter. Usually when you have multiple commands supplied in this manner you can combine all the letters after a single dash to make things easier/faster to type. Experiment a little to prove to yourself that the following 2 commands give the same output.

Code Block
languagebash
titleStandard output plus hidden files in a single column
ls -a -1

ls -al

While knowing that you can combine options in this way helps you analyze data faster/better, the real value comes from being able to decipher commands you come across on help forums, or in publications.

For ls specifically the following association table is worth making note of, but if you want the 'official' names consider using the man command to bring up the ls manual.

flagassociation
-a"all" files
-l"long" listing of file information
-11 column

...

Code Block
languagebash
titleHow to leave Lonestar by logout or exit from a remote connection
collapsetrue
exitlogout
# or
logoutexit

then log back in:

Code Block
languagebash
titleGo log back in to Lonestar
collapsetrue
ssh <username>@ls5.tacc.utexas.edu

If everything is working correctly you should now see a this as your prompt like this:  

No Format
tacc:~$
Warning

If you see anything besides "tacc:~$", get my attention and be ready to share your screen rather than continuing forward.

...

Expand
titleWhile interesting and useful information to have, understanding it is not critical to variant analysis. I suggest you to look through this information after you complete the rest of the tutorial, in your free time, or when you need to modify your profile or bashrc files in the future.
Info

Let's look at what your .bashrc profile actually does. Use the cat command to print contents of the .bashrc file to the screen.

Code Block
collapse
languagebash
titlePrint the contents of the .profile file to the screentrue
cat .bashrc

This will print several lines of text to the terminal window. Let's look at what some of these lines do with a little more information:

  • lines that start with #

    • Any line begins with a # symbol, it is "commented out". Anything after a # symbol will not be executed by any program. Programers commonly make use of behavior to leave notes for others, or even themselves at a later date as to what particular lines of a script are actually doing.
  • Section 1 has multiple lines involving "module load <NAME>"

    • This loads different modules by default. We have included ones that we will use throughout the course and that you will commonly make use of. After we review the use of the nano text editor we'll go into more depth with TACC modules. But for now trust us when we say that not having to load a bunch of modules every time you log into TACC is a good thing.

  • Section 2 has multiple lines starting with "export"

    • The export lines define shell variables for example BI and PATH. You've already seen how using $BI can come in handy accessing our shared course directory. As for PATH, that is a well-known environment variable that defines a set of directories where the shell will look when you type in a program's name. Our shared profile adds the common course directories that we copied at the start of this tutorial and your local ~/local/bin directory (which does not exist yet) to the location list. You can see the entire list of locations by doing this:

      Code Block
      languagebash
      titleHow to see where the bash shell looks for programs
      echo $PATH

      As you can see, there are a lot of locations on the path. That's because when you load modules at TACC (see above), that mechanism makes the programs available to you by putting their installation directories on your $PATH.

  • umask 002

    • The umask command is used to set the default permissions of newly created files and directories limiting the need to use the chmod command. umask functions as the inverse of chmod meaning that it subtracts the values from the default permissions. In this case the command umask 002 is the equivalent of the command chmod 775 for directories, and chmod 664 for files. in summary, having this command in your .profile gives all new files you create read and write access to both you and your group while giving read only access to everyone else.
  • PS1='tacc:\w$ '

    • The PS1='tacc:\w$ ' line is a special setting that tells the shell to display the current directory as part of its prompt. It saves you typing pwd all the time to see where you are in the directory hierarchy. Try using the mkdir command to make a new directory called tmp and change into that directory to see what it does to your prompt.

      Code Block
      languagebash
      titleSee how your prompt reflects your current directory
      collapsetrue
      mkdir tmp
      cd tmp
    • Your prompt should have changed from: "tacc:~$"to now be "tacc:~/tmp$". Your prompt now tells you you are in the tmp subdirectory of your home directory (~). See if you can figure out how to return to your home directory without expanding the code block. Expand the following code block to see the different ways of returning to your home directory.

      Code Block
      languagebash
      titleHow to return to your home directory
      collapsetrue
      cd
      cdh
      cd $HOME
      cd ~
      cd -

      The last example in the above code block will return you to your previous directory. In this case, that means the home directory, but it can be very useful in other situations when you change directories to do something in 1 place then need to hop back to where you were, or if you mistakenly leave a directory.

...

  • Linux text editors installed at TACC (nanoviemacs). These run in your terminal window. vi and emacs are extremely powerful but also quite complex, so nano may be  is the best choice as a first local text editor. If you are already familiar with one of the other programs you are welcome to continue using it.
  • Text editors or IDEs that run on your local computer but have an SFTP (secure FTP) interface that lets you connect to a remote computer (Notepad++ or Komodo Edit). Once you connect to the remote host, you can navigate its directory structure and edit files. When you open a file, its contents are brought over the network into the text editor's edit window, then saved back when you save the file.
  • Software that will allow you to mount your home directory on TACC as if it were a normal disk e.g. MacFuse/MacFusion for Mac, or ExpanDrive for Windows or Mac ($$, but free trial). Then, you can use any text editor to open files and copy them to your computer with the usual drag-drop.

...

Expand
MacFuse/MacFusion/TextWrangler for Mac
MacFuse/MacFusion/TextWrangler for Mac

Want your Lonestar Lonestar5 files to appear like any other place on your hard drive? You can do this using MacFuse/MacFusion on a Mac.

Want to edit files on TACC without having to use nano? You might want to use TextWrangler, a text editor that can edit files over ssh.

Editing Text Files on TACC: TextWrangler

TextWrangler is a recommended FreeWare text editor for MacOS X. (It even keeps with the theme TACC has going with naming its clusters!) You can use it to directly edit text files on Lonestar with OSXFuse/MacFusion using a nice GUI. It is a much more powerful text editor than TextEdit, and won't trip you up by wrapping lines etc., if you learn to use it.

Even if you cannot install OSXFuse/MacFusion, TextWrangler allows you to edit a remote file via SSH. To do this:

  1. Select *File > Open from FTP/SFTP Server...
  2. Type ls5.tacc.utexas.edu, your username, and your password into the appropriate boxes.
  3. Check the You need to check the SFTP box.
  4. Click connect.
  5. You will now have a file browser window. You can create new files and edit existing files on lonsetar, but won't be able to drag-and-drop copy files.

Tip: Files beginning in a dot (.) like (.profile_userbashrc) are "hidden" and won't show up when you are navigating in Finder (if using OSXFuse/MacFusion). There is a way to turn on showing these files in finder, but it can get annoying because they will show up everywhere. If you use the TextWrangler "open" command to open a file, there is a box that you can check to show these files.

Connecting to TACC Like a Hard Drive: MacFuse/MacFusion

Here are the steps for an installation:

  1. Download and install FUSE for OS X.
    • Check the option to install the "compatibility layer"
  2. Download MacFusion.
    • Move the app that gets downloaded to your Applications folder
  3. Restart your computer.
  4. Open the MacFusion application.
  5. Click the + menu in the window and select SSHFS. Enter your login information for lonestar. Choose connect. The remote file system will appear in Finder (depending on your settings it may be on the desktop or inside the computer shortcut in the side of a Finder window). You can also click on the mounted volume within MacFusion and choose "Reveal" from the gear menu.

Copying Files To and From TACC: SFTP Clients

If you can't get OSXFuse/MacFusion to work, you can still copy files back and forth between your computer and TACC using a secure FTP (SFTP) client. Some examples of free programs for Mac are:

...

  1. The most important thing to get used to is the convention of using . or _ in  _  or capitalizing the first letter in each word in names rather than spaces in names, and limiting your use of any other punctuation. Spaces are great for mac and windows folder names when you are using visual interfaces, but on the command line, a space is a signal to start doing something different. Imagine instead of a BioITeam folder you wanted to make it a little easier to read and wanted to call it "Bio I Team" certainly everyone would agree its easier to read that way, but because of the spaces, bash will think you want to create 3 folders, 1 named Bio another named I and a third named Team. Now this is certainly behavior you can use when appropriate to your advantage, but generally speaking spaces will not be your friend. Early on in my computational learning I was told "A computer will always do exactly what you told it to do. The trick is telling it to do what you want it to do". 
  2. Name things something that makes it obvious to you what the contents are not just today but next week, next month, and next year even if you don't touch the it for weeks-months-years.

...

When you execute the ls -1 > whatisHere command, you should have noticed nothing happening happened on the screen, and when you cat the whatisHere file, you should notice the output you would have expected from the ls -1 > whatisHere command. Often it is useful to chain commands together using the output of the first command as the input of the second command. Commands are chained together using the "|" character (shift \ above the return key). Use redirection to put the first 2 lines of the $BI directory contents into the whatisHere file.

...

Expand
titleDo you think 'whatisHere' is a good name for a file considering what the information above about naming files/folders names that will make sense later?

Obviously not, "Here" is ambiguous, and "whatis" doesn't immediately tell you that its actually a list of directory contents.

Code Block
languagebash
titleExample move (mv) commands to rename the file something better
mv whatisHere BioIteam_contents
mv whatisHere BioIteam_directory_contents
mv whatisHere BioIteam_directory_contents_2020-06

This is what i I would consider a good better best improvement. Yes the last one is particularly long, but almost guaranteed that you will know what exactly what that file is no matter when the next time you see it is.


  • Understanding TACC

Now that we've been using lonestar for a little bit, and have it behaving in a way that is a little more useful to us, let's get more of a functional understanding of what exactly it is and how it works.

...

  1. Job: Not required by the script, but likely always will be. This file has a list of commands that you want to run, and is probably biggest part of what makes tacc great... letting you run a large number of commands all at once rather than having to run them 1 at a time on your own computer.
  2. Time and name: They are required so obviously important for that reason. Also names are important as mentioned above naming everything 'tacc_job' will make your life much more confusing at some point.
  3. Wayness: 12 is the default, 48 is the max on lonestar. 
    1. This is a balance of memory and to a lesser extent speed against how long you want to wait for your job to run and SU cost. 
    2. Imagine you have 96 commands you want to run. 12, 24, and 48 as the "w" option will require 8, 4, and 2 remote computers to run at the same time, 2 computers are typically available sooner than a set of 4 and 4 are available sooner than a set of 8. So your job is likely to spend less time 'in the queue' with larger numbers.
    3. We'll go over "SUs" near the end of the course, but for now it is sufficient to say they are a currency for tacc, and that smaller numbers will cost more SUs
    4. For bacterial work, 48 is a much better choice in nearly all situations, unless you are experiencing problems or know you have a massive amount of data.
    5. The downside is if you pick a number that is too small, your commands may have errors and not actually produce results requiring you to start over with longer requests, or smaller "w" values
  4. queue: Development and normal are the 2 you are likely to deal with most often. normal "Normal" is a better choice unless you are developing new code or have odd turn around time requirements.

Running a job

Tip
titleIf a comment has been made over zoom that we'll be starting the second presentation soon

Consider skipping the rest of the tutorials on this page, and jump over to this tutorial on transferring files between tacc and your local computer. You will have plenty of time to come back to this tutorial on Wednesday/Thursday/Friday when we enter the choose your own adventure portion of the coursebegin working with the specialized tutorials, as well as running jobs on tacc being covered in its own tutorial on the last half of Friday's course.

The file transfer tutorial can be found here.

...

Code Block
languagebash
titlehow to make a sample commands file
linenumberstrue
# remember that things after the # sign are ignored by bash 
# lines in code blocks like this often will scroll to the right if you have a narrow browser window
cds  # move to your scratch directory
mkdir my_first_job  # make a new folder called "my_first_job"
cd my_first_job  # move into the new folder to make it easier to create a file there
nano commands  

...

Tip
titleUsing the version numbers for module commands

While not strictly necessary, using the "/2.3.4" text is a very good habit to get into as it controls what version is to be loaded. In this case the "2.3.4" version is the only (and thus default version) and module load bowtie will behave identically to module load bowtie/2.3.4 but that will not always be the case, particularly if in the future TACC installs a new version of bowtie.

While it is tempting to only use "module load name" without the version numbers, using the version numbers can help keep track of what versions were used for referencing in your future publications, and make it easier to identify what went wrong when scripts that have been working for months or years suddenly stop working (ie TACC changed the default version of a program you are using).

...

You will notice when you type module list you have several different modules installed already. These come from both TACC defaults (TACC, linux, etc), and several that are used so commonly both in this class and by biologists that it becomes cumbersome to type "module load python2python3" all the time and therefore we just have them turned on by default by putting them in our profile to load on startup.  As you advance in your own data analysis you may start to find yourself constantly loading modules as well. When you become tiered of doing this (or see jobs fail to run because the modules that load on the compute nodes are based on your .bashrc file plus commands given to each node), you may want to add additional modules to your .bashrc file. This can be done using the "nano .bashrc" command from your home directory.

...

This is about using the pip3 install command. pip is the standard package manager for the common programing language python. When labs put together new analysis programs/packages, increasingly they try to make these programs available for others to use via pip. pip3 rather than just pip references the current specific version of python.

Here we will install the multiqc analysis program which compiles reports from a program called fastqc about the quality of fastq files from multiple different samples at one time. In the later portion of the class you may choose to work with this program to get a better overall view of multiple fastq files all at once rather than clicking through individual reports.

...