Seqanswers Leaderboard Ad

Collapse

Announcement

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

  • Getting Reads from Bam file

    Hello every one.

    I have a bam file which is approx 50gb from hiseq paired end data. I aligned it using BWA and now i am intersted in getting reads at particular location. i.e. for examle in chromosome 1 from (100000 - 101000). I would like to make a subset out from bam file with the above range. How can i do that ?

    Thank you for your help!!

  • #2
    Personally, I'd use samtools view to extract the region of interest into another BAM file. If you then want the reads then you could use Picard's SamToFastq.

    Cheers,
    Ian

    Comment


    • #3
      How can i specify the parameters for samtools view for extracting reads in that region?

      I see the below options in samtools.

      Usage: samtools view [options] <in.bam>|<in.sam> [region1 [...]]

      Options: -b output BAM
      -h print header for the SAM output
      -H print header only (no alignments)
      -S input is SAM
      -u uncompressed BAM output (force -b)
      -1 fast compression (force -b)
      -x output FLAG in HEX (samtools-C specific)
      -X output FLAG in string (samtools-C specific)
      -c print only the count of matching records
      -L FILE output alignments overlapping the input BED FILE [null]
      -t FILE list of reference names and lengths (force -S) [null]
      -T FILE reference sequence file (force -S) [null]
      -o FILE output file name [stdout]
      -R FILE list of read groups to be outputted [null]
      -f INT required flag, 0 for unset [0]
      -F INT filtering flag, 0 for unset [0]
      -q INT minimum mapping quality [0]
      -l STR only output reads in library STR [null]
      -r STR only output reads in read group STR [null]
      -s FLOAT fraction of templates to subsample; integer part as seed [-1]
      -? longer help

      Comment


      • #4
        A region can be presented, for example, in the following format: ‘chr2’ (the whole chr2), ‘chr2:1000000’ (region starting from 1,000,000bp) or ‘chr2:1,000,000-2,000,000’ (region between 1,000,000 and 2,000,000bp including the end points). The coordinate is 1-based.

        example

        samtools view aln.sorted.bam chr2:20,100,000-20,200,000

        Comment


        • #5
          thank you.. it worked

          Comment

          Latest Articles

          Collapse

          • seqadmin
            Recent Developments in Metagenomics
            by seqadmin





            Metagenomics has improved the way researchers study microorganisms across diverse environments. Historically, studying microorganisms relied on culturing them in the lab, a method that limits the investigation of many species since most are unculturable1. Metagenomics overcomes these issues by allowing the study of microorganisms regardless of their ability to be cultured or the environments they inhabit. Over time, the field has evolved, especially with the advent...
            09-23-2024, 06:35 AM
          • seqadmin
            Understanding Genetic Influence on Infectious Disease
            by seqadmin




            During the COVID-19 pandemic, scientists observed that while some individuals experienced severe illness when infected with SARS-CoV-2, others were barely affected. These disparities left researchers and clinicians wondering what causes the wide variations in response to viral infections and what role genetics plays.

            Jean-Laurent Casanova, M.D., Ph.D., Professor at Rockefeller University, is a leading expert in this crossover between genetics and infectious...
            09-09-2024, 10:59 AM

          ad_right_rmr

          Collapse

          News

          Collapse

          Topics Statistics Last Post
          Started by seqadmin, 10-02-2024, 04:51 AM
          0 responses
          13 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 10-01-2024, 07:10 AM
          0 responses
          21 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 09-30-2024, 08:33 AM
          0 responses
          25 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 09-26-2024, 12:57 PM
          0 responses
          18 views
          0 likes
          Last Post seqadmin  
          Working...
          X