Amino acid frequencies histogram with letters [duplicate] - r

This question already has answers here:
Plotting a "sequence logo" using ggplot2?
(6 answers)
Closed 5 years ago.
I'm trying to get some graphical view of the amino acid composition and frequencies in a peptide library.
I know how to create a basic histogram with R but I often see this kind of plot in publication
Can I achieve something similar with R?

That type of figure is normally produced using WebLogo, or similar software.
There's an R wrapper for WebLogo. It's a few years old, I don't know how well it works.
There is also ggseqlogo (more recent, looks pretty good) and in the Bioconductor package, seqLogo; I don't know if the latter handles peptides.

Related

Plot all pairs of variables in R data frame based on column type [duplicate]

This question already has answers here:
Scatterplot matrixes with boxplots for categorical data
(1 answer)
Create a matrix of scatterplots (pairs() equivalent) in ggplot2
(4 answers)
Closed 29 days ago.
This post was edited and submitted for review 28 days ago and failed to reopen the post:
Original close reason(s) were not resolved
I’m fairly sure I saw a package that did this, but I cannot find its name in my notes.
This package produces a plot for each pair of variables in a data frame, but chooses the plot based on the columns’ types. So, two numeric variables would produce a scatterplot. A numeric y and categorical x would produce side-by-side box plots. Like that. It’s this multiple column type ability that distinguishes it from the packages I can find by Googling.
Perhaps I should say that I’m certain I saw it, and didn’t see a bunch of surrounding code with loops or purr calls looping over the data, so I’m guessing there was a package that did it.
You're probably thinking of GGally::ggpairs:
library(GGally)
ggpairs(iris)

get code to reproduce plot of R object [duplicate]

This question already has answers here:
How can I view the source code for a function?
(13 answers)
Closed 7 years ago.
some packages have special plot objects, so when you do plot(object)
it produces one or several plots for this object.
An example is
data("cars")
m <- lm(dist~speed, data=cars)
plot(m)
which produces several plots to this linear model.
How can I get the code to these plots so I can manually reproduce them?
In this case ?plot.lm has some more information, but that is not always the case.
To make it more clear, in this example the first plot is a residuals vs. fitted values plot, which I could get by plot(m$fitted.values, m$residuals). I found this by analysing str(m). In most cases this is not that obvious what the plot of an object does.
You can use the function getAnywhere to see the codes inside a S3 function e.g. plot.lm.
Reference
Use edit(plot) to know the structure of base-R function plot. To know the structure of your object use edit(objName).

How to plot time series clusters in R? [duplicate]

This question already has an answer here:
How can I produce plots like this?
(1 answer)
Closed 9 years ago.
Just read the "Mining time series data" pdf by Ratanamahatana, Lin, Gunopulos and Keogh. Did someone know how to visualize time series clusters in R like in the Figure 1.7?
You can visualize 100s of Time Series sequences with Sparklines. If you also want to the Hierarchical ordering, the you could attain that in 2 steps.
Sort your data.frame of Times Series sequences by their multi-level clusters. (This assumes that you have computed the cluster hierarchy for each series.)
Download and install the SparkTable in your R setup. Now plot the Sparklines for your TS sequences. Take a look at this Inside-R page for SparkEPS.
This answer on statExchange is exactly what you need for the plotting part, so I am not reproducing the same example here.
Hope that helps.
This figure most likely is made with a drawing program, not with a data mining software.
Nobody would run cluster analysis on 6 observations like this. It's easier to look at them visually and do it manually than figuring out how to have a program visualize it this way.

Graph: extract faces [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to find closed loops in graph networks
I have a question regarding graphs. I need to extract all the faces of a graph (imagine a street network where I have to extract all the "blocks"). If you think of a typical checkerboard pattern (e.g. Manhattan) most faces have 4 edges und 4 nodes, but the whole thing should work for other possibilities too (where a face has more than 4 edges for instance).
How can I do that? I thought of diverse things and tried to google it but I did not found a satisfying answer.
Thanks!!
You might be looking for all cycles of length n. Modulo certain conditions, the set of all such cycles will correspond to the "faces" you seek.
If you use this approach, it will become significant if your graphs are directed or not.

Multiple Bar plot in one graphs in R [duplicate]

This question already has an answer here:
Closed 12 years ago.
Possible Duplicate:
Multiple Bar plot in one graphs in R
Hi,
I'm a beginner to R.
I need to create a graph like
http://i.stack.imgur.com/az56z.jpg
I dont know how to produce my entire dataset. The basic idea is some exon id would have more than one subgroups. I need to plot all the values in bar plots within that exon id
How can I do that in R?
I had to do R in my stats class last semester. For the future if you google r-code it yields better results. I know that just searching for r always makes annoying results.
If you set up your dataset as a value say
library(gdata)
dataset = read.csv('blahh.csv')
barplot(dataset, main="blahh",
xlab="blahh")

Resources