Question: Samtools And Flagstat
0
gravatar for nbvasani
5.7 years ago by
nbvasani230
United States
nbvasani230 wrote:

Hello All Biostar community user,

I am trying to use flagstat comand 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

rnaseq bioinformatics samtools • 3.4k views
ADD COMMENTlink modified 5.7 years ago by swbarnes25.2k • written 5.7 years ago by nbvasani230

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 REPLYlink written 5.7 years ago by swbarnes25.2k
2
gravatar for Devon Ryan
5.7 years ago by
Devon Ryan89k
Freiburg, Germany
Devon Ryan89k wrote:

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

ADD COMMENTlink written 5.7 years ago by Devon Ryan89k

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

ADD REPLYlink written 5.7 years ago by nbvasani230
0
gravatar for rob234king
5.7 years ago by
rob234king570
UK/Harpenden/Rothamsted Research
rob234king570 wrote:

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 COMMENTlink modified 5.7 years ago • written 5.7 years ago by rob234king570

Thanks a lot. I was in different directory.

Not it is working fine

ADD REPLYlink written 5.7 years ago by nbvasani230
0
gravatar for swbarnes2
5.7 years ago by
swbarnes25.2k
United States
swbarnes25.2k wrote:

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 COMMENTlink written 5.7 years ago by swbarnes25.2k

Now it is working fine.

Thanks

ADD REPLYlink modified 5.7 years ago • written 5.7 years ago by nbvasani230

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 REPLYlink written 5.7 years ago by matted7.0k

Thanks matted.......

ADD REPLYlink written 5.7 years ago by nbvasani230

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

ADD REPLYlink written 5.7 years ago by matted7.0k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 849 users visited in the last hour