Tuesday 19 December 2023

Visualisation using Cytoscape of a PopPUNK database

Earlier I wrote about how I made a visualisation of my PopPUNK database using Microreact: see the blogpost here.

Today I'm going to tell you how I made a visualisation of the same PopPUNK database using Cytoscape.

I followed the instructions in the PopPUNK documentation, but I had to figure out a few little things. 

Here's what I did:

I had already installed Cytoscape (which you can download from the Cytoscape website on my computer). I opened Cytoscape on my computer.

Then I dragged the network file from PopPUNK (called something like myexample_cytoscape.graphml) into Cytoscape window on my computer. Cytoscape gave me a message "Creating Cytoscape network". It then asked me whether I wanted to make a network view, and I pressed "Cancel".

I then clicked on the "Import table from file" icon at the top left of the Cytoscape window (see the icon with a picture of a spreadsheet), and then selected the csv file from PopPUNK (called something like myexample_cytoscape.csv). I set the value of "Key Column for Network" to be "id".

I then clicked on "G" in the left panel of the Cytoscape window, to select the network. 

I then clicked on "Create view" in the top right panel of the Cytoscape window to create an image of the network. Cytoscape gave me a message "Perfuse Force Directed Layout... Applying Force-Directed...". It took a few minutes to create an image of the network. The image then appeared!

I wanted then to change the appearance of the image of the network, e.g. colour and size of the nodes. I went to the Style panel of the Cytoscape control panel (on the left of the Cytoscape window), and clicked on "Style" on the left (it is written side-ways). 

Then I selected the "Node fill" to be "by Cluster" (to colour it by PopPUNK cluster), and "Mapping type" to be "Discrete". I then right-clicked on the "Discrete mapping" heading and selected "Mapping value generators" to be "Random". 

I selected the "Shape" (of nodes) to be "Ellipse" and selected the Node width to be 25.0 and the Node height to be 25.0 (so that I get a circle for each node).

I tried clicking on "Export" under the network image, and clicking "Export network as image" but this seemed to crash Cytoscape! Instead the next time I found I could just zoom in on the network and make a nice screenshot, something like this:

Yay!






Friday 24 November 2023

Visualisation of a PopPUNK database using Microreact

 Earlier I wrote a blog post about the lovely PopPUNK software, which you can read here.

Today I wanted to visualise the tree and clusters made using PopPUNK for a set of genomes, using Microreact.

 

Creating input files for Microreact, for an existing PopPUNK database

I followed the instructions on the PopPUNK documentation website, and ran these commands:

% poppunk_visualise --ref-db chun_poppunk_db1 --model-dir chun_poppunk_db_fitted1 --output chun_poppunk_db1_example_viz1 --microreact

where the folder chun_poppunk_db1 contained a database that I had made before (this folder contained the PopPUNK sketch files),

the folder chun_poppunk_db_fitted1 contained the fit for the database (ie. the PopPUNK clusters),

and chun_poppunk_db1_example_viz1 was the name I wanted to give to the output folder.

This produced these four output files:

chun_poppunk_db1_example_viz1_core_NJ.nwk  
chun_poppunk_db1_example_viz1.microreact  chun_poppunk_db1_example_viz1_microreact_clusters.csv  chun_poppunk_db1_example_viz1_perplexity20.0_accessory_mandrake.dot
 
 
Visualising the PopPUNK database in Microreact
 
I then went to the  Microreact upload page, and uploaded the three files chun_poppunk_db1_example_viz1_core_NJ.nwk, chun_poppunk_db1_example_viz1_microreact_clusters.csv, and chun_poppunk_db1_example_viz1_perplexity20.0_accessory_mandrake.dot. 

This displayed the PopPUNK database beautifully in Microreact, with a plot on the left showing how distant are the PopPUNK clusters from each other (represented in 2D space), and a tree on the right showing how the isolates are related to each other (coloured by cluster), and the key for the colour for each cluster on the far right. I love it!


 
Displaying additional metadata beside the tree in Microreact
 
I then added another file with additional metadata on MLST sequence type, and named lineage, by dragging and dropping the csv file of metadata into the 'Metadata' section of the Microreact webpage (just below the picture of clusters and tree shown above).
 
Then to display this metadata beside the tree in Microreact, I clicked on the 'Metadata blocks' heading in the tree section of the webpage, and chose 'cluster' and 'named lineage' and 'MLST' to display those next to the tree.

I also set the toggle for 'Leaf Labels' to 'on' in the 'Nodes and 'Labels' menu in the tree section of the webpage.
 


 



Thursday 9 March 2023

Finding the MLST sequence type of an isolate

I want to find the MLST sequence type of Vibrio cholerae isolates based on their genome assemblies.

I find I can do it using the 'mlst' tool, described here.

To run it is very simple, e.g.

% mlst --scheme vcholerae assembly.fa

where assembly.fa is my assembly fasta file.

The output looked like this:

assembly.fa     vcholerae       338     adk(14) gyrB(36)        mdh(6)  metE(193)       pntA(11)        purM(1) pyrC(141)

That is, this isolate is ST338 in the Octavia et al MLST scheme for V. cholerae. Easy peasy!

Acknowledgements

Thanks to my colleages Rahma Golicha and Mat Beale for help with this.