Samtools And Flagstat
3
0
Entering edit mode
11.3 years ago
nbvasani ▴ 240

Hello All Biostar community user,

I am trying to use flagstat command option in samtools.

Usually people get below output when they type samtools.pl in terminal

Program: samtools (Tools for alignments in the SAM format)
Version: 0.1.18 (r982:295)

Usage:   samtools <command> [options]

Command: view        SAM<->BAM conversion
         ##sort        sort alignment file
         ## mpileup     multi-way pileup
         depth       compute the depth
         faidx       index/extract FASTA
         tview       text alignment viewer
         index       index alignment
         idxstats    BAM index stats (r595 or later)
         fixmate     fix mate information
         ## flagstat    simple stats
         calmd       recalculate MD/NM tags and '=' bases
         merge       merge sorted alignments
         rmdup       remove PCR duplicates
         reheader    replace BAM header
         cat         concatenate BAMs
         targetcut   cut fosmid regions (for fosmid pool only)
         phase       phase heterozygotes
`

But in my case when I type samtools.pl, I am getting below output:

Program: samtools.pl (helper script for SAMtools)
Version: 0.3.3
Contact: Heng Li <lh3@sanger.ac.uk>

Usage:   samtools.pl <command> [<arguments>]

Command: ## varFilter     filtering SNPs and short indels
        ## pileup2fq     generate fastq from `pileup -c'
         ## showALEN      print alignment length (ALEN) following CIGAR
`

There is no option for flagstat.

When I type samtools.pl flagstat, it shows flagstat: command not found.

Hope you guys can help me out.

Thanks in advance

Naresh

samtools RNA-seq • 6.6k views
ADD COMMENT
0
Entering edit mode

The top thing is what people get when they type 'samtools' into the terminal. The bottom thing is what people get when they type 'samtools.pl' into the terminal. They are not the same. 'samtools' is what you want 99% of the time.

ADD REPLY
2
Entering edit mode
11.3 years ago

Samtools isn't a perl script, just type samtools (there's no .pl extension).

ADD COMMENT
0
Entering edit mode

Thanks but it still shows same output saying flagstat: command not found

ADD REPLY
0
Entering edit mode
11.3 years ago
rob234king ▴ 610

If samtools is not in your path you will have to refer to the full location. Check location of samtools binary and you are not in a directory where a perl file someone has called samtools.pl is present.

samtools flagstat example shown below from http://elvis.ccc.cranfield.ac.uk/CUBELP2/faces/SNPcalling.xhtml SNP calling comparison tab of SNP tutorial.

/home/rob/Downloads/samtools-0.1.19/samtools flagstat A.bam

If this does not work, reinstall. Hope that helps

ADD COMMENT
0
Entering edit mode

Thanks a lot. I was in different directory.

Not it is working fine

ADD REPLY
0
Entering edit mode
11.3 years ago

samtools and samtools.pl are two different things. 'samtools.pl' is a perl script with a bunch of different functions that do some kind of useful things. 'samtools' converts .sam to .bam, sort .bams, indexes them, does flagstat, etc.

did 'samtools flagstat' really not work?

ADD COMMENT
0
Entering edit mode

Now it is working fine.

Thanks

ADD REPLY
0
Entering edit mode

That's a shell error message, meaning you are typing in flagstat alone. Don't do that. Type samtools flagstat into the shell and press enter. Don't do samtools.pl; as others have said, that's a separate tool.

ADD REPLY
0
Entering edit mode

Thanks matted.......

ADD REPLY
0
Entering edit mode

Oops I replied to the wrong reply, so I'm out of date... glad you got it working.

ADD REPLY

Login before adding your answer.

Traffic: 2337 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6