# HG changeset patch # User dereeper # Date 1534248130 14400 # Node ID e3beb33f88f0b3851d5e55d523869d7541cd9fcd planemo upload commit 11382afe87364aaafb19973470d5066229a6e34f diff -r 000000000000 -r e3beb33f88f0 Cytoscape.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Cytoscape.pl Tue Aug 14 08:02:10 2018 -0400 @@ -0,0 +1,115 @@ +#!/usr/bin/perl + +use strict; +#use Switch; +use Getopt::Long; +use Bio::SeqIO; + +use Cwd; +my $dir = getcwd; + + +my $usage = qq~Usage:$0 [] +where are: + -i, --input + -h, --html +~; +$usage .= "\n"; + +my ($infile,$htmlout); + + +GetOptions( + "input=s" => \$infile, + "html=s" => \$htmlout, +); + + +die $usage + if ( !$infile); + + +my $datain = ""; +open(I,$infile); +while(){ + my $line = $_; + $datain.=$line; +} +close(I); +chomp($datain);chomp($datain); +# remove brackets at the beginning and end of JSON +my $new_datain = substr($datain,1,length($datain)-2); +$datain = $new_datain; + +my @colors = ("#ed292a","#ed292a","#82ABA0","#2255a6","#6ebe43","#e76599","#662e91","#c180ff","#ea8b2f","#fff100","#666666","#01ffff","#bfbfbf","#2ac966","#666666"); + + +my $pie_block = ""; +for (my $i = 0; $i <= scalar @colors; $i++){ + $pie_block .= "'pie-$i-background-color': '$colors[$i]',\n"; + $pie_block .= "'pie-$i-background-size': 'mapData(group$i, 0, 10, 0, 100)',\n"; +} + +open(HTML_CYTOSCAPE,">$htmlout"); + my $html = qq~ + + + + + +Pie style + + + + + +
+
+~; +print HTML_CYTOSCAPE $html; +close(HTML_CYTOSCAPE); + diff -r 000000000000 -r e3beb33f88f0 Cytoscape.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Cytoscape.sh Tue Aug 14 08:02:10 2018 -0400 @@ -0,0 +1,13 @@ +#!/bin/bash + +tool_path=$(dirname $0) + +filein=$1 +cytoscape_html=$2 +logfile=$3 + +perl $tool_path/Cytoscape.pl --input $filein --html $cytoscape_html >>$logfile 2>&1 + + + + diff -r 000000000000 -r e3beb33f88f0 Cytoscape.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Cytoscape.xml Tue Aug 14 08:02:10 2018 -0400 @@ -0,0 +1,134 @@ + + + + Visualize interaction networks from JSON file + + + + perl + perl-bioperl + + + + + + + + + + + + Cytoscape.sh $input $cytoscape_html $filelog + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r e3beb33f88f0 static/images/network.png Binary file static/images/network.png has changed diff -r 000000000000 -r e3beb33f88f0 test-data/input.json --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/input.json Tue Aug 14 08:02:10 2018 -0400 @@ -0,0 +1,22 @@ +{"elements": {"nodes": [{ "data": { "id": "MV1", "width": 0.1} }, +{ "data": { "id": "MV2", "width": 0.1} }, +{ "data": { "id": "MV3", "width": 0.1} }, +{ "data": { "id": "haplo1", "width": 1.2000000000000002 } }, +{ "data": { "id": "haplo2", "width": 0.8 } }, +{ "data": { "id": "haplo3", "width": 5.0 } }, +{ "data": { "id": "haplo4", "width": 0.8 } }, +{ "data": { "id": "haplo5", "width": 0.8 } }, +{ "data": { "id": "haplo6", "width": 0.8 } }, +{ "data": { "id": "haplo7", "width": 0.8 } }, +{ "data": { "id": "haplo8", "width": 0.8 } }], +"edges": [ +{ "data": { "id": "haplo4MV1", "weight": 1, "source": "haplo4", "target": "MV1"} }, +{ "data": { "id": "haplo3haplo4", "weight": 1, "source": "haplo3", "target": "haplo4"} }, +{ "data": { "id": "haplo4haplo6", "weight": 1, "source": "haplo4", "target": "haplo6"} }, +{ "data": { "id": "haplo1MV1", "weight": 1, "source": "haplo1", "target": "MV1"} }, +{ "data": { "id": "haplo1haplo2", "weight": 1, "source": "haplo1", "target": "haplo2"} }, +{ "data": { "id": "haplo7MV2", "weight": 1, "source": "haplo7", "target": "MV2"} }, +{ "data": { "id": "MV2MV3", "weight": 1, "source": "MV2", "target": "MV3"} }, +{ "data": { "id": "haplo5MV3", "weight": 1, "source": "haplo5", "target": "MV3"} }, +{ "data": { "id": "MV1MV2", "weight": 1, "source": "MV1", "target": "MV2"} }, +{ "data": { "id": "haplo8MV3", "weight": 1, "source": "haplo8", "target": "MV3"} }]}} \ No newline at end of file diff -r 000000000000 -r e3beb33f88f0 test-data/network.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/network.html Tue Aug 14 08:02:10 2018 -0400 @@ -0,0 +1,111 @@ + + + + + + +Pie style + + + + + +
+