Unconfigured Ad

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

    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
                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
              • SEQadmin2
                Cancer Drug Resistance: The Lingering Barrier to Rising Survival
                by SEQadmin2



                Cancer survival rates have significantly increased in the last few decades in the United States, reaching a combined 70% 5-year survival rate by 2021. Behind this number, there are years of research to find new therapies, drug targets, and early detection methods. But there is one core challenge that keeps slowing down these advances, and it’s about drug resistance.

                There is no single reason why many patients don’t respond to treatment as expected. Cancer is...
                07-08-2026, 05:17 AM
              • GATTACAT
                Reply to Nine Things a Sample Prep Scientist Thinks About Before Sequencing
                by GATTACAT
                Love this - good data definitely starts from good input, and poor input can only give relatively poor data. I particularly like the mention of Nanodrop/absorbance based methods for quantification. It's such a toss up if you'll get an accurate reading or what amounts to a randomly generated number, and a lot of library/sequencing related issues can be traced back to poor quant.
                07-01-2026, 11:43 AM

              ad_right_rmr

              Collapse

              News

              Collapse

              Topics Statistics Last Post
              Started by SEQadmin2, 07-13-2026, 10:26 AM
              0 responses
              18 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 07-09-2026, 10:04 AM
              0 responses
              30 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 07-08-2026, 10:08 AM
              0 responses
              16 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 07-07-2026, 11:05 AM
              0 responses
              34 views
              0 reactions
              Last Post SEQadmin2  
              Working...