@@ -25,7 +25,7 @@ using namespace std;
2525
2626// Append .1 to version for dev code, remove for release
2727// e.g. 1.00.1 (dev) goes to 1.01 (release)
28- const static string VERSION=" 1.02.1 " ;
28+ const static string VERSION=" 1.02.2 " ;
2929
3030struct PredefinedStruct {
3131 string description;
@@ -95,7 +95,11 @@ void print_usage(){
9595 }
9696 cerr << " \n -h Print this usage information.\n\n " ;
9797 cerr << " Have a different barcode scheme you would like Flexiplex to work with? Post a request at:\n " ;
98- cerr << " https://github.com/DavidsonGroup/flexiplex/issues\n " ;
98+ cerr << " https://github.com/DavidsonGroup/flexiplex/issues\n\n " ;
99+
100+ cerr << " If you use Flexiplex in your research, please cite our paper:\n " ;
101+ cerr << " O. Cheng et al., Flexiplex: a versatile demultiplexer and search tool for omics data, Bioinformatics, Volume 40, Issue 3, 2024 \n " ;
102+
99103 cerr << endl;
100104}
101105
@@ -431,6 +435,7 @@ Barcode get_barcode(string & seq,
431435
432436// search a read for one or more barcodes (parent function that calls get_barcode)
433437vector<Barcode> big_barcode_search (string & sequence, unordered_set<string> & known_barcodes, int max_flank_editd, int max_editd, const std::vector<std::pair<std::string, std::string>> &search_pattern) {
438+
434439 vector<Barcode> return_vec; // vector of all the barcodes found
435440
436441 // search for barcode
@@ -449,8 +454,8 @@ vector<Barcode> big_barcode_search(string & sequence, unordered_set<string> & kn
449454 masked_res=big_barcode_search (masked_sequence,known_barcodes,max_flank_editd,max_editd, search_pattern); // ,ss);
450455 return_vec.insert (return_vec.end (),masked_res.begin (),masked_res.end ()); // add to result
451456 }
452-
453457 return (return_vec);
458+
454459}
455460
456461// utility function to check true/false input options
@@ -531,6 +536,10 @@ void print_read(string read_id, string read, string qual,
531536 string qual_new = " " ; // don't trim the quality scores if it's a fasta file
532537
533538 if (qual != " " ) {
539+ if (qual.length ()!=read_length){
540+ cerr << " WARNING: sequence and quality lengths diff for read: " << read_id << " . Ignoring read." << endl;
541+ return ;
542+ }
534543 qual_new = qual.substr (read_start, read_length);
535544 }
536545 string read_new = read.substr (read_start, read_length);
@@ -572,8 +581,8 @@ void search_read(vector<SearchResult> & reads, unordered_set<string> & known_bar
572581 // forward search
573582 auto forward_reads = big_barcode_search (
574583 reads[r].line ,
575- known_barcodes,
576- flank_edit_distance,
584+ known_barcodes,
585+ flank_edit_distance,
577586 edit_distance,
578587 search_pattern
579588 );
@@ -585,10 +594,10 @@ void search_read(vector<SearchResult> & reads, unordered_set<string> & known_bar
585594 // Check the reverse compliment of the read
586595 auto reverse_reads = big_barcode_search (
587596 reads[r].rev_line ,
588- known_barcodes,
589- flank_edit_distance,
590- edit_distance,
591- search_pattern
597+ known_barcodes,
598+ flank_edit_distance,
599+ edit_distance,
600+ search_pattern
592601 );
593602
594603 reads[r].vec_bc_for = forward_reads;
@@ -607,7 +616,7 @@ int main(int argc, char **argv) {
607616 std::ios_base::sync_with_stdio (false );
608617
609618 cerr << " FLEXIPLEX " << VERSION << " \n " ;
610-
619+
611620 // Variables to store user options
612621 // Set these to their defaults
613622 int expected_cells = 0 ; // (d)
@@ -859,7 +868,7 @@ int main(int argc, char **argv) {
859868 string read_id;
860869
861870 istringstream line_stream (read_id_line);
862- line_stream >> sr.read_id ;
871+ line_stream >> sr.read_id ;
863872 sr.read_id .erase (0 , 1 );
864873
865874 if (!is_fastq) { // fasta (account for multi-lines per read)
@@ -978,7 +987,8 @@ int main(int argc, char **argv) {
978987 cerr << " Number of reads where more than one barcode was found: "
979988 << multi_bc_count << " \n " ;
980989 cerr << " All done!" << endl;
981-
990+ cerr << " If you like Flexiplex, please cite us! https://doi.org/10.1093/bioinformatics/btae102" << endl;
991+
982992 if (known_barcodes.size () > 0 ) {
983993 out_stat_file.close ();
984994 return (0 );
0 commit comments