Entering edit mode
6.1 years ago
Shahzad
▴
30
I have used samtools to make bam files and it is perfectly showing the data in igv. somehow I am unable to get the counts when using htseq. after going through literature I think I needed to sort bam files according to coordinates. is there anyone can share a command example that how a sorted bam can be generated using samtools. thanks
ps. currently is gives an empty txt file when I run htseq on bam file.
previously I used
samtools sort -@ 8 -o file1.bam file1.sam
how to specify sort to coordinates?
Please edit the post type to
Question
instead of Tool asTool
is reserved for posts introducing new software tools and/or packages.Take a look at
samtools
manual to find out how to sort and index a.sam
or.bam
file. http://www.htslib.org/doc/samtools.htmlsamtools sort by coordinates by default so your command should work but you need to add -b param to output in BAM
Hello Nicolas Rosewick ,
the
-b
parameter isn't needed anymore when using-o
to define the output filename.samtools
recognize the filextension automaticly.fin swimmer
EDIT: And
samtools sort
never had a-b
option. Here it is called-O
My bad I had samtools view in mind :/
it gives an error when i run it with -b
if samtools by default is set to coordinated bam output then can you please suggest any reason why the htseq is generating empty text file when i used the bam file. while when i upload same bam file with indexed bai file in igv genome viewer it works perfectly.
i am using this command for htseq
I don't know if it is your problem. But the manual say a htseq-count command looks like this.
Furthermore it looks like you have to specify that your input is
bam
and notsam
. If your sort your data by position, you have to tell it to htseq-count as well.All this I have found in the manual.
fin swimmer
It's likely the chromosome names don't match. IGV can handle (some) chromosome naming differences (e.g., it knows that
1
andchr1
are the same), htseq-count can't (featureCounts can).Can you please post a few lines from the
.bam
file to check that the input .bam file is in correct format. Which version ofhtseq
package are you using?samtools view file.bam|head
i tried all the possible variations
Hi There,
It is important to know what command you are running and understand the parameters specified in the command. You will not get the desired output by randomly trying different combinations of the parameters.
htseq-count -f bam -r pos -o test_htseq-count_output.txt SRR7042071.bam Sorghum.gtf
If you are using a non-Ensembl GTF file then ensure that you are providing relevant tags for
-t
and-i
parameters as described in the manual.i downloaded this reference and gtf file from ensemble reference genome database. still got the same error with the upper mentioned command too few arguments. I previously tried different parameters but they did not worked that time too. so i went with the default settings
Stop changing the ordering:
In many programs you can't intermingle options and positional arguments.