Entering edit mode
4.5 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
Questioninstead of Tool as
Toolis reserved for posts introducing new software tools and/or packages.
Take a look at
samtoolsmanual to find out how to sort and index a
samtools sort by coordinates by default so your command should work but you need to add -b param to output in BAM
Hello Nicolas Rosewick ,
-bparameter isn't needed anymore when using
-oto define the output filename.
samtoolsrecognize the filextension automaticly.
samtools sortnever had a
-boption. Here it is called
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
sam. 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.
It's likely the chromosome names don't match. IGV can handle (some) chromosome naming differences (e.g., it knows that
chr1are the same), htseq-count can't (featureCounts can).
Can you please post a few lines from the
.bamfile to check that the input .bam file is in correct format. Which version of
htseqpackage are you using?
samtools view file.bam|head
i tried all the possible variations
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
-iparameters 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.