Giter Club home page Giter Club logo

Comments (1)

misialq avatar misialq commented on July 17, 2024

After staring at various docs and specifications for a while, I convinced myself that maybe we really are redirecting the wrong thing to /dev/null in case of single-end reads. From samtools fastq help:

Reads are designated READ1 if FLAG READ1 is set and READ2 is not set.
Reads are designated READ2 if FLAG READ1 is not set and READ2 is set.
Reads are designated READ_OTHER if FLAGs READ1 and READ2 are either both set
or both unset.

and more on the flags (samtools flags):

Flags:
	0x1	PAIRED        .. paired-end (or multiple-segment) sequencing technology
	0x2	PROPER_PAIR   .. each segment properly aligned according to the aligner
	0x4	UNMAP         .. segment unmapped
	0x8	MUNMAP        .. next segment in the template unmapped
	0x10	REVERSE       .. SEQ is reverse complemented
	0x20	MREVERSE      .. SEQ of the next segment in the template is reversed
	0x40	READ1         .. the first segment in the template
	0x80	READ2         .. the last segment in the template
[...]

plus this excerpt from the SAM/BAM Format Specification:

If 0x1 is unset, no assumptions can be made about 0x2, 0x8, 0x20, 0x40 and 0x80.

together bring me to the conclusion that in case of single-end reads the 0x1 (1) flag is unset and so the reads will not be flagged as either READ1 or READ2. In that case, they would rather be flagged as READ_OTHER and, according to samtools fastq help, end up in the file indicated with the -0 flag (which we are unfortunately discarding...)

convert_command = [
'samtools', 'fastq', *_reads, '-0', '/dev/null',
'-s', '/dev/null', '-n', bamfile_output_path]

In fact, when I look at the contents of the bowtie2 output (first step in the filter action) I can see that the SAM flag set there is 4 for every aligned sequence (meaning, they are not marked as READ1/2). If that really is the case, we would just need to replace the -1 flag from the samtools fastq command in our code with -0. Given my rather limited experience with samtools though, I may have gotten it wrong, so I'd hope that someone with more XP could qiime in 🙏

from q2-quality-control.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.