File organization - aechchiki/SIB_LongReadsWorkshop_Zurich17 GitHub Wiki
We like colours. We have prepared a small script that will just colour your prompt, to run it, just execute
source workshop_shared_ro/.profile
Organization is important to avoid getting lost in your data.
For our tutorial, we suggest you to use a nested organization per sequencing technology, for example like follows:
~/minion/dna
/rna
/pacbio/dna
/rna
/reference/dna
/rna
/scripts
If you need to refresh your Unix knowledge you can take a look on Unix: useful tips.
The ideal use of this nested organization would be to navigate to the corresponding sub-folder when you are dealing with that particular kind of data. For example, if you are working on genome assembly from PacBio reads, you will change directory to the corresponding sub-folder before executing any commands about this topic:
cd ~/pacbio/dna
<do_stuff>
cd ~
We suggest you to keep a close track on what exactly you are doing. Thus, we recommend you to save all the executed commands into text files or scripts. The command line language we will use in this tutorial is bash.
To create your source script on server, simply use your favorite text editor - as suggestion, use vim:
cd ~/scripts
vim <script_name>.sh
Some notes about vim.
Vim comes in two modes: command and insert mode. You can distinguish these modes by the footer at the very bottom of your file - it will display -- INSERT --
if you are in insert mode. All you need to keep in mind for this tutorial is the following:
- you should use insert mode to modify your file content, and command mode to save the file and exit the editor
- to enter the insert mode, press
i
: this allows you to insert text at the cursor position - to delete text when in insert mode, just press
return
key (as you would normally do on a GUI editor) - to exit the insert mode, press
esc
key - you are now in command mode - to save the file in command mode, type:
:w
- to save the file and quit the editor in command mode, type:
:wq!
Be sure that your script has extension .sh
(for shell script). Be sure that your script includes a shebang, to specify the interpreter we want to use for the script content. As we said before, we are using the Bash shell for interpretation, so your script should look like this:
#!/usr/bin/env bash
<commands>
Save the script in your $scripts
directory, then make it executable:
chmod +x <script_name>.sh
Et voilà! You prepared a script that can be executed
cd ~/pacbio/dna
~/scripts/<script_name>.sh
cd ~
Test your knowledge in the Checkpoint.
Go back to Table of content.