Skip to content

Commit

Permalink
Opened QuickBLAST Git repo
Browse files Browse the repository at this point in the history
  • Loading branch information
vizkidd committed Jul 27, 2023
0 parents commit 2b39bf2
Show file tree
Hide file tree
Showing 21 changed files with 2,738 additions and 0 deletions.
16 changes: 16 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Package: QuickBLAST
Type: Package
Title: BLAST Files/Sequences Directly From R
Version: 1.0
Date: 2023-07-09
Author: Vishvesh Karthik
Maintainer: Vishvesh Karthik <vishveshkarthik@gmail.com>
Description: A BLAST Wrapper to call BLAST directly from R. Depends on ncbi-c++ toolkit (Built and libraries installed)
License: GPL (>= 2)
Depends:
Rcpp (>= 1.0.10),
RcppProgress (>= 0.4.2),
arrow (>= 12.0.1.1)
LinkingTo: Rcpp, RcppProgress
Encoding: UTF-8
RoxygenNote: 7.2.3
3 changes: 3 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
useDynLib(QuickBLAST, .registration=TRUE)
importFrom(Rcpp, evalCpp)
exportPattern("^[[:alpha:]]+")
Binary file added QuickBLAST_1.0.tar.gz
Binary file not shown.
85 changes: 85 additions & 0 deletions R/RcppExports.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#' @name CreateNewBLASTInstance
#'
#' @title Create new BLAST instance with seq_type, strand, program and BLAST options.
#'
#' @description Create a new QuickBLAST C++ object with seq_type, strand, program and BLAST options, which can be used in QuickBLAST::BLAST2Files() and QuickBLAST::BLAST2Seqs()
#'
#' @param seq_info (R List) list((int) "seq_type" : 0 - (eNucleotide) (OR) 1 - (eProtein), (int) "strand" = 0 - (ePlus) (OR) 1 - (eMinus), (bool) "save_sequences" = Save Sequences in the arrow::RecordBatch?). Named or unnamed List is accepted but in order.
#' @param program (string) Name of the BLAST program
#' @param options (string (or) Named List) List of BLAST options - check COMPLETE::GetAvailableBLASTOptions()
#' @return C++ Pointer of QuickBLAST Object (Cannot be used in R)
CreateNewBLASTInstance <- function(seq_info, program, options) {
.Call(`_QuickBLAST_CreateNewBLASTInstance`, seq_info, program, options)
}

#' @name BLAST2Seqs
#' @title BLAST 2 Sequences Strings
#'
#' @description BLAST 2 Sequence Strings and return the RecordBatchVector of BLAST Hits
#'
#' @param ptr (QuickBLAST ptr) Pointer to QuickBLAST object created with CreateNewBLASTInstance().
#' @param query (string) Query Sequence
#' @param subject (string) Subject Sequence
#' @return RecordBatchVector of BLAST Hits
BLAST2Seqs <- function(ptr, query, subject) {
.Call(`_QuickBLAST_BLAST2Seqs`, ptr, query, subject)
}

#' @name BLAST2Folders
#' @title BLAST 2 Folders
#'
#' @description BLAST files of query folder with files of subject folder.
#'
#' @note Output file is named as $query-$subject.hits in the outFolder.
#'
#' @param ptr (QuickBLAST ptr) Pointer to QuickBLAST object created with CreateNewBLASTInstance().
#' @param query (std::string) Query FASTA Folder
#' @param subject (std::string) Subject FASTA Folder
#' @param extension (std::string) Extension of FASTA files.
#' @param outFolder (string) Output Folder
#' @param num_threads (int) Number of Threads
#' @return List of output filenames
BLAST2Folders <- function(ptr, query, subject, extension, outFolder, num_threads) {
.Call(`_QuickBLAST_BLAST2Folders`, ptr, query, subject, extension, outFolder, num_threads)
}

#' @name BLAST1Folder
#' @title BLAST 1 Folder
#'
#' @description BLAST the contents of a folder.
#'
#' @note Output file is named as $query-$subject.hits in the outFolder.
#'
#' @param ptr (QuickBLAST ptr) Pointer to QuickBLAST object created with CreateNewBLASTInstance().
#' @param input_folder (std::string) Input Folder with FASTA (Query and Subjects)
#' @param extension (std::string) Extension of FASTA files.
#' @param outFolder (string) Output Folder
#' @param num_threads (int) Number of Threads
#' @return List of output filenames
BLAST1Folder <- function(ptr, input_folder, extension, outFolder, num_threads) {
.Call(`_QuickBLAST_BLAST1Folder`, ptr, input_folder, extension, outFolder, num_threads)
}

