Repository 'flowtext_scatterplot'
hg clone https://toolshed.g2.bx.psu.edu/repos/immport-devteam/flowtext_scatterplot

Changeset 1:754d511df1a3 (2020-07-14)
Previous changeset 0:cc2266d3e611 (2017-02-27)
Commit message:
"planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowtext_scatterplot commit 2944aa6b74efcdb8d5cbf31abf27b352dcad9ac9"
added:
getDensityPlots_text.R
getDensityPlots_text.xml
static/images/flowtools/flowtextgraph.png
test-data/graph.pdf
test-data/graph.png
test-data/graph2.png
test-data/input.flowtext
removed:
flowtext_scatterplot/getDensityPlots_text.R
flowtext_scatterplot/getDensityPlots_text.xml
flowtext_scatterplot/static/images/flowtools/flowtextgraph.png
flowtext_scatterplot/test-data/graph.pdf
flowtext_scatterplot/test-data/graph.png
flowtext_scatterplot/test-data/graph2.png
flowtext_scatterplot/test-data/input.flowtext
b
diff -r cc2266d3e611 -r 754d511df1a3 flowtext_scatterplot/getDensityPlots_text.R
--- a/flowtext_scatterplot/getDensityPlots_text.R Mon Feb 27 12:58:47 2017 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
[
@@ -1,153 +0,0 @@
-# Density Plot Module for Galaxy
-# ggplot2
-######################################################################
-#                  Copyright (c) 2016 Northrop Grumman.
-#                          All rights reserved.
-######################################################################
-#
-# Version 1
-# Cristel Thomas
-#
-#
-
-library(ggplot2)
-library(grid)
-# Multiple plot function
-# from http://www.cookbook-r.com/Graphs/Multiple_graphs_on_one_page_%28ggplot2%29/
-# ggplot objects can be passed in ..., or to plotlist (as a list of ggplot objects)
-# - cols:   Number of columns in layout
-# - layout: A matrix specifying the layout. If present, 'cols' is ignored.
-#
-# If the layout is something like matrix(c(1,2,3,3), nrow=2, byrow=TRUE),
-# then plot 1 will go in the upper left, 2 will go in the upper right, and
-# 3 will go all the way across the bottom.
-#
-multiplot <- function(..., plotlist=NULL, file, cols=1, layout=NULL) {
-  # Make a list from the ... arguments and plotlist
-  plots <- c(list(...), plotlist)
-  numPlots = length(plots)
-
-  # If layout is NULL, then use 'cols' to determine layout
-  if (is.null(layout)) {
-    # Make the panel
-    # ncol: Number of columns of plots
-    # nrow: Number of rows needed, calculated from # of cols
-    layout <- matrix(seq(1, cols * ceiling(numPlots/cols)),
-                    ncol = cols, nrow = ceiling(numPlots/cols))
-  }
-
- if (numPlots==1) {
-    print(plots[[1]])
-  } else {
-    # Set up the page
-    grid.newpage()
-    pushViewport(viewport(layout = grid.layout(nrow(layout), ncol(layout))))
-
-    # Make each plot, in the correct location
-    for (i in 1:numPlots) {
-      # Get the i,j matrix positions of the regions that contain this subplot
-      matchidx <- as.data.frame(which(layout == i, arr.ind = TRUE))
-      print(plots[[i]], vp = viewport(layout.pos.row = matchidx$row,
-                                      layout.pos.col = matchidx$col))
-    }
-  }
-}
-
-generateGraphFromText <- function(input, channels, output, plot_default, flag_pdf, pdf_out) {
-  fcs <- read.table(input, header = TRUE, sep = "\t", check.names = FALSE)
-  ## marker names
-  markers <- colnames(fcs)
-
-  if (plot_default) {
-    channels <- c(grep(colnames(fcs), pattern="Forward scatter", ignore.case=TRUE),
-                  grep(colnames(fcs), pattern="Side scatter", ignore.case=TRUE))
-   if (length(channels) == 0){
-      channels <- c(grep(colnames(fcs), pattern="FSC"),
-                    grep(colnames(fcs), pattern="SSC"))
-      if (length(channels) > 2) {
-        #get first FSC and corresponding SSC
-        channels <- c(grep(colnames(fcs), pattern="FSC-A"),
-                      grep(colnames(fcs), pattern="SSC-A"))
-        if (length(channels) == 0) {
-          channels <- c(grep(colnames(fcs), pattern="FSC-H"),
-                        grep(colnames(fcs), pattern="SSC-H"))
-          if (length(channels) == 0) {
-            channels <- c(grep(colnames(fcs), pattern="FSC-W"),
-                          grep(colnames(fcs), pattern="SSC-W"))
-          }
-        }
-      }
-    }
-    if (length(channels) == 0) {
-      warning('No forward/side scatter channels found, no plots will be generated.')
-   quit(save = "no", status = 10, runLast = FALSE)
-    }
-  }
-
-  nb_markers <- length(channels)
-
-  for (j in nb_markers) {
-    if (channels[j] > length(markers)){
-     warning('Please indicate markers between 1 and ', length(markers))
-     quit(save = "no", status = 10, runLast = FALSE)
-   }
-  }
-
-  plots <- list()
-  i <- 0
-  for (m in 1:(nb_markers - 1)) {
-    for (n in (m+1):nb_markers) {
-      x <- fcs[,channels[m]]
-      y <- fcs[,channels[n]]
-      df <- data.frame(x = x, y = y,
-                       d = densCols(x, y, colramp = colorRampPalette(rev(rainbow(10, end = 4/6)))))
-      p <- ggplot(df) +
-           geom_point(aes(x, y, col = d), size = 0.2) +
-           scale_color_identity() +
-           theme_bw() +
-           labs(x = markers[channels[m]]) +
-           labs(y = markers[channels[n]])
-      i <- i + 1
-      plots[[i]] <- p
-    }
-  }
-  png(output, type="cairo", width=800, height=800)
-      multiplot(plotlist = plots, cols = 2)
-    dev.off()
-  if (flag_pdf){
-    pdf(pdf_out, useDingbats=FALSE, onefile=TRUE)
-      multiplot(plotlist = plots, cols = 2)
-    dev.off()
-  }
-}
-
-args <- commandArgs(trailingOnly = TRUE)
-channels <- ""
-flag_default <- FALSE
-flag_pdf <- FALSE
-pdf_output <- ""
-
-if (args[3]=="None") {
-  flag_default <- TRUE
-} else {
-  if (args[3] == "i.e.:1,3,4"){
-   flag_default <- TRUE
-  } else {
-    channels <- as.numeric(strsplit(args[3], ",")[[1]])
-    for (channel in channels){
-   if (is.na(channel)){
-     quit(save = "no", status = 11, runLast = FALSE)
-   }
-    }
- if (length(channels) == 1){
-   warning('Please indicate more than one marker to plot.')
-   quit(save = "no", status = 10, runLast = FALSE)
- }
-  }
-}
-
-if (args[5] == "TRUE"){
-  pdf_output <- args[6]
-  flag_pdf <- TRUE
-}
-generateGraphFromText(args[2], channels, args[4], flag_default, flag_pdf, pdf_output)
b
diff -r cc2266d3e611 -r 754d511df1a3 flowtext_scatterplot/getDensityPlots_text.xml
--- a/flowtext_scatterplot/getDensityPlots_text.xml Mon Feb 27 12:58:47 2017 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
[
@@ -1,76 +0,0 @@
-<tool id="gen_density_plots_txt" name="Generate scatter plots" version="1.0">
-  <description>for any given markers in a txt-converted FCS file.</description>
-  <requirements>
-    <requirement type="package" version="3.3.0">r</requirement>
-    <requirement type="package" version="2.1.0">r-ggplot2</requirement>
-  </requirements>
-  <stdio>
-    <exit_code range="10" level="fatal" description="Please provide a comma separated list of channels to plot" />
-    <exit_code range="11" level="fatal" description="Please provide numeric values for the list of channels to plot" />
-  </stdio>
-  <command><![CDATA[
-      Rscript --slave --vanilla $__tool_directory__/getDensityPlots_text.R --args "${input}" "${channels}" "${outpng}" $outformat "${outpdf}"
-  ]]>
-  </command>
-  <inputs>
-    <param format="flowtext" name="input" type="data" label="txt-converted FCS file"/>
-    <param name="channels" type="text" label="Markers to plot:" value="i.e.:1,3,4" help="By default, will plot FSC vs SSC if the channels are found."/>
-    <param name="outformat" type="select" label="Output PDF?">
-      <option value="FALSE">No, thank you</option>
-      <option value="TRUE">Yes, please</option>
-    </param>
-  </inputs>
-  <outputs>
-    <data format="pdf" name="outpdf" label="PDF Scatter Plots of ${channels} from ${input.name}">
-      <filter>outformat=="TRUE"</filter>
-    </data>
-    <data format="png" name="outpng" label="Scatter Plots of ${channels} from ${input.name}"/>
-  </outputs>
-  <tests>
-    <test>
-      <param name="input" value="input.flowtext"/>
-      <param name="channels" value="i.e.:1,3,4"/>
-      <param name="outformat" value="TRUE"/>
-      <output name="outpdf" file="graph.pdf" compare="sim_size"/>
-      <output name="outpng" file="graph.png" compare="sim_size"/>
-    </test>
-    <test>
-      <param name="input" value="input.flowtext"/>
-      <param name="channels" value="1,3,5"/>
-      <param name="outformat" value="FALSE"/>
-      <output name="outpng" file="graph2.png" compare="sim_size"/>
-    </test>
-  </tests>
-  <help><![CDATA[
-   This tool allows generation of density scatter plots using ggplot2.
-
------
-
-**Input files**
-
-This tool takes txt-converted FCS files as input.
-
-**Output files**
-
-This tool generates a scatter plot for each marker combination in a single png file. A pdf file can optionally be generated.
-
------
-
-**Example**
-
-*Output*:
-
-.. image:: static/images/flowtextgraph.png
-  ]]>
-  </help>
-  <citations>
-    <citation type="bibtex">@BOOK{,
-      author = {Hadley Wickham},
-      title = {ggplot2: Elegant Graphics for Data Analysis},
-      publisher = {Springer-Verlag New York},
-      year = {2009},
-      isbn = {978-0-387-98140-6},
-      url = {http://ggplot2.org},
-    }</citation>
-  </citations>
-</tool>
b
diff -r cc2266d3e611 -r 754d511df1a3 flowtext_scatterplot/static/images/flowtools/flowtextgraph.png
b
Binary file flowtext_scatterplot/static/images/flowtools/flowtextgraph.png has changed
b
diff -r cc2266d3e611 -r 754d511df1a3 flowtext_scatterplot/test-data/graph.pdf
b
Binary file flowtext_scatterplot/test-data/graph.pdf has changed
b
diff -r cc2266d3e611 -r 754d511df1a3 flowtext_scatterplot/test-data/graph.png
b
Binary file flowtext_scatterplot/test-data/graph.png has changed
b
diff -r cc2266d3e611 -r 754d511df1a3 flowtext_scatterplot/test-data/graph2.png
b
Binary file flowtext_scatterplot/test-data/graph2.png has changed
b
diff -r cc2266d3e611 -r 754d511df1a3 flowtext_scatterplot/test-data/input.flowtext
--- a/flowtext_scatterplot/test-data/input.flowtext Mon Feb 27 12:58:47 2017 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
b
b'@@ -1,20001 +0,0 @@\n-FSC\tSSC\tFITC CD4\tPE CCR3\tPP CD8\tAPC CCR4\n-449\t157\t551\t129\t169\t292\n-894\t1023\t199\t277\t320\t227\n-262\t73\t437\t69\t0\t146\n-340\t115\t509\t268\t0\t74\n-316\t76\t50\t0\t60\t129\n-394\t144\t83\t138\t335\t194\n-383\t139\t499\t0\t0\t224\n-800\t1023\t239\t284\t288\t280\n-388\t97\t534\t111\t83\t177\n-481\t117\t566\t247\t157\t99\n-652\t997\t118\t236\t250\t300\n-333\t100\t526\t82\t21\t34\n-636\t1023\t162\t290\t242\t261\n-283\t137\t0\t32\t137\t151\n-389\t105\t538\t36\t0\t130\n-684\t1023\t111\t180\t205\t186\n-688\t1023\t156\t255\t233\t77\n-431\t83\t64\t114\t586\t144\n-788\t1023\t167\t258\t158\t241\n-687\t1023\t94\t234\t218\t133\n-676\t1023\t149\t287\t215\t102\n-869\t1023\t223\t285\t277\t388\n-986\t1023\t267\t290\t261\t224\n-603\t1018\t193\t272\t255\t135\n-404\t168\t532\t113\t0\t0\n-661\t501\t418\t184\t256\t248\n-381\t169\t508\t0\t125\t204\n-686\t860\t49\t190\t225\t97\n-402\t202\t117\t90\t693\t316\n-418\t89\t566\t19\t0\t306\n-303\t119\t35\t155\t87\t108\n-402\t184\t70\t111\t627\t309\n-304\t107\t0\t118\t86\t257\n-360\t124\t26\t10\t615\t209\n-372\t118\t558\t125\t0\t120\n-659\t1023\t341\t246\t228\t256\n-720\t1023\t180\t178\t212\t229\n-712\t1002\t228\t163\t282\t195\n-321\t90\t472\t35\t151\t178\n-376\t154\t54\t61\t587\t264\n-744\t1023\t229\t271\t226\t216\n-329\t149\t82\t173\t629\t269\n-447\t153\t524\t161\t138\t197\n-364\t294\t248\t335\t0\t222\n-645\t1023\t177\t179\t282\t254\n-1023\t1023\t456\t557\t482\t445\n-440\t297\t403\t122\t82\t135\n-432\t115\t572\t165\t78\t225\n-366\t112\t299\t0\t23\t98\n-673\t1023\t230\t330\t294\t261\n-707\t1023\t222\t246\t206\t242\n-628\t1023\t161\t288\t241\t234\n-601\t1023\t126\t296\t278\t191\n-347\t157\t531\t0\t42\t49\n-262\t65\t210\t36\t0\t176\n-349\t101\t481\t139\t96\t211\n-596\t1023\t193\t252\t233\t288\n-375\t112\t546\t184\t59\t88\n-436\t141\t123\t229\t611\t218\n-389\t131\t576\t0\t0\t144\n-353\t97\t477\t204\t0\t221\n-400\t149\t91\t143\t639\t310\n-742\t1023\t225\t277\t114\t241\n-747\t1023\t132\t254\t227\t176\n-350\t122\t489\t194\t0\t99\n-407\t131\t535\t209\t0\t57\n-269\t92\t0\t0\t5\t128\n-355\t142\t540\t103\t115\t84\n-387\t123\t529\t116\t115\t0\n-358\t86\t523\t18\t32\t101\n-388\t132\t105\t99\t653\t329\n-305\t165\t509\t126\t0\t63\n-454\t168\t113\t124\t629\t251\n-400\t121\t176\t0\t581\t240\n-405\t230\t115\t233\t632\t289\n-596\t942\t74\t236\t280\t279\n-380\t211\t72\t236\t670\t255\n-392\t127\t546\t204\t47\t105\n-519\t409\t169\t117\t136\t417\n-767\t1023\t196\t278\t269\t192\n-367\t121\t528\t95\t0\t117\n-378\t175\t507\t201\t0\t227\n-664\t668\t359\t287\t268\t166\n-435\t161\t543\t185\t67\t197\n-358\t233\t0\t136\t148\t331\n-633\t977\t95\t250\t175\t187\n-373\t128\t564\t0\t35\t119\n-386\t123\t547\t0\t65\t181\n-319\t110\t497\t77\t101\t0\n-401\t86\t503\t126\t184\t138\n-364\t136\t0\t161\t15\t0\n-741\t1023\t188\t221\t270\t230\n-677\t510\t416\t268\t195\t188\n-311\t212\t17\t22\t91\t146\n-642\t1023\t152\t268\t221\t196\n-739\t395\t291\t219\t174\t75\n-760\t1023\t175\t247\t284\t198\n-410\t168\t528\t125\t0\t211\n-338\t158\t71\t69\t1\t155\n-401\t137\t34\t223\t641\t291\n-780\t853\t198\t256\t230\t270\n-389\t185\t160\t28\t664\t319\n-369\t130\t567\t21\t0\t38\n-359\t119\t60\t55\t660\t217\n-349\t97\t522\t0\t21\t0\n-553\t762\t136\t193\t137\t198\n-476\t91\t554\t0\t0\t102\n-372\t77\t506\t0\t89\t0\n-628\t1023\t202\t285\t305\t61\n-493\t351\t403\t242\t150\t196\n-393\t181\t128\t0\t148\t83\n-400\t143\t554\t109\t89\t115\n-387\t91\t544\t199\t141\t45\n-564\t924\t104\t220\t170\t249\n-673\t237\t124\t79\t648\t268\n-363\t203\t84\t213\t79\t224\n-353\t83\t517\t168\t70\t133\n-378\t157\t577\t0\t68\t205\n-338\t139\t25\t41\t38\t92\n-330\t70\t0\t55\t597\t165\n-558\t280\t421\t143\t113\t226\n-447\t288\t156\t211\t5\t33\n-341\t112\t457\t22\t0\t116\n-757\t1023\t205\t268\t291\t189\n-375\t112\t541\t20\t14\t0\n-657\t1023\t141\t206\t196\t125\n-356\t114\t550\t0\t0\t101\n-700\t1023\t196\t256\t272\t64\n-629\t1023\t189\t174\t253\t149\n-360\t141\t554\t0\t32\t52\n-362\t108\t543\t219\t158\t128\n-337\t112\t511\t107\t65\t178\n-398\t277\t67\t116\t277\t95\n-767\t1023\t157\t205\t212\t95\n-609\t1023\t348\t474\t390\t429\n-369\t96\t532\t255\t0\t212\n-386\t174\t46\t65\t619\t231\n-336\t115\t492\t87\t0\t105\n-469\t164\t580\t94\t50\t12\n-396\t108\t535\t84\t4\t82\n-452\t159\t534\t176\t169\t176\n-410\t129\t537\t107\t0\t67\n-304\t141\t31\t0\t112\t176\n-863\t1023\t242\t349\t309\t330\n-391\t226\t83\t224\t576\t232\n-701\t1023\t77\t158\t258\t111\n-674\t1023\t151\t247\t256\t238\n-309\t70\t73\t137\t287\t110\n-352\t154\t0\t23\t602\t271\n-352\t152\t130\t0\t29\t161\n-542\t1011\t70\t282\t223\t208\n-713\t1023\t160\t223\t253\t199\n-329\t156\t62\t242\t103\t106\n-341\t112\t537\t34\t102\t138\n-825\t1023\t203\t273\t294\t277\n-537\t308\t449\t0\t0\t86\n-587\t1023\t176\t297\t207\t278\n-402\t121\t513\t130\t0\t131\n-390\t155\t572\t130\t92\t176\n-787\t1023\t206\t298\t198\t167\n-409\t158\t514\t0\t127\t358\n-268\t107\t94\t18\t71\t148\n-395\t112\t66\t0\t486\t162\n-402\t117\t537\t0\t242\t79\n-396\t153\t555\t32\t96\t337\n-322\t120\t259\t134\t0\t123\n-1023\t1023\t448\t348\t35'..b'47\t220\n-354\t99\t525\t0\t142\t353\n-753\t1023\t190\t260\t336\t230\n-435\t149\t561\t67\t10\t301\n-376\t113\t545\t87\t0\t141\n-559\t783\t126\t247\t112\t238\n-393\t169\t562\t222\t118\t177\n-287\t93\t447\t95\t0\t175\n-648\t988\t186\t161\t237\t143\n-360\t96\t536\t218\t0\t116\n-308\t159\t0\t137\t55\t93\n-379\t260\t111\t176\t570\t245\n-421\t99\t508\t0\t128\t100\n-316\t69\t527\t244\t0\t52\n-346\t88\t82\t84\t196\t98\n-424\t180\t563\t119\t0\t56\n-387\t203\t60\t69\t623\t243\n-418\t117\t508\t283\t0\t149\n-653\t800\t119\t209\t182\t110\n-358\t182\t80\t44\t667\t310\n-512\t1023\t125\t168\t262\t201\n-466\t240\t133\t157\t196\t5\n-302\t139\t471\t0\t7\t19\n-361\t114\t533\t0\t0\t275\n-1023\t1023\t263\t311\t246\t309\n-334\t118\t371\t156\t0\t44\n-820\t1023\t294\t313\t318\t305\n-407\t150\t547\t133\t138\t210\n-271\t65\t486\t0\t48\t0\n-364\t121\t541\t49\t94\t229\n-654\t1023\t151\t256\t251\t230\n-366\t143\t555\t195\t0\t15\n-512\t571\t107\t220\t20\t192\n-556\t265\t448\t81\t172\t103\n-424\t228\t43\t132\t616\t310\n-753\t1023\t224\t268\t192\t116\n-360\t96\t533\t15\t109\t138\n-426\t207\t276\t99\t578\t328\n-432\t207\t142\t0\t408\t0\n-640\t580\t445\t287\t171\t207\n-658\t1023\t201\t282\t277\t300\n-666\t1023\t92\t257\t172\t234\n-354\t216\t87\t176\t336\t106\n-356\t176\t42\t0\t170\t134\n-689\t1023\t186\t217\t283\t198\n-346\t115\t516\t155\t0\t132\n-387\t128\t579\t203\t51\t141\n-665\t1023\t122\t229\t165\t78\n-400\t168\t0\t160\t600\t249\n-357\t95\t517\t0\t87\t186\n-373\t158\t534\t228\t53\t103\n-372\t103\t525\t238\t7\t175\n-298\t86\t428\t55\t0\t174\n-348\t131\t546\t6\t0\t55\n-368\t135\t549\t144\t0\t12\n-589\t1023\t333\t446\t322\t395\n-337\t117\t81\t149\t643\t348\n-372\t258\t139\t113\t174\t374\n-827\t1023\t128\t271\t263\t132\n-693\t1023\t179\t292\t201\t287\n-732\t946\t187\t253\t264\t121\n-370\t268\t125\t182\t104\t97\n-554\t761\t111\t293\t224\t233\n-411\t188\t525\t185\t124\t208\n-356\t165\t123\t85\t672\t282\n-353\t92\t508\t124\t141\t66\n-684\t902\t144\t248\t244\t173\n-402\t185\t135\t497\t774\t472\n-380\t144\t527\t156\t62\t31\n-765\t1023\t202\t261\t254\t258\n-1023\t1023\t500\t508\t445\t550\n-1023\t1023\t538\t456\t358\t450\n-652\t921\t131\t204\t107\t223\n-480\t181\t541\t223\t133\t294\n-651\t1023\t174\t340\t182\t19\n-619\t1023\t133\t263\t239\t231\n-374\t93\t520\t0\t0\t138\n-547\t760\t70\t0\t162\t224\n-427\t278\t113\t238\t385\t170\n-753\t1023\t156\t296\t263\t300\n-640\t942\t122\t265\t237\t242\n-348\t94\t507\t300\t109\t22\n-599\t1023\t135\t321\t261\t212\n-591\t948\t188\t176\t247\t130\n-386\t92\t515\t201\t32\t79\n-423\t156\t562\t8\t120\t144\n-581\t1023\t146\t214\t153\t145\n-779\t1023\t208\t308\t295\t319\n-1022\t174\t372\t274\t253\t397\n-395\t112\t554\t213\t64\t109\n-398\t283\t104\t418\t52\t211\n-459\t215\t559\t287\t198\t109\n-366\t160\t536\t218\t156\t122\n-380\t197\t123\t74\t638\t287\n-624\t1023\t133\t241\t194\t265\n-400\t163\t518\t139\t69\t225\n-380\t131\t564\t126\t0\t36\n-283\t146\t65\t180\t134\t0\n-379\t112\t173\t0\t646\t223\n-752\t1023\t129\t258\t239\t245\n-409\t206\t179\t149\t641\t290\n-635\t525\t409\t225\t206\t227\n-680\t1023\t234\t196\t249\t165\n-702\t458\t425\t271\t150\t46\n-734\t511\t416\t176\t152\t200\n-409\t171\t20\t29\t574\t212\n-413\t251\t83\t12\t21\t64\n-737\t1023\t180\t287\t284\t283\n-431\t175\t361\t239\t132\t0\n-353\t114\t50\t0\t621\t271\n-408\t141\t559\t0\t132\t196\n-531\t798\t102\t253\t209\t75\n-619\t1023\t205\t294\t235\t212\n-667\t1023\t187\t234\t288\t219\n-392\t247\t261\t675\t198\t451\n-311\t102\t514\t99\t110\t146\n-460\t125\t559\t0\t0\t73\n-400\t99\t564\t212\t139\t96\n-633\t1023\t168\t232\t214\t195\n-404\t166\t556\t177\t58\t46\n-678\t1023\t210\t305\t274\t229\n-364\t174\t98\t36\t615\t267\n-372\t118\t543\t109\t3\t52\n-672\t1023\t188\t292\t133\t249\n-643\t1023\t216\t273\t296\t169\n-445\t134\t552\t0\t143\t94\n-400\t151\t556\t179\t191\t181\n-701\t1023\t226\t239\t247\t291\n-365\t157\t122\t0\t667\t233\n-385\t88\t542\t89\t180\t60\n-358\t87\t482\t10\t0\t55\n-710\t487\t449\t284\t139\t96\n-371\t134\t510\t19\t14\t351\n-264\t69\t463\t0\t0\t80\n-428\t103\t512\t263\t0\t70\n-614\t490\t462\t229\t120\t325\n-466\t219\t513\t117\t0\t174\n-674\t525\t400\t208\t194\t194\n-324\t110\t506\t66\t32\t128\n-394\t115\t28\t0\t557\t193\n-411\t175\t63\t139\t618\t323\n-611\t303\t345\t92\t88\t100\n-450\t239\t160\t99\t195\t210\n-356\t129\t33\t90\t602\t94\n-605\t1006\t213\t204\t220\t220\n-773\t1023\t237\t275\t210\t167\n-429\t142\t570\t272\t0\t141\n-263\t33\t417\t0\t0\t194\n-347\t148\t26\t0\t630\t300\n-364\t121\t528\t182\t70\t194\n-339\t87\t483\t0\t43\t74\n-692\t1009\t147\t285\t115\t156\n-596\t988\t133\t305\t113\t273\n-847\t1023\t244\t216\t316\t101\n-386\t135\t531\t166\t184\t117\n-621\t970\t37\t127\t238\t274\n-298\t99\t482\t88\t0\t130\n-658\t1023\t117\t165\t208\t188\n-326\t172\t76\t12\t149\t77\n-360\t84\t532\t57\t138\t102\n-886\t1023\t229\t361\t290\t234\n-634\t972\t248\t277\t271\t215\n-332\t164\t0\t73\t246\t210\n-447\t121\t548\t0\t0\t393\n-391\t119\t74\t0\t628\t238\n-340\t100\t528\t245\t0\t8\n-385\t99\t179\t115\t513\t163\n-400\t157\t126\t99\t638\t313\n-431\t97\t527\t156\t122\t197\n'
b
diff -r cc2266d3e611 -r 754d511df1a3 getDensityPlots_text.R
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/getDensityPlots_text.R Tue Jul 14 09:40:13 2020 -0400
[
@@ -0,0 +1,158 @@
+#!/usr/bin/env Rscript
+# Density Plot Module for Galaxy
+# ggplot2
+######################################################################
+#                  Copyright (c) 2016 Northrop Grumman.
+#                          All rights reserved.
+######################################################################
+#
+# Version 1
+# Cristel Thomas
+#
+#
+
+library(ggplot2)
+library(grid)
+library(KernSmooth)
+# Multiple plot function
+# from http://www.cookbook-r.com/Graphs/Multiple_graphs_on_one_page_%28ggplot2%29/
+# ggplot objects can be passed in ..., or to plotlist (as a list of ggplot objects)
+# - cols:   Number of columns in layout
+# - layout: A matrix specifying the layout. If present, 'cols' is ignored.
+#
+# If the layout is something like matrix(c(1,2,3,3), nrow=2, byrow=TRUE),
+# then plot 1 will go in the upper left, 2 will go in the upper right, and
+# 3 will go all the way across the bottom.
+#
+multiplot <- function(..., plotlist=NULL, file, cols=1, layout=NULL) {
+  # Make a list from the ... arguments and plotlist
+  plots <- c(list(...), plotlist)
+  numPlots = length(plots)
+
+  # If layout is NULL, then use 'cols' to determine layout
+  if (is.null(layout)) {
+    # Make the panel
+    # ncol: Number of columns of plots
+    # nrow: Number of rows needed, calculated from # of cols
+    layout <- matrix(seq(1, cols * ceiling(numPlots/cols)),
+                    ncol = cols, nrow = ceiling(numPlots/cols))
+  }
+
+ if (numPlots==1) {
+    print(plots[[1]])
+  } else {
+    # Set up the page
+    grid.newpage()
+    pushViewport(viewport(layout = grid.layout(nrow(layout), ncol(layout))))
+
+    # Make each plot, in the correct location
+    for (i in 1:numPlots) {
+      # Get the i,j matrix positions of the regions that contain this subplot
+      matchidx <- as.data.frame(which(layout == i, arr.ind = TRUE))
+      print(plots[[i]], vp = viewport(layout.pos.row = matchidx$row,
+                                      layout.pos.col = matchidx$col))
+    }
+  }
+}
+
+generateGraphFromText <- function(input, channels, output, plot_default=TRUE,
+                                  flag_pdf=FALSE) {
+  fcs <- read.table(input, header = TRUE, sep = "\t", check.names = FALSE)
+  ## marker names
+  markers <- colnames(fcs)
+
+  if (plot_default) {
+    channels <- c(grep(colnames(fcs), pattern="Forward scatter", ignore.case=TRUE),
+                  grep(colnames(fcs), pattern="Side scatter", ignore.case=TRUE))
+   if (length(channels) == 0){
+      channels <- c(grep(colnames(fcs), pattern="FSC"),
+                    grep(colnames(fcs), pattern="SSC"))
+      if (length(channels) > 2) {
+        #get first FSC and corresponding SSC
+        channels <- c(grep(colnames(fcs), pattern="FSC-A"),
+                      grep(colnames(fcs), pattern="SSC-A"))
+        if (length(channels) == 0) {
+          channels <- c(grep(colnames(fcs), pattern="FSC-H"),
+                        grep(colnames(fcs), pattern="SSC-H"))
+          if (length(channels) == 0) {
+            channels <- c(grep(colnames(fcs), pattern="FSC-W"),
+                          grep(colnames(fcs), pattern="SSC-W"))
+          }
+        }
+      }
+    }
+    if (length(channels) == 0) {
+      warning('No forward/side scatter channels found, no plots will be generated.')
+   quit(save = "no", status = 10, runLast = FALSE)
+    }
+  }
+
+  nb_markers <- length(channels)
+  if (nb_markers == 1) {
+    warning('There is only one marker selected to plot.')
+    quit(save = "no", status = 12, runLast = FALSE)
+  }
+  for (j in nb_markers) {
+    if (channels[j] > length(markers)){
+     warning('Please indicate markers between 1 and ', length(markers))
+     quit(save = "no", status = 10, runLast = FALSE)
+   }
+  }
+
+  plots <- list()
+  i <- 0
+  for (m in 1:(nb_markers - 1)) {
+    for (n in (m+1):nb_markers) {
+      x <- fcs[,channels[m]]
+      y <- fcs[,channels[n]]
+      df <- data.frame(x = x, y = y,
+                       d = densCols(x, y, colramp = colorRampPalette(rev(rainbow(10, end = 4/6)))))
+      p <- ggplot(df) +
+           geom_point(aes(x, y, col = d), size = 0.2) +
+           scale_color_identity() +
+           theme_bw() +
+           labs(x = markers[channels[m]]) +
+           labs(y = markers[channels[n]])
+      i <- i + 1
+      plots[[i]] <- p
+    }
+  }
+  nb_rows <- ceiling(((nb_markers-1)*nb_markers)/4)
+  h <- 400 * nb_rows
+  hp <- 10 * (nb_rows/2)
+
+  if (flag_pdf){
+    pdf(output, height=hp, width=10, useDingbats=FALSE, onefile=TRUE)
+      multiplot(plotlist = plots, cols = 2)
+    dev.off()
+  } else {
+    png(output, type="cairo", width=800, height=h)
+      multiplot(plotlist = plots, cols = 2)
+    dev.off()
+  }
+}
+
+args <- commandArgs(trailingOnly = TRUE)
+channels <- list()
+flag_default <- FALSE
+flag_pdf <- FALSE
+
+if (args[2]=="None" || args[2]== "" || args[2] == "i.e.:1,3,4") {
+  flag_default <- TRUE
+} else {
+  channels <- as.numeric(strsplit(args[2], ",")[[1]])
+  for (channel in channels){
+    if (is.na(channel)){
+      quit(save = "no", status = 11, runLast = FALSE)
+    }
+  }
+  if (length(channels) == 1){
+    warning('Please indicate more than one marker to plot.')
+    quit(save = "no", status = 10, runLast = FALSE)
+  }
+}
+
+if (args[4] == "PDF"){
+  flag_pdf <- TRUE
+}
+generateGraphFromText(args[1], channels, args[3], flag_default, flag_pdf)
b
diff -r cc2266d3e611 -r 754d511df1a3 getDensityPlots_text.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/getDensityPlots_text.xml Tue Jul 14 09:40:13 2020 -0400
[
@@ -0,0 +1,83 @@
+<tool id="gen_density_plots_txt" name="Generate scatter plots" version="1.1+galaxy0" profile="18.01">
+  <description>for any given markers in a txt-converted FCS file</description>
+  <requirements>
+    <requirement type="package" version="3.3.2">r-ggplot2</requirement>
+    <requirement type="package" version="2.23_17">r-kernsmooth</requirement>
+  </requirements>
+  <stdio>
+    <exit_code range="1:9" level="fatal" />
+    <exit_code range="10" level="fatal" description="Please provide a comma separated list of channels to plot" />
+    <exit_code range="11" level="fatal" description="Please provide numeric values for the list of channels to plot" />
+    <exit_code range="12" level="fatal" description="Please provide more than one channel to plot" />
+    <exit_code range="13:" level="fatal"/>
+  </stdio>
+  <command><![CDATA[
+      Rscript $__tool_directory__/getDensityPlots_text.R '${input}' '${channels}' '${output}' '${outformat}'
+  ]]>
+  </command>
+  <inputs>
+    <param format="flowtext" name="input" type="data" label="txt-converted FCS file"/>
+    <param name="channels" type="text" label="Markers to plot:" value="i.e.:1,3,4" help="By default, will plot FSC vs SSC if the channels are found."/>
+    <param name="outformat" type="select" label="Output Format" help="PDF will be larger files that may take some time to load.">
+      <option value="PNG">PNG</option>
+      <option value="PDF">PDF</option>
+    </param>
+  </inputs>
+  <outputs>
+    <data format="png" name="output" label="Scatter Plots of ${channels} from ${input.name} in ${outformat}">
+      <change_format>
+        <when input="outformat" value="PDF" format="pdf" />
+      </change_format>
+    </data>
+  </outputs>
+  <tests>
+    <test>
+      <param name="input" value="input.flowtext"/>
+      <param name="channels" value="i.e.:1,3,4"/>
+      <param name="outformat" value="PDF"/>
+      <output name="output" file="graph.pdf" compare="sim_size" delta="2000000"/>
+    </test>
+    <test>
+      <param name="input" value="input.flowtext"/>
+      <param name="channels" value="1,3,5"/>
+      <param name="outformat" value="PNG"/>
+      <output name="output" file="graph2.png" compare="sim_size" delta="1000000"/>
+    </test>
+  </tests>
+  <help><![CDATA[
+   This tool allows generation of density scatter plots using ggplot2.
+
+-----
+
+**Input files**
+
+This tool takes txt-converted FCS files as input.
+
+**Output files**
+
+This tool generates a scatter plot for each marker combination in a single png file. A pdf file can optionally be generated.
+
+class:: warningmark
+
+PDF are larger files that may take some time to load. It might be faster to download the PDF output once generated to open it locally.
+
+-----
+
+**Example**
+
+*Output*:
+
+.. image:: ./static/images/flowtools/flowtextgraph.png
+  ]]>
+  </help>
+  <citations>
+    <citation type="bibtex">@BOOK{,
+      author = {Hadley Wickham},
+      title = {ggplot2: Elegant Graphics for Data Analysis},
+      publisher = {Springer-Verlag New York},
+      year = {2009},
+      isbn = {978-0-387-98140-6},
+      url = {http://ggplot2.org},
+   }</citation>
+  </citations>
+</tool>
b
diff -r cc2266d3e611 -r 754d511df1a3 static/images/flowtools/flowtextgraph.png
b
Binary file static/images/flowtools/flowtextgraph.png has changed
b
diff -r cc2266d3e611 -r 754d511df1a3 test-data/graph.pdf
b
Binary file test-data/graph.pdf has changed
b
diff -r cc2266d3e611 -r 754d511df1a3 test-data/graph.png
b
Binary file test-data/graph.png has changed
b
diff -r cc2266d3e611 -r 754d511df1a3 test-data/graph2.png
b
Binary file test-data/graph2.png has changed
b
diff -r cc2266d3e611 -r 754d511df1a3 test-data/input.flowtext
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/input.flowtext Tue Jul 14 09:40:13 2020 -0400
b
b'@@ -0,0 +1,20001 @@\n+FSC\tSSC\tFITC CD4\tPE CCR3\tPP CD8\tAPC CCR4\n+449\t157\t551\t129\t169\t292\n+894\t1023\t199\t277\t320\t227\n+262\t73\t437\t69\t0\t146\n+340\t115\t509\t268\t0\t74\n+316\t76\t50\t0\t60\t129\n+394\t144\t83\t138\t335\t194\n+383\t139\t499\t0\t0\t224\n+800\t1023\t239\t284\t288\t280\n+388\t97\t534\t111\t83\t177\n+481\t117\t566\t247\t157\t99\n+652\t997\t118\t236\t250\t300\n+333\t100\t526\t82\t21\t34\n+636\t1023\t162\t290\t242\t261\n+283\t137\t0\t32\t137\t151\n+389\t105\t538\t36\t0\t130\n+684\t1023\t111\t180\t205\t186\n+688\t1023\t156\t255\t233\t77\n+431\t83\t64\t114\t586\t144\n+788\t1023\t167\t258\t158\t241\n+687\t1023\t94\t234\t218\t133\n+676\t1023\t149\t287\t215\t102\n+869\t1023\t223\t285\t277\t388\n+986\t1023\t267\t290\t261\t224\n+603\t1018\t193\t272\t255\t135\n+404\t168\t532\t113\t0\t0\n+661\t501\t418\t184\t256\t248\n+381\t169\t508\t0\t125\t204\n+686\t860\t49\t190\t225\t97\n+402\t202\t117\t90\t693\t316\n+418\t89\t566\t19\t0\t306\n+303\t119\t35\t155\t87\t108\n+402\t184\t70\t111\t627\t309\n+304\t107\t0\t118\t86\t257\n+360\t124\t26\t10\t615\t209\n+372\t118\t558\t125\t0\t120\n+659\t1023\t341\t246\t228\t256\n+720\t1023\t180\t178\t212\t229\n+712\t1002\t228\t163\t282\t195\n+321\t90\t472\t35\t151\t178\n+376\t154\t54\t61\t587\t264\n+744\t1023\t229\t271\t226\t216\n+329\t149\t82\t173\t629\t269\n+447\t153\t524\t161\t138\t197\n+364\t294\t248\t335\t0\t222\n+645\t1023\t177\t179\t282\t254\n+1023\t1023\t456\t557\t482\t445\n+440\t297\t403\t122\t82\t135\n+432\t115\t572\t165\t78\t225\n+366\t112\t299\t0\t23\t98\n+673\t1023\t230\t330\t294\t261\n+707\t1023\t222\t246\t206\t242\n+628\t1023\t161\t288\t241\t234\n+601\t1023\t126\t296\t278\t191\n+347\t157\t531\t0\t42\t49\n+262\t65\t210\t36\t0\t176\n+349\t101\t481\t139\t96\t211\n+596\t1023\t193\t252\t233\t288\n+375\t112\t546\t184\t59\t88\n+436\t141\t123\t229\t611\t218\n+389\t131\t576\t0\t0\t144\n+353\t97\t477\t204\t0\t221\n+400\t149\t91\t143\t639\t310\n+742\t1023\t225\t277\t114\t241\n+747\t1023\t132\t254\t227\t176\n+350\t122\t489\t194\t0\t99\n+407\t131\t535\t209\t0\t57\n+269\t92\t0\t0\t5\t128\n+355\t142\t540\t103\t115\t84\n+387\t123\t529\t116\t115\t0\n+358\t86\t523\t18\t32\t101\n+388\t132\t105\t99\t653\t329\n+305\t165\t509\t126\t0\t63\n+454\t168\t113\t124\t629\t251\n+400\t121\t176\t0\t581\t240\n+405\t230\t115\t233\t632\t289\n+596\t942\t74\t236\t280\t279\n+380\t211\t72\t236\t670\t255\n+392\t127\t546\t204\t47\t105\n+519\t409\t169\t117\t136\t417\n+767\t1023\t196\t278\t269\t192\n+367\t121\t528\t95\t0\t117\n+378\t175\t507\t201\t0\t227\n+664\t668\t359\t287\t268\t166\n+435\t161\t543\t185\t67\t197\n+358\t233\t0\t136\t148\t331\n+633\t977\t95\t250\t175\t187\n+373\t128\t564\t0\t35\t119\n+386\t123\t547\t0\t65\t181\n+319\t110\t497\t77\t101\t0\n+401\t86\t503\t126\t184\t138\n+364\t136\t0\t161\t15\t0\n+741\t1023\t188\t221\t270\t230\n+677\t510\t416\t268\t195\t188\n+311\t212\t17\t22\t91\t146\n+642\t1023\t152\t268\t221\t196\n+739\t395\t291\t219\t174\t75\n+760\t1023\t175\t247\t284\t198\n+410\t168\t528\t125\t0\t211\n+338\t158\t71\t69\t1\t155\n+401\t137\t34\t223\t641\t291\n+780\t853\t198\t256\t230\t270\n+389\t185\t160\t28\t664\t319\n+369\t130\t567\t21\t0\t38\n+359\t119\t60\t55\t660\t217\n+349\t97\t522\t0\t21\t0\n+553\t762\t136\t193\t137\t198\n+476\t91\t554\t0\t0\t102\n+372\t77\t506\t0\t89\t0\n+628\t1023\t202\t285\t305\t61\n+493\t351\t403\t242\t150\t196\n+393\t181\t128\t0\t148\t83\n+400\t143\t554\t109\t89\t115\n+387\t91\t544\t199\t141\t45\n+564\t924\t104\t220\t170\t249\n+673\t237\t124\t79\t648\t268\n+363\t203\t84\t213\t79\t224\n+353\t83\t517\t168\t70\t133\n+378\t157\t577\t0\t68\t205\n+338\t139\t25\t41\t38\t92\n+330\t70\t0\t55\t597\t165\n+558\t280\t421\t143\t113\t226\n+447\t288\t156\t211\t5\t33\n+341\t112\t457\t22\t0\t116\n+757\t1023\t205\t268\t291\t189\n+375\t112\t541\t20\t14\t0\n+657\t1023\t141\t206\t196\t125\n+356\t114\t550\t0\t0\t101\n+700\t1023\t196\t256\t272\t64\n+629\t1023\t189\t174\t253\t149\n+360\t141\t554\t0\t32\t52\n+362\t108\t543\t219\t158\t128\n+337\t112\t511\t107\t65\t178\n+398\t277\t67\t116\t277\t95\n+767\t1023\t157\t205\t212\t95\n+609\t1023\t348\t474\t390\t429\n+369\t96\t532\t255\t0\t212\n+386\t174\t46\t65\t619\t231\n+336\t115\t492\t87\t0\t105\n+469\t164\t580\t94\t50\t12\n+396\t108\t535\t84\t4\t82\n+452\t159\t534\t176\t169\t176\n+410\t129\t537\t107\t0\t67\n+304\t141\t31\t0\t112\t176\n+863\t1023\t242\t349\t309\t330\n+391\t226\t83\t224\t576\t232\n+701\t1023\t77\t158\t258\t111\n+674\t1023\t151\t247\t256\t238\n+309\t70\t73\t137\t287\t110\n+352\t154\t0\t23\t602\t271\n+352\t152\t130\t0\t29\t161\n+542\t1011\t70\t282\t223\t208\n+713\t1023\t160\t223\t253\t199\n+329\t156\t62\t242\t103\t106\n+341\t112\t537\t34\t102\t138\n+825\t1023\t203\t273\t294\t277\n+537\t308\t449\t0\t0\t86\n+587\t1023\t176\t297\t207\t278\n+402\t121\t513\t130\t0\t131\n+390\t155\t572\t130\t92\t176\n+787\t1023\t206\t298\t198\t167\n+409\t158\t514\t0\t127\t358\n+268\t107\t94\t18\t71\t148\n+395\t112\t66\t0\t486\t162\n+402\t117\t537\t0\t242\t79\n+396\t153\t555\t32\t96\t337\n+322\t120\t259\t134\t0\t123\n+1023\t1023\t448\t348\t35'..b'47\t220\n+354\t99\t525\t0\t142\t353\n+753\t1023\t190\t260\t336\t230\n+435\t149\t561\t67\t10\t301\n+376\t113\t545\t87\t0\t141\n+559\t783\t126\t247\t112\t238\n+393\t169\t562\t222\t118\t177\n+287\t93\t447\t95\t0\t175\n+648\t988\t186\t161\t237\t143\n+360\t96\t536\t218\t0\t116\n+308\t159\t0\t137\t55\t93\n+379\t260\t111\t176\t570\t245\n+421\t99\t508\t0\t128\t100\n+316\t69\t527\t244\t0\t52\n+346\t88\t82\t84\t196\t98\n+424\t180\t563\t119\t0\t56\n+387\t203\t60\t69\t623\t243\n+418\t117\t508\t283\t0\t149\n+653\t800\t119\t209\t182\t110\n+358\t182\t80\t44\t667\t310\n+512\t1023\t125\t168\t262\t201\n+466\t240\t133\t157\t196\t5\n+302\t139\t471\t0\t7\t19\n+361\t114\t533\t0\t0\t275\n+1023\t1023\t263\t311\t246\t309\n+334\t118\t371\t156\t0\t44\n+820\t1023\t294\t313\t318\t305\n+407\t150\t547\t133\t138\t210\n+271\t65\t486\t0\t48\t0\n+364\t121\t541\t49\t94\t229\n+654\t1023\t151\t256\t251\t230\n+366\t143\t555\t195\t0\t15\n+512\t571\t107\t220\t20\t192\n+556\t265\t448\t81\t172\t103\n+424\t228\t43\t132\t616\t310\n+753\t1023\t224\t268\t192\t116\n+360\t96\t533\t15\t109\t138\n+426\t207\t276\t99\t578\t328\n+432\t207\t142\t0\t408\t0\n+640\t580\t445\t287\t171\t207\n+658\t1023\t201\t282\t277\t300\n+666\t1023\t92\t257\t172\t234\n+354\t216\t87\t176\t336\t106\n+356\t176\t42\t0\t170\t134\n+689\t1023\t186\t217\t283\t198\n+346\t115\t516\t155\t0\t132\n+387\t128\t579\t203\t51\t141\n+665\t1023\t122\t229\t165\t78\n+400\t168\t0\t160\t600\t249\n+357\t95\t517\t0\t87\t186\n+373\t158\t534\t228\t53\t103\n+372\t103\t525\t238\t7\t175\n+298\t86\t428\t55\t0\t174\n+348\t131\t546\t6\t0\t55\n+368\t135\t549\t144\t0\t12\n+589\t1023\t333\t446\t322\t395\n+337\t117\t81\t149\t643\t348\n+372\t258\t139\t113\t174\t374\n+827\t1023\t128\t271\t263\t132\n+693\t1023\t179\t292\t201\t287\n+732\t946\t187\t253\t264\t121\n+370\t268\t125\t182\t104\t97\n+554\t761\t111\t293\t224\t233\n+411\t188\t525\t185\t124\t208\n+356\t165\t123\t85\t672\t282\n+353\t92\t508\t124\t141\t66\n+684\t902\t144\t248\t244\t173\n+402\t185\t135\t497\t774\t472\n+380\t144\t527\t156\t62\t31\n+765\t1023\t202\t261\t254\t258\n+1023\t1023\t500\t508\t445\t550\n+1023\t1023\t538\t456\t358\t450\n+652\t921\t131\t204\t107\t223\n+480\t181\t541\t223\t133\t294\n+651\t1023\t174\t340\t182\t19\n+619\t1023\t133\t263\t239\t231\n+374\t93\t520\t0\t0\t138\n+547\t760\t70\t0\t162\t224\n+427\t278\t113\t238\t385\t170\n+753\t1023\t156\t296\t263\t300\n+640\t942\t122\t265\t237\t242\n+348\t94\t507\t300\t109\t22\n+599\t1023\t135\t321\t261\t212\n+591\t948\t188\t176\t247\t130\n+386\t92\t515\t201\t32\t79\n+423\t156\t562\t8\t120\t144\n+581\t1023\t146\t214\t153\t145\n+779\t1023\t208\t308\t295\t319\n+1022\t174\t372\t274\t253\t397\n+395\t112\t554\t213\t64\t109\n+398\t283\t104\t418\t52\t211\n+459\t215\t559\t287\t198\t109\n+366\t160\t536\t218\t156\t122\n+380\t197\t123\t74\t638\t287\n+624\t1023\t133\t241\t194\t265\n+400\t163\t518\t139\t69\t225\n+380\t131\t564\t126\t0\t36\n+283\t146\t65\t180\t134\t0\n+379\t112\t173\t0\t646\t223\n+752\t1023\t129\t258\t239\t245\n+409\t206\t179\t149\t641\t290\n+635\t525\t409\t225\t206\t227\n+680\t1023\t234\t196\t249\t165\n+702\t458\t425\t271\t150\t46\n+734\t511\t416\t176\t152\t200\n+409\t171\t20\t29\t574\t212\n+413\t251\t83\t12\t21\t64\n+737\t1023\t180\t287\t284\t283\n+431\t175\t361\t239\t132\t0\n+353\t114\t50\t0\t621\t271\n+408\t141\t559\t0\t132\t196\n+531\t798\t102\t253\t209\t75\n+619\t1023\t205\t294\t235\t212\n+667\t1023\t187\t234\t288\t219\n+392\t247\t261\t675\t198\t451\n+311\t102\t514\t99\t110\t146\n+460\t125\t559\t0\t0\t73\n+400\t99\t564\t212\t139\t96\n+633\t1023\t168\t232\t214\t195\n+404\t166\t556\t177\t58\t46\n+678\t1023\t210\t305\t274\t229\n+364\t174\t98\t36\t615\t267\n+372\t118\t543\t109\t3\t52\n+672\t1023\t188\t292\t133\t249\n+643\t1023\t216\t273\t296\t169\n+445\t134\t552\t0\t143\t94\n+400\t151\t556\t179\t191\t181\n+701\t1023\t226\t239\t247\t291\n+365\t157\t122\t0\t667\t233\n+385\t88\t542\t89\t180\t60\n+358\t87\t482\t10\t0\t55\n+710\t487\t449\t284\t139\t96\n+371\t134\t510\t19\t14\t351\n+264\t69\t463\t0\t0\t80\n+428\t103\t512\t263\t0\t70\n+614\t490\t462\t229\t120\t325\n+466\t219\t513\t117\t0\t174\n+674\t525\t400\t208\t194\t194\n+324\t110\t506\t66\t32\t128\n+394\t115\t28\t0\t557\t193\n+411\t175\t63\t139\t618\t323\n+611\t303\t345\t92\t88\t100\n+450\t239\t160\t99\t195\t210\n+356\t129\t33\t90\t602\t94\n+605\t1006\t213\t204\t220\t220\n+773\t1023\t237\t275\t210\t167\n+429\t142\t570\t272\t0\t141\n+263\t33\t417\t0\t0\t194\n+347\t148\t26\t0\t630\t300\n+364\t121\t528\t182\t70\t194\n+339\t87\t483\t0\t43\t74\n+692\t1009\t147\t285\t115\t156\n+596\t988\t133\t305\t113\t273\n+847\t1023\t244\t216\t316\t101\n+386\t135\t531\t166\t184\t117\n+621\t970\t37\t127\t238\t274\n+298\t99\t482\t88\t0\t130\n+658\t1023\t117\t165\t208\t188\n+326\t172\t76\t12\t149\t77\n+360\t84\t532\t57\t138\t102\n+886\t1023\t229\t361\t290\t234\n+634\t972\t248\t277\t271\t215\n+332\t164\t0\t73\t246\t210\n+447\t121\t548\t0\t0\t393\n+391\t119\t74\t0\t628\t238\n+340\t100\t528\t245\t0\t8\n+385\t99\t179\t115\t513\t163\n+400\t157\t126\t99\t638\t313\n+431\t97\t527\t156\t122\t197\n'