Plotting metabolic networks? - visualization

I need to draw a map of the core metabolism of E.coli. Associated with each reaction in the map I have a number that indicates the flux through this reaction. I want the map to reflect these fluxes through the color of each reaction in the map.
I have tried using tools like Mathematica and Cytoscape, but it is very hard to get a nice layout of the metabolic network. I have seen maps of E.coli metabolism which look very nice on paper. What I need is a map like these, but where I can define the colors of the reactions.
There are some tools available, for example, metdraw.com. But when I upload my E.coli SBML model, the plot layout is a disaster. There used to be a web IPython notebook that one could use for some prebuilt models, where you just had to input the reaction fluxes. But now it's gone: http://nbviewer.ipython.org/github/opencobra/cobrapy/blob/master/documentation_builder/visbio.ipynb
See the image below for an example. Forget about the yellow bounding boxes delimiting compartments. I can spare those.

Some tracking of the broken link you posted brings me to Escher, which appears to be what visbio is now called:
https://github.com/zakandrewking/escher
For example see:
https://cobrapy.readthedocs.org/en/latest/escher.html
Escher is part of Cobrapy:
http://opencobra.github.io/cobrapy/
A software suite to model biological networks.

Related

Feed multiple images to CoreML image classification model (swift)

I know how to use the CoreML library to train a model and use it. However, I was wondering if it's possible to feed the model more than one image in order for it to identify it with better accuracy.
The reason for this is because i'm a trying to build an app that classifies histological slides, however, many of them look quite similar, so I thought maybe I could feed the model images at different magnifications in order to make the identification. Is it possible?
Thank you,
Mehdi
Yes, this is a common technique. You can give Core ML the images at different scales or use different crops from the same larger image.
A typical approach is to take 4 corner crops and 1 center crop, and also horizontally flip these, so you have 10 images total. Then feed these to Core ML as a batch. (Maybe in your case it makes sense to also vertically flip the crops.)
To get the final prediction, take the average of the predicted probabilities for all images.
Note that in order to use images at different sizes, the model must be configured to support "size flexibility". And it must also be trained on images of different sizes to get good results.

Simulink - how to configure the appearance of a scope

I'm working on generating some figures for a paper from a simulink model, and would prefer to use minimal work to produce them so I'm trying to configure a simulink scope to output the figures I want on its own. The problem is, while I can get colors and such all arranged well, I can't seem to figure out how to modify the spacing between the graphs in a scope showing multiple signals. What I have now looks like the below:
Notice how the two plots have different vertical scales (probably a consequence of having the time scale only on the bottom one), and that there's a large gap of unused space between the plots. This is a concern when trying to publish in a journal, since page space is at a premium and we need to make the information as dense as possible.
So, how can I tweak these margins and formatting? I've tried looking at all the settings I can find, but none seem to affect these parameters.

How to make a DEM in QGIS using spot heights and contors

I have 2 shapefiles. One is the contors of an area and the other the spot heights. Both of them has a altitude attribute. In ArcGIS there is a tool called topo to raster were you can use both these features to create a dem. In qgis I have only found tools were you can only use one.
Any Ideas?
There is only the interpolation tool that I know of which will create a DEM. Depending on the resolution you're after, you could BUFFER the spot heights, then MERGE SHAPE FILES and run the interpolation tool on that.
Using the graphical modeler would prevent the buffer layer being created making the process a little tidier (and i'm sure there's a better way using the python console). Hope this helps.

Dynamic graphs from frames using Networkx

I partitioned a large dataset of tweets in time-based slices and I created 1 graph per each slice.
How can I create a dynamic graph using the slices as "frames"?
I can do it using Gephi, but it is a manual process.
Thanks!
Visualize dynamic graphs is a complex topic and there's of course not a silver bullet for that.
There are different techniques out there and each library offers a different solution for such problem.
Once of the most common techniques is to combine two visualization components to show the graph in a particular "time frame" and a filter bar to slice / aggregate / navigate in time.
The filter bar an have multiple declination but one of the common pattern is a Time bar (either with line or histogram).
Where I work we recently did a webinar about this topic and offered our solution to it. Here's the link with slides and video.
Disclaimer: to watch the video there's a form to fill. But the slides are publicly available.

