merging data; remove extra rows
2
0
Entering edit mode
2.3 years ago
Rob ▴ 170

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 • 1.3k views
ADD COMMENT
0
Entering edit mode
2.3 years ago
tomas4482 ▴ 430

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.

ADD COMMENT
0
Entering edit mode

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?

ADD REPLY
0
Entering edit mode

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.

ADD REPLY
0
Entering edit mode
2.3 years ago

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

ADD COMMENT
0
Entering edit mode

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

ADD REPLY

Login before adding your answer.

Traffic: 3002 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6