BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Nathalie1
Obsidian | Level 7

Hello,

I work as beginner in bioinformatics. I must do a MA plot. It is possible with R. But I'm not an experimented user of R.

Can I realize with SAS ?

I don't find any response in the community.

Thank you for help.

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

Thanks for providing the missing third variable. It is not obvious (at least to me) what values of edgemyoPV indicate "significance", because -- contrary to my expectations --

  • edgemyoPV takes values from 0 to 74.4 with a mean of 2.3
  • edgemyoPV has a significant positive correlation with the absolute value of edgemyoFC.

But once you know the criterion for "significant" edgemyoPV values, the implementation is easy: Just replace the assignment statement r=choosec(...) in my suggested DATA step by

if criterion for significant edgemyoPV
then r=choosec(sign(edgemyofc)+2,'Down','None','Up');
else r='None';

where "criterion for significant edgemyoPV " stands for a logical expression involving edgemyoPV, for example edgemyoPV>=1.

 

(Edit: Made the definition of r more similar to the earlier suggestion.)

View solution in original post

6 REPLIES 6
ballardw
Super User

Can you point us to at least an example of an "MA" plot?

MA is jargon for your field. It may be known as something else to us not in bioinformatics.

 

Be prepared to discuss, as in provide examples, of your data. Dummy data is okay as long as it provides similar information to what you have.

 

Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the </> icon or attached as text to show exactly what you have and that we can test code against.

Nathalie1
Obsidian | Level 7

Thank you for your response.

The MA plot is on this picture. Axis X = LogCPM (Average Mean) and axis Y = edgemyoFC (Log2 Fold Change).

I insert a table with the two variables. Each point is a gene.

I MA plot.png

FreelanceReinh
Jade | Level 19

Hello @Nathalie1,

 

I think you will need a third variable defining the color of the scatter points. Below is an example using an arbitrarily defined variable r just for demonstration.

 

Then you can use the SCATTER statement of PROC SGPLOT with LogCPM as the x variable, edgemyoFC as the y variable and the third variable as the group variable:

/* Create sample data for demonstration */

data have;
set test;
if n(edgemyofc,logcpm)=2;
length r $4;
r=choosec(sign(round(edgemyofc*exp(logcpm/3)))+2,'Down','None','Up'); /* arbitrary definition */
label logcpm='Average Expression'
      edgemyofc='Log2 Fold Change'
      r='Regulated';
run;

proc sort data=have;
by r;
run;

title 'Average Expression vs. Log2 Fold Change';

proc sgplot data=have;
styleattrs datacontrastcolors=(lime gray red);
scatter x=logcpm y=edgemyofc / group=r markerattrs=(symbol=circlefilled size=5pt);
keylegend / position=right noborder valueattrs=(size=8);
run;

title;

 

 

Nathalie1
Obsidian | Level 7

Thank you very much for your response. You already did a lot of for me.

A column missed, it is the pvalue (table test).

I obtain a graph but  with the pvalue missing, I don't know if it is correct.

 

Here, is a code in R.

 

Generate a plot of log fold change versus mean expression (MA plot)

## S4 method for signature 'data.frame'
plotMA( object, ylim = NULL,
  colNonSig = "gray32", colSig = "red3", colLine = "#ff000080",
  log = "x", cex=0.45, xlab="mean expression", ylab="log fold change", ... )

Arguments

object

A data.frame with (at least) three columns, the first containing the mean expression values (for the x-axis), the second the logarithmic fold change (for the-y axis) and the third a logical vector indicating significance (for the colouring of the dots).

ylim

The limits for the y-axis. If missing, an attempt is made to choose a sensible value. Dots exceeding the limits will be displayed as triangles at the limits, pointing outwards.

colNonSig

colour to use for non-significant data points.

colSig

colour to use for significant data points.

colLine

colour to use for the horizontal (y=0) line.

log

which axis/axes should be logarithmic; will be passed to plot.

cex

The cex parameter for plot.

xlab

The x-axis label.

ylab

The y-axis label.

...

Further parameters to be passed through to plot.

FreelanceReinh
Jade | Level 19

Thanks for providing the missing third variable. It is not obvious (at least to me) what values of edgemyoPV indicate "significance", because -- contrary to my expectations --

  • edgemyoPV takes values from 0 to 74.4 with a mean of 2.3
  • edgemyoPV has a significant positive correlation with the absolute value of edgemyoFC.

But once you know the criterion for "significant" edgemyoPV values, the implementation is easy: Just replace the assignment statement r=choosec(...) in my suggested DATA step by

if criterion for significant edgemyoPV
then r=choosec(sign(edgemyofc)+2,'Down','None','Up');
else r='None';

where "criterion for significant edgemyoPV " stands for a logical expression involving edgemyoPV, for example edgemyoPV>=1.

 

(Edit: Made the definition of r more similar to the earlier suggestion.)

Nathalie1
Obsidian | Level 7
Thank you very much for your help. It is OK for me.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 737 views
  • 9 likes
  • 3 in conversation