Seqanswers Leaderboard Ad

Collapse

Announcement

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

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

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


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


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


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

          • 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, Yesterday, 08:47 AM
          0 responses
          14 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 04-11-2024, 12:08 PM
          0 responses
          60 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 04-10-2024, 10:19 PM
          0 responses
          60 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 04-10-2024, 09:21 AM
          0 responses
          54 views
          0 likes
          Last Post seqadmin  
          Working...
          X