I have a featureCounts results file that looks like the snippet at bottom. I have another file for the parent that looks similar. How do I load these into DESeq2?(I don't know R well at all). I found something that purports to solve this problem: https://digibio.blogspot.com/2017/11/rna-seq-analysis-hisat2-featurecounts.html, but I can't tell what it's trying to do and it chokes on:
>colnames(counts)[6:11]=str_split_fixed(colnames(counts)[6:11],"\\.",6)[,5]
Error in names(x) <- value :
'names' attribute [11] must be the same length as the vector [7]
The code from the above referenced link looks like:
> library(DESeq2)
> setwd("~/example_data/practice_rnaseq_data/featurecounts/")
> counts=read.csv("counts2.txt", sep="", head=T, skip=1, row.names = "Geneid")
> colnames(counts)[6:11]
> colnames(counts)[6:11]=str_split_fixed(colnames(counts)[6:11],"\\.",6)[,5]
> colnames(counts)[6:11]
> samples=cbind(colnames(counts)[6:11],str_split_fixed(colnames(counts)[6:11],"_",3)[,2])
> rownames(samples)=samples[,1]
> samples=as.data.frame(samples[,-1])
> colnames(samples)="condition"
> all(rownames(samples) %in% colnames(counts))
> dds=DESeqDataSetFromMatrix(countData = counts[,6:11],colData = samples,design = ~ condition)
Thanks for your help, Craig
#Program:featureCounts v1.6.4; Command:"featureCounts" "-t" "gene" "--extraAttributes" "gene_name" "-a" "/scratch/chunter/Merged/bonobo_chimp.gtf" "-o" "/public/home/chunter/Chonobo/alignments/Dennis/Merged/FullGenome/bonobochimp.fc" "/public/home/chunter/Chonobo/alignments/Dennis/Merged/FullGenome/bonobochimp_aln.sam"
Geneid Chr Start End Strand Length gene_name /public/home/chunter/Chonobo/alignments/Dennis/Merged/FullGenome/bonobochimp_aln.sam
ENSPPAG00000015487 B_2B 114156142 114156248 + 107 RF00026 0
ENSPPAG00000006288 B_2B 114192967 114231750 - 38784 SLC35F5 7
ENSPPAG00000016250 B_2B 114196346 114196424 - 79 MIR4782 0
ENSPPAG00000040697 B_2B 114373392 114445729 + 72338 ACTR3 29
ENSPPAG00000002669 B_2B 114479033 114479117 - 85 NA 0
ENSPPAG00000018872 B_2B 114495289 114495504 - 216 RF00012 0
ENSPPAG00000014590 B_2B 114895226 114895399 + 174 RF00004 0
ENSPPAG00000025416 B_2B 114920488 116362960 + 1442473 DPP10 0
ENSPPAG00000044705 B_2B 117049987 117054218 - 4232 NA 0
ENSPPAG00000019034 B_2B 117687182 117687242 - 61 RF00066 0
ENSPPAG00000033473 B_2B 118358168 118375910 + 17743 DDX18 11
ENSPPAG00000028222 B_2B 118403125 118447025 + 43901 NA 0
ENSPPAG00000039658 B_2B 118458782 118557824 - 99043 CCDC93 10
ENSPPAG00000002117 B_2B 118560035 118560319 + 285 RF00017 0
ENSPPAG00000033913 B_2B 118632402 118652647 + 20246 INSIG2 8
ENSPPAG00000033812 B_2B 118864453 118867104 - 2652 NA 5028
ENSPPAG00000044544 B_2B 119392495 119396304 - 3810 NA 0
ENSPPAG00000038285 B_2B 119475677 119520385 + 44709 MARCO 0
ENSPPAG00000035484 B_2B 119679840 119686120 - 6281 C1QL2 0
ENSPPAG00000005832 B_2B 119692903 119693196 + 294 RF00017 0
ENSPPAG00000029473 B_2B 119752363 119787051 + 34689 STEAP3 7
ENSPPAG00000041702 B_2B 119823756 119887553 - 63798 C2orf76 6
ENSPPAG00000038470 B_2B 119887728 119892986 + 5259 NA 248