whogives a list of who is logged in
wgive a list of who is logged in - and what they are doing
dfor
df -hto see disk space use
man dfor just web search....
sh,
csh,
tcsh,
bash
exitor
ctrl-d
Shells ensure convenient and almost universal remote access to unix machine
lslist files in the current directory. Nb note also "." and ".."
ls -lto see files in current directory - how is it different?
ls -lartto see files in current directory - how is it different?
ls /usr/binlist files in another directory
ls /usr/bin/x*or files matching a wildcard
pwdto see current directory location
pwd; lsmultiple commands on the same line
cd /usr/bin
pwd
cd
pwd
cd -
pwd
cd
mkdir -p seq/data/results; ls -l seqcreate a directory hierarchy
-pswitch do?
mv seq/data seq/olddata; ls -l seqrenaming a directory (or file)
rm -r seq; ls -l seqremoving an entire directory hierarchy (be careful!)
cp file1 file2; ls -l seqcopying a file
cp -r seq/data seq/data2; ls -l seqcopying a directory recursively
cphas many important and useful switches!
df -Thcan help you find where the disk has been "mounted"
-Thhelp?
touch myfilecreate a new empty file
ls -l myfiledisplay myfile permissions
-rw-r--r-- 1 avc team117 17729 Mar 12 13:59 myfile
chmod u-w myfileremove User write permission
chmod g+x myfileadd Group execute permission
chmod go-r myfileremove Group and Other read permission
touch myfileto create and empty file
historyshows you your shell command history
! #cmdre-executes that command
Ctrl-aand
Ctrl-emove to start and end of lines
cdtakes you home
.is your current directory and
..is your parent directory
wget 'ftp://ftp.sanger.ac.uk/pub/teams/117/WTAC/data/adapters.fasta'another fasta file with adapter sequence
cat adapters.fastadisplays the entire file to the terminal
less adapters.fastasimple viewer for the terminal
/[string]and PageUp/PageDown keys to search within the display
qto quit from
less
wc phix-illumina.fato get the number of lines, words, and characters
wget ftp://ftp.sanger.ac.uk/pub/teams/117/WTAC/data/phix-illumina.falet's download a fasta sequence file for phiX (from the command line or just use your browser)
head phix-illumina.fato inspect the top of the file
tail phix-illumina.fato inspect the tail of a file
head -n 5 phix-illumina.fato inspect the first 5 lines
tail -n 5 phix-illumina.fato inspect the last 5 lines
grep -c -E '^>' adapters.fastacount the number of sequence records
grep -A 2 RNA adapters.fastashow (first line of) RNA related records
touch foo{1,3,5}{A,B} okayshell creates files named using all possible expanded strings
wget ftp://ftp.sanger.ac.uk/pub/teams/117/WTAC/data/s6823_1_{1,2,t}_phix.fastqdownload 3 fastq sequence files with phiX reads
head -n 6 s6823_1_{1,2,t}_phix.fastqto inspect the first few lines of each file
wc s6823_1_*_phix.fastqto get the number of lines, words, and characters
md5sum s6823_1_1_phix.fastqshow the md5sum of a file
md5sum s6823_1_1_phix.fastq > s6823_1_1_phix.fastq.md5save the output of md5sum in a file
cat s6823_1_1_phix.fastq.md5
history > cmd.historysave my shell command history
>>to append to a file rather than overwrite it
env
env | sort
env | grep SHELL
cat adapters.fasta | wcoutput of a process can also be redirected to another process
cat adapters.fasta | grep -E '^>' | sort -u | wc -1eh?
for f in *.fastq; do md5sum $f > $f.md5; doneloop through all the fastq files creating corresponding md5 files
gzip adapters.fastacompresses file with gzip and adds a .gz suffix
gzip -d adapters.fasta.gzdecompresses a .gz file
tar cf - s6823_1_{1,2,t}_phix.fastq > archive.tarcreate an archive of the fastq files (reduced IO)
gzip archive.tarcompresses archive with gzip and adds a .gz suffix
tar cf - s6823_1_{1,2,t}_phix.fastq | gzip -9 > s6823_1_phix.tgzuses a pipe and a redirect to create a compressed archive of the fastq files (reduced IO)
gunzip -c s6823_1_phix.tgz | tar tf -lists the contents of the archive
tar xvfz s6823_1_phix.tgzextracts the contents of the archive
xeyesthen ctrl-C to terminate it
xeyesthen
bgto allow it to continue running in the background
xeyes &to start a process running in the background
jobsto see background processes, jobs, of this shell
psshows processes of this session
kill %1to terminate the first xeyes
kill2nd xeyes PID for the second
topfor a full terminal updating display of processes running on the system
wget ftp://ftp.sanger.ac.uk/pub/teams/117/WTAC/data/s6823_1_phix.sam
head s6823_1_phix.samheader records start with @, tab delimited fields identified by two character tags followed by a :
grep -v -E '^@' s6823_1_phix.sam | headseparate sequence/alignment data records for paired reads (subreads), tab delimited fields (11 mandatory folowed by optional tag identified fields)
grep -v -E '^@' s6823_1_phix.sam | headHS1_6823:1:2208:16638:14313#168 81 phix-illumina.fa 1 37 75M = 5080 5004 GAGTTTTATCGCTTCCATGACGCAGAAGTTAACACTTTCGGATATTTCTGATGAGTCGAAAAATTATCTTGATAA G;BGIKJMGHEKJ>AOMJHJOLLHIKIQLLFHLHM?LLNJKFKOLKJMJLKHLIKNKLMIJLKJILMJ>GJGHBD X0:i:1 X1:i:0 MD:Z:75 RG:Z:1 XG:i:0 AM:i:37 NM:i:0 SM:i:37 XM:i:0 XO:i:0 QT:Z:+1144=AD RT:Z:ACAACGCA XT:A:U
GAGTTTTATCGCTTCCATGACGCAGAAGTTAACAC.....
G;BGIKJMGHEKJ>AOMJHJOLLHIKIQLLFHLHM.....
wget https://github.com/samtools/samtools/releases/download/1.4/samtools-1.4.tar.bz2 \ && tar xjf samtools-1.4.tar.bz2
cd samtools-1.4; ls; make -j 2
ls; cd ..
samtools-1.4/samtools
samtools-1.4/samtools help view
man samtools-1.4/samtools.1
samtools-1.4/samtools view -O bam s6823_1_phix.sam > s6823_1_phix.bamconvert SAM to BAM
file s6823_1_phix.bam s6823_1_phix.samnot normally interesting to look directly in binary files....
ls -lh s6823_1*compare the sizes of the files....
samtools-1.4/samtools flagstat s6823_1_phix.bamfor some useful stats (dependant on how it's been created)
samtools-1.4/samtools index s6823_1_phix.bamcreating an index allows fast reference location access
samtools-1.4/samtools tview s6823_1_phix.bam phix-illumina.fareference based text viewer -- boring for phiX
samtools-1.4/samtools view -O cram -T phix-illumina.fa s6823_1_phix.sam > s6823_1_phix.cramconvert SAM to CRAM
ls -lh s6823_1*compare the sizes of the files....
samtools-1.4/samtools view -h s6823_1_phix.cram | lessto convert to SAM and pipe to a "pager" (q to quit)
InterOp
Data/Intensities
Data/Intensities/BaseCalls
history
samtools-1.4/samtools faidx phix-illumina.facreate an index for reference fasta file
cat phix-illumina.fa.faiit's quite boring for this reference
samtools-1.4/samtools mpileup -f phix-illumina.fa s6823_1_phix.bam | less -S
wget https://github.com/samtools/bcftools/releases/download/1.4/bcftools-1.4.tar.bz2
tar xjf bcftools-1.4.tar.bz2
cd bcftools-1.4; make; cd ..
samtools-1.4/samtools mpileup -t DP,SP -I -uf phix-illumina.fa -Q 25 s6823_1_phix.bam \ | bcftools-1.4/bcftools call -vc -
samtools-1.4/samtools view -u \ ftp://ngs.sanger.ac.uk/production/WTAC/data/12585_1#21.bam \ | samtools-1.4/samtools stats - | tee 12585_1#21.bam.bamstatspull your data from ftp site, push it uncompressed through bamcheck, and both write bamcheck's output to the terminal and to a file
samtools-1.4/misc/plot-bamstats -p 12585_1#21/ 12585_1#21.bam.bamstatscreate some plots using the bamcheck data
wget ftp://ftp.sanger.ac.uk/pub/teams/117/WTAC/data/12585_1%2321.tar.gz
tar xvf 12585_1#21.tar.gz
file:///tmp/12585_1%2321/index.html
wget http://www.bioinformatics.babraham.ac.uk/projects/fastqc/fastqc_v0.11.5.zip
unzip fastqc_v0.11.5.zip
chmod 755 FastQC/fastqc
FastQC/fastqc
wget http://data.broadinstitute.org/igv/projects/downloads/IGV_2.3.92.zip
unzip IGV_2.3.92.zip
IGV_2.3.92/igv.sh
wget https://github.com/broadinstitute/picard/releases/download/2.9.0/picard.jar
java -jar picard.jar SamToFastq -h
wget https://github.com/gt1/biobambam2/releases/download/2.0.72-release-20170316102450/biobambam2-2.0.72-release-20170316102450-x86_64-etch-linux-gnu.tar.gz
tar xvf biobambam2-2.0.72-release-20170316102450-x86_64-etch-linux-gnu.tar.gz
ln -s biobambam2-2.0.72-release-20170316102450-x86_64-etch-linux-gnu/bin biobambam
./bammarkduplicates -h