Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ronton
    Member
    • Jun 2014
    • 34

    #1

    Sort/create list of locations with highest # of reads?

    Hello,

    Hopefully there is a simple way to do this that I am unaware of.

    I have fastq and bam files (100bp paired end Illumina). In the alignment files there are lots of areas with one or a few reads spread throughout the genome.

    What I would like to do is either sort results to visualize, for example in Integrative Genomics Viewer, or generate a list that will show in descending order the locations that have the greatest number of reads or the greatest coverage. This would most likely be within a window, say 50bp.

    For example:

    chr21:33,031,597 has 58 reads
    chr21:33,031,200 has 56 reads
    chr21:33,025,000 has 42 reads

    and so on.

    Any advice or guidance on different ways I might achieve this is very appreciated.

    Thank you
  • Richard Finney
    Senior Member
    • Feb 2009
    • 701

    #2
    Check out samtools ...

    $ samtools depth

    Usage: samtools depth [options] in1.bam [in2.bam [...]]
    Options:
    -b <bed> list of positions or regions
    -f <list> list of input BAM filenames, one per line [null]
    -l <int> minQLen
    -q <int> base quality threshold
    -Q <int> mapping quality threshold
    -r <chr:from-to> region

    Example:
    $ samtools depth -r chr1:1-100000 1221792.bam | head
    chr1 10033 1
    chr1 10034 1
    chr1 10035 1
    chr1 10036 1
    chr1 10037 1
    chr1 10038 1
    chr1 10039 1
    chr1 10040 1
    chr1 10041 1
    chr1 10042 1


    Use "awk" to filter on column 3 and "sort" on column 3 and "tail" it.
    Like this ...
    samtools depth 1221792.bam | awk '{if ($3>300) print $0}' | sort -k3n | tail
    Last edited by Richard Finney; 06-06-2014, 06:43 AM.

    Comment

    • ronton
      Member
      • Jun 2014
      • 34

      #3
      Thanks so much Richard,

      So if I use:

      samtools depth 1221792.bam | awk '{if ($3>50) print $0}' | sort -k3n | tail

      for example, this will give me a list of all locations with more than 50 reads, correct?

      But no 'window,' or in other words, it will likely print the individual locations for each block of reads, rather than one result for each bin or chunk of 50 bases or something like that. Meaning, at chr1 10038 +/- 25bp, there are max 50 reads.

      Certainly a start, thank you for the help.

      Comment

      • swbarnes2
        Senior Member
        • May 2008
        • 910

        #4
        Code:
        samtools view -F 4 sorted.bam | cut -f 3,4 | uniq -c | sort -nr | head -n 20 > most_common.txt
        That'll give you the top 20 most common start sites for your reads.

        Comment

        Latest Articles

        Collapse

        • SEQadmin2
          16S/ITS Profiling vs. Shotgun Metagenomics: What Changes in Your Workflow?
          by SEQadmin2




          NGS has revolutionized clinical microbiology by offering new ways to identify and surveil pathogens without prior knowledge of the target. One popular approach is 16S rRNA and ITS amplicon sequencing, which targets specific microbial markers. But studies are increasingly incorporating shotgun metagenomics, a technique that sequences all DNA from a sample without targeting specific microbial markers. This approach allows more detailed taxonomic classification, detection...
          Today, 06:46 AM
        • 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

        ad_right_rmr

        Collapse

        News

        Collapse

        Topics Statistics Last Post
        Started by SEQadmin2, 10-28-2026, 09:57 AM
        0 responses
        24 views
        0 reactions
        Last Post SEQadmin2  
        Started by SEQadmin2, 10-28-2026, 09:51 AM
        0 responses
        15 views
        0 reactions
        Last Post SEQadmin2  
        Started by SEQadmin2, 10-22-2026, 11:13 AM
        0 responses
        68 views
        0 reactions
        Last Post SEQadmin2  
        Started by SEQadmin2, 10-22-2026, 10:48 AM
        0 responses
        48 views
        0 reactions
        Last Post SEQadmin2  
        Working...