Renaming Bedtools outputs individually
I ran a Bedtools function to extract particular segments from a genome I am working with and got an output with all of them however they are all named with the word "unspecified" and a number. I want to name these all using R scripts based on their chromosome location but I am not sure how to go about this at all. Any help?
• 1,296 views
•
link
1 answer
Let's say your file has the following columns:
- chromosome
- start
- end
- name
You read this into R as "data":
data <- read.table("file.bed", sep = "\t", colnames = c("chromosome", "start", "end", "name")
In R, it's pretty easy to rename based on position:
data[data$chromosome == "I" & data$start > 300 & data$start <1000, "name"] <- "segment_name"
• 0 views
•
link
Log in to answer this question.