Hello,
After counting genomic features with featureCounts
featureCounts -F GTF -t exon -g gene_id -f -O --minOverlap 2 -M --fraction -J -a annotation.gtf -o out.txt 1_sorted.bam 2_sorted.bam 3_sorted.bam 4_sorted.bam
I decided to use the output file as an input for edgeR to create the DGElist.
First I used the read.delim function in R to read the text file and create a table. The command I used is shown below.
counts <- read.delim("~/Desktop/thesis_bioinformatics/chick_fl_hl_comparison/counts_fcounts.txt", sep="\t", header = TRUE, check.names = FALSE, stringsAsFactors = FALSE)
After getting the table, I tried using it to create the DGElist by using the commands below.
group<-c(1,1,2,2)
y <- DGEList(counts=counts, group=group)
This outputs an error message that says Error: Negative counts not allowed. I followed someones advice from this post Question: Error when running edgeR, where they suggest using is.na(counts) || counts < 0 to check if NA or negative counts are present. I checked all the columns of my counts file and the only column where the output was true was the Strand column, which describes the directionality. I removed this column from the table and tried running DGElist again with a counts file that did not have the Strands column. The same error message appeared.
I'm pretty confused as to why I get this error message when none of my counts are negative. Any help would be appreciated.
Cheers, Fjodor
The start of my counts table looks something like this:
Geneid Chr Start End Strand Length 1 2 3 4
1 ENSGALG00000054818 1 9774 10061 - 288 # # # #
Did you manipulate
out.txtprior to reading it with theread.delimcommand? With this command you should not be able to read afeatureCountsoutput. It should complain about the header line (starting with# Program....) not matching the number of columns. Please showhead -n 10 counts_fcounts.txtYes, I did remove the header and gave the counts columns easier names.