I'm trying to figure out how to draw combined average profile graphs in R. I have 4 files, each with 2 columns of values. Any help given would be useful. Thank you.
Yes I have. I'm trying to use R to plot TSS binding site location vs log-likelihood values. I believe this falls under the purview of "Bioinformatics". Hence posted here.
ADD REPLY
• link
updated 2.6 years ago by
Ram
44k
•
written 9.8 years ago by
aj123
▴
120
0
Entering edit mode
It'd help if you showed an example of what you're trying to do. I assume you're trying to just plot average lines in different colors, in which case ggplot2 makes this quite simple (not that you can't use the base graphics, they're just less convenient).
Average log-likehood ratios (0.1, 0.3, 0.5 etc) on Y-axis vs.distance to TSS binding site (in bp ie -5000 -2500, 0, +2500, +5000) lines on X axis. 4 lines for the 4 tss1, 2, 3, 4 files. each of the 4 files has log-likehood ration column and distance to TSS column. So I guess yes, 4 lines in diff colors.
ADD REPLY
• link
updated 2.6 years ago by
Ram
44k
•
written 9.8 years ago by
aj123
▴
120
The most convenient method is to just use ggplot2. If you make a single data.frame from your 4 files and add a column that designates what column things came from then just:
g <- ggplot(some_data_frame, aes(x=position, y=average_value, colour=some_file_designator))
g <- g + geom_line()
g
Hello anjanaram1!
We believe that this post does not fit the main topic of this site.
This belongs better on stackoverflow (or its statistics division).
For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.
If you disagree please tell us why in a reply below, we'll be happy to talk about it.
Cheers!
the two values are "TSS binding site affinities" vs. log likelihood ratios.
Even so, this is more of a graphing question than bioinformatics. Have you tried searching on stack overflow?
Yes I have. I'm trying to use R to plot TSS binding site location vs log-likelihood values. I believe this falls under the purview of "Bioinformatics". Hence posted here.
It'd help if you showed an example of what you're trying to do. I assume you're trying to just plot average lines in different colors, in which case ggplot2 makes this quite simple (not that you can't use the base graphics, they're just less convenient).
Average log-likehood ratios (0.1, 0.3, 0.5 etc) on Y-axis vs.distance to TSS binding site (in bp ie -5000 -2500, 0, +2500, +5000) lines on X axis. 4 lines for the 4 tss1, 2, 3, 4 files. each of the 4 files has log-likehood ration column and distance to TSS column. So I guess yes, 4 lines in diff colors.