Skip to content
Switch branches/tags
Go to file
Cannot retrieve contributors at this time

Tips for Organized Coding

  1. Naming directories

mkdir pfb2019_SEW

  • Keep directory names informative.
  • No spaces or special characters.
  • No extensions (e.g., .txt, .fasta)
  1. Naming files

vi rawSeqData.fasta

•Keep file names informative. •No spaces or special characters. •Use appropriate extensions.

  1. Naming scripts


•Keep file names informative. •No spaces or special characters. •Use appropriate extensions.

###Examples for PFB 2019

sew$ mkdir ProblemSet1 sew$ vi sew$ vi

  1. Creating daily "readMe" files

mkdir dailyReadMe

•Take notes daily for ongoing projects for yourself to keep track. •One way to do this is keep a daily journal of your progress. Use it for successes, failures, random notes, specific end points.

vi vi

  1. Comment your code.

Sharing code is becoming more common and sometimes expected by journals. In order to maximize reproducibility, code that is shared publicly should be commented and accessible.

#!/usr/bin/env python3
import sys

myString = 'sapiens, erectus, neanderthalensis'


myList = myString.split(', ') #splitting string on the comma and the space
print(sorted(myList)) #sorting my list; default is alphabetical
print(sorted(myList, key = len)) #sorting my list by length; must tell sorted to use length

##Changing your bash prompt

Create a beautiful prompt.

  1. Go to and create a beautiful prompt.
  2. Type: cd ~
  3. Type: vi .bash_profile
  4. Paste code from into your .bash_profile at the bottom.
  5. Type: source .bash_profile

Create a beautiful VI experience.

  1. Type vi .vimrc
  2. Into your .vimrc file, type:
syntax enable #enables programming syntax and color change
set tabstop=2 #makes your tabs the size of 2 spaces
set number #adds numbers on the left side of your vi window
  1. Save the file by typing :wq.
  2. At the command line, type source .vimrc
  3. Open vi again and the changes should be saved.