Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • KathrineBL
    Junior Member
    • May 2012
    • 3

    #1

    Downsampling a BAM file

    Hi ChIP-seq experts

    I'm a newbie in the field of ChIP-seq data mining and need some help! I've sequenced several samples and mapped them using bowtie and everything looks fine so fare

    But they differ somewhat in sequence depth which makes them difficult to compare - until now I've used coverageBed (bedtools) to find the read coverage around TSS and in my peak regions and then normalized the read count in these regions to sequence depth.

    But for some of my future analysis it would be really nice if the BAM file was normalized to sequence depth - simply, I want to remove some random reads from one sample so it has the same amount of reads as my second sample... I've found that picard "DownsampleSam" should be able to do this, however I cannot get the programme to work on my (mac) computer.

    I hope someone can help!!

    BR, Kathrine
  • ETHANol
    Senior Member
    • Feb 2010
    • 308

    #2
    Discussion of next-gen sequencing related bioinformatics: resources, algorithms, open source efforts, etc


    If you have no headers or you convert to BED the attached perl script should work as well. Warning: I'm not really sure what the script does, but it seems to work.
    Attached Files
    --------------
    Ethan

    Comment

    • pbluescript
      Senior Member
      • Nov 2009
      • 224

      #3
      You could use bamtools random for this as well.
      What errors is Picard giving you?

      Comment

      • KathrineBL
        Junior Member
        • May 2012
        • 3

        #4
        Thank you so much for your input!!

        I've tried the code, but i doesn't seem to work - I'm not that much up for converting it to a bed file as I need the BAM format later on.

        I'e tried bamtools random, but keep on getting the same error message

        bamtools random ERROR: could not load index data for all input BAM file(s)... Aborting.

        My code line is as follows:

        bamtools random -in Input_file.bam -out output_reduced.bam -n 1000000

        The input bam file originates from the SAM file produced when mapping with bowtie - it is converted to BAM with "samtools view", and sorted with "samtools sort" - then I extract all mapped reads with "samtools view -b -F 4"

        As you might can imagine I'm a newbie in this field and all help is very much appreciated!

        Comment

        • KathrineBL
          Junior Member
          • May 2012
          • 3

          #5
          Regarding the Picard errors - I think it relates to the (mac) version of my java (which otherwise is up to date):

          Exception in thread "main" java.lang.NoClassDefFoundError: jvm-argsCaused by: java.lang.ClassNotFoundException: jvm-args
          at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
          at java.security.AccessController.doPrivileged(Native Method)
          at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
          at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

          Comment

          • pbluescript
            Senior Member
            • Nov 2009
            • 224

            #6
            You need to index the bam file first. You can do this with bamtools:

            bamtools index -in Input_file.bam

            Comment

            • dkolbe
              Junior Member
              • May 2012
              • 1

              #7
              Originally posted by KathrineBL View Post
              Regarding the Picard errors - I think it relates to the (mac) version of my java (which otherwise is up to date):

              Exception in thread "main" java.lang.NoClassDefFoundError: jvm-args
              [...]
              You're using this as a template, I'm guessing:
              java jvm-args -jar PicardCommand.jar OPTION1=value1 OPTION2=value2...

              Like the command and the options, jvm-args needs to be substituted for actual java arguments. A typical example is -Xmx2g (specifying 2G of memory allocated for the run)

              Comment

              Latest Articles

              Collapse

              • SEQadmin2
                Beyond CRISPR/Cas9: Understand, Choose, and Use the Right Genome Editing Tool
                by SEQadmin2



                CRISPR/Cas9 sparked the gene editing revolution for both research and therapeutics.1 But this system still showed severe issues that limited its applications. The most prominent were the heavy reliance on PAM sequences, delivery limitations, double-stranded breaks that prompt unintended edits and cell death, and editing inefficiency (both in targeting and in knock-in reliability).

                Despite this, “CRISPR helped turn genome editing from a specialized technique into
                ...
                07-31-2026, 11:01 AM
              • SEQadmin2
                Proteomic Platforms: How to Choose the Right Analytical Strategy to Improve Detection and Clinical Applications
                by SEQadmin2


                Proteomics platforms are evolving rapidly, with advances in mass spectrometry and affinity-based approaches expanding what researchers can detect and at what scale. As the field moves toward deeper proteome coverage and clinical applications, scientists face an increasingly complex landscape of tools. This article will explore how researchers are navigating these choices to find the right platform for their work.

                The systematic characterization of the human proteome has
                ...
                07-20-2026, 11:48 AM
              • SEQadmin2
                Advanced Sequencing Platforms Tackle Neuroscience’s Toughest Genomics Problems
                by SEQadmin2



                Genomics studies in neuroscience face a special challenge due to the brain’s complexity and scarcity of samples. Mapping changes in cell type and state using conventional next-generation sequencing methods remains challenging. Advances in technologies like single-cell sequencing, spatial transcriptomics, and long-read sequencing have opened the door to deeper studies of the brain and diseases like Alzheimer’s, amyotrophic lateral sclerosis (ALS), and schizophrenia.
                ...
                07-09-2026, 11:10 AM

              ad_right_rmr

              Collapse

              News

              Collapse

              Topics Statistics Last Post
              Started by SEQadmin2, Yesterday, 10:13 AM
              0 responses
              13 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 07-31-2026, 02:55 AM
              0 responses
              26 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 07-24-2026, 12:17 PM
              0 responses
              20 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 07-23-2026, 11:41 AM
              0 responses
              19 views
              0 reactions
              Last Post SEQadmin2  
              Working...