Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kellyv
    Junior Member
    • Jul 2009
    • 3

    #1

    SAMtools pileup command

    I am having trouble with the samtools pileup command and would appreciate any advice. I'm probably doing something wrong, but I have read the documentation and can't figure out what. Originally I was starting with a sam file produced by BWA. But that wasn't working so I switched to a sam file generated by using bowtie2sam.pl on a bowtie file.

    I used the following command to create the unsorted bam file:
    samtools view -buSt chrM.fa -o file.bam file.sam

    And then the following to sort the file:
    samtools sort file.bam file.bam.sorted

    Then I tried a variety of things to produce the pileup file.

    samtools pileup -f chrM.fa file.bam.sorted.bam
    --> no output, no error

    samtools pileup -t chrM.fa.fai file.bam.sorted.bam
    samtools pileup -f chrM.fa -t chrM.fa.fai file.bam.sorted.bam
    -->
    [sam_header_read2] 1 sequences loaded.
    [sam_read1] reference '$(((((((((((((((((((((((((NMCX1CMDZ7N0N27' is recognized as '*'.
    [sam_read1] reference '(((((((((((((((((((((((((((((NMCX1CMDZ7N0N27' is recognized as '*'.
    Parse error at line 2: invalid CIGAR character
    Abort trap

    samtools pileup -f chrM.fa -S file.sam
    -->
    [samopen] no @SQ lines in the header.
    [sam_read1] missing header? Abort!

    samtools pileup -f chrM.fa file.sam
    -->
    [bam_pileup] fail to read the header: non-exisiting file or wrong format.


    The only way I could get pileup output was as follows:
    samtools pileup -t chrM.fa.fai file.sam
    samtools pileup -t chrM.fa.fai -S file.sam
    --> note there is no -S flag in the first one and yet it produced correct output

    I want to be able to use the pileup command on the bam file because I am assuming it will be much faster on large files. Can I do that?

    And I was told that it's better to use -f than -t--is that true, or does it not matter?
  • dawe
    Senior Member
    • Apr 2009
    • 258

    #2
    I have same issues here when I use the conversion tools. I mean, if I perform the alignment with bwa (which produces SAM output) everything works fine, like this:

    bwa aln genome file.fq > file.sai
    bwa samse file.sai | samtools view -bt genome.fai -o results.bam -

    samtools sort results.bam sorted && mv sorted.bam results.bam
    samtools index results.bam

    samtools pileup [-f genome] results.bam

    I've tried export2sam.pl for old runs but it has some issues which I believe are related to the fact export files have the chromosome (or genome) file name in the 'chromosome' column. This is reported in SAM from the converter but there's no, say, chr5.fa chromosome in the reference used for samtools. The worst happens when I convert eland_export files aligned against a multifasta reference: the expected column for chromosome contains only, say, genome.fa... the export2sam.pl places all the reads as they were aligned to chromosome 'genome.fa':

    11II-08F1-GA_1:6:1:0:1237 81 genome.fa 138895 275 36M = 138757 -174 CGAATTAGTAGATTGTTTGTAAAAATCGGTATTGTN <:<997<;<:<<::;9999;;;:;9<<:
    <<;:;;/& MD:Z:C35 SM:i:133
    11II-08F1-GA_1:6:1:0:1237 161 genome.fa 138757 275 36M = 138895 174 ACTTGTTTTAAATAAACAGATTTTCCACTCATGTTG @@@@?=BBBCBB@?@BAB=5>@B@B@A@
    AA@@?<@@ MD:Z:36 SM:i:142
    11II-08F1-GA_1:6:1:0:399 97 genome.fa 179127 275 36M = 179285 194 NATATCATAACCATAAAAAAAAAAGCACAATTCAAC &1<<<<<<<<<<<<<<<<<<<<<8579:
    :<<:::98 MD:Z:A35 SM:i:133

    I don't have bowtie ouputs here at the moment, you may check if the bowtie chromosome column is the name of the file or the chromosome...

    HTH

    Davide

    Comment

    • ech
      Junior Member
      • Jul 2009
      • 7

      #3
      * character in pileup output

      Here is an example of line in pileup output which contains * characters
      chrIII 8884091 T W 95 126 60 12 ,,*****,*aA^]A aab`a^aHa^aa

      I do not believe this character is documented. Would be nice to hear back what it means.

      Comment

      • baohua100
        Senior Member
        • Jun 2008
        • 103

        #4
        How can I pileup all the sites of reference sequence , but not only the sites covered by at least 1 ?

        Comment

        • nilshomer
          Nils Homer
          • Nov 2008
          • 1283

          #5
          Originally posted by baohua100 View Post
          How can I pileup all the sites of reference sequence , but not only the sites covered by at least 1 ?
          You can get a bioinformatician or computer scientist to write a quick perl script to do this for you. We need jobs!

          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
          16 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...