Skip to content

Commit

Permalink
Adds citation information and gives warning if quality scores are tru…
Browse files Browse the repository at this point in the history
…ncated
  • Loading branch information
nadiadavidson committed Jan 10, 2025
1 parent 0d270d2 commit 856f988
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 12 deletions.
4 changes: 4 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

We also ask that you cite this software and its corresponding publication:
https://doi.org/10.1093/bioinformatics/btae102, in papers where you made
use of it for any part of the data analysis.
34 changes: 22 additions & 12 deletions flexiplex.c++
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ using namespace std;

// Append .1 to version for dev code, remove for release
// e.g. 1.00.1 (dev) goes to 1.01 (release)
const static string VERSION="1.02.1";
const static string VERSION="1.02.2";

struct PredefinedStruct {
string description;
Expand Down Expand Up @@ -95,7 +95,11 @@ void print_usage(){
}
cerr << "\n -h Print this usage information.\n\n";
cerr << "Have a different barcode scheme you would like Flexiplex to work with? Post a request at:\n" ;
cerr << "https://github.com/DavidsonGroup/flexiplex/issues\n" ;
cerr << "https://github.com/DavidsonGroup/flexiplex/issues\n\n" ;

cerr << "If you use Flexiplex in your research, please cite our paper:\n" ;
cerr << "O. Cheng et al., Flexiplex: a versatile demultiplexer and search tool for omics data, Bioinformatics, Volume 40, Issue 3, 2024 \n";

cerr << endl;
}

Expand Down Expand Up @@ -431,6 +435,7 @@ Barcode get_barcode(string & seq,

//search a read for one or more barcodes (parent function that calls get_barcode)
vector<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) {

vector<Barcode> return_vec; //vector of all the barcodes found

//search for barcode
Expand All @@ -449,8 +454,8 @@ vector<Barcode> big_barcode_search(string & sequence, unordered_set<string> & kn
masked_res=big_barcode_search(masked_sequence,known_barcodes,max_flank_editd,max_editd, search_pattern); //,ss);
return_vec.insert(return_vec.end(),masked_res.begin(),masked_res.end()); //add to result
}

return(return_vec);

}

// utility function to check true/false input options
Expand Down Expand Up @@ -531,6 +536,10 @@ void print_read(string read_id, string read, string qual,
string qual_new = ""; // don't trim the quality scores if it's a fasta file

if (qual != "") {
if(qual.length()!=read_length){
cerr << "WARNING: sequence and quality lengths diff for read: " << read_id << ". Ignoring read." << endl;
return;
}
qual_new = qual.substr(read_start, read_length);
}
string read_new = read.substr(read_start, read_length);
Expand Down Expand Up @@ -572,8 +581,8 @@ void search_read(vector<SearchResult> & reads, unordered_set<string> & known_bar
//forward search
auto forward_reads = big_barcode_search(
reads[r].line,
known_barcodes,
flank_edit_distance,
known_barcodes,
flank_edit_distance,
edit_distance,
search_pattern
);
Expand All @@ -585,10 +594,10 @@ void search_read(vector<SearchResult> & reads, unordered_set<string> & known_bar
//Check the reverse compliment of the read
auto reverse_reads = big_barcode_search(
reads[r].rev_line,
known_barcodes,
flank_edit_distance,
edit_distance,
search_pattern
known_barcodes,
flank_edit_distance,
edit_distance,
search_pattern
);

reads[r].vec_bc_for = forward_reads;
Expand All @@ -607,7 +616,7 @@ int main(int argc, char **argv) {
std::ios_base::sync_with_stdio(false);

cerr << "FLEXIPLEX " << VERSION << "\n";

// Variables to store user options
// Set these to their defaults
int expected_cells = 0; //(d)
Expand Down Expand Up @@ -859,7 +868,7 @@ int main(int argc, char **argv) {
string read_id;

istringstream line_stream(read_id_line);
line_stream >> sr.read_id;
line_stream >> sr.read_id;
sr.read_id.erase(0, 1);

if (!is_fastq) { // fasta (account for multi-lines per read)
Expand Down Expand Up @@ -978,7 +987,8 @@ int main(int argc, char **argv) {
cerr << "Number of reads where more than one barcode was found: "
<< multi_bc_count << "\n";
cerr << "All done!" << endl;

cerr << "If you like Flexiplex, please cite us! https://doi.org/10.1093/bioinformatics/btae102" << endl;

if (known_barcodes.size() > 0) {
out_stat_file.close();
return (0);
Expand Down

0 comments on commit 856f988

Please sign in to comment.