This is a wrapper for blastp.
blast_p(query, database, out_file = NULL, outfmt = "6", other_args = NULL, echo = TRUE, wd, ...)
| query | Character vector of length one; the path to the fasta file to use as the query sequence(s). |
|---|---|
| database | Character vector of length one; the name of the blast database. |
| out_file | Character vector of length one; the name to use for the results file. |
| outfmt | Character vector of length one; value to pass to
|
| other_args | Character vector; other arguments to pass on to
|
| echo | Logical; should standard error and output be printed? |
| wd | Character vector of length one; working directory. The blast search will be conducted here. |
| ... | Additional other arguments. Not used by this function,
but meant to be used by |
A tab-separated text file with the results of the blastp
search, named with the value of out_file.
https://www.ncbi.nlm.nih.gov/books/NBK279690/
library(ape) # Make temp dir for storing files temp_dir <- fs::dir_create(fs::path(tempdir(), "baitfindR_example")) # Write out ape::woodmouse dataset as amino acids data(woodmouse) woodmouse_aa <- trans(woodmouse, 2)#> Warning: sequence length not a multiple of 3: 2 nucleotides droppedape::write.FASTA(woodmouse_aa, fs::path(temp_dir, "woodmouse.fasta")) # Make protein blast database build_blast_db( fs::path(temp_dir, "woodmouse.fasta"), db_type = "prot", out_name = "wood", parse_seqids = TRUE, wd = temp_dir)#> #> #> Building a new DB, current time: 05/15/2019 16:40:38 #> New DB name: /tmp/RtmpeNC9nF/baitfindR_example/wood #> New DB title: /tmp/RtmpeNC9nF/baitfindR_example/woodmouse.fasta #> Sequence type: Protein #> Keep MBits: T #> Maximum file size: 1000000000B #> Adding sequences from FASTA; added 15 sequences in 0.0140989 seconds.#> $status #> [1] 0 #> #> $stdout #> [1] "\n\nBuilding a new DB, current time: 05/15/2019 16:40:38\nNew DB name: /tmp/RtmpeNC9nF/baitfindR_example/wood\nNew DB title: /tmp/RtmpeNC9nF/baitfindR_example/woodmouse.fasta\nSequence type: Protein\nKeep MBits: T\nMaximum file size: 1000000000B\nAdding sequences from FASTA; added 15 sequences in 0.0140989 seconds.\n" #> #> $stderr #> [1] "" #> #> $timeout #> [1] FALSE #># Blast the original sequences against the database blast_p( fs::path(temp_dir, "woodmouse.fasta"), database = "wood", out_file = "blastp_results", wd = temp_dir, echo = TRUE )#> $status #> [1] 0 #> #> $stdout #> [1] "" #> #> $stderr #> [1] "" #> #> $timeout #> [1] FALSE #># Take a look at the results. readr::read_tsv( fs::path(temp_dir, "blastp_results"), col_names = FALSE )#> #> #>#> # A tibble: 225 x 12 #> X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 #> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 No305 No305 100 320 0 0 2 321 2 321 0 645 #> 2 No305 No1206S 98.4 319 5 0 2 320 2 320 0 639 #> 3 No305 No1202S 98.4 319 5 0 2 320 2 320 0 639 #> 4 No305 No1103S 98.4 319 5 0 2 320 2 320 0 639 #> 5 No305 No0913S 98.4 319 5 0 2 320 2 320 0 639 #> 6 No305 No0912S 98.4 319 5 0 2 320 2 320 0 639 #> 7 No305 No0908S 98.4 319 5 0 2 320 2 320 0 639 #> 8 No305 No304 98.4 320 5 0 2 321 2 321 0 639 #> 9 No305 No1007S 98.1 319 6 0 2 320 2 320 0 637 #> 10 No305 No0910S 98.1 319 6 0 2 320 2 320 0 637 #> # … with 215 more rows