Unix Tutorial Practice commands

July 31, 2013

 

# Warm up: To see where you are.

pwd

# To see files in current folder

ls                                 

# To see files in details

ls -l                 

# To see invisible files which start with a ¡°.¡±

ls -la               

# ¡±.¡± Is current folder, ¡°..¡± is folder that is 1 level up

# Change directory:  Go to a folder of given path

cd  /media/LB/sbuddenb                   

# Go to home folder

cd                   

-------------------------------------------------------------------------------------------------------------------

# Download E. coli genome from an ftp website.

wget ftp://ftp.ncbi.nih.gov/genomes/Bacteria/Escherichia_coli_K_12_substr__DH10B_uid58979/NC_010473.fna

# See the file content. Use "q" to quit, use pageup pagedown to flip pages.

less NC_010473.fna

# Check the file lines, words, and size

wc NC_010473.fna

-------------------------------------------------------------------------------------------------------------------

# Check the current working directory.

pwd

# Check what's in the folder testdata

ls ../testdata

# Detailed list

ll ../testdata

# Copy the gff3 file to current folder. The dot '.' indicates current folder.

cp ../testdata/example.gff3 .

# Check file content

less example.gff3

# Check annotations

grep -v '#' example.gff3 | less

# Check the second column

grep -v '#' example.gff3 | cut -f2 | less

# Sort the second column

grep -v '#' example.gff3 | cut -f2 | sort | less

# Sort and pick only the unique content of the second column

grep -v '#' example.gff3 | cut -f2 | sort | uniq | less

# Replace "sequence-region" with "Chromosome" for all lines of example.gff3 file

sed 's/sequence-region/Chromosome/' example.gff3 > new_example.gff3

less new_example.gff3

-------------------------------------------------------------------------------------------------------------------

## Short reads assembly.

# make a new directory with name "assembly".

mkdir assembly

# get into the folder

cd assembly

# Copy paired end reads file to current folder.

cp /media/LB/testdata/reads*.fastq .

# Check files in current directory

ls

# Check reads file

less reads1.fastq

# Run the program Abyss to assembly paired end reads.

abyss-pe name=ecoli k=25 in='reads1.fastq reads2.fastq'

# Check the assemblied scaffolds

less ecoli-scaffolds.fa