This is a test version of Biostars. For the public version, visit https://www.biostars.org.
merging data; remove extra rows

Hi all I have 450 files to merge, but each of them has 6 rows that I don't need and should be removed from the files.

Is there any code to remove the 6 rows and merge them Or merge them first and remove the 6 rows?

Here is what one of the files looks like:

remove-Rows

rna-seq

2 answers

In R, read.table or other similar functions can skip first N rows using skip = 6. In python, read_csv in pandas module can skip rows by skiprows = 6.

Remember to add header = False because the output does not have headers. You can name the columns using col.names = c("a","b","c") in R or names = ["a","b","c"] in python.

Thank you tomas The problem is I have 450 files each in one folder. How can I read all these at the same time?

Is it possible to do it for multiple files?

You can use cbind and for loop in R to merge all data. list.files(dir) will list all file names. You can make the loop and assign filenames as column names.

Is this RSEM format? Or some other format that txinport can handle?

Hi it is not RSEM format and every file has different columns that you can see in the image above. such as tpm, fpkm

Log in to answer this question.