How to visualize correlation matrix as a schemaball in Matlab

I have 42 variables and I have calculated the correlation matrix for them in Matlab. Now I would like to visualize it with a schemaball. Does anyone have any suggestions / experiences how this could be done in Matlab? The following pictures will explain my point better:
In the pictures each parabola between variables would mean the strength of correlation between them. The thicker the line is, the more correlation. I prefer the style of picture 1 more than the style in picture 2 where I have used different colors to highlight the strength of correlation.
Kinda finished I guess.. code can be found here at github.
Documentation is included in the file.
The yellow/magenta color (for positive/negative correlation) is configurable, as well as the fontsize of the labels and the angles at which the labels are plotted, so you can get fancy if you want and not distribute them evenly along the perimeter/group some/...
If you want to actually print these graphs or use them outside matlab, I suggest using vector formats (eg eps). It's also annoying that the text resizes when you zoom in/out, but I don't know of any way to fix that without hacking the zoom function :/
schemaball % demo
schemaball(arrayfun(#num2str,1:10,'uni',false), rand(10).^8,11,[0.1587 0.8750],[0.8333 1],2*pi*sin(linspace(0,pi/2-pi/20,10)))
schemaball(arrayfun(#num2str,1:50,'uni',false), rand(50).^50,9)
I finished and submitted my version to the FEX: schemaball and will update the link asap.
There are a some differences with Gunther Struyf's contribution:
You can return the handles to the graphic object for full manual customization
Labels are oriented to allow maximum left-to-rigth readability
The figure stretches to fit labels in, leaving the axes unchanged
Syntax requires only correlations matrix (but allows optional inputs)
Optimized for performance.
Follow examples of demo, custom labels and creative customization.
Note: the first figure was exported with saveas(), all others with export_fig.
schemaball
x = rand(10).^3;
x(:,3) = 1.3*mean(x,2);
schemaball(x, {'Hi','how','is','your','day?', 'Do','you','like','schemaballs?','NO!!'})
h = schemaball;
set(h.l(~isnan(h.l)), 'LineWidth',1.2)
set(h.s, 'MarkerEdgeColor','red','LineWidth',2,'SizeData',100)
set(h.t, 'EdgeColor','white','LineWidth',1)
The default colormap:
To improve on screen rendering you can launch MATLAB with the experimental -hgVersion 2 switch which produces anti/aliased graphics by default now (source: HG2 update | Undocumented Matlab). However, if you try to save the figure, the file will have the usual old anti-aliased rendering, so here's a printscreen image of Gunther's schemaball:
Important update:
You can do this in Matlab now with the FileExchange submission:
http://www.mathworks.com/matlabcentral/fileexchange/48576-circulargraph
There is an exmample by Matlab in here:
http://uk.mathworks.com/examples/matlab/3859-circular-graph-examples
Which gives this kind of beautiful plots:
Coincidentally, Cleve Moler (MathWorks Chief Mathematician) showed an example of just this sort of plot on his most recent blog post (not nearly as beautiful as the ones in your example, and the connecting lines are straight rather than parabolic, but it looks functional). Unfortunately he didn't include the code directly, but if you leave him a comment on the post he's usually very willing to share things.
What might be even nicer for you is that he also applies (and this time includes) code to permute the rows/columns of the array in order to maximize the spatial proximity of highly connected nodes, rather than randomly ordering them around the circumference. You end up with a 'crescent'-shaped envelope of connecting lines, with the thick bit of the crescent representing the most highly connected nodes.
Unfortunately however, I suspect that if you need to enhance his code to get the very narrow, high-resolution lines in your example plots, then MATLAB's currently non-anti-aliased graphics aren't quite up to it yet.
I've recently been experimenting with MATLAB data and the D3 visualization library for similar graphs - there are several related types of circular visualizations you may be interested in and many of them are interactive. Another helpful, well-baked, and freely available option is Circos which is probably responsible for most of the prettier versions of these graphs you've seen in popular press.