Answers.Body: <p>I m not sure about htseq-counts but I would suggest go for featureCounts, I will update my answer and share the script/command. Give it a try </p>
  
  <p>the command i use </p>
  
  <pre><code>featureCounts -T 50 -C -p -t exon -g gene_id -a /run/media/data2/gencode.v21.annotation.gtf  -o PRIMARY_CELL.txt $(ls *.bam | sort )
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-22T05:28:11.863Z
Answers.Text: Thanks. I haven't use featureCounts. I found that it could run on R. Hopefully it works.
Answers.UserDisplayName: LoveVirology
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-22T05:52:52.933Z
Answers.Text: yes you can but it takes lot of memory
Answers.UserDisplayName: kcm
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-22T15:36:55.983Z
Answers.Text: I am running on cluster. But, I have a question here. I have .sam files obtained from HISAT2 which were generated from the paired fastq files. Can I use that .sam files directly for feature counts ? Do I need to sort the sam file and then use feature counts ?
Answers.UserDisplayName: LoveVirology
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-22T15:46:12.740Z
Answers.Text: I used the following commands 
  fcounts <- featureCounts(files=“reads.sam”,genome="genes.gtf").  
   And my results were:                                                                      
   Unassigned_NoFeatures = 5305153, and Unassigned_Unmapped=49253221. So, none of the genes were mapped. Any idea what could have gone wrong here ?
Answers.UserDisplayName: LoveVirology
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-22T16:39:01.107Z
Answers.Text: i have updated my answer see if that helps becuase i never use the sub-read package in R as such , i think you need to convert it into bam files...that would be better...
Answers.UserDisplayName: kcm
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-22T21:55:41.887Z
Answers.Text: For some reason I was not able to get any of my reads mapped. But I was able to do my analysis using Salmon.
Answers.UserDisplayName: LoveVirology
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-23T04:44:09.587Z
Answers.Text: it shouldn't be case may be some minor issue because i use star to align data and then to get reads i use featureCounts ,in star i get bam sorted file as my output but I don;t think if you don;t get sorted files you wont be able to get reads using featureCounts ..but anyways it worked may be you can give it a try again..
Answers.UserDisplayName: kcm
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-23T23:33:50.573Z
Answers.Text: Yes, I found a lot of papers using STAR aligner. I will give it a try. Thanks.
Answers.UserDisplayName: LoveVirology
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-22T03:46:08.070Z
Answers.LastActivityDate: 2018-04-22T16:37:56.963Z
Answers.LastEditDate: 2018-04-22T16:37:56.963Z
Answers.UserDisplayName: kcm
Body: <p>I am doing RNA-Seq data analysis using data available on SRA (SRR6047326). Samples are from the pig and they are paired. So, I did alignment using HISAT2.I used pig reference genome available on ENSEMBL. Then, I sorted .sam output files obtained from HISAT2. Now I am trying to get the count file using sorted sam file and it is not working. I am using annotated GTF file for pig which I downloaded from Ensembl.</p>
  
  <p>I get count files using following commands, but all the counts are 0.</p>
  
  <pre><code>htseq-counts -i no myfile.sam genes.gtf&gt;output.count
  </code></pre>
  
  <p>What is wrong here ? Are there any alternatives to htseq-count? </p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-04-22T08:57:55.153Z
