Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • simonandrews
    replied
    Originally posted by aurelielaugraud View Post
    We want to use SAM format but we don't get how to use the flag field, is anyone having an exemple for us please?
    The SAM flag field although it appears as a single number actually contains several pieces of information which have been combined together. It is a bitwise field, which means that it makes use of the way that computers represent numbers to store several small values stored in one large value.

    If you think of a standard integer as being composed of 32 bits (0 or 1) then it would look like:

    00000000000000000000000000000000

    However SAM uses this single number as a series of boolean (true false) flags where each position in the array of bits represents a different sequence attribute

    Bit 0 = The read was part of a pair during sequencing
    Bit 1 = The read is mapped in a pair
    Bit 2 = The query sequence is unmapped
    Bit 3 = The mate is unmapped
    Bit 4 = Strand of query (0=forward 1=reverse)

    etc.

    Constructing the value from the individual flags is fairly easy. If the flag is false don't add anything to the total. If its true then add 2 raised to the power of the bit position.

    For example:

    Bit 0 - false - add nothing
    Bit 1 - true - add 2**1 = 2
    Bit 2 - false - add nothing
    Bit 3 - true - add 2**3 = 8
    Bit 4 - true - add 2**4 = 16

    Bit pattern = 11010 = 16+8+2 = 26

    So the flag value would be 26.

    To extract the individual flags from the compound value you can use a logical AND operation. This will tell you if a specific bit in the compound value is true or not. The exact syntax will depend on the language you're using, but in Perl for instance you could do:

    if ($compound & 16) {
    print "Reverse";
    }
    else {
    print "Forward";
    }

    To extract the information from the 4th (therefore 2**4 = 16) bit field.

    I hope that makes it a bit clearer.

    Leave a comment:


  • aurelielaugraud
    replied
    Hello and thanks for taking some time to reply .
    I have already had a look at samtools manual regarding the flag section but I am sorry it doesn't seem to be enough for me and I would really appreciate an example. or some documentation on how to use bitwise data ...
    Maybe I can leave the MAPQ field with 255 value as indicated in the manual is the program I use to map the reads doesn't caclulate this value for me. ( the more it goes, the least I wish to calculate it myself)

    Leave a comment:


  • totalnew
    replied
    FLAG field is normally associated with other attributes to parse the read, likely, if this read is mapped, if this red is paired..... see the description table in samtools manual.

    For MAPQ calculation, it is complicated. The mapping quality is the phred-scaled probability that a read alignment may be wrong. In practice, MAPQ is approximated in some ways. bwa approximates the MAPQ as 0, 23, 25 37, 255,...according to the factors of number of best hits, number of second best hits.......

    Leave a comment:


  • aurelielaugraud
    started a topic bitwise flag in sam format and others

    bitwise flag in sam format and others

    Hello,
    new to the seqanswers community, I have started with NGS data (illumina) about 2 month ago.
    We align with GEM (not published yet but quite good as far as we tried it), we tried Maq but is doesn't seem to work for the moment on our machines (says it is running but not writting anything ....), and I am currently running bwa at the moment as another test.
    We want to use SAM format but we don't get how to use th flag field, is anyone having an exemple for us please ? I know bwa outputs can be converted directly but we would need to do it ourselves for the GEM output.

    moreover, there is a question on the MAPQ field. we don't have any direct information about that I think. Can we infer it ? how is it calculated ? we have phred-based quality scores for each base.

    thanks to the community.

Latest Articles

Collapse

  • SEQadmin2
    Multiomic Liquid Biopsy: What DNA/RNA Panels Reveal That DNA Alone Can’t
    by SEQadmin2



    Tumors contain complex mixtures of cell populations that evolve in response to treatment and host-specific factors. Tissue biopsies provide only static snapshots of a tumor’s state. But what if we could follow that evolution over time using a minimally invasive technique?

    Liquid biopsies can detect tumor-derived material circulating in the bloodstream, providing a way to study treatment response, detect emerging resistance, and discover new biomarkers. Circulating
    ...
    10-14-2026, 09:55 AM
  • SEQadmin2
    New Genomics Technologies Take Aim at Long-Standing Limits
    by SEQadmin2


    Researchers using sequencing and genomics tools often have to make trade-offs. They can choose between speed or scale, short reads or long-range information, or targeted panels or a view of the whole transcriptome. New technologies that have been released this year are built to address those tough choices.

    We asked six companies the same four questions to learn about their latest products. The new technologies bring a lot to the table, including rethinking sequencing
    ...
    09-28-2026, 10:25 AM

ad_right_rmr

Collapse

News

Collapse

Topics Statistics Last Post
Started by SEQadmin2, 10-22-2026, 11:13 AM
0 responses
54 views
0 reactions
Last Post SEQadmin2  
Started by SEQadmin2, 10-22-2026, 10:48 AM
0 responses
40 views
0 reactions
Last Post SEQadmin2  
Started by SEQadmin2, 10-15-2026, 10:52 AM
0 responses
46 views
0 reactions
Last Post SEQadmin2  
Started by SEQadmin2, 10-14-2026, 05:39 AM
0 responses
46 views
0 reactions
Last Post SEQadmin2  
Working...