Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jan
    Junior Member
    • May 2009
    • 6

    #1

    Samtools view error message

    I am attempting to generate a bam file with just chromosome 12 from my larger whole genome bam file. I entered the following code and got the following error message:

    samtools view -b myfile.bam chr12 > myfile_chr12.bam
    [main_samview] fail to get the reference name. Continue anyway.

    I then tried adding in the -f command with the fai file of my reference thinking I need to have the fai file and got the same error message.

    Have I used this command incorrectly? How can I remedy this problem?
  • nilshomer
    Nils Homer
    • Nov 2008
    • 1283

    #2
    Originally posted by Jan View Post
    I am attempting to generate a bam file with just chromosome 12 from my larger whole genome bam file. I entered the following code and got the following error message:

    samtools view -b myfile.bam chr12 > myfile_chr12.bam
    [main_samview] fail to get the reference name. Continue anyway.

    I then tried adding in the -f command with the fai file of my reference thinking I need to have the fai file and got the same error message.

    Have I used this command incorrectly? How can I remedy this problem?
    What is the output of "samtools view -H myfile.bam"? Chromosome 12 should be in the header.

    Comment

    • Jan
      Junior Member
      • May 2009
      • 6

      #3
      Tried the view -H

      Here is the first bit of output that looked most relevant although I don't understand what it means (I'm a biologist by training so the learning curve is steep right now). Should I be typing "12" instead of chr12? Thanks!
      @HD VN:0.1.2 SO:unsorted GO:none
      @SQ SN:1 LN:247249719
      @SQ SN:2 LN:242951149
      @SQ SN:3 LN:199501827
      @SQ SN:4 LN:191273063
      @SQ SN:5 LN:180857866
      @SQ SN:6 LN:170899992
      @SQ SN:7 LN:158821424
      @SQ SN:8 LN:146274826
      @SQ SN:9 LN:140273252
      @SQ SN:10 LN:135374737
      @SQ SN:11 LN:134452384
      @SQ SN:12 LN:132349534
      @SQ SN:13 LN:114142980
      @SQ SN:14 LN:106368585
      @SQ SN:15 LN:100338915
      @SQ SN:16 LN:88827254
      @SQ SN:17 LN:78774742
      @SQ SN:18 LN:76117153
      @SQ SN:19 LN:63811651
      @SQ SN:20 LN:62435964
      @SQ SN:21 LN:46944323
      @SQ SN:22 LN:49691432
      @SQ SN:X LN:154913754
      @SQ SN:Y LN:57772954
      @SQ SN:MT LN:16571
      @SQ SN:NT_113887 LN:3994
      @SQ SN:NT_113947 LN:4262
      @SQ SN:NT_113903 LN:12854
      @SQ SN:NT_113908 LN:13036
      @SQ SN:NT_113940 LN:19187
      @SQ SN:NT_113917 LN:19840
      @SQ SN:NT_113963 LN:24360

      Comment

      • nilshomer
        Nils Homer
        • Nov 2008
        • 1283

        #4
        Originally posted by Jan View Post
        Here is the first bit of output that looked most relevant although I don't understand what it means (I'm a biologist by training so the learning curve is steep right now). Should I be typing "12" instead of chr12? Thanks!
        @HD VN:0.1.2 SO:unsorted GO:none
        @SQ SN:1 LN:247249719
        @SQ SN:2 LN:242951149
        @SQ SN:3 LN:199501827
        @SQ SN:4 LN:191273063
        @SQ SN:5 LN:180857866
        @SQ SN:6 LN:170899992
        @SQ SN:7 LN:158821424
        @SQ SN:8 LN:146274826
        @SQ SN:9 LN:140273252
        @SQ SN:10 LN:135374737
        @SQ SN:11 LN:134452384
        @SQ SN:12 LN:132349534
        @SQ SN:13 LN:114142980
        @SQ SN:14 LN:106368585
        @SQ SN:15 LN:100338915
        @SQ SN:16 LN:88827254
        @SQ SN:17 LN:78774742
        @SQ SN:18 LN:76117153
        @SQ SN:19 LN:63811651
        @SQ SN:20 LN:62435964
        @SQ SN:21 LN:46944323
        @SQ SN:22 LN:49691432
        @SQ SN:X LN:154913754
        @SQ SN:Y LN:57772954
        @SQ SN:MT LN:16571
        @SQ SN:NT_113887 LN:3994
        @SQ SN:NT_113947 LN:4262
        @SQ SN:NT_113903 LN:12854
        @SQ SN:NT_113908 LN:13036
        @SQ SN:NT_113940 LN:19187
        @SQ SN:NT_113917 LN:19840
        @SQ SN:NT_113963 LN:24360
        Type "12" instead of "chr12". It looks like your FASTA reference had chromsome 12 named "12" instead of "chr12" (1000 Genomes reference? ).

        Comment

        • Jan
          Junior Member
          • May 2009
          • 6

          #5
          Thanks!

          That did it! Now I know to run -H to check the header to avoid this problem in the future. Thank you!

          Comment

          Latest Articles

          Collapse

          • SEQadmin2
            Multiomic Liquid Biopsy: What DNA/RNA Panels Reveal That DNA Alone Can’t
            by SEQadmin2



            Tumors contain complex mixtures of cell populations that evolve in response to treatment and host-specific factors. Tissue biopsies provide only static snapshots of a tumor’s state. But what if we could follow that evolution over time using a minimally invasive technique?

            Liquid biopsies can detect tumor-derived material circulating in the bloodstream, providing a way to study treatment response, detect emerging resistance, and discover new biomarkers. Circulating
            ...
            10-14-2026, 09:55 AM
          • SEQadmin2
            New Genomics Technologies Take Aim at Long-Standing Limits
            by SEQadmin2


            Researchers using sequencing and genomics tools often have to make trade-offs. They can choose between speed or scale, short reads or long-range information, or targeted panels or a view of the whole transcriptome. New technologies that have been released this year are built to address those tough choices.

            We asked six companies the same four questions to learn about their latest products. The new technologies bring a lot to the table, including rethinking sequencing
            ...
            09-28-2026, 10:25 AM

          ad_right_rmr

          Collapse

          News

          Collapse

          Topics Statistics Last Post
          Started by SEQadmin2, Yesterday, 11:13 AM
          0 responses
          16 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, Yesterday, 10:48 AM
          0 responses
          17 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 10-15-2026, 10:52 AM
          0 responses
          35 views
          0 reactions
          Last Post SEQadmin2  
          Started by SEQadmin2, 10-14-2026, 05:39 AM
          0 responses
          42 views
          0 reactions
          Last Post SEQadmin2  
          Working...