Loading...
 

Profile_r_heatmaps_template

{if $smarty.get.itemId gt 0}

{wikiplugin _name=rr loadandsave=1 wikisyntax=0 svg=1 pdf=1}

    1. if you still can't get through the proxy, double-check that the previous command worked with:
  1. Sys.getenv("http_proxy")

      1. Check and get File 1

if (file_type == "text/csv" | file_type == "text/comma-separated-values" | file_type == "text/plain") {literal} { {/literal}
fileurl1 <- "http://{$smarty.server.SERVER_NAME}{$smarty.server.PHP_SELF|regex_replace:'/(tiki-index.php|tiki-index_raw.php)/':''}tiki-download_item_attachment.php?itemId={$f_itemId}&fieldId=$profileobject:field_10$&display=inline"
expresFileNameTmp <- read.csv(fileurl1, sep=",");

  1. Convert decimal separator value in the form for its equivalent character in R
if ( length(grep("dot", "{$f_$profileobject:field_24$}") )==1) {literal} { {/literal} # case for dot .
decChar <- ".";
{literal} } {/literal} else if ( length(grep("comma", "{$f_$profileobject:field_24$}") )==1) {literal} { {/literal} # case for comma ,
decChar <- ",";
{literal} } {/literal} else {literal} { {/literal} # case for comma ,
cat("\nWe could not identify your choice of decimal separator for the expressions file. Using dot '.' by default, then.\n");
decChar <- ".";
{literal} } {/literal}

  1. Start case for semicolon ; (csv2)
if ( length(grep("csv2", "{$f_$profileobject:field_11$}") )==1) {literal} { {/literal}
expresFileNameTmp <- read.csv(fileurl1, sep=";", dec=decChar, row.names=1);
  1. cat("Semicolons\n") # XXX
{literal} } {/literal} # end of case for semicolon

  1. Start case for comma , (csv)
if ( length(grep("csv -", "{$f_$profileobject:field_11$}") )==1) {literal} { {/literal}
expresFileNameTmp <- read.csv(fileurl1, sep=",", dec=decChar, row.names=1);
  1. cat("Commas\n") # XXX
{literal} } {/literal} # end of case for semicolon

  1. Start case for tabs \t (txt)
if ( length(grep("txt", "{$f_$profileobject:field_11$}") )==1) {literal} { {/literal}
expresFileNameTmp <- read.csv(fileurl1, sep="\t", dec=decChar, row.names=1);
  1. cat("Tabs\n") # XXX
{literal} } {/literal} # end of case for semicolon

  1. Remove extra symbol column if present (coming from the Basic Pipe for Microarrays results)
if ( length(expresFileNameTmp$symbol) > 0) {literal} { {/literal} # case when column symbol is found in the expressions file
ncolsymbol <- grep("symbol",colnames(expresFileNameTmp))
expresFileNameTmp <- expresFileNameTmp-ncolsymbol
cat("\nWe noted that you didn't remove the column with symbols. We removed it for you.\n");
cat("\n");
{literal} } {/literal}

  1. convert to matrix (needed for the R package to create the HeatMap.
expresNum <- as.matrix(expresFileNameTmp)

write.table(expresNum, sep="\t",
row.names=TRUE, quote=FALSE,
file="expres.filtered.ALL.txt")

{literal} } {/literal}


      1. Check and get File 2
if (file_type == "text/csv" | file_type == "text/comma-separated-values" | file_type == "text/plain") {literal} { {/literal}
fileurl2 <- "http://{$smarty.server.SERVER_NAME}{$smarty.server.PHP_SELF|regex_replace:'/(tiki-index.php|tiki-index_raw.php)/':''}tiki-download_item_attachment.php?itemId={$f_itemId}&fieldId=$profileobject:field_20$&display=inline"

  1. Start case for semicolon ; (csv2)
if ( length(grep("csv2", "{$f_$profileobject:field_25$}") )==1) {literal} { {/literal}
colorsForColumnsTmp <- read.csv(fileurl2, sep=";");
# end of case for semicolon
{literal} } {/literal} else if ( length(grep("csv -", "{$f_$profileobject:field_25$}") )==1) {literal} { {/literal} # Start case for comma , (csv)
colorsForColumnsTmp <- read.csv(fileurl2, sep=",");
# end of case for commas
{literal} } {/literal} else if ( length(grep("txt", "{$f_$profileobject:field_25$}") )==1) {literal} { {/literal} # Start case for tabs \t (txt)
colorsForColumnsTmp <- read.csv(fileurl2, sep="\t");
# end of case for tabs
{literal} } {/literal} else {literal} { {/literal} # end of case for semicolon
cat("We could not find any value for the parameter 'Type of file with Color names for columns' \n") # XXX
{literal} } {/literal}

write.table(colorsForColumnsTmp, sep="\t",
row.names=FALSE, col.names=c("Column", "Group"), quote=FALSE,
file="colorsForColumns.txt")


require(easyHeatMap)

clustPar<-newClustPar(expres = NULL , # We'll give it a file attached to the tracker item
expresFileName ="expres.filtered.ALL", # For a file "foo.txt", you have to indicate here "foo" (without extension)
fileType = "txt",
comparisonName = "ALL",
Title = "{$f_$profileobject:field_13$}",
numClusters = 0, # Confirm that with zero nothing is done
plotProfiles=FALSE,
rowDistance = "{$f_$profileobject:field_14$}",
colDistance = "{$f_$profileobject:field_15$}",
RowVals = {$f_$profileobject:field_16$},
ColVals = {$f_$profileobject:field_17$},
escala = "{$f_$profileobject:field_18$}",
colorsSet = {$f_$profileobject:field_19$}, #colors,
colsForGroups = NULL,
colsForGroupsFileName="colorsForColumns",
densityInfo = '{$f_$profileobject:field_21$}',
cexForColumns = {$f_$profileobject:field_22$},
cexForRows = {$f_$profileobject:field_23$},
outputDir=getwd(),
toPDF = FALSE,
)

cat("<b>{$f_$profileobject:field_7$}</b>: "); cat("{$f_$profileobject:field_8$} <hr />")

  1. HeatMap generation
hm.ALL <- doHMAnalysis(clustPar)

{literal} } {/literal} else {literal} { {/literal}

cat("There are no data files attached for this HeatMap yet, or that file is not a file with tab or comma separated values. \n\nPlease, upload a tab or csv file through the box above (using comma or semicolon to separate values, and point to indicate decimals (if any).");

{literal} } {/literal}

{/wikiplugin}

{/if}