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
            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
          • 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

          ad_right_rmr

          Collapse

          News

          Collapse

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