#' @name BLAST2Files
#' @title BLAST 2 Files
#'
#' @description BLAST 2 Files and return the RecordBatchVector of BLAST Hits Asynchronously
#'
#' @note Keep return_values_ = FALSE for large files to avoid choking R.
#'
#' @param ptr (QuickBLAST ptr) Pointer to QuickBLAST object created with CreateNewBLASTInstance().
#' @param query (string) Query FASTA File
#' @param subject (string) Subject FASTA File
#' @param outFile (string) Output Filename (Arrow Feather/IPC Format)
#' @param seq_limit (int) Batch Size to BLAST at a time. { -1 = Whole File, 0 - One sequence at a time or > 0 }
#' @param num_threads (int) Number of Threads
#' @param show_progress (bool) TRUE - Show progress, Set FALSE for multiple instances
#' @param return_values (bool) TRUE - Returns values as list, Default - FALSE - Does not return values (Return true on completion)
#' @return RecordBatchVector of Asynchronous BLAST Hits
BLAST2Files <- function(ptr, query, subject, outFile, seq_limit, num_threads, show_progress, return_values) {
.Call(`_QuickBLAST_BLAST2Files`, ptr, query, subject, outFile, seq_limit, num_threads, show_progress, return_values)
}

28 changes: 28 additions & 0 deletions man/BLAST1Folder.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 43 additions & 0 deletions man/BLAST2Files.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions man/BLAST2Folders.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions man/BLAST2Seqs.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions man/CreateNewBLASTInstance.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/Makevars
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CXXSTD = CXX17
PKG_LIBS = -L/usr/local/lib/ -L/usr/lib/ -larrow -lparquet -lrt -lxncbi -lxobjsimple -lxobjmgr -lblastinput -lblast -lblastdb -lblastdb_format -lxblast -lpthread -lseq -lxser -lgeneral -lseqset -lxutil -lalign_format `$(R_HOME)/bin/Rscript -e "Rcpp:::CxxFlags()"` `$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"` $(SHLIB_OPENMP_CXXFLAGS)
PKG_CXXFLAGS = -O3 -fPIC -fpermissive -fopenmp -Wextra -shared -Ilibsrc `$(R_HOME)/bin/Rscript -e "Rcpp:::CxxFlags()"` $(SHLIB_OPENMP_CXXFLAGS) -pthread -I/usr/local/src/ -I/usr/local/include/ncbi-tools++/ -I/usr/include/arrow/ -I/usr/include/parquet/ -I/usr/include/
3 changes: 3 additions & 0 deletions src/Makevars.win
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CXXSTD = CXX17
PKG_LIBS = -L/usr/local/lib/ -L/usr/lib/ -larrow -lparquet -lrt -lxncbi -lxobjsimple -lxobjmgr -lblastinput -lblast -lblastdb -lblastdb_format -lxblast -lpthread -lseq -lxser -lgeneral -lseqset -lxutil -lalign_format `$(R_HOME)/bin/Rscript -e "Rcpp:::CxxFlags()"` `$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"` $(SHLIB_OPENMP_CXXFLAGS)
PKG_CXXFLAGS = -O3 -fPIC -fpermissive -fopenmp -Wextra -shared -Ilibsrc `$(R_HOME)/bin/Rscript -e "Rcpp:::CxxFlags()"` $(SHLIB_OPENMP_CXXFLAGS) -pthread -I/usr/local/src/ -I/usr/local/include/ncbi-tools++/ -I/usr/include/arrow/ -I/usr/include/parquet/ -I/usr/include/
Binary file added src/QuickBLAST.so
Binary file not shown.
104 changes: 104 additions & 0 deletions src/RcppExports.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
// Generated by using Rcpp::compileAttributes() -> do not edit by hand
// Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#include <Rcpp.h>

using namespace Rcpp;

#ifdef RCPP_USE_GLOBAL_ROSTREAM
Rcpp::Rostream<true>& Rcpp::Rcout = Rcpp::Rcpp_cout_get();
Rcpp::Rostream<false>& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get();
#endif

