Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Exercise

Introduction to basic linux commands

#!/bin/bash

##mk subdirectories for projects ##Quiz 1

mkdir exercise that will be used in the exercise

mkdir exercise
cd  exercise

Quiz 2 create subdirectories to store various input and analysis output

mkdir dataset  result  analysis

cd into result directory to create a file needed for analysis process

cd result
touch "nucleotide_C_count.txt" "nucleotide_T_count.txt" "nucleotide_G_count.txt" "nucleotide_A_count.txt" "nucleotidecount.txt" "sequence_names.txt" "non_transcripts_count.txt" "non_mrna.txt" "predicted.txt" "predicted_count.txt" "mrna_transcripts.txt" "organism.txt" "mrna_transcript_count.txt"

Download your .fa sequence files and move them to dataset directory

cd ../dataset

##Quiz 4

Go to the directory containing downloaded fasta files

Extract the headers from both files using grep.You can use absolute or relative path

to directory with .fa files /with your sequence.

grep ">" *.fa | cat > /home/odongo/Desktop/exercise/result/sequence_names.txt

Question 6

Extract sequence that are mRNA and discard non- mRNA sequences

grep ">" *.fa | grep "mRNA" | uniq | cat >/home/odongo/Desktop/exercise/result/mrna_transcripts.txt

##count mrna transcripts

grep ">" *.fa | grep "mRNA" |cut -d "," -f1 |cut -d ":" -f3| cut  -d "" -f12 |sort| uniq | wc -l| cat >  /home/odongo/Desktop/exercise/result/mrna_transcript_count.txt

obtain non _mrna transcripts

grep ">" *.fa | grep -v "mRNA" | cat > /home/odongo/Desktop/exercise/result/non_mrna.txt 

Question 8 : How many are predicted

###Extract predicted sequences and count them .Store count in predicted_count.txt and sequences in predicted.txt in your result directory

grep "PREDICTED" *.fa | cat >  /home/odongo/Desktop/exercise/result/predicted.txt

count predicted sequences

 grep "PREDICTED" *.fa | wc -l|  cat >  /home/odongo/Desktop/exercise/result/predicted_count.txt

Question 6 Count the number of mRNA

Extract non mrna trasncripts and store thme in in non_transcript folder located in result folder

### count non mrna transcripts and store in  non_transcripts_count.txt and mrna
 grep ">" *.fa | grep -v "mRNA"| cat >  /home/odongo/Desktop/exercise/result/non_transcripts.txt
 grep ">" *.fa | grep -v "mRNA"| wc -l| cat >   /home/odongo/Desktop/exercise/result/non_transcripts_count.txt

Question 7

Extract organism names from the sequences and remove none organisms

grep ">" *.fa | grep "mRNA" |cut -d "," -f1 |cut -d ":" -f3| cut  -d "" -f12 |sort| uniq | cat >  /home/odongo/Desktop/exercise/result/organism.txt

counting nucleotide numbers in both files using wildcard

grep -v "nrf1" *.fa | tr -d '\n' | grep -o '[AGCTagct]' | wc -c > /home/odongo/Desktop/exercise/result/nucleotidecount.txt

cd in result directory to visualize the sequence

count nucleotide and store various count of of each nucleotide in their respective files

grep -v "nrf1" *.fa | tr -d '\n' | grep -o 'A' | wc -c > /home/odongo/Desktop/exercise/result/nucleotide_A_count.txt
grep -v "nrf1" *.fa | tr -d '\n' | grep -o 'G' | wc -c > /home/odongo/Desktop/exercise/result/nucleotide_G_count.txt
grep -v "nrf1" *.fa | tr -d '\n' | grep -o 'C' | wc -c > /home/odongo/Desktop/exercise/result/nucleotide_C_count.txt
grep -v "nrf1" *.fa | tr -d '\n' | grep -o 'T' | wc -c > /home/odongo/Desktop/exercise/result/nucleotide_T_count.txt

About

Introduction to basic linux commands

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages