title | author | date |
---|---|---|
Basic Unix Commands |
Quynh Nhu Nguyen |
May 2nd 2023 |
$ grep ">" apple.genome | wc -l
# Or
$ grep -c ">" apple.genome
# Gene names is listed in 1st column, Transcript variants is listed in 2nd column
$ cut -f1 apple.genes | uniq | wc -l
$ cut -f2 apple.genes | more | wc -l #Eevery variant was independently, because indeed the file contains only one line for each variant of a gene.
# Or
$ cut -f1 apple-genes | sort -u | wc -l
$ cut -f2 apple-genes | sort -u | wc -l
$ cut -f1 apple.genes | uniq -c | grep -c " 1 "
$ cut -f1 apple.genes | uniq -c | grep -v " 1 " | wc -l
$ cut -f1,4 apple.genes | sort | uniq -c | grep "+" | wc -l
# Or
$ cut -f1,4 apple.genes | grep "+" | uniq | wc -l
## How many genes are there on the ‘-’ strand?
```bash
$ cut -f1,4 apple.genes | sort | uniq -c | grep "-" | wc -l
# Or
$ cut -f1,4 apple.genes | grep "-" | uniq | wc -l
cut -f1,3 apple.genes | sort -u | cut -f2 | sort | uniq -c
# Or
$ cut -f1,3 apple.genes | grep "chr1" | sort -u | wc -l
$ cut -f1,3 apple.genes | grep "chr2" | sort -u | wc -l
$ cut -f1,3 apple.genes | grep "chr3" | sort -u | wc -l
cut -f2,3 apple.genes | sort -u | cut -f2 | sort | uniq -c
# Or
$ cut -f2,3 apple.genes | grep -c "chr1"
$ cut -f2,3 apple.genes | grep -c "chr2"
$ cut -f2,3 apple.genes | grep -c "chr3"
$ grep Smell */*.genes # give us all the lines that contain somewhere within the line, the word smell.
$ cut -f1 apple/apple.genes | sort -u > applegenes
$ cut -f1 pear/pear.genes | sort -u > peargenes
$ comm -1 -2 applegenes peargenes | wc -l
# Or
$ cat applegenes peargenes | sort | uniq -c | grep -v " 1 " | wc -l
# Genes are specific to the apple species
$ comm -2 -3 applegenes peargenes
# Genes are specific to the pear species
$ comm -1 -3 applegenes peargenes
cut -f1 apple.conditionC | sort -u > sortC
comm -1 -2 apple.conditionA apple.conditionB > sortAB
comm -1 -2 sortAB sortC | wc -l