chromap
chromap copied to clipboard
[BUG] output to /dev/stdout
Describe the bug When I use /dev/stdout instead of the output of the -o argument, the program reports an error, saying "Assertion 'temp_mapping_output_file! = __null' failed. "So I can't use /dev/stdout instead of the standard output, so I can't pipe the output (mainly by using samtools to compress the sam file for other downstream analysis)
To Reproduce Steps to reproduce the behavior:
- The test data I used came from the test file in chromap-0.2.5
- 0.2.5/0.2.5
- chromap --preset atac -x index -r ref.fa -1 read1.fq -2 read2.fq -o /dev/stdout
- chromap: src/mapping_writer.cc:365: void chromap::MappingWriter<MappingRecord>::OutputTempMapping(const string&, uint32_t, const std::vector<std::vector<MappingRecord> >&) [with MappingRecord = chromap::SAMMapping; std::string = std::basic_string
; uint32_t = unsigned int]: Assertion `temp_mapping_output_file != __null' failed.)
Expected behavior Content should be output in standard output.
Screenshots If applicable, add screenshots to help explain your problem.
Environment (please complete the following information):
- OS: [e.g. centos 7]
- Way you install Chromap [build from source]
- If you compiled Chromap from source yourself, please provide the compiler version [e.g. GCC 8.4.0]
Additional context I suggest that we should add an option to output to standard output in the software option list. Many people who do not know the principle of linux do not understand the use of /dev/std*, which is not conducive to the friendly use of software
I see the issue. It should work with low memory mode turned off. In this case, the temp mapping files won't be generated. Otherwise, it will generate temp mapping file in the same directory, which caused the issue. We should have a fix for this. When the output is /dev/stdout, we just use the current directory as the temp directory.
Thank you for your prompt reply, how should I fix this bug now or fix it when the next version is updated (but I see you have updated a version in recent days).
雨中的雕塑 @.***
------------------ 原始邮件 ------------------ 发件人: "haowenz/chromap" @.>; 发送时间: 2024年2月22日(星期四) 上午10:52 @.>; @.@.>; 主题: Re: [haowenz/chromap] [BUG] output to /dev/stdout (Issue #150)
I see the issue. It should work with low memory mode turned off. In this case, the temp mapping files won't be generated. Otherwise, it will generate temp mapping file in the same directory, which caused the issue. We should have a fix for this. When the output is /dev/stdout, we just use the current directory as the temp directory.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
Thank you for bringing up this issue. We move the temporary files to the local directory when outputting to stdout. The updated code is in the li_dev5 branch. Could you please checkout this branch and give it a try? If it works on your system, we will merge it to the master branch. Thank you.
Hi @lvyunyunSCI have you got a chance to test the code in the li_dev5 branch?
Hi,
I also would like this feature, so I tested it out. I can confirm it works using the li_dev5
branch. The following ran without any problem:
chromap -t 4 -x genonme.index -r genome.fa \
--preset atac --summary summary.csv \
-1 R1.fastq.gz -2 R2.fastq.gz -b I2.fastq.gz \
--barcode-whitelist 737K-cratac-v1_rc.txt \
-o /dev/stdout | bgzip > fragments.tsv.gz
Hope this helps.
Xi
Thank you for the testing! This feature is in the master branch now and will be in the next release.