Skip to content

Commit

Permalink
resolve BiocCheck warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
OliverVoogd committed Jul 31, 2023
1 parent 3275249 commit cff743e
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ vignettes/.build.timestamp
vignettes/FLAMES_vignette.md
**/.smbdelete*
check
src/testfuncs.cpp
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export(sc_long_multisample_pipeline)
export(sc_long_pipeline)
export(sc_mutations)
export(sc_umap_expression)
import(zlibbioc)
importFrom(BiocGenerics,cbind)
importFrom(BiocGenerics,colnames)
importFrom(BiocGenerics,end)
Expand Down
1 change: 1 addition & 0 deletions R/RcppExports.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#' @param stats_out output file for demultiplexed stats
#' @param n_threads number of threads to be used during demultiplexing
#' @param bc_out WIP
#' @return integer return value. 0 represents normal return.
#' @export
flexiplex <- function(reads_in, barcodes_file, bc_as_readid, max_bc_editdistance, max_flank_editdistance, pattern, reads_out, stats_out, bc_out, n_threads) {
.Call(`_FLAMES_flexiplex`, reads_in, barcodes_file, bc_as_readid, max_bc_editdistance, max_flank_editdistance, pattern, reads_out, stats_out, bc_out, n_threads)
Expand Down
2 changes: 2 additions & 0 deletions R/find_barcode.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
#' reads_out = file.path(outdir, 'demultiplexed.fq.gz'),
#' barcodes_file = bc_allow
#')
#' @return invisible()
#' @import zlibbioc
#' @md
#' @export
find_barcode <- function(fastq, barcodes_file, max_bc_editdistance = 2, max_flank_editdistance = 8,
Expand Down
3 changes: 3 additions & 0 deletions man/find_barcode.Rd

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

3 changes: 3 additions & 0 deletions man/flexiplex.Rd

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

2 changes: 1 addition & 1 deletion man/sc_long_multisample_pipeline.Rd

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

12 changes: 10 additions & 2 deletions src/flexiplex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,12 @@ void search_read(std::vector<SearchResult> &reads,
}
}

// file exists
bool file_exists(const std::string &filename) {
std::ifstream infile(filename);
return infile.good();
}

//' Rcpp port of flexiplex
//'
//' @description demultiplex reads with flexiplex, for detailed description, see
Expand All @@ -400,6 +406,7 @@ void search_read(std::vector<SearchResult> &reads,
//' @param stats_out output file for demultiplexed stats
//' @param n_threads number of threads to be used during demultiplexing
//' @param bc_out WIP
//' @return integer return value. 0 represents normal return.
//' @export
// [[Rcpp::export]]
int flexiplex(Rcpp::String reads_in, Rcpp::String barcodes_file,
Expand Down Expand Up @@ -477,7 +484,7 @@ int flexiplex(Rcpp::String reads_in, Rcpp::String barcodes_file,
} else {
kseq = kseq_init(gz_reads_in);
kseq_len = kseq_read(kseq);
if (!kseq_len > 0) {
if (!(kseq_len > 0)) {
Rcpp::stop("Unknown read format");
} else {
is_fastq = (bool)kseq->qual.s;
Expand All @@ -497,7 +504,8 @@ int flexiplex(Rcpp::String reads_in, Rcpp::String barcodes_file,
std::ofstream out_stat_file;

if (known_barcodes.size() > 0) {
if (std::filesystem::exists(stats_out.get_cstring())) {
// if (std::filesystem::exists(stats_out.get_cstring())) {
if (file_exists(stats_out.get_cstring())) {
out_stat_file.open(stats_out, std::ios_base::app);
} else {
out_stat_file.open(stats_out);
Expand Down

0 comments on commit cff743e

Please sign in to comment.