Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project->Text did not work on Windows - easy fix #51

Open
johan-gson opened this issue Mar 11, 2020 · 0 comments
Open

Project->Text did not work on Windows - easy fix #51

johan-gson opened this issue Mar 11, 2020 · 0 comments

Comments

@johan-gson
Copy link
Contributor

johan-gson commented Mar 11, 2020

I experienced that project -> text didn't work as expected, I got a text file of 47 GB, containing mainly long strings like AAAATTTEEEAA...

I had a similar bug when I was writing some code in BUSTools, and the problem then was that I had opened my out file in text mode, not binary. What happens in Windows then is that \n is replaced by \r\n, which inserts an extra byte. This happens in the header for 10x data, since one of the lengths (I think it is the UMI) happens to have the value '\n', leading to a huge umi length. When looking at the code for project, I see the following lines (around line 250):

std::streambuf *buf = nullptr;
if (!opt.stream_out) {
  of.open(opt.output); 
  buf = of.rdbuf();
} else {
  buf = std::cout.rdbuf();
}
std::ostream o(buf);

The bug would most likely be fixed by changing one of these lines from
of.open(opt.output);
to
of.open(opt.output, std::ios::binary);

This is the code in the devel branch. I am not able to build on Windows, not sure how to do it, so I cannot verify the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant