Seqanswers Leaderboard Ad

Collapse

Announcement

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

  • Problem with samtools view chr

    Hello,

    I am trying to create a .bam file for each chromosome from the single file "mutant.bam". I'm using the following script:

    for f in {1..25} ; do echo $f ; samtools view -b mutant.bam chr"$f" -o mutant_chr"$f".bam

    The script appears to run fine, 25 file new files are created, but they are the exact same size. From manual inspection in IGV, it appears that all files contain chromosome 1.

    I have run samtools idxstats on the mutant.bam file, and the read counts for the various chromosomes are different (though similar). Any help or suggestions would be greatly appreciated.

    Best regards

  • #2
    it works fine for me... except u cant go till chr25.. u have to specify XY...
    can u post a snapshot of the IGV.. ?

    Comment


    • #3
      Thank you for your response. I should have mentioned that we are dealing with zebrafish and there are 25 chromosomes. I've attached screenshots of IGV for chromosomes 1 and 15. Any suggestions would be appreciated!
      Attached Files

      Comment


      • #4
        Well , here's your hint ... tried your program on a human sample ...
        NOTE chr23, chr24, chr25 show up as same size ... similar to "chr1".
        So, "chr1...chr25" dont match the names in the bam file. The "index" for the passed chromosome is always evaluating to zero. Index zero is the first thing, which is "chr1". So invalid chrom names are defaulting to chr1.

        How about dumping the header for us ???


        -bash-3.00$ cat job.tmp
        for f in {1..25}; do echo $f ; /h1/finneyr/samtools-0.1.18/samtools view -b mutant.bam chr"$f" -o mutant_chr"$f".bam; done
        -bash-3.00$ ls -l mutant.ba*
        -rw-rw-r-- 1 finneyr finneyr 2382311392 Jul 9 14:59 mutant.bam
        -rw-rw-r-- 1 finneyr finneyr 3282168 Jul 9 15:00 mutant.bam.bai
        -bash-3.00$ for f in {1..25}; do echo $f ; /h1/finneyr/samtools-0.1.18/samtools view -b mutant.bam chr"$f" -o mutant_chr"$f".bam; done
        1
        2
        3
        4
        5
        ... [blah blah blah ] ...
        21
        22
        23
        24
        25

        -bash-3.00$ ls -ltra mutant_chr*.bam
        -rw-rw-r-- 1 finneyr finneyr 188544953 Jul 9 15:01 mutant_chr1.bam
        -rw-rw-r-- 1 finneyr finneyr 182304264 Jul 9 15:02 mutant_chr2.bam
        -rw-rw-r-- 1 finneyr finneyr 110355683 Jul 9 15:03 mutant_chr3.bam
        -rw-rw-r-- 1 finneyr finneyr 39704885 Jul 9 15:03 mutant_chr4.bam
        -rw-rw-r-- 1 finneyr finneyr 65711066 Jul 9 15:03 mutant_chr5.bam
        -rw-rw-r-- 1 finneyr finneyr 93410203 Jul 9 15:04 mutant_chr6.bam
        -rw-rw-r-- 1 finneyr finneyr 101683378 Jul 9 15:04 mutant_chr7.bam
        -rw-rw-r-- 1 finneyr finneyr 52687973 Jul 9 15:04 mutant_chr8.bam
        -rw-rw-r-- 1 finneyr finneyr 63029186 Jul 9 15:04 mutant_chr9.bam
        -rw-rw-r-- 1 finneyr finneyr 50675311 Jul 9 15:05 mutant_chr10.bam
        -rw-rw-r-- 1 finneyr finneyr 112430386 Jul 9 15:05 mutant_chr11.bam
        -rw-rw-r-- 1 finneyr finneyr 153721958 Jul 9 15:06 mutant_chr12.bam
        -rw-rw-r-- 1 finneyr finneyr 27555154 Jul 9 15:06 mutant_chr13.bam
        -rw-rw-r-- 1 finneyr finneyr 146768148 Jul 9 15:06 mutant_chr14.bam
        -rw-rw-r-- 1 finneyr finneyr 42938121 Jul 9 15:07 mutant_chr15.bam
        -rw-rw-r-- 1 finneyr finneyr 54046327 Jul 9 15:07 mutant_chr16.bam
        -rw-rw-r-- 1 finneyr finneyr 126879400 Jul 9 15:07 mutant_chr17.bam
        -rw-rw-r-- 1 finneyr finneyr 17673537 Jul 9 15:07 mutant_chr18.bam
        -rw-rw-r-- 1 finneyr finneyr 156792702 Jul 9 15:08 mutant_chr19.bam
        -rw-rw-r-- 1 finneyr finneyr 43187357 Jul 9 15:08 mutant_chr20.bam
        -rw-rw-r-- 1 finneyr finneyr 11786036 Jul 9 15:08 mutant_chr21.bam
        -rw-rw-r-- 1 finneyr finneyr 69096206 Jul 9 15:09 mutant_chr22.bam
        -rw-rw-r-- 1 finneyr finneyr 182304264 Jul 9 15:09 mutant_chr23.bam
        -rw-rw-r-- 1 finneyr finneyr 182304264 Jul 9 15:10 mutant_chr24.bam
        -rw-rw-r-- 1 finneyr finneyr 182304264 Jul 9 15:11 mutant_chr25.bam
        Last edited by Richard Finney; 07-09-2012, 11:39 AM.

        Comment


        • #5
          Thank you for the response! Here is the header:

          @SQ SN:1 LN:60348388
          @SQ SN:2 LN:60300536
          @SQ SN:3 LN:63268876
          @SQ SN:4 LN:62094675
          @SQ SN:5 LN:75682077
          @SQ SN:6 LN:59938731
          @SQ SN:7 LN:77276063
          @SQ SN:8 LN:56184765
          @SQ SN:9 LN:58232459
          @SQ SN:10 LN:46591166
          @SQ SN:11 LN:46661319
          @SQ SN:12 LN:50697278
          @SQ SN:13 LN:54093808
          @SQ SN:14 LN:53733891
          @SQ SN:15 LN:47442429
          @SQ SN:16 LN:58780683
          @SQ SN:17 LN:53984731
          @SQ SN:18 LN:49877488
          @SQ SN:19 LN:50254551
          @SQ SN:20 LN:55952140
          @SQ SN:21 LN:44544065
          @SQ SN:22 LN:42261000
          @SQ SN:23 LN:46386876
          @SQ SN:24 LN:43947580
          @SQ SN:25 LN:38499472
          @SQ SN:MT LN:16596

          I'm continuing to read through the spec (http://samtools.sourceforge.net/SAM1.pdf), but I haven't been able to determine how the individual chromosomes are generated. Does it look like the header is missing essential data/tags?

          Thank you!

          Comment


          • #6
            You can give a "reference chromosome" any name you want.
            Just use "1" instead of "chr1" and "2" instead of "chr2", etc.
            hook 'em!

            Comment


            • #7
              Ah ha! That completely solved my problem. I really appreciate your help! hook 'em indeed!

              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, 04-25-2024, 11:49 AM
              0 responses
              19 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 04-24-2024, 08:47 AM
              0 responses
              19 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 04-11-2024, 12:08 PM
              0 responses
              62 views
              0 likes
              Last Post seqadmin  
              Started by seqadmin, 04-10-2024, 10:19 PM
              0 responses
              60 views
              0 likes
              Last Post seqadmin  
              Working...
              X