--- title: "01-blast" output: html_document date: "2023-03-30" --- #Download Software #change directory ```{bash} cd /home/jovyan/applications ``` #download software from NCBI ```{bash} curl -O https://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/LATEST/ncbi-blast-2.13.0+-x64-linux.tar.gz ``` #unzip ```{bash} cd /home/jovyan/applications tar -xf ncbi-blast-2.13.0+-x64-linux.tar.gz ``` #check if it's working ```{bash} ~/applications/ncbi-blast-2.13.0+/bin/blastx -h ``` #make blast database #mv renames the file into something I want #cd../data is relative file path ```{bash} #download from url cd ../data curl -O https://ftp.uniprot.org/pub/databases/uniprot/current_release/knowledgebase/complete/uniprot_sprot.fasta.gz mv uniprot_sprot.fasta.gz uniprot_sprot_r2023_01.fasta.gz gunzip -k uniprot_sprot_r2023_01.fasta.gz ls ../data ``` ```{bash} #back slash makes it possible for you to separate codes on different lines #make the blast database ~/applications/ncbi-blast-2.13.0+/bin/makeblastdb \ -in ../data/uniprot_sprot_r2023_01.fasta \ -dbtype prot \ -out ../blastdb/uniprot_sprot_r2023_01 ``` ```{bash} curl https://eagle.fish.washington.edu/cnidarian/Ab_4denovo_CLC6_a.fa \ -k \ > ../data/Ab_4denovo_CLC6_a.fa ``` ```{bash} head ../data/Ab_4denovo_CLC6_a.fa echo "How many sequences are there?" grep -c ">" ../data/Ab_4denovo_CLC6_a.fa ``` ####Run Blast#### #~/ is home directory #evalue is the percent match ```{bash} ~/applications/ncbi-blast-2.13.0+/bin/blastx \ -query ../data/Ab_4denovo_CLC6_a.fa \ -db ../blastdb/uniprot_sprot_r2023_01 \ -out ../output/Ab_4-uniprot_blastx.tab \ -evalue 1E-20 \ -num_threads 8 \ -max_target_seqs 1 \ -outfmt 6 ``` ```{bash} head -2 ../output/Ab_4-uniprot_blastx.tab wc -l ../output/Ab_4-uniprot_blastx.tab ``` #####join blast table with annotation table##### ```{bash} head -2 ../output/Ab_4-uniprot_blastx.tab wc -l ../output/Ab_4-uniprot_blastx.tab ``` #change format of blast output ```{bash} tr '|' '\t' < ../output/Ab_4-uniprot_blastx.tab \ > ../output/Ab_4-uniprot_blastx_sep.tab ``` #load package in R ```{r} library(tidyverse) ``` #read in annotation table ```{r} spgo <- read.csv("https://gannet.fish.washington.edu/seashell/snaps/uniprot_table_r2023_01.tab", sep = '\t', header = TRUE) ``` #read in data table ```{r} bltabl <- read.csv("../output/Ab_4-uniprot_blastx_sep.tab", sep = '\t', header = FALSE) ``` #join tables ```{r} left_join(bltabl, spgo, by = c("V3" = "Entry")) %>% select(V1, V3, V13, Protein.names, Organism, Gene.Ontology..biological.process., Gene.Ontology.IDs) %>% mutate(V1 = str_replace_all(V1, pattern = "solid0078_20110412_FRAG_BC_WHITE_WHITE_F3_QV_SE_trimmed", replacement = "Ab")) %>% write_delim("../output/blast_annot_go.tab", delim = '\t') ``` #read in combined table ```{r} annot_tab <- read.csv("../output/blast_annot_go.tab", sep = '\t', header = TRUE) ```