I have a combined file consisting of gene columns and its respective logFC values. I have used this R code for making this combined file.
library(data.table)
file_list <- list.files(pattern = "*.txt" )
import_files <- lapply(file_list,read.table,stringsAsFactors =FALSE)
rbinded_files <- na.omit(rbindlist(import_files,idcol="file"))
merged_data = dcast(rbinded_files,V2 ~file,fun=max, na.rm=TRUE)
But i didn't get the column headers which should be the filenames. Ex- my filename is output_GSE89333.txt. I want only GSE89333_logFC to be written in column headers.
ABAT NA 1.674985738
ABCC5 0.452140288776222 NA
This is my file. I want first column header as Genenames and other column headers as their respective filenames. How to add code for this in my existing code? Please suggest me. Thanks in advance
Can you add an example of what the inside of one of the files looks like, and an example of what you want the output to be?
The file looks like:
And i want