Comments.Text: Help us to help you. What does "not working" mean? Please post relevant error messages, if any.
Comments.UserDisplayName: fridaymeetssunday
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-04-22T15:31:41.327Z
Comments.Text: I runs well and gives me the count file. But there are zero counts for all the genes. At the end of count files it scores most of the genes are on --alignment_not_unique.
Comments.UserDisplayName: LoveVirology
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-04-22T15:32:32.067Z
Comments.Text: I tried kallisto and it seems to work fine with kallisto.I can see counts for the multiple genes in tsv file generated by kallisto.
Comments.UserDisplayName: LoveVirology
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-04-22T18:07:02.590Z
Comments.Text: Is that the actual command you ran? Because the "no" in `-i no myfile.sam` is odd, and since kallisto is returning some reasonable counts we can assume the issue with the htseq command and not the alignments (which was my 1st thought).
Comments.UserDisplayName: fridaymeetssunday
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-04-22T18:08:18.333Z
Comments.Text: Speaking of kallisto, it is also fine to use those results for your analysis, unless that there a specific reason to use `htseq-count`.
Comments.UserDisplayName: fridaymeetssunday
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-04-22T21:53:20.533Z
Comments.Text: And I gave a shot to "Salmon" too. It is awesome. Basically it works like Kallisto. Thanks for your help guys.
Comments.UserDisplayName: LoveVirology
Tags: <rna-seq>
Title: Count files using htseq-count?
ThreadText: # Count files using htseq-count?
  
  (Asked by: username_0 on 2018-04-21)
  
  I am doing RNA-Seq data analysis using data available on SRA (SRR6047326). Samples are from the pig and they are paired. So, I did alignment using HISAT2.I used pig reference genome available on ENSEMBL. Then, I sorted .sam output files obtained from HISAT2. Now I am trying to get the count file using sorted sam file and it is not working. I am using annotated GTF file for pig which I downloaded from Ensembl.
  
  I get count files using following commands, but all the counts are 0.
  
  ```
  htseq-counts -i no myfile.sam genes.gtf>output.count
  
  ```
  
  What is wrong here ? Are there any alternatives to htseq-count?
  
  **Tags:** rna-seq
  
  > **Comments:**
  > **username_1**: Help us to help you. What does "not working" mean? Please post relevant error messages, if any.  
  > **username_0**: I runs well and gives me the count file. But there are zero counts for all the genes. At the end of count files it scores most of the genes are on --alignment_not_unique.  
  > **username_0**: I tried kallisto and it seems to work fine with kallisto.I can see counts for the multiple genes in tsv file generated by kallisto.  
  > **username_1**: Is that the actual command you ran? Because the "no" in `-i no myfile.sam` is odd, and since kallisto is returning some reasonable counts we can assume the issue with the htseq command and not the alignments (which was my 1st thought).  
  > **username_1**: Speaking of kallisto, it is also fine to use those results for your analysis, unless that there a specific reason to use `htseq-count`.  
  > **username_0**: And I gave a shot to "Salmon" too. It is awesome. Basically it works like Kallisto. Thanks for your help guys.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2018-04-22. Score: 2
  
  I m not sure about htseq-counts but I would suggest go for featureCounts, I will update my answer and share the script/command. Give it a try
  
  the command i use
  
  ```
  featureCounts -T 50 -C -p -t exon -g gene_id -a /run/media/data2/gencode.v21.annotation.gtf  -o PRIMARY_CELL.txt $(ls *.bam | sort )
  
  ```
  
  > **Comments:**
  > **username_0**: Thanks. I haven't use featureCounts. I found that it could run on R. Hopefully it works.  
  > **username_2**: yes you can but it takes lot of memory  
  > **username_0**: I am running on cluster. But, I have a question here. I have .sam files obtained from HISAT2 which were generated from the paired fastq files. Can I use that .sam files directly for feature counts ? Do I need to sort the sam file and then use feature counts ?  
  > **username_0**: I used the following commands  fcounts <- featureCounts(files=“reads.sam”,genome="genes.gtf").    And my results were:                                                                        Unassigned_NoFeatures = 5305153, and Unassigned_Unmapped=49253221. So, none of the genes were mapped. Any idea what could have gone wrong here ?  
  > **username_2**: i have updated my answer see if that helps becuase i never use the sub-read package in R as such , i think you need to convert it into bam files...that would be better...  
  > **username_0**: For some reason I was not able to get any of my reads mapped. But I was able to do my analysis using Salmon.  
  > **username_2**: it shouldn't be case may be some minor issue because i use star to align data and then to get reads i use featureCounts ,in star i get bam sorted file as my output but I don;t think if you don;t get sorted files you wont be able to get reads using featureCounts ..but anyways it worked may be you can give it a try again..  
  > **username_0**: Yes, I found a lot of papers using STAR aligner. I will give it a try. Thanks.  
  
  ---
  
  