// CreateNewBLASTInstance
RcppExport SEXP CreateNewBLASTInstance(SEXP seq_info, SEXP program, SEXP options);
RcppExport SEXP _QuickBLAST_CreateNewBLASTInstance(SEXP seq_infoSEXP, SEXP programSEXP, SEXP optionsSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< SEXP >::type seq_info(seq_infoSEXP);
Rcpp::traits::input_parameter< SEXP >::type program(programSEXP);
Rcpp::traits::input_parameter< SEXP >::type options(optionsSEXP);
rcpp_result_gen = Rcpp::wrap(CreateNewBLASTInstance(seq_info, program, options));
return rcpp_result_gen;
END_RCPP
}
// BLAST2Seqs
RcppExport SEXP BLAST2Seqs(SEXP ptr, SEXP query, SEXP subject);
RcppExport SEXP _QuickBLAST_BLAST2Seqs(SEXP ptrSEXP, SEXP querySEXP, SEXP subjectSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< SEXP >::type ptr(ptrSEXP);
Rcpp::traits::input_parameter< SEXP >::type query(querySEXP);
Rcpp::traits::input_parameter< SEXP >::type subject(subjectSEXP);
rcpp_result_gen = Rcpp::wrap(BLAST2Seqs(ptr, query, subject));
return rcpp_result_gen;
END_RCPP
}
// BLAST2Folders
RcppExport SEXP BLAST2Folders(SEXP ptr, SEXP query, SEXP subject, SEXP extension, SEXP outFolder, SEXP num_threads);
RcppExport SEXP _QuickBLAST_BLAST2Folders(SEXP ptrSEXP, SEXP querySEXP, SEXP subjectSEXP, SEXP extensionSEXP, SEXP outFolderSEXP, SEXP num_threadsSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< SEXP >::type ptr(ptrSEXP);
Rcpp::traits::input_parameter< SEXP >::type query(querySEXP);
Rcpp::traits::input_parameter< SEXP >::type subject(subjectSEXP);
Rcpp::traits::input_parameter< SEXP >::type extension(extensionSEXP);
Rcpp::traits::input_parameter< SEXP >::type outFolder(outFolderSEXP);
Rcpp::traits::input_parameter< SEXP >::type num_threads(num_threadsSEXP);
rcpp_result_gen = Rcpp::wrap(BLAST2Folders(ptr, query, subject, extension, outFolder, num_threads));
return rcpp_result_gen;
END_RCPP
}
// BLAST1Folder
RcppExport SEXP BLAST1Folder(SEXP ptr, SEXP input_folder, SEXP extension, SEXP outFolder, SEXP num_threads);
RcppExport SEXP _QuickBLAST_BLAST1Folder(SEXP ptrSEXP, SEXP input_folderSEXP, SEXP extensionSEXP, SEXP outFolderSEXP, SEXP num_threadsSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< SEXP >::type ptr(ptrSEXP);
Rcpp::traits::input_parameter< SEXP >::type input_folder(input_folderSEXP);
Rcpp::traits::input_parameter< SEXP >::type extension(extensionSEXP);
Rcpp::traits::input_parameter< SEXP >::type outFolder(outFolderSEXP);
Rcpp::traits::input_parameter< SEXP >::type num_threads(num_threadsSEXP);
rcpp_result_gen = Rcpp::wrap(BLAST1Folder(ptr, input_folder, extension, outFolder, num_threads));
return rcpp_result_gen;
END_RCPP
}
// BLAST2Files
RcppExport SEXP BLAST2Files(SEXP ptr, SEXP query, SEXP subject, SEXP outFile, SEXP seq_limit, SEXP num_threads, SEXP show_progress, SEXP return_values);
RcppExport SEXP _QuickBLAST_BLAST2Files(SEXP ptrSEXP, SEXP querySEXP, SEXP subjectSEXP, SEXP outFileSEXP, SEXP seq_limitSEXP, SEXP num_threadsSEXP, SEXP show_progressSEXP, SEXP return_valuesSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< SEXP >::type ptr(ptrSEXP);
Rcpp::traits::input_parameter< SEXP >::type query(querySEXP);
Rcpp::traits::input_parameter< SEXP >::type subject(subjectSEXP);
Rcpp::traits::input_parameter< SEXP >::type outFile(outFileSEXP);
Rcpp::traits::input_parameter< SEXP >::type seq_limit(seq_limitSEXP);
Rcpp::traits::input_parameter< SEXP >::type num_threads(num_threadsSEXP);
Rcpp::traits::input_parameter< SEXP >::type show_progress(show_progressSEXP);
Rcpp::traits::input_parameter< SEXP >::type return_values(return_valuesSEXP);
rcpp_result_gen = Rcpp::wrap(BLAST2Files(ptr, query, subject, outFile, seq_limit, num_threads, show_progress, return_values));
return rcpp_result_gen;
END_RCPP
}

RcppExport SEXP _rcpp_module_boot_blast_module();

static const R_CallMethodDef CallEntries[] = {
{"_QuickBLAST_CreateNewBLASTInstance", (DL_FUNC) &_QuickBLAST_CreateNewBLASTInstance, 3},
{"_QuickBLAST_BLAST2Seqs", (DL_FUNC) &_QuickBLAST_BLAST2Seqs, 3},
{"_QuickBLAST_BLAST2Folders", (DL_FUNC) &_QuickBLAST_BLAST2Folders, 6},
{"_QuickBLAST_BLAST1Folder", (DL_FUNC) &_QuickBLAST_BLAST1Folder, 5},
{"_QuickBLAST_BLAST2Files", (DL_FUNC) &_QuickBLAST_BLAST2Files, 8},
{"_rcpp_module_boot_blast_module", (DL_FUNC) &_rcpp_module_boot_blast_module, 0},
{NULL, NULL, 0}
};

RcppExport void R_init_QuickBLAST(DllInfo *dll) {
R_registerRoutines(dll, NULL, CallEntries, NULL, NULL);
R_useDynamicSymbols(dll, FALSE);
}
Binary file added src/RcppExports.o
Binary file not shown.
Loading

0 comments on commit 2b39bf2

Please sign in to comment.