Seqanswers Leaderboard Ad

Collapse

Announcement

Collapse
No announcement yet.
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Filter reads by mappability, unique reads, not more than 1 mismatches

    Hi all,
    I am working with ChIP-seq data and want to filter the reads with the following criteria: (A) mappable reads; (B) unique alignments (most likely based on MAPQ score) and (C) not more than 1 mismatches. I want the final output as BED file.
    I have BAM files, and am doing the following to achieve A, B, C.
    Code:
    samtools view -b -F 4 -q 20 temp.bam > mapped_temp1.bam
    bamToBed -i mapped_temp1.bam > mapped_temp1.bed
    bamToBed -i mapped_temp1.bam -tag NM > mapped_temp2.bed
    paste mapped_temp1.bed mapped_temp2.bed | awk '$11 == 0' > final.bed # Field 11 is the NM score
    paste mapped_temp1.bed mapped_temp2.bed | awk '$11 == 1' >> final.bed
    more final.bed | cut -f1-6 > temp_FILTERED.bed # Retain fields 1-6
    The NM tag in the BAM file could be used for filtering based on number of mismatches. Is there a way I can do all filtering in one step (is there a SAMtools command to get this?).

    Thanks for any help or pointers.

  • #2
    This is one of those cases where knowing a programming language or two would make life easier. If you're familiar with python, you could just use pysam to do this in one go. Similarly, for Java there's the picard API, for C the samtools API, and even javascript can use SamJS.

    Comment


    • #3
      Thanks Devon.
      Will look into pysam.

      Comment

      Latest Articles

      Collapse

      • seqadmin
        Essential Discoveries and Tools in Epitranscriptomics
        by seqadmin




        The field of epigenetics has traditionally concentrated more on DNA and how changes like methylation and phosphorylation of histones impact gene expression and regulation. However, our increased understanding of RNA modifications and their importance in cellular processes has led to a rise in epitranscriptomics research. “Epitranscriptomics brings together the concepts of epigenetics and gene expression,” explained Adrien Leger, PhD, Principal Research Scientist...
        04-22-2024, 07:01 AM
      • seqadmin
        Current Approaches to Protein Sequencing
        by seqadmin


        Proteins are often described as the workhorses of the cell, and identifying their sequences is key to understanding their role in biological processes and disease. Currently, the most common technique used to determine protein sequences is mass spectrometry. While still a valuable tool, mass spectrometry faces several limitations and requires a highly experienced scientist familiar with the equipment to operate it. Additionally, other proteomic methods, like affinity assays, are constrained...
        04-04-2024, 04:25 PM

      ad_right_rmr

      Collapse

      News

      Collapse

      Topics Statistics Last Post
      Started by seqadmin, Today, 08:47 AM
      0 responses
      9 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 04-11-2024, 12:08 PM
      0 responses
      60 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 04-10-2024, 10:19 PM
      0 responses
      57 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 04-10-2024, 09:21 AM
      0 responses
      53 views
      0 likes
      Last Post seqadmin  
      Working...
      X