Entering edit mode
I am having problems importing my HTSeq count data- it tells me the counts are zero when this is clearly not the case when head outputs:
>head(WTCHG_862660_71955267)
GeneID WTCHG_862660_71955267
1 A1BG 148
2 A1BG-AS1 196
3 A1CF 0
4 A2M 1
5 A2M-AS1 79
6 A2ML1 0
>
This is the script:
#this works
metadata <- read.csv("Meta_data_clones_vs_vbneg.csv")
metadata
print(metadata)
#this adds in a column to say what the file name is in the metadata file
metadata = mutate(metadata, countFile = paste0(metadata$SampleName, ".stranded-counts.txt"))
metadata <- lapply(metadata, as.character)
metadata
#this works and makes the sample table
mysampleTable <- data.frame(sampleName = metadata$SampleName, fileName = metadata$countFile, condition = metadata$Condition)
print(mysampleTable)
#this creates the table of counts
DESeq2Table <- DESeqDataSetFromHTSeqCount(sampleTable = mysampleTable, directory = "H:/R/htseq_counts_vbneg_pos/", design = ~condition, ignoreRank = FALSE)
# include your problematic code here with any corresponding output
#Error in DESeqDataSet(se, design = design, ignoreRank) :
all samples have 0 counts for all genes. check the counting script.
# please also include the results of running the following in an R session
sessionInfo( )
R version 4.1.1 (2021-08-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)
Matrix products: default
locale:
[1] LC_COLLATE=English_United Kingdom.1252
[2] LC_CTYPE=English_United Kingdom.1252
[3] LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252
attached base packages:
[1] parallel stats4 stats graphics grDevices utils datasets
[8] methods base
other attached packages:
[1] DESeq2_1.32.0 SummarizedExperiment_1.22.0
[3] Biobase_2.52.0 MatrixGenerics_1.4.3
[5] matrixStats_0.61.0 GenomicRanges_1.44.0
[7] GenomeInfoDb_1.28.4 forcats_0.5.1
[9] stringr_1.4.0 dplyr_1.0.7
[11] purrr_0.3.4 readr_2.0.1
[13] tidyr_1.1.3 tibble_3.1.4
[15] ggplot2_3.3.5 tidyverse_1.3.1
[17] IRanges_2.26.0 S4Vectors_0.30.0
[19] BiocGenerics_0.38.0
loaded via a namespace (and not attached):
[1] bitops_1.0-7 fs_1.5.0 usethis_2.0.1
[4] devtools_2.4.2 bit64_4.0.5 lubridate_1.7.10
[7] RColorBrewer_1.1-2 httr_1.4.2 rprojroot_2.0.2
[10] tools_4.1.1 backports_1.2.1 utf8_1.2.2
[13] R6_2.5.1 DBI_1.1.1 colorspace_2.0-2
[16] withr_2.4.2 tidyselect_1.1.1 prettyunits_1.1.1
[19] processx_3.5.2 bit_4.0.4 compiler_4.1.1
[22] cli_3.0.1 rvest_1.0.1 xml2_1.3.2
[25] desc_1.4.0 DelayedArray_0.18.0 scales_1.1.1
[28] genefilter_1.74.0 callr_3.7.0 XVector_0.32.0
[31] pkgconfig_2.0.3 sessioninfo_1.1.1 dbplyr_2.1.1
[34] fastmap_1.1.0 rlang_0.4.11 readxl_1.3.1
[37] rstudioapi_0.13 RSQLite_2.2.8 generics_0.1.0
[40] jsonlite_1.7.2 BiocParallel_1.26.2 RCurl_1.98-1.5
[43] magrittr_2.0.1 GenomeInfoDbData_1.2.6 Matrix_1.3-4
[46] Rcpp_1.0.7 munsell_0.5.0 fansi_0.5.0
[49] lifecycle_1.0.1 stringi_1.7.4 zlibbioc_1.38.0
[52] pkgbuild_1.2.0 blob_1.2.2 grid_4.1.1
[55] crayon_1.4.1 lattice_0.20-45 splines_4.1.1
[58] Biostrings_2.60.2 haven_2.4.3 annotate_1.70.0
[61] KEGGREST_1.32.0 hms_1.1.1 locfit_1.5-9.4
[64] ps_1.6.0 pillar_1.6.2 pkgload_1.2.2
[67] geneplotter_1.70.0 reprex_2.0.1 XML_3.99-0.8
[70] glue_1.4.2 remotes_2.4.1 BiocManager_1.30.16
[73] modelr_0.1.8 png_0.1-7 vctrs_0.3.8
[76] tzdb_0.1.2 testthat_3.0.4 cellranger_1.1.0
[79] gtable_0.3.0 assertthat_0.2.1 cachem_1.0.6
[82] xtable_1.8-4 broom_0.7.9 survival_3.2-13
[85] AnnotationDbi_1.54.1 memoise_2.0.0 ellipsis_0.3.2
I tried manually adding a column with row numbers (using the rowid_to_column) function but it returned the same error message.
Anyone help?? I've going round and round for days with this.
I think it would be hard to help you as it stands, could you share what
mysampleTable
looks like ? Have you checked the filenames correctly match with your directory ?This is the head of
mysampleTable
and yes the file names do match.Everything seems fine here, so I suppose there might be a problem with the txt files. Is there any row header in your txt files ? If yes, just remove it and it might solve the issue
Yes! There was a header in the text files that just read '0'. I removed it manually and it works fine now.