Question: Box plot and genetic data
0
gravatar for L_LANKA
13 days ago by
L_LANKA0
L_LANKA0 wrote:

Hi! I have a question about box plot and data. I made the correlation analysis Spearman. I see a positive connection between gene and phenotypic expression. For example, I have gene AAAA where 1 and 3 - homozygous and 2- heterozygote. I have information about temperature and I make graduation this information from 1 to 8 (1- 36.0-36.5; 2- 36.6 - 37.0 etc). Can I see how genotype correlation with phenotype in box plot graphic? (For example, if a patient has genotype 2 (C\T) so he\she can has temperature from 4 to 6). enter image description here

R gene • 135 views
ADD COMMENTlink modified 12 days ago by Hamid Ghaedi570 • written 13 days ago by L_LANKA0

Can you edit your post and include some example data? It's difficult to help without more specific information.

ADD REPLYlink written 13 days ago by rpolicastro2.0k

Ok, no problem! :) I made a table and a temperature encryption key.

ADD REPLYlink written 13 days ago by L_LANKA0
1
gravatar for rpolicastro
12 days ago by
rpolicastro2.0k
rpolicastro2.0k wrote:

Some example data.

df <- data.frame(
  patient=sprintf("C%s", seq_len(10)),
  genotype=sample(seq_len(3), 10, replace=TRUE),
  temperature=sample(seq_len(7), 10, replace=TRUE)
)

> head(df, 5)
  patient genotype temperature
1      C1        1           4
2      C2        3           1
3      C3        1           3
4      C4        2           2
5      C5        1           6

A boxplot using ggplot2.

library("tidyverse")

df %>%
  mutate(genotype=as_factor(genotype)) %>%
  ggplot(aes(x=genotype, y=temperature)) +
    geom_boxplot()

enter image description here

Or a stacked barplot as Hamid Ghaedi correctly pointed out.

df %>%
  mutate(across(!patient, as_factor)) %>%
  ggplot(aes(x=genotype, fill=temperature)) +
    geom_bar(position="fill") +
    scale_fill_viridis_d()

enter image description here

ADD COMMENTlink modified 12 days ago • written 12 days ago by rpolicastro2.0k
1
gravatar for Hamid Ghaedi
12 days ago by
Hamid Ghaedi570
Canada
Hamid Ghaedi570 wrote:

Important notice: Box-plot is usually use to show how a quantitative variable is distributed. Especially it does a great job when diffrneces in variance is significant between the groups and you expect to have some outliers ( Like gene expression data). Since you have discretized the tempreature data, using a box-plot for visualization does not make sense anymore, however, you can plot your original tempreature data as box-plot.

Now you have frequency data of tempreature per genotype, you can viusalize the data using a barplot (or prefreably stacked barplot).

ADD COMMENTlink modified 12 days ago • written 12 days ago by Hamid Ghaedi570
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2165 users visited in the last hour