---
# System prepended metadata

title: Lab 5

---

# Lab 5
'export BLASTDB="$BLASTDB:/courses/bi278/Course_Materials/blastdb"'
echo $BLASTDB
'awk 'BEGIN {RS=">"} /hypothetical protein/ {print ">"$0}' ORS="" lab_04/PROKKA_09242022.faa' 
What the command above does is:
ü Read the file you designate at the end of the command by whatever you tell it to
use as a record separator (RS=">")
ü Match a particular pattern (/pattern/) you give it in each record, such as the
word ‘hypothetical’
ü When a record contains that pattern, it then prints the symbol ‘>’ followed by the
record ($0)
ü When it prints, it doesn’t use an additional output record separator (ORS="") (If the explanation ain't broke don't fix it.... just copy paste)
Then created FASTA file using awk 'BEGIN {RS=">"} /hypothetical protein/ {print ">"$0}' ORS="" /courses/bi278/Course_Materials/lab_04/bhqs69/PROKKA_09242022.faa > lab_05/ProteinHyp
NOTE** had to make lab_05 folder first using mkdir lab_05
'awk 'BEGIN {RS=">"; srand()} (rand()<=.003) {print ">"$0}' ORS="" lab_05/ProteinHyp
>BH69_00006 hypothetical protein' Run this to subset 3% of the data
>used the prior command '> lab_05/subset_01' to put subset into file subset_01
>'blastp -task blastp-fast -num_threads 2 -db refseq_select_prot -evalue 1e-6 -query lab_05/subset_01' to run blast on chosen subset
>'blastp -task blastp-fast -num_threads 2 -db refseq_select_prot -evalue 1e6 -outfmt "6 std ppos qcovs stitle sscinames staxid" -max_target_seqs 10 -query lab_05/subset_01 > lab_05/subset_blastp_fmt3.txt' to create new file to blast with alternative specifications
>repeat the blast step with new file ^
>'awk '$1=="BO395_01177" {print $2}' lab_05/subset_blastp_fmt3.txt | sort | uniq > example_blastp_BO395_01177.sseqids.txt' once again moved file elsewhere
>'blastdbcmd -db refseq_select_prot -entry_batch example_blastp_BO395_01177.sseqids.txt' to find the entries from my search target database
that match the subject sequence ids
'awk -F "\t" '{print $1,$2,$15,$16,$13,$14,$11}' OFS="\t" lab_05/subset_blastp_fmt3.txt' takes the information from the output file and reorganizes it. Each of the
columns (fields) of the table format at specified with dollar-signs ($) and numbers for
each column. 
Q2
max_target_seqs = Number of aligned sequences to keep. Use with report formats that do not have separate
definition line and alignment sections such as tabular (all outfmt > 4). Not compatible
with num_descriptions or num_alignments. Ties are broken by order of sequences in
the database. default value = 500
num_descriptions = Show one-line descriptions for this number of database sequences; default value = 500
num_alignments = Show alignments for this number of database sequences. default value =250
evalue = Expect value (E) for saving hits. Default value = 10
matrix = scoring matrix name. default value = BLOSUM62 for all blast except blastp-short which uses PAM30
The only alternative default i saw was for the matrix. I wouldn't change anything else because I saw no options...