├── LICENSE ├── README.md ├── doc ├── Manual.html ├── Manual.md ├── Manual.pdf └── src │ ├── GM.jpg │ ├── aNodes.jpg │ ├── admin.jpg │ ├── admin_p.jpg │ ├── application.jpg │ ├── cover.jpg │ ├── demo.jpg │ ├── fasta_missing_d.jpg │ ├── gene.jpg │ ├── gene_d.jpg │ ├── graph_m_d.jpg │ ├── hover.jpg │ ├── interaction.jpg │ ├── load_gfa_d.jpg │ ├── load_vcf_d.jpg │ ├── mSelection.jpg │ ├── node_shape_d.jpg │ ├── sample_s_d.jpg │ ├── selection_basic_d.jpg │ ├── sequence_w.jpg │ ├── variant.jpg │ ├── vcf_err_d.jpg │ ├── webLogin.jpg │ ├── webUI.jpg │ └── workflow.jpg ├── panGraphViewerApp ├── README.md ├── config.ini ├── config_default.ini ├── panGraphViewerApp.py ├── requirements.txt ├── requirements_windows.txt └── scripts │ ├── About.py │ ├── About_mac.py │ ├── GraphModificationUI.py │ ├── GraphModificationUI_mac.py │ ├── NodeShapesUI.py │ ├── NodeShapesUI_mac.py │ ├── NodesInfoBrowser.py │ ├── UI_vcf2rGFA.py │ ├── UI_vcf2rGFA_mac.py │ ├── __init__.py │ ├── config.ini │ ├── config_default.ini │ ├── entireUIDesign.py │ ├── entireUIDesign_mac.py │ ├── gfa2rGFA.py │ ├── nodeGeneOverlap.py │ ├── nodeGeneOverlapUI.py │ ├── panGraph.py │ ├── renameFastaHeader.py │ ├── renameFastaHeaderUI.py │ ├── renameFastaHeaderUI_mac.py │ ├── screenClipping.py │ ├── screenshot.py │ ├── template │ ├── htmlTemplate.html │ ├── htmlTemplate_cytoscape.html │ ├── images │ │ ├── cy │ │ │ ├── barrel.png │ │ │ ├── bottom-round-rectangle.png │ │ │ ├── concave-hexagon.png │ │ │ ├── cut-rectangle.png │ │ │ ├── diamond.png │ │ │ ├── ellipse.png │ │ │ ├── heptagon.png │ │ │ ├── hexagon.png │ │ │ ├── octagon.png │ │ │ ├── pentagon.png │ │ │ ├── rectangle.png │ │ │ ├── rhomboid.png │ │ │ ├── round-diamond.png │ │ │ ├── round-heptagon.png │ │ │ ├── round-hexagon.png │ │ │ ├── round-octagon.png │ │ │ ├── round-pentagon.png │ │ │ ├── round-rectangle.png │ │ │ ├── round-tag.png │ │ │ ├── round-triangle.png │ │ │ ├── star.png │ │ │ ├── tag.png │ │ │ ├── triangle.png │ │ │ └── vee.png │ │ ├── gen_images_js.py │ │ └── vis │ │ │ ├── box.png │ │ │ ├── database.png │ │ │ ├── diamond.png │ │ │ ├── dot.png │ │ │ ├── ellipse.png │ │ │ ├── square.png │ │ │ ├── star.png │ │ │ ├── text.png │ │ │ ├── triangle.png │ │ │ └── triangleDown.png │ ├── loader.gif │ ├── static.zip │ └── static │ │ ├── cy │ │ ├── css │ │ │ ├── cytoscape-context-menus.css │ │ │ └── index.css │ │ └── js │ │ │ ├── all.min.js │ │ │ ├── bluebird.js │ │ │ ├── cose-base.js │ │ │ ├── cytoscape-context-menus.js │ │ │ ├── cytoscape-fcose.js │ │ │ ├── cytoscape-popper.js │ │ │ ├── cytoscape-popper.min.js │ │ │ ├── cytoscape.min.js │ │ │ ├── fetch.min.js │ │ │ ├── fetch.min.js.map │ │ │ ├── index.all.min.js │ │ │ ├── index.all.min.js.map │ │ │ ├── jquery-2.0.3.min.js │ │ │ ├── layout-base.js │ │ │ ├── popper.js │ │ │ └── popper.js.map │ │ ├── images.js │ │ ├── images │ │ └── loader.gif │ │ └── vis │ │ ├── css │ │ └── vis.css │ │ └── js │ │ ├── jquery-2.0.3.min.js │ │ └── vis-network.min.js │ ├── utilities.py │ ├── vcf2rGFA.py │ └── vcf2rGFAHelper.py ├── panGraphViewerWeb ├── .gitignore ├── Dockerfile ├── README.md ├── config.ini ├── config_default.ini ├── db.sqlite3 ├── docker │ ├── build_docker.bat │ ├── build_docker.sh │ ├── run_docker.bat │ ├── run_docker.sh │ ├── run_docker_prebuilt.bat │ └── run_docker_prebuilt.sh ├── manage.py ├── pangraph │ ├── .env │ ├── __init__.py │ ├── asgi.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── pangraphviewer │ ├── __init__.py │ ├── admin.py │ ├── apps.py │ ├── forms.py │ ├── gfa2rGFA.py │ ├── migrations │ │ ├── 0001_initial.py │ │ └── __init__.py │ ├── models.py │ ├── panGraph.py │ ├── panGraphWeb.py │ ├── templates │ │ ├── base.html │ │ ├── pangraphviewer │ │ │ ├── .gitignore │ │ │ ├── base4.html │ │ │ ├── config.html │ │ │ ├── graph.html │ │ │ ├── navbar4.html │ │ │ └── vcf_to_gfa.html │ │ └── registration │ │ │ └── login.html │ ├── tests.py │ ├── urls.py │ ├── utilities.py │ ├── vcf2rGFA.py │ ├── vcf2rGFAHelper.py │ └── views.py ├── requirements.txt ├── requirements_windows.txt ├── run.bat ├── run.sh └── static │ ├── favicon.ico │ ├── images │ ├── add.svg │ ├── cy │ │ ├── barrel.png │ │ ├── bottom-round-rectangle.png │ │ ├── concave-hexagon.png │ │ ├── cut-rectangle.png │ │ ├── diamond.png │ │ ├── ellipse.png │ │ ├── heptagon.png │ │ ├── hexagon.png │ │ ├── octagon.png │ │ ├── pentagon.png │ │ ├── rectangle.png │ │ ├── rhomboid.png │ │ ├── round-diamond.png │ │ ├── round-heptagon.png │ │ ├── round-hexagon.png │ │ ├── round-octagon.png │ │ ├── round-pentagon.png │ │ ├── round-rectangle.png │ │ ├── round-tag.png │ │ ├── round-triangle.png │ │ ├── star.png │ │ ├── tag.png │ │ ├── triangle.png │ │ └── vee.png │ ├── frontpage.jpg │ ├── loader.gif │ └── remove.svg │ └── pangraphviewer │ ├── css │ ├── bootstrap.min.css │ ├── bootstrap.min.css.map │ ├── cytoscape-context-menus.css │ ├── index.css │ ├── style.css │ ├── upload.css │ └── vis.css │ └── js │ ├── bootstrap.bundle.min.js │ ├── bootstrap.bundle.min.js.map │ ├── config.js │ ├── cose-base.js │ ├── cytoscape-context-menus.js │ ├── cytoscape-fcose.js │ ├── cytoscape-popper.js │ ├── cytoscape.min.js │ ├── graph.js │ ├── html2canvas.min.js │ ├── index.all.min.js │ ├── index.all.min.js.map │ ├── jquery.min.js │ ├── layout-base.js │ ├── popper.js │ ├── popper.js.map │ ├── popper.min.js │ ├── vcf_to_gfa.js │ └── vis-network.min.js ├── test ├── 1-rGFA │ ├── demo.bed │ ├── demo.gfa │ ├── demo.gff3 │ └── demo.gtf ├── 2-GFA1 │ ├── tiny.gfa │ └── tiny.gtf ├── 3-VCF │ ├── test.bed │ ├── test.fasta │ └── test.vcf └── README.md └── thirdPartyTools ├── README.md └── SAMtools ├── ace2sam.exe ├── bcftools.exe ├── bgzip.exe ├── blast2sam.pl ├── bowtie2sam.pl ├── color-chrs.pl ├── export2sam.pl ├── htsfile.exe ├── interpolate_sam.pl ├── maq2sam-long.exe ├── maq2sam-short.exe ├── md5fa.exe ├── md5sum-lite.exe ├── msys-2.0.dll ├── msys-ncursesw6.dll ├── msys-z.dll ├── novo2sam.pl ├── plot-bamstats ├── plot-vcfstats ├── psl2sam.pl ├── sam2vcf.pl ├── samtools.exe ├── samtools.pl ├── seq_cache_populate.pl ├── soap2sam.pl ├── tabix.exe ├── varfilter.py ├── vcfutils.pl ├── wgsim.exe ├── wgsim_eval.pl └── zoom2sam.pl /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 TF-Chan-Lab 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /doc/Manual.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/doc/Manual.pdf -------------------------------------------------------------------------------- /doc/src/GM.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/doc/src/GM.jpg -------------------------------------------------------------------------------- /doc/src/aNodes.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/doc/src/aNodes.jpg -------------------------------------------------------------------------------- /doc/src/admin.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/doc/src/admin.jpg -------------------------------------------------------------------------------- /doc/src/admin_p.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/doc/src/admin_p.jpg -------------------------------------------------------------------------------- /doc/src/application.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/doc/src/application.jpg -------------------------------------------------------------------------------- /doc/src/cover.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/doc/src/cover.jpg -------------------------------------------------------------------------------- /doc/src/demo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/doc/src/demo.jpg -------------------------------------------------------------------------------- /doc/src/fasta_missing_d.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/doc/src/fasta_missing_d.jpg -------------------------------------------------------------------------------- /doc/src/gene.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/doc/src/gene.jpg -------------------------------------------------------------------------------- /doc/src/gene_d.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/doc/src/gene_d.jpg -------------------------------------------------------------------------------- /doc/src/graph_m_d.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/doc/src/graph_m_d.jpg -------------------------------------------------------------------------------- /doc/src/hover.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/doc/src/hover.jpg -------------------------------------------------------------------------------- /doc/src/interaction.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/doc/src/interaction.jpg -------------------------------------------------------------------------------- /doc/src/load_gfa_d.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/doc/src/load_gfa_d.jpg -------------------------------------------------------------------------------- /doc/src/load_vcf_d.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/doc/src/load_vcf_d.jpg -------------------------------------------------------------------------------- /doc/src/mSelection.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/doc/src/mSelection.jpg -------------------------------------------------------------------------------- /doc/src/node_shape_d.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/doc/src/node_shape_d.jpg -------------------------------------------------------------------------------- /doc/src/sample_s_d.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/doc/src/sample_s_d.jpg -------------------------------------------------------------------------------- /doc/src/selection_basic_d.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/doc/src/selection_basic_d.jpg -------------------------------------------------------------------------------- /doc/src/sequence_w.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/doc/src/sequence_w.jpg -------------------------------------------------------------------------------- /doc/src/variant.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/doc/src/variant.jpg -------------------------------------------------------------------------------- /doc/src/vcf_err_d.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/doc/src/vcf_err_d.jpg -------------------------------------------------------------------------------- /doc/src/webLogin.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/doc/src/webLogin.jpg -------------------------------------------------------------------------------- /doc/src/webUI.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/doc/src/webUI.jpg -------------------------------------------------------------------------------- /doc/src/workflow.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/doc/src/workflow.jpg -------------------------------------------------------------------------------- /panGraphViewerApp/README.md: -------------------------------------------------------------------------------- 1 | ## Welcome to the Desktop-based PanGraphViewer 2 | 3 | ### How to install this application 4 | 5 | You may follow the instruction [here](https://github.com/TF-Chan-Lab/panGraphViewer/wiki/Installation) to install this application. 6 | 7 | ### How to open the application 8 | 9 | You may follow the instruction [here](https://github.com/TF-Chan-Lab/panGraphViewer/wiki/Start-the-program) to start the application. 10 | 11 | ### How to use this application 12 | 13 | You may follow the [Manual](../doc/Manual.md#how-to-use-desktop-based-pangraphviewer) to get familiar with the software. 14 | 15 | Enjoy the use of panGraphViewer! 16 | -------------------------------------------------------------------------------- /panGraphViewerApp/config.ini: -------------------------------------------------------------------------------- 1 | [nodes] 2 | colors = 3 | 800000,8B0000,A52A2A,B22222,DC143C,FF0000,FF6347,FF7F50, 4 | CD5C5C,F08080,E9967A,FA8072,FFA07A,FF4500,FF8C00,FFA500, 5 | FFD700,B8860B,DAA520,EEE8AA,BDB76B,F0E68C,808000,FFFF00, 6 | 9ACD32,556B2F,6B8E23,7CFC00,7FFF00,ADFF2F,006400,008000, 7 | 228B22,00FF00,32CD32,90EE90,98FB98,8FBC8F,00FA9A,00FF7F, 8 | 2E8B57,66CDAA,3CB371,20B2AA,2F4F4F,008080,008B8B,00FFFF, 9 | 00FFFF,E0FFFF,00CED1,40E0D0,48D1CC,AFEEEE,7FFFD4,B0E0E6, 10 | 5F9EA0,4682B4,6495ED,00BFFF,1E90FF,ADD8E6,87CEEB,87CEFA, 11 | 191970,000080,0000CD,0000FF,4169E1,8A2BE2,4B0082,483D8B, 12 | 6A5ACD,7B68EE,9370DB,8B008B,9400D3,9932CC,BA55D3,800080, 13 | D8BFD8,DDA0DD,EE82EE,FF00FF,DA70D6,C71585,DB7093,FF1493, 14 | FF69B4,FFB6C1,FFC0CB,FAEBD7,F5F5DC,FFE4C4,FFEBCD,F5DEB3, 15 | FFF8DC,FFFACD,FAFAD2,FFFFE0,8B4513,A0522D,D2691E,CD853F, 16 | F4A460,DEB887,D2B48C,BC8F8F,FFE4B5,FFDEAD,FFDAB9,FFE4E1, 17 | FFF0F5,FAF0E6,FDF5E6,FFEFD5,FFF5EE,F5FFFA,708090,778899, 18 | B0C4DE,E6E6FA,FFFAF0,F0F8FF,F8F8FF,F0FFF0,75fa7a,F0FFFF, 19 | 4f94d4,f86368,696969,808080,A9A9A9,C0C0C0,D3D3D3,DCDCDC, 20 | F5F5F5,1ed14b,fe4a49,2ab7ca,fed766,e6e6ea,f4f4f8,eee3e7, 21 | ead5dc,eec9d2,f4b6c2,f6abb6,005b96,6497b1,b3cde0,851e3e, 22 | dec3c3,e7d3d3,f0e4e4,f9f4f4,0e9aa7,3da4ab,f6cd61,fe8a71, 23 | 4b86b4,adcbe3,63ace5,fe9c8f,feb2a8,fec8c1,fad9c1,f9caa7, 24 | 009688,35a79c,54b2a9,65c3ba,83d0c9,ee4035,f37736,fdf498, 25 | 7bc043,0392cf,96ceb4,ffeead,ff6f69,ffcc5c,88d8b0,008744, 26 | 0057e7,d62d20,ffa700,CDCDCD,a8e6cf,dcedc1,ffd3b6,ffaaa5, 27 | ff8b94,d11141,00b159,00aedb,f37735,ffc425,84c1ff 28 | 29 | SN_delim = || 30 | 31 | BB_shape = dot 32 | 33 | SNP_shape = dot 34 | DEL_shape = triangle 35 | DUP_shape = database 36 | INS_shape = triangleDown 37 | INV_shape = text 38 | BND_shape = star 39 | 40 | maxNodesDisplay = 200 41 | maxNodesLimit = 20000 42 | maxNodeLenDisplay = 100000 43 | 44 | checknLines = 10 45 | 46 | geneNodeOverlapCntThreshold = 2 47 | 48 | [enable] 49 | interaction = No 50 | graphLayoutModification = No 51 | addRemoveNodes = No 52 | 53 | [canvas] 54 | height = 980 55 | width = 1400 56 | 57 | [cytoscape] 58 | BB_shape = ellipse 59 | 60 | SNP_shape = ellipse 61 | DEL_shape = concave-hexagon 62 | DUP_shape = diamond 63 | INS_shape = triangle 64 | INV_shape = vee 65 | BND_shape = star 66 | 67 | [web] 68 | work_dir = /tmp/panGraph/working 69 | -------------------------------------------------------------------------------- /panGraphViewerApp/config_default.ini: -------------------------------------------------------------------------------- 1 | [nodes] 2 | colors = 3 | 800000,8B0000,A52A2A,B22222,DC143C,FF0000,FF6347,FF7F50, 4 | CD5C5C,F08080,E9967A,FA8072,FFA07A,FF4500,FF8C00,FFA500, 5 | FFD700,B8860B,DAA520,EEE8AA,BDB76B,F0E68C,808000,FFFF00, 6 | 9ACD32,556B2F,6B8E23,7CFC00,7FFF00,ADFF2F,006400,008000, 7 | 228B22,00FF00,32CD32,90EE90,98FB98,8FBC8F,00FA9A,00FF7F, 8 | 2E8B57,66CDAA,3CB371,20B2AA,2F4F4F,008080,008B8B,00FFFF, 9 | 00FFFF,E0FFFF,00CED1,40E0D0,48D1CC,AFEEEE,7FFFD4,B0E0E6, 10 | 5F9EA0,4682B4,6495ED,00BFFF,1E90FF,ADD8E6,87CEEB,87CEFA, 11 | 191970,000080,0000CD,0000FF,4169E1,8A2BE2,4B0082,483D8B, 12 | 6A5ACD,7B68EE,9370DB,8B008B,9400D3,9932CC,BA55D3,800080, 13 | D8BFD8,DDA0DD,EE82EE,FF00FF,DA70D6,C71585,DB7093,FF1493, 14 | FF69B4,FFB6C1,FFC0CB,FAEBD7,F5F5DC,FFE4C4,FFEBCD,F5DEB3, 15 | FFF8DC,FFFACD,FAFAD2,FFFFE0,8B4513,A0522D,D2691E,CD853F, 16 | F4A460,DEB887,D2B48C,BC8F8F,FFE4B5,FFDEAD,FFDAB9,FFE4E1, 17 | FFF0F5,FAF0E6,FDF5E6,FFEFD5,FFF5EE,F5FFFA,708090,778899, 18 | B0C4DE,E6E6FA,FFFAF0,F0F8FF,F8F8FF,F0FFF0,75fa7a,F0FFFF, 19 | 4f94d4,f86368,696969,808080,A9A9A9,C0C0C0,D3D3D3,DCDCDC, 20 | F5F5F5,1ed14b,fe4a49,2ab7ca,fed766,e6e6ea,f4f4f8,eee3e7, 21 | ead5dc,eec9d2,f4b6c2,f6abb6,005b96,6497b1,b3cde0,851e3e, 22 | dec3c3,e7d3d3,f0e4e4,f9f4f4,0e9aa7,3da4ab,f6cd61,fe8a71, 23 | 4b86b4,adcbe3,63ace5,fe9c8f,feb2a8,fec8c1,fad9c1,f9caa7, 24 | 009688,35a79c,54b2a9,65c3ba,83d0c9,ee4035,f37736,fdf498, 25 | 7bc043,0392cf,96ceb4,ffeead,ff6f69,ffcc5c,88d8b0,008744, 26 | 0057e7,d62d20,ffa700,CDCDCD,a8e6cf,dcedc1,ffd3b6,ffaaa5, 27 | ff8b94,d11141,00b159,00aedb,f37735,ffc425,84c1ff 28 | 29 | SN_delim = || 30 | 31 | BB_shape = dot 32 | 33 | SNP_shape = dot 34 | DEL_shape = triangle 35 | DUP_shape = database 36 | INS_shape = triangleDown 37 | INV_shape = text 38 | BND_shape = star 39 | 40 | maxNodesDisplay = 200 41 | maxNodesLimit = 20000 42 | maxNodeLenDisplay = 100000 43 | 44 | checknLines = 10 45 | 46 | geneNodeOverlapCntThreshold = 2 47 | 48 | [enable] 49 | interaction = No 50 | graphLayoutModification = No 51 | addRemoveNodes = No 52 | 53 | [canvas] 54 | height = 980 55 | width = 1400 56 | 57 | [cytoscape] 58 | BB_shape = ellipse 59 | 60 | SNP_shape = ellipse 61 | DEL_shape = concave-hexagon 62 | DUP_shape = diamond 63 | INS_shape = triangle 64 | INV_shape = vee 65 | BND_shape = star 66 | 67 | [web] 68 | work_dir = /tmp/panGraph/working 69 | -------------------------------------------------------------------------------- /panGraphViewerApp/requirements.txt: -------------------------------------------------------------------------------- 1 | PyQt5==5.12.3 2 | PyQtWebEngine==5.12.1 3 | configparser 4 | pandas 5 | bokeh==2.2.3 6 | dna_features_viewer 7 | natsort 8 | networkx 9 | pysam 10 | jinja2==3.0 11 | -------------------------------------------------------------------------------- /panGraphViewerApp/requirements_windows.txt: -------------------------------------------------------------------------------- 1 | PyQt5==5.12.3 2 | PyQtWebEngine==5.12.1 3 | configparser 4 | pandas 5 | bokeh==2.2.3 6 | dna_features_viewer 7 | natsort 8 | networkx 9 | pyfaidx 10 | -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/About_mac.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Form implementation generated from reading ui file 'about_mac.ui' 4 | # 5 | # Created by: PyQt5 UI code generator 5.12.3 6 | # 7 | # WARNING! All changes made in this file will be lost! 8 | 9 | 10 | from PyQt5 import QtCore, QtGui, QtWidgets 11 | 12 | 13 | class Ui_About(object): 14 | def setupUi(self, About): 15 | About.setObjectName("About") 16 | About.resize(495, 440) 17 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) 18 | sizePolicy.setHorizontalStretch(0) 19 | sizePolicy.setVerticalStretch(0) 20 | sizePolicy.setHeightForWidth(About.sizePolicy().hasHeightForWidth()) 21 | About.setSizePolicy(sizePolicy) 22 | About.setMinimumSize(QtCore.QSize(495, 440)) 23 | About.setMaximumSize(QtCore.QSize(495, 440)) 24 | self.gridLayout = QtWidgets.QGridLayout(About) 25 | self.gridLayout.setObjectName("gridLayout") 26 | spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) 27 | self.gridLayout.addItem(spacerItem, 2, 0, 1, 1) 28 | self.closeButton = QtWidgets.QPushButton(About) 29 | self.closeButton.setObjectName("closeButton") 30 | self.gridLayout.addWidget(self.closeButton, 2, 2, 1, 1) 31 | self.textBrowser = QtWidgets.QTextBrowser(About) 32 | self.textBrowser.setObjectName("textBrowser") 33 | self.gridLayout.addWidget(self.textBrowser, 1, 0, 1, 3) 34 | 35 | self.retranslateUi(About) 36 | QtCore.QMetaObject.connectSlotsByName(About) 37 | 38 | def retranslateUi(self, About): 39 | _translate = QtCore.QCoreApplication.translate 40 | About.setWindowTitle(_translate("About", "About")) 41 | self.closeButton.setText(_translate("About", "OK")) 42 | self.textBrowser.setHtml(_translate("About", "\n" 43 | "\n" 46 | "

----------------------------------------------------------------

\n" 47 | "

Name: PanGraphViewer

\n" 48 | "

Version: 1.0.2

\n" 49 | "

Creators: Yuxuan Yuan, Ricky Ma and Ting-Fung Chan

\n" 50 | "

Copyright: TF Chan Lab (c) 2022, the Chinese University of Hong Kong, HK

\n" 51 | "

----------------------------------------------------------------

\n" 52 | "

PanGraphViewer is a tool helping to create a graph-based pangenome using a given VCF file with or without a fasta file. It can also accept a reference graphical fragment assembly (rGFA) file from other software, such as minigraph. PanGraphViewer shows the genome graph in a graphical user interface (GUI) or a webpage.

\n" 53 | "


\n" 54 | "

During graph display, users can customise the layout of a graph. Users can also check genes overlapping with specific genomic regions (nodes). Multiple nodes selection enable users to browse the seleted nodes only or the rest nodes only.

\n" 55 | "


\n" 56 | "

PanGraphViewer also provides functions to check the sequence of selected nodes and enable users to save the corresponding sequences. By clicking \'Tools\' in the top left panel of the GUI, users can upload the saved sequences to NCBI blast to check the function of the selected genomic regions.

\n" 57 | "


\n" 58 | "

Users can also perform multiple sequence alignment by uploading the saved sequences to MAFFT.

\n" 59 | "


\n" 60 | "

panGraphViewer provides an easy way to display a pangenome graph from rGFA or VCF files.

")) 61 | -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/NodesInfoBrowser.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Form implementation generated from reading ui file 'NodesInfoBrowser.ui' 4 | # 5 | # Created by: PyQt5 UI code generator 5.15.2 6 | # 7 | # WARNING: Any manual changes made to this file will be lost when pyuic5 is 8 | # run again. Do not edit this file unless you know what you are doing. 9 | 10 | 11 | from PyQt5 import QtCore, QtGui, QtWidgets 12 | 13 | 14 | class Ui_NodesInfoCanvas(object): 15 | def setupUi(self, NodesInfoCanvas): 16 | NodesInfoCanvas.setObjectName("NodesInfoCanvas") 17 | NodesInfoCanvas.resize(400, 300) 18 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) 19 | sizePolicy.setHorizontalStretch(0) 20 | sizePolicy.setVerticalStretch(0) 21 | sizePolicy.setHeightForWidth(NodesInfoCanvas.sizePolicy().hasHeightForWidth()) 22 | NodesInfoCanvas.setSizePolicy(sizePolicy) 23 | self.verticalLayout = QtWidgets.QVBoxLayout(NodesInfoCanvas) 24 | self.verticalLayout.setObjectName("verticalLayout") 25 | self.NodeInfotextBrowser = QtWidgets.QTextBrowser(NodesInfoCanvas) 26 | self.NodeInfotextBrowser.setObjectName("NodeInfotextBrowser") 27 | self.verticalLayout.addWidget(self.NodeInfotextBrowser) 28 | 29 | self.retranslateUi(NodesInfoCanvas) 30 | QtCore.QMetaObject.connectSlotsByName(NodesInfoCanvas) 31 | 32 | def retranslateUi(self, NodesInfoCanvas): 33 | _translate = QtCore.QCoreApplication.translate 34 | NodesInfoCanvas.setWindowTitle(_translate("NodesInfoCanvas", "Selected node(s) Information")) 35 | -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerApp/scripts/__init__.py -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/config.ini: -------------------------------------------------------------------------------- 1 | [nodes] 2 | colors = 3 | 800000,8B0000,A52A2A,B22222,DC143C,FF0000,FF6347,FF7F50, 4 | CD5C5C,F08080,E9967A,FA8072,FFA07A,FF4500,FF8C00,FFA500, 5 | FFD700,B8860B,DAA520,EEE8AA,BDB76B,F0E68C,808000,FFFF00, 6 | 9ACD32,556B2F,6B8E23,7CFC00,7FFF00,ADFF2F,006400,008000, 7 | 228B22,00FF00,32CD32,90EE90,98FB98,8FBC8F,00FA9A,00FF7F, 8 | 2E8B57,66CDAA,3CB371,20B2AA,2F4F4F,008080,008B8B,00FFFF, 9 | 00FFFF,E0FFFF,00CED1,40E0D0,48D1CC,AFEEEE,7FFFD4,B0E0E6, 10 | 5F9EA0,4682B4,6495ED,00BFFF,1E90FF,ADD8E6,87CEEB,87CEFA, 11 | 191970,000080,0000CD,0000FF,4169E1,8A2BE2,4B0082,483D8B, 12 | 6A5ACD,7B68EE,9370DB,8B008B,9400D3,9932CC,BA55D3,800080, 13 | D8BFD8,DDA0DD,EE82EE,FF00FF,DA70D6,C71585,DB7093,FF1493, 14 | FF69B4,FFB6C1,FFC0CB,FAEBD7,F5F5DC,FFE4C4,FFEBCD,F5DEB3, 15 | FFF8DC,FFFACD,FAFAD2,FFFFE0,8B4513,A0522D,D2691E,CD853F, 16 | F4A460,DEB887,D2B48C,BC8F8F,FFE4B5,FFDEAD,FFDAB9,FFE4E1, 17 | FFF0F5,FAF0E6,FDF5E6,FFEFD5,FFF5EE,F5FFFA,708090,778899, 18 | B0C4DE,E6E6FA,FFFAF0,F0F8FF,F8F8FF,F0FFF0,75fa7a,F0FFFF, 19 | 4f94d4,f86368,696969,808080,A9A9A9,C0C0C0,D3D3D3,DCDCDC, 20 | F5F5F5,1ed14b,fe4a49,2ab7ca,fed766,e6e6ea,f4f4f8,eee3e7, 21 | ead5dc,eec9d2,f4b6c2,f6abb6,005b96,6497b1,b3cde0,851e3e, 22 | dec3c3,e7d3d3,f0e4e4,f9f4f4,0e9aa7,3da4ab,f6cd61,fe8a71, 23 | 4b86b4,adcbe3,63ace5,fe9c8f,feb2a8,fec8c1,fad9c1,f9caa7, 24 | 009688,35a79c,54b2a9,65c3ba,83d0c9,ee4035,f37736,fdf498, 25 | 7bc043,0392cf,96ceb4,ffeead,ff6f69,ffcc5c,88d8b0,008744, 26 | 0057e7,d62d20,ffa700,CDCDCD,a8e6cf,dcedc1,ffd3b6,ffaaa5, 27 | ff8b94,d11141,00b159,00aedb,f37735,ffc425,84c1ff 28 | 29 | SN_delim = || 30 | 31 | BB_shape = dot 32 | 33 | SNP_shape = dot 34 | DEL_shape = triangle 35 | DUP_shape = database 36 | INS_shape = triangleDown 37 | INV_shape = text 38 | BND_shape = star 39 | 40 | maxNodesDisplay = 200 41 | maxNodesLimit = 20000 42 | maxNodeLenDisplay = 100000 43 | 44 | checknLines = 10 45 | 46 | geneNodeOverlapCntThreshold = 2 47 | 48 | [enable] 49 | interaction = No 50 | graphLayoutModification = No 51 | addRemoveNodes = No 52 | 53 | [canvas] 54 | height = 980 55 | width = 1400 56 | 57 | [cytoscape] 58 | BB_shape = ellipse 59 | 60 | SNP_shape = ellipse 61 | DEL_shape = concave-hexagon 62 | DUP_shape = diamond 63 | INS_shape = triangle 64 | INV_shape = vee 65 | BND_shape = star 66 | 67 | [web] 68 | work_dir = /tmp/panGraph/working 69 | -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/config_default.ini: -------------------------------------------------------------------------------- 1 | [nodes] 2 | colors = 3 | 800000,8B0000,A52A2A,B22222,DC143C,FF0000,FF6347,FF7F50, 4 | CD5C5C,F08080,E9967A,FA8072,FFA07A,FF4500,FF8C00,FFA500, 5 | FFD700,B8860B,DAA520,EEE8AA,BDB76B,F0E68C,808000,FFFF00, 6 | 9ACD32,556B2F,6B8E23,7CFC00,7FFF00,ADFF2F,006400,008000, 7 | 228B22,00FF00,32CD32,90EE90,98FB98,8FBC8F,00FA9A,00FF7F, 8 | 2E8B57,66CDAA,3CB371,20B2AA,2F4F4F,008080,008B8B,00FFFF, 9 | 00FFFF,E0FFFF,00CED1,40E0D0,48D1CC,AFEEEE,7FFFD4,B0E0E6, 10 | 5F9EA0,4682B4,6495ED,00BFFF,1E90FF,ADD8E6,87CEEB,87CEFA, 11 | 191970,000080,0000CD,0000FF,4169E1,8A2BE2,4B0082,483D8B, 12 | 6A5ACD,7B68EE,9370DB,8B008B,9400D3,9932CC,BA55D3,800080, 13 | D8BFD8,DDA0DD,EE82EE,FF00FF,DA70D6,C71585,DB7093,FF1493, 14 | FF69B4,FFB6C1,FFC0CB,FAEBD7,F5F5DC,FFE4C4,FFEBCD,F5DEB3, 15 | FFF8DC,FFFACD,FAFAD2,FFFFE0,8B4513,A0522D,D2691E,CD853F, 16 | F4A460,DEB887,D2B48C,BC8F8F,FFE4B5,FFDEAD,FFDAB9,FFE4E1, 17 | FFF0F5,FAF0E6,FDF5E6,FFEFD5,FFF5EE,F5FFFA,708090,778899, 18 | B0C4DE,E6E6FA,FFFAF0,F0F8FF,F8F8FF,F0FFF0,75fa7a,F0FFFF, 19 | 4f94d4,f86368,696969,808080,A9A9A9,C0C0C0,D3D3D3,DCDCDC, 20 | F5F5F5,1ed14b,fe4a49,2ab7ca,fed766,e6e6ea,f4f4f8,eee3e7, 21 | ead5dc,eec9d2,f4b6c2,f6abb6,005b96,6497b1,b3cde0,851e3e, 22 | dec3c3,e7d3d3,f0e4e4,f9f4f4,0e9aa7,3da4ab,f6cd61,fe8a71, 23 | 4b86b4,adcbe3,63ace5,fe9c8f,feb2a8,fec8c1,fad9c1,f9caa7, 24 | 009688,35a79c,54b2a9,65c3ba,83d0c9,ee4035,f37736,fdf498, 25 | 7bc043,0392cf,96ceb4,ffeead,ff6f69,ffcc5c,88d8b0,008744, 26 | 0057e7,d62d20,ffa700,CDCDCD,a8e6cf,dcedc1,ffd3b6,ffaaa5, 27 | ff8b94,d11141,00b159,00aedb,f37735,ffc425,84c1ff 28 | 29 | SN_delim = || 30 | 31 | BB_shape = dot 32 | 33 | SNP_shape = dot 34 | DEL_shape = triangle 35 | DUP_shape = database 36 | INS_shape = triangleDown 37 | INV_shape = text 38 | BND_shape = star 39 | 40 | maxNodesDisplay = 200 41 | maxNodesLimit = 20000 42 | maxNodeLenDisplay = 100000 43 | 44 | checknLines = 10 45 | 46 | geneNodeOverlapCntThreshold = 2 47 | 48 | [enable] 49 | interaction = No 50 | graphLayoutModification = No 51 | addRemoveNodes = No 52 | 53 | [canvas] 54 | height = 980 55 | width = 1400 56 | 57 | [cytoscape] 58 | BB_shape = ellipse 59 | 60 | SNP_shape = ellipse 61 | DEL_shape = concave-hexagon 62 | DUP_shape = diamond 63 | INS_shape = triangle 64 | INV_shape = vee 65 | BND_shape = star 66 | 67 | [web] 68 | work_dir = /tmp/panGraph/working 69 | -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/nodeGeneOverlap.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Form implementation generated from reading ui file 'nodeGeneTable.ui' 4 | # 5 | # Created by: PyQt5 UI code generator 5.12.3 6 | # 7 | # WARNING! All changes made in this file will be lost! 8 | 9 | 10 | from PyQt5 import QtCore, QtGui, QtWidgets 11 | 12 | 13 | class Ui_Form(object): 14 | def setupUi(self, Form): 15 | Form.setObjectName("Form") 16 | Form.resize(320, 485) 17 | Form.setMinimumSize(QtCore.QSize(320, 485)) 18 | Form.setMaximumSize(QtCore.QSize(320, 485)) 19 | self.tableWidget = QtWidgets.QTableWidget(Form) 20 | self.tableWidget.setGeometry(QtCore.QRect(10, 60, 301, 371)) 21 | self.tableWidget.setObjectName("tableWidget") 22 | self.tableWidget.setColumnCount(2) 23 | self.tableWidget.setRowCount(0) 24 | item = QtWidgets.QTableWidgetItem() 25 | font = QtGui.QFont() 26 | font.setBold(True) 27 | font.setWeight(75) 28 | item.setFont(font) 29 | self.tableWidget.setHorizontalHeaderItem(0, item) 30 | item = QtWidgets.QTableWidgetItem() 31 | font = QtGui.QFont() 32 | font.setBold(True) 33 | font.setWeight(75) 34 | item.setFont(font) 35 | item.setBackground(QtGui.QColor(0, 0, 255)) 36 | self.tableWidget.setHorizontalHeaderItem(1, item) 37 | self.label = QtWidgets.QLabel(Form) 38 | self.label.setGeometry(QtCore.QRect(20, 20, 291, 31)) 39 | font = QtGui.QFont() 40 | font.setPointSize(12) 41 | font.setBold(True) 42 | font.setWeight(75) 43 | self.label.setFont(font) 44 | self.label.setObjectName("label") 45 | self.label_2 = QtWidgets.QLabel(Form) 46 | self.label_2.setGeometry(QtCore.QRect(10, 440, 151, 25)) 47 | self.label_2.setMinimumSize(QtCore.QSize(0, 25)) 48 | font = QtGui.QFont() 49 | font.setPointSize(8) 50 | font.setBold(True) 51 | font.setWeight(75) 52 | self.label_2.setFont(font) 53 | self.label_2.setObjectName("label_2") 54 | self.save = QtWidgets.QPushButton(Form) 55 | self.save.setGeometry(QtCore.QRect(240, 440, 75, 23)) 56 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) 57 | sizePolicy.setHorizontalStretch(0) 58 | sizePolicy.setVerticalStretch(25) 59 | sizePolicy.setHeightForWidth(self.save.sizePolicy().hasHeightForWidth()) 60 | self.save.setSizePolicy(sizePolicy) 61 | self.save.setObjectName("save") 62 | 63 | self.retranslateUi(Form) 64 | QtCore.QMetaObject.connectSlotsByName(Form) 65 | 66 | def retranslateUi(self, Form): 67 | _translate = QtCore.QCoreApplication.translate 68 | Form.setWindowTitle(_translate("Form", "Nodes & Genes")) 69 | item = self.tableWidget.horizontalHeaderItem(0) 70 | item.setText(_translate("Form", "Nodes ")) 71 | item = self.tableWidget.horizontalHeaderItem(1) 72 | item.setText(_translate("Form", "Gene ID")) 73 | self.label.setText(_translate("Form", "Node overlapping with gene(s)")) 74 | self.label_2.setText(_translate("Form", "Save to output directory ?")) 75 | self.save.setText(_translate("Form", "Yes")) 76 | -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/nodeGeneOverlapUI.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Form implementation generated from reading ui file 'nodeGeneTable.ui' 4 | # 5 | # Created by: PyQt5 UI code generator 5.12.3 6 | # 7 | # WARNING! All changes made in this file will be lost! 8 | 9 | 10 | from PyQt5 import QtCore, QtGui, QtWidgets 11 | 12 | 13 | class Ui_Form(object): 14 | def setupUi(self, Form): 15 | Form.setObjectName("Form") 16 | Form.resize(320, 485) 17 | Form.setMinimumSize(QtCore.QSize(320, 485)) 18 | Form.setMaximumSize(QtCore.QSize(320, 485)) 19 | self.tableWidget = QtWidgets.QTableWidget(Form) 20 | self.tableWidget.setGeometry(QtCore.QRect(10, 60, 301, 371)) 21 | self.tableWidget.setObjectName("tableWidget") 22 | self.tableWidget.setColumnCount(2) 23 | self.tableWidget.setRowCount(0) 24 | item = QtWidgets.QTableWidgetItem() 25 | font = QtGui.QFont() 26 | font.setBold(True) 27 | font.setWeight(75) 28 | item.setFont(font) 29 | self.tableWidget.setHorizontalHeaderItem(0, item) 30 | item = QtWidgets.QTableWidgetItem() 31 | font = QtGui.QFont() 32 | font.setBold(True) 33 | font.setWeight(75) 34 | item.setFont(font) 35 | item.setBackground(QtGui.QColor(0, 0, 255)) 36 | self.tableWidget.setHorizontalHeaderItem(1, item) 37 | self.label = QtWidgets.QLabel(Form) 38 | self.label.setGeometry(QtCore.QRect(20, 20, 291, 31)) 39 | font = QtGui.QFont() 40 | font.setPointSize(12) 41 | font.setBold(True) 42 | font.setWeight(75) 43 | self.label.setFont(font) 44 | self.label.setObjectName("label") 45 | self.label_2 = QtWidgets.QLabel(Form) 46 | self.label_2.setGeometry(QtCore.QRect(10, 440, 151, 25)) 47 | self.label_2.setMinimumSize(QtCore.QSize(0, 25)) 48 | font = QtGui.QFont() 49 | font.setPointSize(8) 50 | font.setBold(True) 51 | font.setWeight(75) 52 | self.label_2.setFont(font) 53 | self.label_2.setObjectName("label_2") 54 | self.save = QtWidgets.QPushButton(Form) 55 | self.save.setGeometry(QtCore.QRect(240, 440, 75, 23)) 56 | sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) 57 | sizePolicy.setHorizontalStretch(0) 58 | sizePolicy.setVerticalStretch(25) 59 | sizePolicy.setHeightForWidth(self.save.sizePolicy().hasHeightForWidth()) 60 | self.save.setSizePolicy(sizePolicy) 61 | self.save.setObjectName("save") 62 | 63 | self.retranslateUi(Form) 64 | QtCore.QMetaObject.connectSlotsByName(Form) 65 | 66 | def retranslateUi(self, Form): 67 | _translate = QtCore.QCoreApplication.translate 68 | Form.setWindowTitle(_translate("Form", "Nodes & Genes")) 69 | item = self.tableWidget.horizontalHeaderItem(0) 70 | item.setText(_translate("Form", "Nodes ")) 71 | item = self.tableWidget.horizontalHeaderItem(1) 72 | item.setText(_translate("Form", "Gene ID")) 73 | self.label.setText(_translate("Form", "Node overlapping with gene(s)")) 74 | self.label_2.setText(_translate("Form", "Save to output directory ?")) 75 | self.save.setText(_translate("Form", "Yes")) 76 | -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/renameFastaHeader.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import os 4 | import sys 5 | import logging 6 | from argparse import ArgumentParser 7 | 8 | #============================= Function ================================= 9 | ##logging info 10 | DEBUG="" #change it when debugging 11 | logFormat = "%(asctime)s [%(levelname)s] %(message)s" 12 | level = "DEBUG" if DEBUG != "" else "INFO" 13 | logging.basicConfig( stream=sys.stderr, level=level, format=logFormat ) 14 | #======================================================================== 15 | 16 | def checkDir(Dirname): 17 | logging.info("Checking folder: '%s'" % Dirname) 18 | dirname = os.path.abspath(Dirname) 19 | if not os.path.isdir(dirname): 20 | logging.error("Oops! Folder: '%s' does not exit. Please check!" % Dirname) 21 | sys.exit(-1) 22 | if not os.access(dirname, os.W_OK): 23 | logging.error("Oops! Folder: '%s' is not writable. Please check!" % Dirname) 24 | sys.exit(-1) 25 | 26 | def checkFile(Filename): 27 | logging.info("Checking file: '%s'" % Filename) 28 | filename = os.path.abspath(Filename) 29 | if not os.path.isfile(filename): 30 | logging.error("Oops! File: '%s' does not exit. Please check!" % Filename) 31 | sys.exit(-1) 32 | if not os.access(filename, os.R_OK): 33 | logging.error("Oops! File: '%s' is not readable. Please check!" % Filename) 34 | sys.exit(-1) 35 | 36 | 37 | def renameFastaHeader(fasta, sampleName, delimiter, outDir): 38 | checkFile(fasta) 39 | checkDir(outDir) 40 | name = fasta.rsplit('.', 1)[0] 41 | fasta = os.path.abspath(fasta) 42 | outDir = os.path.abspath(outDir) 43 | outputfile = os.path.join(outDir, '%s.headerModified.fa' % name) 44 | logging.info("Start to rename the header ...") 45 | with open (outputfile, 'w') as fd: 46 | with open (fasta, 'r') as fa: 47 | for line in fa: 48 | line = line.strip() 49 | if line.startswith(">"): 50 | line=">%s%s%s" % (sampleName, delimiter, line[1:]) 51 | fd.write('%s\n' % line) 52 | logging.info("Complete rename the header ...") 53 | 54 | 55 | if __name__=="__main__": 56 | parser = ArgumentParser(description='rename the header of a given fasta file') 57 | parser.add_argument('--version', action='version', version='1.0') 58 | parser.add_argument('-f', dest='fasta', help='a fasta format file', type = str) 59 | parser.add_argument('-n', dest='name', help='name of the sample', type = str) 60 | parser.add_argument('-d', dest='delim', help="delimiter. Default: '||'", type = str) 61 | parser.add_argument('-o', dest='output', help='the output directory', type=str) 62 | args = parser.parse_args() 63 | 64 | if None in [args.fasta, args.name, args.output]: 65 | print(parser.print_help()) 66 | exit(-1) 67 | if args.delim == None: 68 | args.delim = "||" 69 | renameFastaHeader(args.fasta, args.name, args.delim, args.output) 70 | 71 | 72 | -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/renameFastaHeaderUI.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Form implementation generated from reading ui file 'renameFastaHeader.ui' 4 | # 5 | # Created by: PyQt5 UI code generator 5.12.3 6 | # 7 | # WARNING! All changes made in this file will be lost! 8 | 9 | 10 | from PyQt5 import QtCore, QtGui, QtWidgets 11 | 12 | 13 | class Ui_header(object): 14 | def setupUi(self, header): 15 | header.setObjectName("header") 16 | header.resize(440, 245) 17 | header.setMinimumSize(QtCore.QSize(440, 245)) 18 | header.setMaximumSize(QtCore.QSize(440, 245)) 19 | self.gridLayoutWidget = QtWidgets.QWidget(header) 20 | self.gridLayoutWidget.setGeometry(QtCore.QRect(10, 50, 421, 81)) 21 | self.gridLayoutWidget.setObjectName("gridLayoutWidget") 22 | self.gridLayout = QtWidgets.QGridLayout(self.gridLayoutWidget) 23 | self.gridLayout.setContentsMargins(0, 0, 0, 0) 24 | self.gridLayout.setObjectName("gridLayout") 25 | self.outDirSelect = QtWidgets.QPushButton(self.gridLayoutWidget) 26 | self.outDirSelect.setMinimumSize(QtCore.QSize(0, 25)) 27 | self.outDirSelect.setMaximumSize(QtCore.QSize(50, 16777215)) 28 | self.outDirSelect.setObjectName("outDirSelect") 29 | self.gridLayout.addWidget(self.outDirSelect, 1, 2, 1, 1) 30 | self.label_2 = QtWidgets.QLabel(self.gridLayoutWidget) 31 | self.label_2.setMinimumSize(QtCore.QSize(0, 25)) 32 | self.label_2.setObjectName("label_2") 33 | self.gridLayout.addWidget(self.label_2, 0, 0, 1, 1) 34 | self.fastaPath = QtWidgets.QLineEdit(self.gridLayoutWidget) 35 | self.fastaPath.setMinimumSize(QtCore.QSize(0, 25)) 36 | self.fastaPath.setObjectName("fastaPath") 37 | self.gridLayout.addWidget(self.fastaPath, 0, 1, 1, 1) 38 | self.label_5 = QtWidgets.QLabel(self.gridLayoutWidget) 39 | self.label_5.setObjectName("label_5") 40 | self.gridLayout.addWidget(self.label_5, 1, 0, 1, 1) 41 | self.outDir = QtWidgets.QLineEdit(self.gridLayoutWidget) 42 | self.outDir.setMinimumSize(QtCore.QSize(0, 25)) 43 | self.outDir.setObjectName("outDir") 44 | self.gridLayout.addWidget(self.outDir, 1, 1, 1, 1) 45 | self.outDirClear = QtWidgets.QPushButton(self.gridLayoutWidget) 46 | self.outDirClear.setMinimumSize(QtCore.QSize(0, 25)) 47 | self.outDirClear.setMaximumSize(QtCore.QSize(50, 16777215)) 48 | self.outDirClear.setObjectName("outDirClear") 49 | self.gridLayout.addWidget(self.outDirClear, 1, 3, 1, 1) 50 | self.fastaClear = QtWidgets.QPushButton(self.gridLayoutWidget) 51 | self.fastaClear.setMinimumSize(QtCore.QSize(0, 25)) 52 | self.fastaClear.setMaximumSize(QtCore.QSize(50, 16777215)) 53 | self.fastaClear.setObjectName("fastaClear") 54 | self.gridLayout.addWidget(self.fastaClear, 0, 3, 1, 1) 55 | self.fastaSelect = QtWidgets.QPushButton(self.gridLayoutWidget) 56 | self.fastaSelect.setMinimumSize(QtCore.QSize(50, 25)) 57 | self.fastaSelect.setMaximumSize(QtCore.QSize(50, 16777215)) 58 | self.fastaSelect.setObjectName("fastaSelect") 59 | self.gridLayout.addWidget(self.fastaSelect, 0, 2, 1, 1) 60 | self.label = QtWidgets.QLabel(header) 61 | self.label.setGeometry(QtCore.QRect(10, 10, 361, 31)) 62 | font = QtGui.QFont() 63 | font.setPointSize(12) 64 | font.setBold(True) 65 | font.setWeight(75) 66 | self.label.setFont(font) 67 | self.label.setObjectName("label") 68 | self.gridLayoutWidget_2 = QtWidgets.QWidget(header) 69 | self.gridLayoutWidget_2.setGeometry(QtCore.QRect(10, 140, 421, 89)) 70 | self.gridLayoutWidget_2.setObjectName("gridLayoutWidget_2") 71 | self.gridLayout_2 = QtWidgets.QGridLayout(self.gridLayoutWidget_2) 72 | self.gridLayout_2.setContentsMargins(0, 0, 0, 0) 73 | self.gridLayout_2.setObjectName("gridLayout_2") 74 | self.sampleName = QtWidgets.QLineEdit(self.gridLayoutWidget_2) 75 | self.sampleName.setMinimumSize(QtCore.QSize(0, 25)) 76 | self.sampleName.setMaximumSize(QtCore.QSize(105, 16777215)) 77 | self.sampleName.setObjectName("sampleName") 78 | self.gridLayout_2.addWidget(self.sampleName, 0, 2, 1, 1) 79 | spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) 80 | self.gridLayout_2.addItem(spacerItem, 0, 1, 1, 1) 81 | self.label_3 = QtWidgets.QLabel(self.gridLayoutWidget_2) 82 | self.label_3.setMinimumSize(QtCore.QSize(0, 25)) 83 | self.label_3.setObjectName("label_3") 84 | self.gridLayout_2.addWidget(self.label_3, 0, 0, 1, 1) 85 | self.label_4 = QtWidgets.QLabel(self.gridLayoutWidget_2) 86 | self.label_4.setMinimumSize(QtCore.QSize(0, 25)) 87 | self.label_4.setObjectName("label_4") 88 | self.gridLayout_2.addWidget(self.label_4, 1, 0, 1, 1) 89 | self.delim = QtWidgets.QLineEdit(self.gridLayoutWidget_2) 90 | self.delim.setMinimumSize(QtCore.QSize(0, 25)) 91 | self.delim.setMaximumSize(QtCore.QSize(105, 16777215)) 92 | self.delim.setObjectName("delim") 93 | self.gridLayout_2.addWidget(self.delim, 1, 2, 1, 1) 94 | self.label_6 = QtWidgets.QLabel(self.gridLayoutWidget_2) 95 | self.label_6.setMinimumSize(QtCore.QSize(0, 25)) 96 | self.label_6.setObjectName("label_6") 97 | self.gridLayout_2.addWidget(self.label_6, 2, 0, 1, 1) 98 | self.startRename = QtWidgets.QPushButton(self.gridLayoutWidget_2) 99 | self.startRename.setMinimumSize(QtCore.QSize(0, 25)) 100 | self.startRename.setObjectName("startRename") 101 | self.gridLayout_2.addWidget(self.startRename, 2, 2, 1, 1) 102 | self.renameStatus = QtWidgets.QLabel(self.gridLayoutWidget_2) 103 | self.renameStatus.setMinimumSize(QtCore.QSize(0, 25)) 104 | self.renameStatus.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) 105 | self.renameStatus.setObjectName("renameStatus") 106 | self.gridLayout_2.addWidget(self.renameStatus, 2, 1, 1, 1) 107 | 108 | self.retranslateUi(header) 109 | QtCore.QMetaObject.connectSlotsByName(header) 110 | 111 | def retranslateUi(self, header): 112 | _translate = QtCore.QCoreApplication.translate 113 | header.setWindowTitle(_translate("header", "renameFastaHeader")) 114 | self.outDirSelect.setText(_translate("header", "Select")) 115 | self.label_2.setText(_translate("header", "The fasta file")) 116 | self.label_5.setText(_translate("header", "The output Directory")) 117 | self.outDirClear.setText(_translate("header", "Clear")) 118 | self.fastaClear.setText(_translate("header", "Clear")) 119 | self.fastaSelect.setText(_translate("header", "Select")) 120 | self.label.setText(_translate("header", "Rename the hearder of a given fasta file")) 121 | self.label_3.setText(_translate("header", "Name of the sample")) 122 | self.label_4.setText(_translate("header", "Delimiter ")) 123 | self.delim.setText(_translate("header", "||")) 124 | self.label_6.setText(_translate("header", "Rename")) 125 | self.startRename.setText(_translate("header", "Start")) 126 | self.renameStatus.setText(_translate("header", "Idle")) 127 | -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/renameFastaHeaderUI_mac.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Form implementation generated from reading ui file 'renameFastaHeader_mac.ui' 4 | # 5 | # Created by: PyQt5 UI code generator 5.12.3 6 | # 7 | # WARNING! All changes made in this file will be lost! 8 | 9 | 10 | from PyQt5 import QtCore, QtGui, QtWidgets 11 | 12 | 13 | class Ui_header(object): 14 | def setupUi(self, header): 15 | header.setObjectName("header") 16 | header.resize(440, 280) 17 | header.setMinimumSize(QtCore.QSize(440, 280)) 18 | header.setMaximumSize(QtCore.QSize(440, 280)) 19 | self.gridLayoutWidget = QtWidgets.QWidget(header) 20 | self.gridLayoutWidget.setGeometry(QtCore.QRect(10, 50, 421, 91)) 21 | self.gridLayoutWidget.setObjectName("gridLayoutWidget") 22 | self.gridLayout = QtWidgets.QGridLayout(self.gridLayoutWidget) 23 | self.gridLayout.setContentsMargins(0, 0, 0, 0) 24 | self.gridLayout.setObjectName("gridLayout") 25 | self.outDirSelect = QtWidgets.QPushButton(self.gridLayoutWidget) 26 | self.outDirSelect.setMinimumSize(QtCore.QSize(60, 30)) 27 | self.outDirSelect.setMaximumSize(QtCore.QSize(50, 16777215)) 28 | self.outDirSelect.setObjectName("outDirSelect") 29 | self.gridLayout.addWidget(self.outDirSelect, 1, 2, 1, 1) 30 | self.label_2 = QtWidgets.QLabel(self.gridLayoutWidget) 31 | self.label_2.setMinimumSize(QtCore.QSize(0, 25)) 32 | self.label_2.setObjectName("label_2") 33 | self.gridLayout.addWidget(self.label_2, 0, 0, 1, 1) 34 | self.fastaPath = QtWidgets.QLineEdit(self.gridLayoutWidget) 35 | self.fastaPath.setMinimumSize(QtCore.QSize(0, 25)) 36 | self.fastaPath.setObjectName("fastaPath") 37 | self.gridLayout.addWidget(self.fastaPath, 0, 1, 1, 1) 38 | self.label_5 = QtWidgets.QLabel(self.gridLayoutWidget) 39 | self.label_5.setObjectName("label_5") 40 | self.gridLayout.addWidget(self.label_5, 1, 0, 1, 1) 41 | self.outDir = QtWidgets.QLineEdit(self.gridLayoutWidget) 42 | self.outDir.setMinimumSize(QtCore.QSize(0, 25)) 43 | self.outDir.setObjectName("outDir") 44 | self.gridLayout.addWidget(self.outDir, 1, 1, 1, 1) 45 | self.outDirClear = QtWidgets.QPushButton(self.gridLayoutWidget) 46 | self.outDirClear.setMinimumSize(QtCore.QSize(60, 30)) 47 | self.outDirClear.setMaximumSize(QtCore.QSize(50, 16777215)) 48 | self.outDirClear.setObjectName("outDirClear") 49 | self.gridLayout.addWidget(self.outDirClear, 1, 3, 1, 1) 50 | self.fastaClear = QtWidgets.QPushButton(self.gridLayoutWidget) 51 | self.fastaClear.setMinimumSize(QtCore.QSize(60, 30)) 52 | self.fastaClear.setMaximumSize(QtCore.QSize(50, 16777215)) 53 | self.fastaClear.setObjectName("fastaClear") 54 | self.gridLayout.addWidget(self.fastaClear, 0, 3, 1, 1) 55 | self.fastaSelect = QtWidgets.QPushButton(self.gridLayoutWidget) 56 | self.fastaSelect.setMinimumSize(QtCore.QSize(60, 30)) 57 | self.fastaSelect.setMaximumSize(QtCore.QSize(50, 16777215)) 58 | self.fastaSelect.setObjectName("fastaSelect") 59 | self.gridLayout.addWidget(self.fastaSelect, 0, 2, 1, 1) 60 | self.label = QtWidgets.QLabel(header) 61 | self.label.setGeometry(QtCore.QRect(10, 10, 361, 31)) 62 | font = QtGui.QFont() 63 | font.setPointSize(15) 64 | font.setBold(True) 65 | font.setWeight(75) 66 | self.label.setFont(font) 67 | self.label.setObjectName("label") 68 | self.gridLayoutWidget_2 = QtWidgets.QWidget(header) 69 | self.gridLayoutWidget_2.setGeometry(QtCore.QRect(10, 150, 421, 114)) 70 | self.gridLayoutWidget_2.setObjectName("gridLayoutWidget_2") 71 | self.gridLayout_2 = QtWidgets.QGridLayout(self.gridLayoutWidget_2) 72 | self.gridLayout_2.setContentsMargins(0, 0, 0, 0) 73 | self.gridLayout_2.setObjectName("gridLayout_2") 74 | self.sampleName = QtWidgets.QLineEdit(self.gridLayoutWidget_2) 75 | self.sampleName.setMinimumSize(QtCore.QSize(0, 30)) 76 | self.sampleName.setMaximumSize(QtCore.QSize(105, 16777215)) 77 | self.sampleName.setObjectName("sampleName") 78 | self.gridLayout_2.addWidget(self.sampleName, 0, 2, 1, 1) 79 | spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) 80 | self.gridLayout_2.addItem(spacerItem, 0, 1, 1, 1) 81 | self.label_3 = QtWidgets.QLabel(self.gridLayoutWidget_2) 82 | self.label_3.setMinimumSize(QtCore.QSize(0, 25)) 83 | self.label_3.setObjectName("label_3") 84 | self.gridLayout_2.addWidget(self.label_3, 0, 0, 1, 1) 85 | self.label_4 = QtWidgets.QLabel(self.gridLayoutWidget_2) 86 | self.label_4.setMinimumSize(QtCore.QSize(0, 25)) 87 | self.label_4.setObjectName("label_4") 88 | self.gridLayout_2.addWidget(self.label_4, 1, 0, 1, 1) 89 | self.delim = QtWidgets.QLineEdit(self.gridLayoutWidget_2) 90 | self.delim.setMinimumSize(QtCore.QSize(0, 30)) 91 | self.delim.setMaximumSize(QtCore.QSize(105, 16777215)) 92 | self.delim.setObjectName("delim") 93 | self.gridLayout_2.addWidget(self.delim, 1, 2, 1, 1) 94 | self.label_6 = QtWidgets.QLabel(self.gridLayoutWidget_2) 95 | self.label_6.setMinimumSize(QtCore.QSize(0, 25)) 96 | self.label_6.setObjectName("label_6") 97 | self.gridLayout_2.addWidget(self.label_6, 2, 0, 1, 1) 98 | self.startRename = QtWidgets.QPushButton(self.gridLayoutWidget_2) 99 | self.startRename.setMinimumSize(QtCore.QSize(0, 30)) 100 | self.startRename.setObjectName("startRename") 101 | self.gridLayout_2.addWidget(self.startRename, 2, 2, 1, 1) 102 | self.renameStatus = QtWidgets.QLabel(self.gridLayoutWidget_2) 103 | self.renameStatus.setMinimumSize(QtCore.QSize(0, 25)) 104 | self.renameStatus.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) 105 | self.renameStatus.setObjectName("renameStatus") 106 | self.gridLayout_2.addWidget(self.renameStatus, 2, 1, 1, 1) 107 | 108 | self.retranslateUi(header) 109 | QtCore.QMetaObject.connectSlotsByName(header) 110 | 111 | def retranslateUi(self, header): 112 | _translate = QtCore.QCoreApplication.translate 113 | header.setWindowTitle(_translate("header", "renameFastaHeader")) 114 | self.outDirSelect.setText(_translate("header", "Select")) 115 | self.label_2.setText(_translate("header", "The fasta file")) 116 | self.label_5.setText(_translate("header", "The output Directory")) 117 | self.outDirClear.setText(_translate("header", "Clear")) 118 | self.fastaClear.setText(_translate("header", "Clear")) 119 | self.fastaSelect.setText(_translate("header", "Select")) 120 | self.label.setText(_translate("header", "Rename the hearder of a given fasta file")) 121 | self.label_3.setText(_translate("header", "Name of the sample")) 122 | self.label_4.setText(_translate("header", "Delimiter ")) 123 | self.delim.setText(_translate("header", "||")) 124 | self.label_6.setText(_translate("header", "Rename")) 125 | self.startRename.setText(_translate("header", "Start")) 126 | self.renameStatus.setText(_translate("header", "Idle")) 127 | -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/screenClipping.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import logging 3 | from PyQt5.QtWidgets import QApplication, QWidget 4 | from PyQt5.QtCore import Qt, qAbs, QRect 5 | from PyQt5.QtGui import QPen, QPainter, QColor, QGuiApplication 6 | 7 | 8 | #============================= Function ================================= 9 | ##logging info 10 | DEBUG="" #change it when debugging 11 | logFormat = "%(asctime)s [%(levelname)s] %(message)s" 12 | level = "DEBUG" if DEBUG != "" else "INFO" 13 | logging.basicConfig( stream=sys.stderr, level=level, format=logFormat ) 14 | #======================================================================== 15 | 16 | class CaptureScreen(QWidget): 17 | beginPosition = None 18 | endPosition = None 19 | fullScreenImage = None 20 | captureImage = None 21 | isMousePressLeft = None 22 | painter = QPainter() 23 | 24 | def __init__(self): 25 | super(QWidget, self).__init__() 26 | self.initWindow() 27 | self.captureFullScreen() 28 | 29 | def initWindow(self): 30 | self.setMouseTracking(True) 31 | self.setCursor(Qt.CrossCursor) 32 | self.setWindowFlag(Qt.FramelessWindowHint) 33 | self.setWindowState(Qt.WindowFullScreen) 34 | 35 | def captureFullScreen(self): 36 | self.fullScreenImage = QGuiApplication.primaryScreen().grabWindow(QApplication.desktop().winId()) 37 | 38 | def mousePressEvent(self, event): 39 | if event.button() == Qt.LeftButton: 40 | self.beginPosition = event.pos() 41 | self.isMousePressLeft = True 42 | if event.button() == Qt.RightButton: 43 | if self.captureImage is not None: 44 | self.captureImage = None 45 | self.paintBackgroundImage() 46 | self.update() 47 | else: 48 | self.close() 49 | 50 | def mouseMoveEvent(self, event): 51 | if self.isMousePressLeft is True: 52 | self.endPosition = event.pos() 53 | self.update() 54 | 55 | def mouseReleaseEvent(self, event): 56 | self.endPosition = event.pos() 57 | self.isMousePressLeft = False 58 | 59 | def mouseDoubleClickEvent(self, event): 60 | if self.captureImage is not None: 61 | self.saveImage() 62 | self.close() 63 | 64 | def keyPressEvent(self, event): 65 | if event.key() == Qt.Key_Escape: 66 | self.close() 67 | if event.key() == Qt.Key_Enter or event.key() == Qt.Key_Return: 68 | if self.captureImage is not None: 69 | self.saveImage() 70 | self.close() 71 | 72 | def paintBackgroundImage(self): 73 | shadowColor = QColor(0, 0, 0, 100) 74 | self.painter.drawPixmap(0, 0, self.fullScreenImage) 75 | self.painter.fillRect(self.fullScreenImage.rect(), shadowColor) 76 | 77 | def paintEvent(self, event): 78 | self.painter.begin(self) 79 | self.paintBackgroundImage() 80 | penColor = QColor(30, 144, 245) 81 | self.painter.setPen(QPen(penColor, 1, Qt.SolidLine, Qt.RoundCap)) 82 | if self.isMousePressLeft is True: 83 | pickRect = self.getRectangle(self.beginPosition, self.endPosition) 84 | self.captureImage = self.fullScreenImage.copy(pickRect) 85 | self.painter.drawPixmap(pickRect.topLeft(), self.captureImage) 86 | self.painter.drawRect(pickRect) 87 | self.painter.end() 88 | 89 | def getRectangle(self, beginPoint, endPoint): 90 | pickRectWidth = int(qAbs(beginPoint.x() - endPoint.x())) 91 | pickRectHeight = int(qAbs(beginPoint.y() - endPoint.y())) 92 | pickRectTop = beginPoint.x() if beginPoint.x() < endPoint.x() else endPoint.x() 93 | pickRectLeft = beginPoint.y() if beginPoint.y() < endPoint.y() else endPoint.y() 94 | pickRect = QRect(pickRectTop, pickRectLeft, pickRectWidth, pickRectHeight) 95 | if pickRectWidth == 0: 96 | pickRect.setWidth(2) 97 | if pickRectHeight == 0: 98 | pickRect.setHeight(2) 99 | 100 | return pickRect 101 | 102 | def saveImage(self): 103 | format = 'png' 104 | self.captureImage.save(f'{sys.argv[1]}.{format}', format = format, quality=100) 105 | logging.info(f"Screenshot has been saved at: '{sys.argv[1]}.{format}'") 106 | 107 | if __name__ == "__main__": 108 | app = QApplication(sys.argv) 109 | windows = CaptureScreen() 110 | windows.show() 111 | sys.exit(app.exec_()) 112 | 113 | -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/screenshot.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import os 4 | import sys 5 | import logging 6 | from PyQt5 import QtCore, QtWidgets,QtGui 7 | 8 | #============================= Function ================================= 9 | ##logging info 10 | DEBUG="" #change it when debugging 11 | logFormat = "%(asctime)s [%(levelname)s] %(message)s" 12 | level = "DEBUG" if DEBUG != "" else "INFO" 13 | logging.basicConfig( stream=sys.stderr, level=level, format=logFormat ) 14 | #======================================================================== 15 | 16 | class Screenshot(QtWidgets.QWidget): 17 | def __init__(self): 18 | super(Screenshot, self).__init__() 19 | self.screenshotLabel = QtWidgets.QLabel() 20 | self.screenshotLabel.setSizePolicy(QtWidgets.QSizePolicy.Expanding, 21 | QtWidgets.QSizePolicy.Expanding) 22 | self.screenshotLabel.setAlignment(QtCore.Qt.AlignCenter) 23 | self.screenshotLabel.setMinimumSize(240, 160) 24 | self.createOptionsGroupBox() 25 | self.createButtonsLayout() 26 | mainLayout = QtWidgets.QVBoxLayout() 27 | mainLayout.addWidget(self.screenshotLabel) 28 | mainLayout.addWidget(self.optionsGroupBox) 29 | mainLayout.addLayout(self.buttonsLayout) 30 | self.setLayout(mainLayout) 31 | self.shootScreen() 32 | self.delaySpinBox.setValue(0) 33 | self.setWindowTitle("Screenshot") 34 | self.resize(300, 200) 35 | 36 | def resizeEvent(self, event): 37 | scaledSize = self.originalPixmap.size() 38 | scaledSize.scale(self.screenshotLabel.size(), QtCore.Qt.KeepAspectRatio) 39 | if not self.screenshotLabel.pixmap() or scaledSize != self.screenshotLabel.pixmap().size(): 40 | self.updateScreenshotLabel() 41 | 42 | def newScreenshot(self): 43 | if self.hideThisWindowCheckBox.isChecked(): 44 | self.hide() 45 | self.newScreenshotButton.setDisabled(True) 46 | QtCore.QTimer.singleShot(self.delaySpinBox.value() * 1000, 47 | self.shootScreen) 48 | 49 | def saveScreenshot(self): 50 | format = 'png' 51 | initialPath = QtCore.QDir.currentPath() + "/untitled." + format 52 | fileName,filetype = QtWidgets.QFileDialog.getSaveFileName(self, "Save As", 53 | initialPath, 54 | "%s Files (*.%s);;All Files (*)" % (format.upper(), format)) 55 | if fileName: 56 | self.originalPixmap.save(fileName, format) 57 | logging.info(f"Screenshot has been saved to '{os.path.abspath(fileName)}'") 58 | 59 | def shootScreen(self): 60 | if self.delaySpinBox.value() != 0: 61 | QtWidgets.qApp.beep() 62 | # Garbage collect any existing image first. 63 | self.originalPixmap = None 64 | 65 | screen= QtWidgets.QApplication.primaryScreen() 66 | self.originalPixmap = screen.grabWindow(QtWidgets.QApplication.desktop().winId()) 67 | 68 | self.updateScreenshotLabel() 69 | self.newScreenshotButton.setDisabled(False) 70 | if self.hideThisWindowCheckBox.isChecked(): 71 | self.show() 72 | 73 | def updateCheckBox(self): 74 | if self.delaySpinBox.value() == 0: 75 | self.hideThisWindowCheckBox.setDisabled(True) 76 | else: 77 | self.hideThisWindowCheckBox.setDisabled(False) 78 | 79 | def createOptionsGroupBox(self): 80 | self.optionsGroupBox = QtWidgets.QGroupBox("Options") 81 | self.delaySpinBox = QtWidgets.QSpinBox() 82 | self.delaySpinBox.setSuffix(" s") 83 | self.delaySpinBox.setMaximum(60) 84 | self.delaySpinBox.valueChanged.connect(self.updateCheckBox) 85 | self.delaySpinBoxLabel = QtWidgets.QLabel("Screenshot Delay:") 86 | self.hideThisWindowCheckBox = QtWidgets.QCheckBox("Hide This Window") 87 | optionsGroupBoxLayout = QtWidgets.QGridLayout() 88 | optionsGroupBoxLayout.addWidget(self.delaySpinBoxLabel, 0, 0) 89 | optionsGroupBoxLayout.addWidget(self.delaySpinBox, 0, 1) 90 | optionsGroupBoxLayout.addWidget(self.hideThisWindowCheckBox, 1, 0, 1, 2) 91 | self.optionsGroupBox.setLayout(optionsGroupBoxLayout) 92 | 93 | def createButtonsLayout(self): 94 | self.newScreenshotButton = self.createButton("New Screenshot", 95 | self.newScreenshot) 96 | self.saveScreenshotButton = self.createButton("Save Screenshot", 97 | self.saveScreenshot) 98 | self.quitScreenshotButton = self.createButton("Quit", self.close) 99 | self.buttonsLayout = QtWidgets.QHBoxLayout() 100 | self.buttonsLayout.addStretch() 101 | self.buttonsLayout.addWidget(self.newScreenshotButton) 102 | self.buttonsLayout.addWidget(self.saveScreenshotButton) 103 | self.buttonsLayout.addWidget(self.quitScreenshotButton) 104 | def createButton(self, text, member): 105 | button = QtWidgets.QPushButton(text) 106 | button.clicked.connect(member) 107 | return button 108 | def updateScreenshotLabel(self): 109 | self.screenshotLabel.setPixmap(self.originalPixmap.scaled( 110 | self.screenshotLabel.size(), QtCore.Qt.KeepAspectRatio, 111 | QtCore.Qt.SmoothTransformation)) 112 | 113 | 114 | if __name__ == '__main__': 115 | import sys 116 | app = QtWidgets.QApplication(sys.argv) 117 | screenshot = Screenshot() 118 | screenshot.show() 119 | sys.exit(app.exec_()) 120 | -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/template/htmlTemplate.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | 11 | 12 | 13 | 23 | 24 |
25 |

{%title%}

26 |
Legend (mouseover here to show)
27 |
28 | 29 | 30 | 33 | 36 | 37 |
31 |
32 |
34 |
35 |
38 |
39 |
40 | 41 | 43 | 44 | 131 | 132 | 133 | 134 | 135 |
136 | 137 |
138 |
139 |
0%
140 |
141 |
142 |
143 |
144 |
145 | 146 | 147 | 236 | 237 | 258 | 259 | 260 | -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/template/images/cy/barrel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerApp/scripts/template/images/cy/barrel.png -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/template/images/cy/bottom-round-rectangle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerApp/scripts/template/images/cy/bottom-round-rectangle.png -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/template/images/cy/concave-hexagon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerApp/scripts/template/images/cy/concave-hexagon.png -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/template/images/cy/cut-rectangle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerApp/scripts/template/images/cy/cut-rectangle.png -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/template/images/cy/diamond.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerApp/scripts/template/images/cy/diamond.png -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/template/images/cy/ellipse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerApp/scripts/template/images/cy/ellipse.png -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/template/images/cy/heptagon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerApp/scripts/template/images/cy/heptagon.png -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/template/images/cy/hexagon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerApp/scripts/template/images/cy/hexagon.png -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/template/images/cy/octagon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerApp/scripts/template/images/cy/octagon.png -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/template/images/cy/pentagon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerApp/scripts/template/images/cy/pentagon.png -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/template/images/cy/rectangle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerApp/scripts/template/images/cy/rectangle.png -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/template/images/cy/rhomboid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerApp/scripts/template/images/cy/rhomboid.png -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/template/images/cy/round-diamond.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerApp/scripts/template/images/cy/round-diamond.png -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/template/images/cy/round-heptagon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerApp/scripts/template/images/cy/round-heptagon.png -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/template/images/cy/round-hexagon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerApp/scripts/template/images/cy/round-hexagon.png -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/template/images/cy/round-octagon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerApp/scripts/template/images/cy/round-octagon.png -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/template/images/cy/round-pentagon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerApp/scripts/template/images/cy/round-pentagon.png -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/template/images/cy/round-rectangle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerApp/scripts/template/images/cy/round-rectangle.png -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/template/images/cy/round-tag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerApp/scripts/template/images/cy/round-tag.png -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/template/images/cy/round-triangle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerApp/scripts/template/images/cy/round-triangle.png -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/template/images/cy/star.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerApp/scripts/template/images/cy/star.png -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/template/images/cy/tag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerApp/scripts/template/images/cy/tag.png -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/template/images/cy/triangle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerApp/scripts/template/images/cy/triangle.png -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/template/images/cy/vee.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerApp/scripts/template/images/cy/vee.png -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/template/images/gen_images_js.py: -------------------------------------------------------------------------------- 1 | import base64 2 | import json 3 | from shutil import copyfile 4 | 5 | from os import linesep 6 | 7 | shapes = {'cy':["ellipse", "triangle", "round-triangle", 8 | "rectangle", "round-rectangle", "bottom-round-rectangle", 9 | "cut-rectangle", "barrel", "rhomboid", "diamond", 10 | "round-diamond", "pentagon", "round-pentagon", "hexagon", 11 | "round-hexagon", "concave-hexagon", "heptagon", "round-heptagon", 12 | "octagon", "round-octagon", "star", "tag", "round-tag", "vee"],\ 13 | 'vis':['dot','triangle','database','triangleDown','text','star', 14 | 'ellipse', 'square', 'box', 'diamond']} 15 | js = '../static/images.js' 16 | #js_web = '../../../../panGraphViewerWeb/static/pangraphviewer/js/images.js' 17 | 18 | data = {} 19 | 20 | def gen_js(): 21 | for type in shapes: 22 | data[type] = {} 23 | for shape in shapes[type]: 24 | image = open(f'{type}/{shape}.png', 'rb') 25 | image_read = image.read() 26 | #image_64_encode = base64.encodestring(image_read) 27 | image_64_encode = base64.encodebytes(image_read) 28 | str = image_64_encode.decode("utf-8").replace(linesep,"") 29 | 30 | data[type][shape] = f'data:image/png;base64,{str}' 31 | 32 | with open(js, 'w') as f: 33 | print(f'var images = {{}};', file=f) 34 | for type in shapes: 35 | print(f"images = ", json.dumps(data), file=f) 36 | 37 | # copy to web 38 | #copyfile(js, js_web) 39 | 40 | gen_js() 41 | -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/template/images/vis/box.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerApp/scripts/template/images/vis/box.png -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/template/images/vis/database.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerApp/scripts/template/images/vis/database.png -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/template/images/vis/diamond.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerApp/scripts/template/images/vis/diamond.png -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/template/images/vis/dot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerApp/scripts/template/images/vis/dot.png -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/template/images/vis/ellipse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerApp/scripts/template/images/vis/ellipse.png -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/template/images/vis/square.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerApp/scripts/template/images/vis/square.png -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/template/images/vis/star.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerApp/scripts/template/images/vis/star.png -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/template/images/vis/text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerApp/scripts/template/images/vis/text.png -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/template/images/vis/triangle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerApp/scripts/template/images/vis/triangle.png -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/template/images/vis/triangleDown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerApp/scripts/template/images/vis/triangleDown.png -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/template/loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerApp/scripts/template/loader.gif -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/template/static.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerApp/scripts/template/static.zip -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/template/static/cy/css/cytoscape-context-menus.css: -------------------------------------------------------------------------------- 1 | .cy-context-menus-cxt-menu { 2 | display:none; 3 | z-index: 1000; 4 | position:absolute; 5 | border:1px solid #A0A0A0; 6 | padding: 0; 7 | margin: 0; 8 | width:auto; 9 | } 10 | 11 | .cy-context-menus-cxt-menuitem { 12 | display:block; 13 | width: 100%; 14 | padding: 3px 20px; 15 | position:relative; 16 | margin:0; 17 | background-color:#f8f8f8; 18 | font-weight:normal; 19 | font-size: 12px; 20 | white-space:nowrap; 21 | border: 0; 22 | text-align: left; 23 | } 24 | 25 | .cy-context-menus-cxt-menuitem:enabled { 26 | color: #000000; 27 | } 28 | 29 | .cy-context-menus-ctx-operation:focus { 30 | outline: none; 31 | } 32 | 33 | .cy-context-menus-cxt-menuitem:hover { 34 | color: #ffffff; 35 | text-decoration: none; 36 | background-color: #0B9BCD; 37 | background-image: none; 38 | cursor: pointer; 39 | } 40 | 41 | .cy-context-menus-cxt-menuitem[content]:before { 42 | content:attr(content); 43 | } 44 | 45 | .cy-context-menus-divider { 46 | border-bottom:1px solid #A0A0A0; 47 | } 48 | 49 | .cy-context-menus-submenu-indicator { 50 | position: absolute; 51 | right: 2px; 52 | top: 50%; 53 | transform: translateY(-50%); 54 | } -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/template/static/cy/js/cytoscape-popper.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Minified by jsDelivr using Terser v3.14.1. 3 | * Original file: /npm/cytoscape-popper@1.0.4/cytoscape-popper.js 4 | * 5 | * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files 6 | */ 7 | !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("popper.js")):"function"==typeof define&&define.amd?define(["popper.js"],t):"object"==typeof exports?exports.cytoscapePopper=t(require("popper.js")):e.cytoscapePopper=t(e.Popper)}(this,function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=7)}([function(e,t,n){"use strict";e.exports=null!=Object.assign?Object.assign.bind(Object):function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r1&&(console.warn("Popper.js Extension should only be used on one element."),console.warn("Ignoring all subsequent elements"))}e.exports={popper:function(e){return u(this),o(this[0],p(this[0],e))},popperRef:function(e){return u(this),i(this[0],p(this[0],e))}}},function(e,t,n){"use strict";var r=n(0),o=n(2).getPopper,i=n(1).getRef;function p(e,t){return r({},{boundingBox:{top:0,left:0,right:0,bottom:0,w:3,h:3},renderedDimensions:function(){return{w:3,h:3}},redneredPosition:function(){return{x:0,y:0}},popper:{},cy:e},t)}e.exports={popper:function(e){return o(this,p(this,e))},popperRef:function(e){return i(this,p(this,e))}}},function(e,t,n){"use strict";e.exports={getBoundingBox:function(e,t){var n=t.renderedPosition,r=t.cy,o=t.renderedDimensions,i=r.container().getBoundingClientRect(),p=o(e),u=n(e);return{top:u.y+i.top,left:u.x+i.left,right:u.x+p.w+i.left,bottom:u.y+p.h+i.top,width:p.w,height:p.h}}}},function(e,t,n){"use strict";e.exports={getContent:function(e,t){var n=null;if("function"!=typeof t){if(t instanceof HTMLElement)return t;throw new Error("Can not create popper from 'target' with unknown type")}if(null===(n=t(e)))throw new Error("No 'target' specified to create popper");return n}}},function(e,t,n){"use strict";var r=n(4),o=n(3),i=function(e){e&&(e("core","popper",r.popper),e("collection","popper",o.popper),e("core","popperRef",r.popperRef),e("collection","popperRef",o.popperRef))};"undefined"!=typeof cytoscape&&i(cytoscape),e.exports=i},function(t,n){t.exports=e}])}); 8 | //# sourceMappingURL=/sm/29057e04e5a260bd46a85f3783b9c25827cb3e8a6e3a13b771f52b8e26cb61d4.map -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/template/static/cy/js/fetch.min.js: -------------------------------------------------------------------------------- 1 | !function(t){"use strict";function e(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function r(t){return"string"!=typeof t&&(t=String(t)),t}function o(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return m.iterable&&(e[Symbol.iterator]=function(){return e}),e}function n(t){this.map={},t instanceof n?t.forEach(function(t,e){this.append(e,t)},this):Array.isArray(t)?t.forEach(function(t){this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function i(t){return t.bodyUsed?Promise.reject(new TypeError("Already read")):void(t.bodyUsed=!0)}function s(t){return new Promise(function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}})}function a(t){var e=new FileReader,r=s(e);return e.readAsArrayBuffer(t),r}function u(t){var e=new FileReader,r=s(e);return e.readAsText(t),r}function h(t){for(var e=new Uint8Array(t),r=new Array(e.length),o=0;o-1?e:t}function l(t,e){e=e||{};var r=e.body;if(t instanceof l){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new n(t.headers)),this.method=t.method,this.mode=t.mode,r||null==t._bodyInit||(r=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"omit",!e.headers&&this.headers||(this.headers=new n(e.headers)),this.method=y(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}function p(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var r=t.split("="),o=r.shift().replace(/\+/g," "),n=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(o),decodeURIComponent(n))}}),e}function c(t){var e=new n;return t.split(/\r?\n/).forEach(function(t){var r=t.split(":"),o=r.shift().trim();if(o){var n=r.join(":").trim();e.append(o,n)}}),e}function b(t,e){e||(e={}),this.type="default",this.status="status"in e?e.status:200,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new n(e.headers),this.url=e.url||"",this._initBody(t)}if(!t.fetch){var m={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(m.arrayBuffer)var w=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],v=function(t){return t&&DataView.prototype.isPrototypeOf(t)},B=ArrayBuffer.isView||function(t){return t&&w.indexOf(Object.prototype.toString.call(t))>-1};n.prototype.append=function(t,o){t=e(t),o=r(o);var n=this.map[t];this.map[t]=n?n+","+o:o},n.prototype.delete=function(t){delete this.map[e(t)]},n.prototype.get=function(t){return t=e(t),this.has(t)?this.map[t]:null},n.prototype.has=function(t){return this.map.hasOwnProperty(e(t))},n.prototype.set=function(t,o){this.map[e(t)]=r(o)},n.prototype.forEach=function(t,e){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(e,this.map[r],r,this)},n.prototype.keys=function(){var t=[];return this.forEach(function(e,r){t.push(r)}),o(t)},n.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),o(t)},n.prototype.entries=function(){var t=[];return this.forEach(function(e,r){t.push([r,e])}),o(t)},m.iterable&&(n.prototype[Symbol.iterator]=n.prototype.entries);var _=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];l.prototype.clone=function(){return new l(this,{body:this._bodyInit})},d.call(l.prototype),d.call(b.prototype),b.prototype.clone=function(){return new b(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new n(this.headers),url:this.url})},b.error=function(){var t=new b(null,{status:0,statusText:""});return t.type="error",t};var A=[301,302,303,307,308];b.redirect=function(t,e){if(A.indexOf(e)===-1)throw new RangeError("Invalid status code");return new b(null,{status:e,headers:{location:t}})},t.Headers=n,t.Request=l,t.Response=b,t.fetch=function(t,e){return new Promise(function(r,o){var n=new l(t,e),i=new XMLHttpRequest;i.onload=function(){var t={status:i.status,statusText:i.statusText,headers:c(i.getAllResponseHeaders()||"")};t.url="responseURL"in i?i.responseURL:t.headers.get("X-Request-URL");var e="response"in i?i.response:i.responseText;r(new b(e,t))},i.onerror=function(){o(new TypeError("Network request failed"))},i.ontimeout=function(){o(new TypeError("Network request failed"))},i.open(n.method,n.url,!0),"include"===n.credentials&&(i.withCredentials=!0),"responseType"in i&&m.blob&&(i.responseType="blob"),n.headers.forEach(function(t,e){i.setRequestHeader(e,t)}),i.send("undefined"==typeof n._bodyInit?null:n._bodyInit)})},t.fetch.polyfill=!0}}("undefined"!=typeof self?self:this); 2 | //# sourceMappingURL=fetch.min.js.map -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/template/static/images/loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerApp/scripts/template/static/images/loader.gif -------------------------------------------------------------------------------- /panGraphViewerApp/scripts/utilities.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import os 4 | import sys 5 | import logging 6 | from subprocess import Popen, PIPE 7 | from configparser import ConfigParser 8 | 9 | #============================= Function ================================= 10 | ##logging info 11 | DEBUG="" #change it when debugging 12 | logFormat = "%(asctime)s [%(levelname)s] %(message)s" 13 | level = "DEBUG" if DEBUG != "" else "INFO" 14 | logging.basicConfig( stream=sys.stderr, level=level, format=logFormat ) 15 | #======================================================================== 16 | 17 | config = None 18 | script_directory = os.path.dirname(os.path.realpath(__file__)) 19 | copied = os.path.join(script_directory, '..', "config.ini") 20 | 21 | def getVar(cfg, group, var, mustHave=False, forceRead=True): 22 | global config 23 | 24 | if not config or forceRead: 25 | config = ConfigParser() 26 | config.read(cfg) 27 | 28 | try: 29 | return config.get(group, var) 30 | except: 31 | if mustHave: 32 | raise 33 | else: 34 | logging.info(f'Config value [{group}][{var}] not found') 35 | return None 36 | 37 | def rev_comp(seq): 38 | trans = str.maketrans('ACGTN*', 'TGCAN*') 39 | return seq.translate(trans)[::-1] 40 | 41 | def checkDir(Dirname): 42 | logging.info("Checking folder: '%s'" % Dirname) 43 | dirname = os.path.abspath(Dirname) 44 | if not os.path.isdir(dirname): 45 | logging.error("Oops! Folder: '%s' does not exit. Please check!" % Dirname) 46 | return -1 47 | if not os.access(dirname, os.W_OK): 48 | logging.error("Oops! Folder: '%s' is not writable. Please check!" % Dirname) 49 | return -1 50 | 51 | def checkFile(Filename): 52 | logging.info("Checking file: '%s'" % Filename) 53 | filename = os.path.abspath(Filename) 54 | if not os.path.isfile(filename): 55 | logging.error("Oops! File: '%s' does not exit. Please check!" % Filename) 56 | return -1 57 | if not os.access(filename, os.R_OK): 58 | logging.error("Oops! File: '%s' is not readable. Please check!" % Filename) 59 | return -1 60 | 61 | def checkInt(value): 62 | try: 63 | val = int(value) 64 | except ValueError: 65 | logging.error("Oops! The input value '%s' is not an integer. Please check!" % value) 66 | return -1 67 | 68 | class Utilities: 69 | @staticmethod 70 | def runCmdLine(cmd, input=None, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE): 71 | p = Popen(cmd, shell=shell, stdin=stdin, stdout=stdout, stderr=stderr, universal_newlines=True) 72 | out, _err = p.communicate(input=input) 73 | 74 | output = out.strip().split('\n') 75 | 76 | return output 77 | 78 | @staticmethod 79 | def get_var(cfg, group, var, must_have=False): 80 | global config 81 | 82 | if not config: 83 | config = ConfigParser() 84 | config.read(cfg) 85 | 86 | try: 87 | return config.get(group, var) 88 | except: 89 | if must_have: 90 | raise 91 | else: 92 | logging.warning(f'Config value [{group}][{var}] not found') 93 | 94 | return None 95 | 96 | 97 | if __name__=="__main__": 98 | #print(Utilities.runCmdLine('pwd')) 99 | print(Utilities.get_var('nodes','SN_delim')) 100 | -------------------------------------------------------------------------------- /panGraphViewerWeb/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | -------------------------------------------------------------------------------- /panGraphViewerWeb/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.7-slim 2 | 3 | RUN apt-get update && apt-get install build-essential zlib1g-dev libbz2-dev liblzma-dev -y 4 | 5 | # set work directory 6 | WORKDIR /usr/src/app 7 | 8 | # install dependencies 9 | RUN pip install --upgrade pip 10 | COPY ./requirements.txt /usr/src/app 11 | RUN pip install -r requirements.txt 12 | 13 | # copy project 14 | COPY . /usr/src/app 15 | 16 | EXPOSE 8000 17 | 18 | CMD ./run.sh 19 | -------------------------------------------------------------------------------- /panGraphViewerWeb/README.md: -------------------------------------------------------------------------------- 1 | ## Welcome to the Web browser-based panGraphViewer 2 | 3 | There are 2 ways to install: using ``miniconda3`` or using ``docker`` 4 | 5 | ### 1. Using miniconda 6 | You may use ``pip`` in ``miniconda3`` to install the packages. 7 | 8 | Go to the directory ``panGraphViewerWeb`` first: 9 | ``` 10 | cd panGraphViewerWeb 11 | ``` 12 | 13 | Then, 14 | 15 | On ``Linux`` or ``macOS``: 16 | ``` 17 | pip install -r requirements.txt 18 | ``` 19 | To start the server: 20 | ``` 21 | ./run.sh 22 | ``` 23 | 24 | --- 25 | 26 | On Windows: 27 | ``` 28 | pip install -r requirements_windows.txt 29 | ``` 30 | One more packages on ``Window`` platform is 31 | ``` 32 | conda install m2-base 33 | ``` 34 | To start the server: 35 | ``` 36 | run.bat 37 | ``` 38 | 39 | --- 40 | 41 | And then, you may type ``http://localhost:8000`` or ``http://:8000`` in your browser to use ``panGraphViewer`` 42 | 43 | The default demo login info: 44 | ``` 45 | Account: demo 46 | password: demodemo 47 | ``` 48 | 49 | You can also manage the accounts by using admin account at admin address: 50 | ``` 51 | Address: http://localhost:8000/admin 52 | Account: admin 53 | password: abcd1234 54 | ``` 55 | 56 | --- 57 | 58 | 59 | ### 2. Using docker 60 | 61 | If you have docker permission, you can use docker to simplify the deployment. 62 | You can either: (i) build your own docker image and create the container, or (ii) use the prebuilt image directly to create the container. 63 | 64 | Go to the directory ``docker``first: 65 | ``` 66 | cd panGraphViewerWeb/docker 67 | ``` 68 | 69 | Then, 70 | 71 | #### (i) Build your own docker image and create the container 72 | 73 | On ``Linux`` or ``macOS``: 74 | ``` 75 | ./build_docker.sh 76 | ./run_docker.sh 77 | ``` 78 | 79 | On Windows: 80 | ``` 81 | build_docker.bat 82 | run_docker.bat 83 | ``` 84 | 85 | #### (ii) Use prebuilt image directly to create the container 86 | 87 | On ``Linux`` or ``macOS``: 88 | ``` 89 | ./run_docker_prebuilt.sh 90 | ``` 91 | 92 | On Windows: 93 | ``` 94 | run_docker_prebuilt.bat 95 | ``` 96 | 97 | --- 98 | 99 | When running run_docker\*, you will see the published port number at the end of execution. Then you can use your browser to access the address ```localhost:``` or ```:```. 100 | E.g. if the published port number is 32793, then you can type in the address ``http://localhost:32793`` 101 | 102 | 103 | The default demo login info: 104 | ``` 105 | Account: demo 106 | password: demodemo 107 | ``` 108 | 109 | You can also manage the accounts by using admin account at admin address: 110 | ``` 111 | Address: http://:/admin 112 | Account: admin 113 | password: abcd1234 114 | ``` 115 | 116 | --- 117 | Enjoy the use of panGraphViewer! 118 | -------------------------------------------------------------------------------- /panGraphViewerWeb/config.ini: -------------------------------------------------------------------------------- 1 | [nodes] 2 | colors = 3 | 800000,8B0000,A52A2A,B22222,DC143C,FF0000,FF6347,FF7F50, 4 | CD5C5C,F08080,E9967A,FA8072,FFA07A,FF4500,FF8C00,FFA500, 5 | FFD700,B8860B,DAA520,EEE8AA,BDB76B,F0E68C,808000,FFFF00, 6 | 9ACD32,556B2F,6B8E23,7CFC00,7FFF00,ADFF2F,006400,008000, 7 | 228B22,00FF00,32CD32,90EE90,98FB98,8FBC8F,00FA9A,00FF7F, 8 | 2E8B57,66CDAA,3CB371,20B2AA,2F4F4F,008080,008B8B,00FFFF, 9 | 00FFFF,E0FFFF,00CED1,40E0D0,48D1CC,AFEEEE,7FFFD4,B0E0E6, 10 | 5F9EA0,4682B4,6495ED,00BFFF,1E90FF,ADD8E6,87CEEB,87CEFA, 11 | 191970,000080,0000CD,0000FF,4169E1,8A2BE2,4B0082,483D8B, 12 | 6A5ACD,7B68EE,9370DB,8B008B,9400D3,9932CC,BA55D3,800080, 13 | D8BFD8,DDA0DD,EE82EE,FF00FF,DA70D6,C71585,DB7093,FF1493, 14 | FF69B4,FFB6C1,FFC0CB,FAEBD7,F5F5DC,FFE4C4,FFEBCD,F5DEB3, 15 | FFF8DC,FFFACD,FAFAD2,FFFFE0,8B4513,A0522D,D2691E,CD853F, 16 | F4A460,DEB887,D2B48C,BC8F8F,FFE4B5,FFDEAD,FFDAB9,FFE4E1, 17 | FFF0F5,FAF0E6,FDF5E6,FFEFD5,FFF5EE,F5FFFA,708090,778899, 18 | B0C4DE,E6E6FA,FFFAF0,F0F8FF,F8F8FF,F0FFF0,75fa7a,F0FFFF, 19 | 4f94d4,f86368,696969,808080,A9A9A9,C0C0C0,D3D3D3,DCDCDC, 20 | F5F5F5,1ed14b,fe4a49,2ab7ca,fed766,e6e6ea,f4f4f8,eee3e7, 21 | ead5dc,eec9d2,f4b6c2,f6abb6,005b96,6497b1,b3cde0,851e3e, 22 | dec3c3,e7d3d3,f0e4e4,f9f4f4,0e9aa7,3da4ab,f6cd61,fe8a71, 23 | 4b86b4,adcbe3,63ace5,fe9c8f,feb2a8,fec8c1,fad9c1,f9caa7, 24 | 009688,35a79c,54b2a9,65c3ba,83d0c9,ee4035,f37736,fdf498, 25 | 7bc043,0392cf,96ceb4,ffeead,ff6f69,ffcc5c,88d8b0,008744, 26 | 0057e7,d62d20,ffa700,CDCDCD,a8e6cf,dcedc1,ffd3b6,ffaaa5, 27 | ff8b94,d11141,00b159,00aedb,f37735,ffc425,84c1ff 28 | 29 | SN_delim = || 30 | 31 | BB_shape = dot 32 | 33 | SNP_shape = dot 34 | DEL_shape = triangle 35 | DUP_shape = database 36 | INS_shape = triangleDown 37 | INV_shape = text 38 | BND_shape = star 39 | 40 | maxNodesDisplay = 200 41 | maxNodesLimit = 20000 42 | maxNodeLenDisplay = 100000 43 | 44 | checknLines = 10 45 | 46 | geneNodeOverlapCntThreshold = 2 47 | 48 | [enable] 49 | interaction = No 50 | graphLayoutModification = No 51 | addRemoveNodes = No 52 | 53 | [canvas] 54 | height = 980 55 | width = 1400 56 | 57 | [cytoscape] 58 | BB_shape = ellipse 59 | 60 | SNP_shape = ellipse 61 | DEL_shape = concave-hexagon 62 | DUP_shape = diamond 63 | INS_shape = triangle 64 | INV_shape = vee 65 | BND_shape = star 66 | 67 | [web] 68 | work_dir = data 69 | -------------------------------------------------------------------------------- /panGraphViewerWeb/config_default.ini: -------------------------------------------------------------------------------- 1 | [nodes] 2 | colors = 3 | 800000,8B0000,A52A2A,B22222,DC143C,FF0000,FF6347,FF7F50, 4 | CD5C5C,F08080,E9967A,FA8072,FFA07A,FF4500,FF8C00,FFA500, 5 | FFD700,B8860B,DAA520,EEE8AA,BDB76B,F0E68C,808000,FFFF00, 6 | 9ACD32,556B2F,6B8E23,7CFC00,7FFF00,ADFF2F,006400,008000, 7 | 228B22,00FF00,32CD32,90EE90,98FB98,8FBC8F,00FA9A,00FF7F, 8 | 2E8B57,66CDAA,3CB371,20B2AA,2F4F4F,008080,008B8B,00FFFF, 9 | 00FFFF,E0FFFF,00CED1,40E0D0,48D1CC,AFEEEE,7FFFD4,B0E0E6, 10 | 5F9EA0,4682B4,6495ED,00BFFF,1E90FF,ADD8E6,87CEEB,87CEFA, 11 | 191970,000080,0000CD,0000FF,4169E1,8A2BE2,4B0082,483D8B, 12 | 6A5ACD,7B68EE,9370DB,8B008B,9400D3,9932CC,BA55D3,800080, 13 | D8BFD8,DDA0DD,EE82EE,FF00FF,DA70D6,C71585,DB7093,FF1493, 14 | FF69B4,FFB6C1,FFC0CB,FAEBD7,F5F5DC,FFE4C4,FFEBCD,F5DEB3, 15 | FFF8DC,FFFACD,FAFAD2,FFFFE0,8B4513,A0522D,D2691E,CD853F, 16 | F4A460,DEB887,D2B48C,BC8F8F,FFE4B5,FFDEAD,FFDAB9,FFE4E1, 17 | FFF0F5,FAF0E6,FDF5E6,FFEFD5,FFF5EE,F5FFFA,708090,778899, 18 | B0C4DE,E6E6FA,FFFAF0,F0F8FF,F8F8FF,F0FFF0,75fa7a,F0FFFF, 19 | 4f94d4,f86368,696969,808080,A9A9A9,C0C0C0,D3D3D3,DCDCDC, 20 | F5F5F5,1ed14b,fe4a49,2ab7ca,fed766,e6e6ea,f4f4f8,eee3e7, 21 | ead5dc,eec9d2,f4b6c2,f6abb6,005b96,6497b1,b3cde0,851e3e, 22 | dec3c3,e7d3d3,f0e4e4,f9f4f4,0e9aa7,3da4ab,f6cd61,fe8a71, 23 | 4b86b4,adcbe3,63ace5,fe9c8f,feb2a8,fec8c1,fad9c1,f9caa7, 24 | 009688,35a79c,54b2a9,65c3ba,83d0c9,ee4035,f37736,fdf498, 25 | 7bc043,0392cf,96ceb4,ffeead,ff6f69,ffcc5c,88d8b0,008744, 26 | 0057e7,d62d20,ffa700,CDCDCD,a8e6cf,dcedc1,ffd3b6,ffaaa5, 27 | ff8b94,d11141,00b159,00aedb,f37735,ffc425,84c1ff 28 | 29 | SN_delim = || 30 | 31 | BB_shape = dot 32 | 33 | SNP_shape = dot 34 | DEL_shape = triangle 35 | DUP_shape = database 36 | INS_shape = triangleDown 37 | INV_shape = text 38 | BND_shape = star 39 | 40 | maxNodesDisplay = 200 41 | maxNodesLimit = 20000 42 | maxNodeLenDisplay = 100000 43 | 44 | checknLines = 10 45 | 46 | geneNodeOverlapCntThreshold = 2 47 | 48 | [enable] 49 | interaction = No 50 | graphLayoutModification = No 51 | addRemoveNodes = No 52 | 53 | [canvas] 54 | height = 980 55 | width = 1400 56 | 57 | [cytoscape] 58 | BB_shape = ellipse 59 | 60 | SNP_shape = ellipse 61 | DEL_shape = concave-hexagon 62 | DUP_shape = diamond 63 | INS_shape = triangle 64 | INV_shape = vee 65 | BND_shape = star 66 | 67 | [web] 68 | work_dir = data 69 | -------------------------------------------------------------------------------- /panGraphViewerWeb/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerWeb/db.sqlite3 -------------------------------------------------------------------------------- /panGraphViewerWeb/docker/build_docker.bat: -------------------------------------------------------------------------------- 1 | bash build_docker.sh 2 | -------------------------------------------------------------------------------- /panGraphViewerWeb/docker/build_docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | # build image 6 | docker build -t pangraph .. 7 | -------------------------------------------------------------------------------- /panGraphViewerWeb/docker/run_docker.bat: -------------------------------------------------------------------------------- 1 | bash run_docker.sh 2 | -------------------------------------------------------------------------------- /panGraphViewerWeb/docker/run_docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | data_path=`pwd`/../data 4 | 5 | set -e 6 | 7 | # remove existing container 8 | container_id=`docker ps -aqf "name=pangraph1"` 9 | if [ ! -z "$container_id" ] 10 | then 11 | docker stop $container_id > /dev/null 12 | docker rm $container_id > /dev/null 13 | fi 14 | 15 | docker run -v ${data_path}:/usr/src/app/data -d -P --name pangraph1 pangraph > /dev/null 16 | 17 | port=$( docker port pangraph1 8000 | cut -d':' -f2 ) 18 | echo "Port for web is $port" 19 | -------------------------------------------------------------------------------- /panGraphViewerWeb/docker/run_docker_prebuilt.bat: -------------------------------------------------------------------------------- 1 | bash run_docker_prebuilt.sh 2 | -------------------------------------------------------------------------------- /panGraphViewerWeb/docker/run_docker_prebuilt.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | data_path=`pwd`/../data 4 | 5 | set -e 6 | 7 | # remove existing container 8 | container_id=`docker ps -aqf "name=pangraph1"` 9 | if [ ! -z "$container_id" ] 10 | then 11 | docker stop $container_id > /dev/null 12 | docker rm $container_id > /dev/null 13 | fi 14 | 15 | docker run -v ${data_path}:/usr/src/app/data -d -P --name pangraph1 rickyma1/pangraphviewerweb > /dev/null 16 | 17 | port=$( docker port pangraph1 8000 | cut -d':' -f2 ) 18 | echo "Port for web is $port" 19 | -------------------------------------------------------------------------------- /panGraphViewerWeb/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """Django's command-line utility for administrative tasks.""" 3 | import os 4 | import sys 5 | 6 | 7 | def main(): 8 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'pangraph.settings') 9 | try: 10 | from django.core.management import execute_from_command_line 11 | except ImportError as exc: 12 | raise ImportError( 13 | "Couldn't import Django. Are you sure it's installed and " 14 | "available on your PYTHONPATH environment variable? Did you " 15 | "forget to activate a virtual environment?" 16 | ) from exc 17 | execute_from_command_line(sys.argv) 18 | 19 | 20 | if __name__ == '__main__': 21 | main() 22 | -------------------------------------------------------------------------------- /panGraphViewerWeb/pangraph/.env: -------------------------------------------------------------------------------- 1 | TMPPATH_PREFIX='/tmp/' 2 | -------------------------------------------------------------------------------- /panGraphViewerWeb/pangraph/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerWeb/pangraph/__init__.py -------------------------------------------------------------------------------- /panGraphViewerWeb/pangraph/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for pangraph project. 3 | 4 | It exposes the ASGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.asgi import get_asgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'pangraph.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /panGraphViewerWeb/pangraph/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for pangraph project. 3 | 4 | Generated by 'django-admin startproject' using Django 3.0.7. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.0/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/3.0/ref/settings/ 11 | """ 12 | 13 | import os 14 | import environ 15 | 16 | env = environ.Env() 17 | environ.Env.read_env() 18 | 19 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 20 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 21 | 22 | 23 | # Quick-start development settings - unsuitable for production 24 | # See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/ 25 | 26 | # SECURITY WARNING: keep the secret key used in production secret! 27 | SECRET_KEY = 'bvclmfhj=(5$)3j(ni-x7_=y8@urm87j@xo6(l&r^farqmxww8' 28 | 29 | # SECURITY WARNING: don't run with debug turned on in production! 30 | #DEBUG = True 31 | DEBUG = False 32 | 33 | ALLOWED_HOSTS = ['*'] 34 | 35 | 36 | # Application definition 37 | 38 | INSTALLED_APPS = [ 39 | 'django.contrib.admin', 40 | 'django.contrib.auth', 41 | 'django.contrib.contenttypes', 42 | 'django.contrib.sessions', 43 | 'django.contrib.messages', 44 | 'django.contrib.staticfiles', 45 | 'pangraphviewer.apps.pangraphviewerConfig', 46 | 47 | 'bootstrap4', 48 | 'fontawesome-free' 49 | ] 50 | 51 | MIDDLEWARE = [ 52 | 'django.middleware.security.SecurityMiddleware', 53 | 'whitenoise.middleware.WhiteNoiseMiddleware', 54 | 'django.contrib.sessions.middleware.SessionMiddleware', 55 | 'django.middleware.common.CommonMiddleware', 56 | 'django.middleware.csrf.CsrfViewMiddleware', 57 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 58 | 'django.contrib.messages.middleware.MessageMiddleware', 59 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 60 | ] 61 | 62 | ROOT_URLCONF = 'pangraph.urls' 63 | 64 | TEMPLATES = [ 65 | { 66 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 67 | 'DIRS': [], 68 | 'APP_DIRS': True, 69 | 'OPTIONS': { 70 | 'context_processors': [ 71 | 'django.template.context_processors.debug', 72 | 'django.template.context_processors.request', 73 | 'django.contrib.auth.context_processors.auth', 74 | 'django.contrib.messages.context_processors.messages', 75 | ], 76 | }, 77 | }, 78 | ] 79 | 80 | WSGI_APPLICATION = 'pangraph.wsgi.application' 81 | 82 | 83 | # Database 84 | # https://docs.djangoproject.com/en/3.0/ref/settings/#databases 85 | 86 | DATABASES = { 87 | 'default': { 88 | 'ENGINE': 'django.db.backends.sqlite3', 89 | 'NAME': BASE_DIR + '/db.sqlite3', 90 | }, 91 | } 92 | 93 | 94 | # Password validation 95 | # https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators 96 | 97 | AUTH_PASSWORD_VALIDATORS = [ 98 | { 99 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 100 | }, 101 | { 102 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 103 | }, 104 | #{ 105 | # 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 106 | #}, 107 | { 108 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 109 | }, 110 | ] 111 | 112 | # Internationalization 113 | # https://docs.djangoproject.com/en/3.0/topics/i18n/ 114 | 115 | LANGUAGE_CODE = 'en-us' 116 | 117 | #TIME_ZONE = 'UTC' 118 | TIME_ZONE = 'Asia/Hong_Kong' 119 | 120 | USE_I18N = True 121 | 122 | USE_L10N = True 123 | 124 | USE_TZ = True 125 | 126 | 127 | # Static files (CSS, JavaScript, Images) 128 | # https://docs.djangoproject.com/en/3.0/howto/static-files/ 129 | 130 | STATICFILES_DIRS = [ 131 | os.path.join(BASE_DIR, "static"), 132 | ] 133 | 134 | STATIC_URL = '/static/' 135 | 136 | DJANGO_BOOTSTRAP_UI_THEME = 'bootswatch-paper' 137 | 138 | LOGGING = { 139 | 'version': 1, 140 | 'disable_existing_loggers': False, 141 | 'handlers': { 142 | 'console': { 143 | 'level': 'DEBUG', 144 | 'class': 'logging.StreamHandler', 145 | } 146 | }, 147 | 'loggers': { 148 | 'django.db.backends': { 149 | 'handlers': ['console'], 150 | 'level': 'DEBUG', 151 | }, 152 | } 153 | } 154 | 155 | REST_FRAMEWORK = { 156 | 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination', 157 | 'PAGE_SIZE': 10, 158 | 159 | 'DEFAULT_PERMISSION_CLASSES': [ 160 | 'rest_framework.permissions.AllowAny', 161 | ] 162 | } 163 | 164 | TMPPATH_PREFIX = env.str('TMPPATH_PREFIX') 165 | 166 | # config/settings.py 167 | LOGIN_REDIRECT_URL = '/' 168 | LOGOUT_REDIRECT_URL = '/' 169 | 170 | STATIC_ROOT = BASE_DIR + '/staticfiles' 171 | #STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' 172 | -------------------------------------------------------------------------------- /panGraphViewerWeb/pangraph/urls.py: -------------------------------------------------------------------------------- 1 | """pangraph URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/3.0/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import include, path, re_path 18 | from django.views.generic.base import TemplateView 19 | 20 | urlpatterns = [ 21 | #re_path(r'^$', include('pangraphviewer.urls')), 22 | re_path(r'^', include('pangraphviewer.urls')), 23 | 24 | path('admin/', admin.site.urls), 25 | path('accounts/', include('django.contrib.auth.urls')), 26 | #path('home', TemplateView.as_view(template_name='home.html'), name='home'), 27 | 28 | path('pangraphviewer/', include('pangraphviewer.urls')), 29 | ] 30 | -------------------------------------------------------------------------------- /panGraphViewerWeb/pangraph/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for pangraph project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'pangraph.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /panGraphViewerWeb/pangraphviewer/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerWeb/pangraphviewer/__init__.py -------------------------------------------------------------------------------- /panGraphViewerWeb/pangraphviewer/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /panGraphViewerWeb/pangraphviewer/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class pangraphviewerConfig(AppConfig): 5 | name = 'pangraphviewer' 6 | -------------------------------------------------------------------------------- /panGraphViewerWeb/pangraphviewer/forms.py: -------------------------------------------------------------------------------- 1 | from django import forms 2 | from .models import Upload 3 | 4 | class UploadForm(forms.ModelForm): 5 | class Meta: 6 | model = Upload 7 | fields = ('image',) 8 | -------------------------------------------------------------------------------- /panGraphViewerWeb/pangraphviewer/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.1.3 on 2021-05-01 14:26 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | initial = True 9 | 10 | dependencies = [ 11 | ] 12 | 13 | operations = [ 14 | migrations.CreateModel( 15 | name='Upload', 16 | fields=[ 17 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 18 | ('image', models.FileField(upload_to='files')), 19 | ], 20 | ), 21 | ] 22 | -------------------------------------------------------------------------------- /panGraphViewerWeb/pangraphviewer/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerWeb/pangraphviewer/migrations/__init__.py -------------------------------------------------------------------------------- /panGraphViewerWeb/pangraphviewer/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | 5 | class Upload(models.Model): 6 | #image = models.ImageField(upload_to='images') 7 | image = models.FileField(upload_to='files') 8 | 9 | def __str__(self): 10 | return str(self.pk) 11 | 12 | class Profile(models.Model): 13 | user_id = models.AutoField(primary_key=True) 14 | username = models.CharField(max_length=500, unique=True) 15 | work_base_dir = models.CharField(max_length=500) 16 | -------------------------------------------------------------------------------- /panGraphViewerWeb/pangraphviewer/panGraphWeb.py: -------------------------------------------------------------------------------- 1 | from pangraphviewer.panGraph import * 2 | 3 | class PanGraphWeb(PanGraph): 4 | pass 5 | -------------------------------------------------------------------------------- /panGraphViewerWeb/pangraphviewer/templates/base.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {% block title %}Django Auth Tutorial{% endblock %} 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | {% block content %} 17 | {% endblock %} 18 |
19 |
20 | 21 | 22 | -------------------------------------------------------------------------------- /panGraphViewerWeb/pangraphviewer/templates/pangraphviewer/.gitignore: -------------------------------------------------------------------------------- 1 | old/* 2 | -------------------------------------------------------------------------------- /panGraphViewerWeb/pangraphviewer/templates/pangraphviewer/base4.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 | 3 | panGraph 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | {% include 'pangraphviewer/navbar4.html' %} 21 |
22 | {% block content %} 23 | {% endblock content %} 24 |
25 | 26 | -------------------------------------------------------------------------------- /panGraphViewerWeb/pangraphviewer/templates/pangraphviewer/config.html: -------------------------------------------------------------------------------- 1 | {% extends "pangraphviewer/base4.html" %} 2 | 3 | {% block content %} 4 | 5 | {% load static %} 6 | 7 | 8 | 9 | 19 | 20 |
21 |
22 |
23 |
24 |
25 | {% csrf_token %} 26 | 27 |
28 | 29 |
30 |
31 |
32 | 33 |
34 |
35 | 36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 | {% csrf_token %} 47 | 48 |
49 | 62 |
63 |
64 |
65 |
66 | 67 | {% endblock content %} 68 | -------------------------------------------------------------------------------- /panGraphViewerWeb/pangraphviewer/templates/pangraphviewer/navbar4.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 | 3 | 4 | 5 | 37 | -------------------------------------------------------------------------------- /panGraphViewerWeb/pangraphviewer/templates/pangraphviewer/vcf_to_gfa.html: -------------------------------------------------------------------------------- 1 | {% extends "pangraphviewer/base4.html" %} 2 | 3 | {% block content %} 4 | 5 | {% load static %} 6 | 7 | 8 | 9 | 10 | 11 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 |
24 |
25 |
26 | 27 |
28 | {% csrf_token %} 29 | 30 |
31 | 32 |
33 |
34 |
35 | 36 |
37 | 38 |
39 |
40 | 41 |
42 |
43 | 44 |
45 |
46 |
47 | 48 |
49 | 50 |
51 |
52 |
53 | 56 |
57 |
58 | 61 | 64 | 67 | 71 | 72 |
73 | 74 |
75 |
76 |
77 | 78 |
79 | 80 |
81 |
82 |
83 | 86 |
87 |
88 | 91 | 94 | 97 | 101 | 102 |
103 | 104 |
105 |
106 |
107 | 108 |
109 | 110 |
111 |
112 |
113 | 114 |
115 | 116 |
117 | 118 |
119 | 120 |
121 | 122 |
123 | 124 |
125 |
126 |
127 | 128 |
129 | 130 |
131 |
132 | 133 | 143 | 144 | {% endblock content %} 145 | -------------------------------------------------------------------------------- /panGraphViewerWeb/pangraphviewer/templates/registration/login.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | {% block title %}Log In{% endblock %} 4 | 5 | {% block content %} 6 | 11 | 12 |
13 |
14 | 15 |
16 |
17 |
18 |
19 | (username: demo, password: demodemo) 20 | {% csrf_token %} 21 | {{ form.as_p }} 22 |
23 |
24 | 25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | 33 | {% endblock %} 34 | -------------------------------------------------------------------------------- /panGraphViewerWeb/pangraphviewer/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /panGraphViewerWeb/pangraphviewer/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path, re_path 2 | 3 | from . import views 4 | 5 | urlpatterns = [ 6 | re_path(r'^$', views.graph, name='default'), 7 | 8 | # main pages 9 | path('graph', views.graph, name='graph'), 10 | path('config', views.config, name='config'), 11 | path('vcf_to_gfa', views.vcf_to_gfa, name='vcf_to_gfa'), 12 | 13 | # supporting pages 14 | path('getdata', views.getdata, name='getdata'), 15 | path('parse_gfa', views.parse_gfa, name='parse_gfa'), 16 | path('parse_vcf', views.parse_vcf, name='parse_vcf'), 17 | path('parse_bed', views.parse_bed, name='parse_bed'), 18 | path('viewseq', views.viewseq, name='viewseq'), 19 | path('downloadseq', views.downloadseq, name='downloadseq'), 20 | 21 | path('upload_file', views.upload_file, name='upload_file'), 22 | 23 | path('convert_vcf', views.convert_vcf, name='convert_vcf'), 24 | path('download_rgfa', views.download_rgfa, name='download_rgfa'), 25 | 26 | path('get_uploaded_list', views.get_uploaded_list, name='get_uploaded_list'), 27 | path('manage_file', views.manage_file, name='manage_file'), 28 | 29 | path('draw_overlap_gene', views.draw_overlap_gene, name='draw_overlap_gene'), 30 | path('check_node_id', views.check_node_id, name='check_node_id'), 31 | ] 32 | -------------------------------------------------------------------------------- /panGraphViewerWeb/pangraphviewer/utilities.py: -------------------------------------------------------------------------------- 1 | import subprocess 2 | import os 3 | import sys 4 | import shlex 5 | import logging 6 | 7 | from configparser import ConfigParser 8 | 9 | #============================= Function ================================= 10 | ##logging info 11 | DEBUG="" #change it when debugging 12 | logFormat = "%(asctime)s [%(levelname)s] %(message)s" 13 | level = "DEBUG" if DEBUG != "" else "INFO" 14 | logging.basicConfig( stream=sys.stderr, level=level, format=logFormat ) 15 | #======================================================================== 16 | 17 | #config = None 18 | script_directory = os.path.dirname(os.path.realpath(__file__)) 19 | copied = os.path.join(script_directory, '..', "config.ini") 20 | 21 | def getVar(cfg, group, var, mustHave=False, forceRead=True): 22 | #global config 23 | config = None 24 | 25 | if not config or forceRead: 26 | config = ConfigParser() 27 | config.read(cfg) 28 | 29 | try: 30 | return config.get(group, var) 31 | except: 32 | if mustHave: 33 | raise 34 | else: 35 | logging.info(f'Config value [{group}][{var}] not found') 36 | return None 37 | 38 | def rev_comp(seq): 39 | trans = str.maketrans('ACGTN*', 'TGCAN*') 40 | return seq.translate(trans)[::-1] 41 | 42 | def run_shell_cmd(cmd, stdinInput=None, logError=True): 43 | cmd_list = [str.strip('"').strip("'") for str in shlex.split(cmd, posix=False)] 44 | 45 | ret = subprocess.run(cmd_list, shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE, text=True) 46 | 47 | if ret.returncode and logError: 48 | logging.error(f'cmd: {cmd}') 49 | logging.error(f'stderr: {ret.stderr.strip()}') 50 | 51 | return {'returncode':ret.returncode, 'out':ret.stdout.strip().split('\n'), 'err':ret.stderr.strip().split('\n')} 52 | 53 | def convert_vcf_to_gfa(vcf, chr, backbone, outdir, prefix, fasta=None): 54 | pyscript = 'pangraphviewer/vcf2rGFA.py' 55 | cmd = f"'{sys.executable}' '{pyscript}' -b '{backbone}' -v '{vcf}' -o '{outdir}' -p '{prefix}'" 56 | if chr: cmd += f" -c '{chr}'" 57 | if fasta: cmd += f" -f '{fasta}'" 58 | 59 | return run_shell_cmd(cmd) 60 | 61 | def convert_gfa_to_rgfa(gfa, rgfa): 62 | pyscript = 'pangraphviewer/gfa2rGFA.py' 63 | cmd = f"'{sys.executable}' '{pyscript}' -in_gfa '{gfa}' -out_rgfa '{rgfa}'" 64 | 65 | return run_shell_cmd(cmd, logError=False) 66 | 67 | #return subprocess.call(shlex.split(cmd), shell = False) 68 | 69 | def makedirs(dir): 70 | try: 71 | umask_orig = os.umask(0) 72 | os.makedirs(dir, mode=0o777, exist_ok=True) 73 | except: 74 | raise Exception(f'Cannot create directory {dir}') 75 | finally: 76 | os.umask(umask_orig) 77 | -------------------------------------------------------------------------------- /panGraphViewerWeb/requirements.txt: -------------------------------------------------------------------------------- 1 | Django==3.1.3 2 | django-bootstrap4 3 | requests 4 | django-environ 5 | djangorestframework 6 | configparser 7 | natsort 8 | networkx 9 | fontawesome-free==5.15 10 | bokeh==2.2.3 11 | dna_features_viewer 12 | pysam 13 | pandas 14 | whitenoise 15 | jinja2==3.0 16 | -------------------------------------------------------------------------------- /panGraphViewerWeb/requirements_windows.txt: -------------------------------------------------------------------------------- 1 | Django==3.1.3 2 | django-bootstrap4 3 | requests 4 | django-environ 5 | djangorestframework 6 | configparser 7 | natsort 8 | networkx 9 | pyfaidx 10 | fontawesome-free==5.15 11 | bokeh==2.2.3 12 | dna_features_viewer 13 | pandas 14 | whitenoise 15 | -------------------------------------------------------------------------------- /panGraphViewerWeb/run.bat: -------------------------------------------------------------------------------- 1 | bash run.sh 2 | -------------------------------------------------------------------------------- /panGraphViewerWeb/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #mode=PROD 4 | 5 | if [[ $mode == "PROD" ]] 6 | then 7 | echo "Generating static files ..." 8 | python manage.py collectstatic --noinput 9 | 10 | echo "Starting server ...." 11 | python manage.py runserver 0.0.0.0:8000 12 | else 13 | echo "Starting server ...." 14 | python manage.py runserver --insecure 0.0.0.0:8000 15 | fi 16 | -------------------------------------------------------------------------------- /panGraphViewerWeb/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerWeb/static/favicon.ico -------------------------------------------------------------------------------- /panGraphViewerWeb/static/images/add.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /panGraphViewerWeb/static/images/cy/barrel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerWeb/static/images/cy/barrel.png -------------------------------------------------------------------------------- /panGraphViewerWeb/static/images/cy/bottom-round-rectangle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerWeb/static/images/cy/bottom-round-rectangle.png -------------------------------------------------------------------------------- /panGraphViewerWeb/static/images/cy/concave-hexagon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerWeb/static/images/cy/concave-hexagon.png -------------------------------------------------------------------------------- /panGraphViewerWeb/static/images/cy/cut-rectangle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerWeb/static/images/cy/cut-rectangle.png -------------------------------------------------------------------------------- /panGraphViewerWeb/static/images/cy/diamond.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerWeb/static/images/cy/diamond.png -------------------------------------------------------------------------------- /panGraphViewerWeb/static/images/cy/ellipse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerWeb/static/images/cy/ellipse.png -------------------------------------------------------------------------------- /panGraphViewerWeb/static/images/cy/heptagon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerWeb/static/images/cy/heptagon.png -------------------------------------------------------------------------------- /panGraphViewerWeb/static/images/cy/hexagon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerWeb/static/images/cy/hexagon.png -------------------------------------------------------------------------------- /panGraphViewerWeb/static/images/cy/octagon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerWeb/static/images/cy/octagon.png -------------------------------------------------------------------------------- /panGraphViewerWeb/static/images/cy/pentagon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerWeb/static/images/cy/pentagon.png -------------------------------------------------------------------------------- /panGraphViewerWeb/static/images/cy/rectangle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerWeb/static/images/cy/rectangle.png -------------------------------------------------------------------------------- /panGraphViewerWeb/static/images/cy/rhomboid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerWeb/static/images/cy/rhomboid.png -------------------------------------------------------------------------------- /panGraphViewerWeb/static/images/cy/round-diamond.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerWeb/static/images/cy/round-diamond.png -------------------------------------------------------------------------------- /panGraphViewerWeb/static/images/cy/round-heptagon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerWeb/static/images/cy/round-heptagon.png -------------------------------------------------------------------------------- /panGraphViewerWeb/static/images/cy/round-hexagon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerWeb/static/images/cy/round-hexagon.png -------------------------------------------------------------------------------- /panGraphViewerWeb/static/images/cy/round-octagon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerWeb/static/images/cy/round-octagon.png -------------------------------------------------------------------------------- /panGraphViewerWeb/static/images/cy/round-pentagon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerWeb/static/images/cy/round-pentagon.png -------------------------------------------------------------------------------- /panGraphViewerWeb/static/images/cy/round-rectangle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerWeb/static/images/cy/round-rectangle.png -------------------------------------------------------------------------------- /panGraphViewerWeb/static/images/cy/round-tag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerWeb/static/images/cy/round-tag.png -------------------------------------------------------------------------------- /panGraphViewerWeb/static/images/cy/round-triangle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerWeb/static/images/cy/round-triangle.png -------------------------------------------------------------------------------- /panGraphViewerWeb/static/images/cy/star.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerWeb/static/images/cy/star.png -------------------------------------------------------------------------------- /panGraphViewerWeb/static/images/cy/tag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerWeb/static/images/cy/tag.png -------------------------------------------------------------------------------- /panGraphViewerWeb/static/images/cy/triangle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerWeb/static/images/cy/triangle.png -------------------------------------------------------------------------------- /panGraphViewerWeb/static/images/cy/vee.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerWeb/static/images/cy/vee.png -------------------------------------------------------------------------------- /panGraphViewerWeb/static/images/frontpage.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerWeb/static/images/frontpage.jpg -------------------------------------------------------------------------------- /panGraphViewerWeb/static/images/loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/panGraphViewerWeb/static/images/loader.gif -------------------------------------------------------------------------------- /panGraphViewerWeb/static/images/remove.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | image/svg+xml -------------------------------------------------------------------------------- /panGraphViewerWeb/static/pangraphviewer/css/cytoscape-context-menus.css: -------------------------------------------------------------------------------- 1 | .cy-context-menus-cxt-menu { 2 | display:none; 3 | z-index: 1000; 4 | position:absolute; 5 | border:1px solid #A0A0A0; 6 | padding: 0; 7 | margin: 0; 8 | width:auto; 9 | } 10 | 11 | .cy-context-menus-cxt-menuitem { 12 | display:block; 13 | width: 100%; 14 | padding: 3px 20px; 15 | position:relative; 16 | margin:0; 17 | background-color:#f8f8f8; 18 | font-weight:normal; 19 | font-size: 12px; 20 | white-space:nowrap; 21 | border: 0; 22 | text-align: left; 23 | } 24 | 25 | .cy-context-menus-cxt-menuitem:enabled { 26 | color: #000000; 27 | } 28 | 29 | .cy-context-menus-ctx-operation:focus { 30 | outline: none; 31 | } 32 | 33 | .cy-context-menus-cxt-menuitem:hover { 34 | color: #ffffff; 35 | text-decoration: none; 36 | background-color: #0B9BCD; 37 | background-image: none; 38 | cursor: pointer; 39 | } 40 | 41 | .cy-context-menus-cxt-menuitem[content]:before { 42 | content:attr(content); 43 | } 44 | 45 | .cy-context-menus-divider { 46 | border-bottom:1px solid #A0A0A0; 47 | } 48 | 49 | .cy-context-menus-submenu-indicator { 50 | position: absolute; 51 | right: 2px; 52 | top: 50%; 53 | transform: translateY(-50%); 54 | } -------------------------------------------------------------------------------- /panGraphViewerWeb/static/pangraphviewer/css/style.css: -------------------------------------------------------------------------------- 1 | #mynetwork { 2 | width: 1400; 3 | height: 980; 4 | background-color: #ffffff; 5 | border: 1px solid lightgray; 6 | position: relative; 7 | float: left; 8 | } 9 | 10 | 11 | #loadingBar { 12 | position:absolute; 13 | top:0px; 14 | left:0px; 15 | width: 1400; 16 | height: 980; 17 | background-color:rgba(200,200,200,0.8); 18 | -webkit-transition: all 0.5s ease; 19 | -moz-transition: all 0.5s ease; 20 | -ms-transition: all 0.5s ease; 21 | -o-transition: all 0.5s ease; 22 | transition: all 0.5s ease; 23 | opacity:1; 24 | } 25 | 26 | #bar { 27 | position:absolute; 28 | top:0px; 29 | left:0px; 30 | width:20px; 31 | height:20px; 32 | margin:auto auto auto auto; 33 | border-radius:11px; 34 | border:2px solid rgba(30,30,30,0.05); 35 | background: rgb(0, 173, 246); /* Old browsers */ 36 | box-shadow: 2px 0px 4px rgba(0,0,0,0.4); 37 | } 38 | 39 | #border { 40 | position:absolute; 41 | top:10px; 42 | left:10px; 43 | width:500px; 44 | height:23px; 45 | margin:auto auto auto auto; 46 | box-shadow: 0px 0px 4px rgba(0,0,0,0.2); 47 | border-radius:10px; 48 | } 49 | 50 | #text { 51 | position:absolute; 52 | top:8px; 53 | left:530px; 54 | width:30px; 55 | height:50px; 56 | margin:auto auto auto auto; 57 | font-size:22px; 58 | color: #000000; 59 | } 60 | 61 | div.outerBorder { 62 | position:relative; 63 | top:400px; 64 | width:600px; 65 | height:44px; 66 | margin:auto auto auto auto; 67 | border:8px solid rgba(0,0,0,0.1); 68 | background: rgb(252,252,252); /* Old browsers */ 69 | background: -moz-linear-gradient(top, rgba(252,252,252,1) 0%, rgba(237,237,237,1) 100%); /* FF3.6+ */ 70 | background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(252,252,252,1)), color-stop(100%,rgba(237,237,237,1))); /* Chrome,Safari4+ */ 71 | background: -webkit-linear-gradient(top, rgba(252,252,252,1) 0%,rgba(237,237,237,1) 100%); /* Chrome10+,Safari5.1+ */ 72 | background: -o-linear-gradient(top, rgba(252,252,252,1) 0%,rgba(237,237,237,1) 100%); /* Opera 11.10+ */ 73 | background: -ms-linear-gradient(top, rgba(252,252,252,1) 0%,rgba(237,237,237,1) 100%); /* IE10+ */ 74 | background: linear-gradient(to bottom, rgba(252,252,252,1) 0%,rgba(237,237,237,1) 100%); /* W3C */ 75 | filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fcfcfc', endColorstr='#ededed',GradientType=0 ); /* IE6-9 */ 76 | border-radius:72px; 77 | box-shadow: 0px 0px 10px rgba(0,0,0,0.2); 78 | } 79 | 80 | #config { 81 | float: left; 82 | width: 400px; 83 | height: 600px; 84 | } 85 | 86 | body { 87 | font-family: helvetica; 88 | font-size: 14px; 89 | } 90 | 91 | h1 { 92 | opacity: 0.5; 93 | font-size: 1em; 94 | } 95 | 96 | #graph-legend { 97 | color: grey; 98 | border: 2px solid grey; 99 | padding: 3px; 100 | } 101 | 102 | .custom-menu { 103 | display: none; 104 | z-index: 1000; 105 | position: absolute; 106 | overflow: hidden; 107 | border: 1px solid #CCC; 108 | white-space: nowrap; 109 | font-family: sans-serif; 110 | background: #FFF; 111 | color: #333; 112 | border-radius: 5px; 113 | padding: 0; 114 | } 115 | 116 | /* Each of the items in the list */ 117 | .custom-menu li { 118 | padding: 8px 12px; 119 | cursor: pointer; 120 | list-style-type: none; 121 | transition: all .3s ease; 122 | user-select: none; 123 | } 124 | 125 | .custom-menu li:hover { 126 | background-color: #DEF; 127 | } 128 | -------------------------------------------------------------------------------- /panGraphViewerWeb/static/pangraphviewer/css/upload.css: -------------------------------------------------------------------------------- 1 | .not-visible { 2 | display: none; 3 | } -------------------------------------------------------------------------------- /panGraphViewerWeb/static/pangraphviewer/js/config.js: -------------------------------------------------------------------------------- 1 | $( "#input-form" ).submit(function( event ) { 2 | event.preventDefault(); 3 | 4 | var work_base_dir = document.getElementById('work_base_dir').value; 5 | var csrf = document.getElementsByName('csrfmiddlewaretoken')[0].value; 6 | 7 | var alertBox = document.getElementById('alert-box'); 8 | alertBox.innerHTML = `` 9 | 10 | data = {'csrfmiddlewaretoken': csrf,'work_base_dir':work_base_dir} 11 | $.ajax({ 12 | type:'POST', 13 | //url: url, 14 | data: data, 15 | dataType: 'json', 16 | success: function(result) { 17 | alertBox.innerHTML = `` 18 | }, 19 | error: function(response) { 20 | obj = response.responseJSON; 21 | str = 'Update failed'; 22 | if (obj && 'msg' in obj) str += ': '+ obj.msg; 23 | alertBox.innerHTML = `` 24 | } 25 | }); 26 | }); 27 | 28 | -------------------------------------------------------------------------------- /panGraphViewerWeb/static/pangraphviewer/js/vcf_to_gfa.js: -------------------------------------------------------------------------------- 1 | const alertBox = document.getElementById('alert-box') 2 | const csrf = document.getElementsByName('csrfmiddlewaretoken') 3 | 4 | var upload_file_url = document.getElementById('upload_file_url').value 5 | 6 | function upload_add_listener_change(prefix) { 7 | upload = document.getElementById(prefix+'_upload') 8 | upload.onchange = function(e) { 9 | var prefix = e.target.id.split('_')[0] 10 | var file_data = e.target.files[0] 11 | 12 | var fd = new FormData() 13 | fd.append('csrfmiddlewaretoken', csrf[0].value) 14 | fd.append('image', file_data) 15 | fd.append('file_type', prefix) 16 | 17 | $.ajax({ 18 | type:'POST', 19 | url: upload_file_url, 20 | enctype: 'multipart/form-data', 21 | data: fd, 22 | beforeSend: function(){ 23 | update_alert_box('') 24 | }, 25 | xhr: function(){ 26 | const xhr = new window.XMLHttpRequest(); 27 | xhr.upload.addEventListener('progress', e=>{ 28 | if (e.lengthComputable) { 29 | const percent = e.loaded / e.total * 100 30 | update_alert_box(`Upload status: ${percent.toFixed(1)}%`, 'alert-info') 31 | } 32 | 33 | }) 34 | return xhr 35 | }, 36 | success: function(response){ 37 | update_alert_box('Successfully uploaded the file below', 'alert-success') 38 | var idx = response['filepath'].lastIndexOf("/") + 1; 39 | var filename = response['filepath'].substr(idx); 40 | refresh_uploaded_list(`${prefix}_path`,prefix,filename); 41 | }, 42 | error: function(error){ 43 | //console.log('error', error) 44 | update_alert_box('Ups... something went wrong', 'alert-danger') 45 | }, 46 | cache: false, 47 | contentType: false, 48 | processData: false, 49 | }); 50 | 51 | $(this).prop("value", ""); 52 | } 53 | } 54 | 55 | $('#convert-btn').click(function() { 56 | event.preventDefault(); 57 | 58 | var vcf_path = document.getElementById('vcf_path').value; 59 | var fasta_path = document.getElementById('fasta_path').value; 60 | var backbone = document.getElementById('backbone').value; 61 | var convert_vcf_url = document.getElementById('convert_vcf_url').value; 62 | 63 | var rgfa_path = document.getElementById('rgfa_path') 64 | 65 | if (!backbone) { 66 | update_alert_box('Please input backbone name', 'alert-danger') 67 | document.getElementById('backbone').focus(); 68 | return; 69 | } 70 | 71 | if (!vcf_path) { 72 | update_alert_box('Please select uploaded VCF file, or upload new local VCF file', 'alert-danger') 73 | document.getElementById('vcf_path').focus(); 74 | return; 75 | } 76 | 77 | if (!fasta_path) { 78 | update_alert_box('Please select uploaded fasta file, or upload new local fasta file', 'alert-danger') 79 | document.getElementById('fasta_path').focus(); 80 | return; 81 | } 82 | 83 | var post_data = { 84 | 'csrfmiddlewaretoken': csrf[0].value, 85 | 'vcf': vcf_path, 86 | 'fasta': fasta_path, 87 | 'backbone': backbone, 88 | } 89 | 90 | alertBox.innerHTML = `` 91 | $.ajax({ 92 | type:'POST', 93 | url: convert_vcf_url, 94 | data: post_data, 95 | success: function(result) { 96 | rgfa_path.value = result['rgfa']; 97 | $('#download-btn').prop('disabled', false); 98 | alertBox.innerHTML = `` 99 | }, 100 | error: function(result) { 101 | rgfa_path.value = ''; 102 | alertBox.innerHTML = `` 103 | } 104 | }); 105 | }); 106 | 107 | $('#download-btn').click(function() { 108 | event.preventDefault(); 109 | 110 | download_rgfa(); 111 | }); 112 | 113 | function download_rgfa() { 114 | /* 115 | var rgfa = document.getElementById('rgfa_path').value; 116 | var url = 'download_rgfa?rgfa=' + rgfa; 117 | window.open(url); 118 | */ 119 | action = 'download'; 120 | file_name = document.getElementById('rgfa_path').value; 121 | if (!file_name) return; 122 | 123 | manage_file(action, file_name, 'gfa'); 124 | } 125 | 126 | function update_alert_box(msg, alert_type) { 127 | const alertBox = document.getElementById('alert-box') 128 | if (msg) { 129 | alertBox.innerHTML = `` 130 | } else { 131 | alertBox.innerHTML = ''; 132 | } 133 | } 134 | 135 | function refresh_uploaded_list(dropdown_id, file_type, selected_value) { 136 | get_uploaded_list_url = document.getElementById('get_uploaded_list_url').value 137 | 138 | if (!selected_value) selected_value = $(`#${dropdown_id}`).val(); 139 | 140 | var post_data = { 141 | 'csrfmiddlewaretoken': csrf[0].value, 142 | 'file_type': file_type 143 | } 144 | 145 | $.ajax({ 146 | type:'POST', 147 | url: get_uploaded_list_url, 148 | data: post_data, 149 | success: function(result) { 150 | dropdown_obj = $(`#${dropdown_id}`).find('option:not(:first)').remove(); 151 | $.each(result.files, function(index, value) { 152 | if (value == selected_value) selected = 'selected'; else selected = ''; 153 | dropdown_obj.end().append(``); 154 | }); 155 | update_alert_box(`${file_type.toUpperCase()} uploaded file list updated`, 'alert-success'); 156 | }, 157 | error: function(result) { 158 | update_alert_box(`Error in getting ${file_type.toUpperCase()} uploaded file list`, 'alert-danger'); 159 | } 160 | }); 161 | } 162 | 163 | function delete_uploaded(dropdown_id, file_type) { 164 | action = 'delete'; 165 | file_name = $(`#${dropdown_id}`).val(); 166 | if (!file_name) return; 167 | 168 | manage_file(action, file_name, file_type); 169 | } 170 | 171 | $.download_file = function(url, post_data){ 172 | var form = $('
').attr('action', url).attr('method', 'post'); 173 | $.each(post_data, function(name, value) { 174 | form.append($("").attr('type', 'hidden').attr('name', name).attr('value', value)); 175 | }); 176 | form.appendTo('body').submit().remove(); 177 | }; 178 | 179 | function download_uploaded(dropdown_id, file_type) { 180 | action = 'download'; 181 | file_name = $(`#${dropdown_id}`).val(); 182 | if (!file_name) return; 183 | 184 | manage_file(action, file_name, file_type); 185 | } 186 | 187 | function manage_file(action, file_name, file_type, select_id) { 188 | url = $('#manage_file_url').val() 189 | 190 | var post_data = { 191 | 'csrfmiddlewaretoken': csrf[0].value, 192 | 'action': action, 193 | 'file_name': file_name, 194 | 'file_type': file_type, 195 | } 196 | 197 | if (action == 'download') { 198 | $.download_file(url, post_data); 199 | } else { 200 | $.ajax({ 201 | type:'POST', 202 | url: url, 203 | data: post_data, 204 | success: function(result) { 205 | //update_alert_box(`File removed`, 'alert-success'); 206 | if (action == 'delete') alert(`${file_name} removed`); 207 | refresh_uploaded_list(`${file_type}_path`,file_type); 208 | }, 209 | error: function(result) { 210 | update_alert_box(`Error on working on ${file_name}`, 'alert-danger'); 211 | } 212 | }); 213 | } 214 | } 215 | 216 | upload_add_listener_change('vcf'); 217 | upload_add_listener_change('fasta'); 218 | -------------------------------------------------------------------------------- /test/1-rGFA/demo.bed: -------------------------------------------------------------------------------- 1 | chr2 38813 46870 ENSG00000184731.5 FAM110C - 2 | chr2 197568 202605 ENSG00000227061.1 AC079779.7 + 3 | chr2 217729 266398 ENSG00000035115.21 SH3YL1 - 4 | chr2 264139 278283 ENSG00000143727.15 ACP1 + 5 | chr2 279557 288851 ENSG00000189292.15 FAM150B - 6 | chr2 286418 301515 ENSG00000228643.1 AC079779.4 + 7 | chr2 305110 314367 ENSG00000235779.7 AC079779.5 - 8 | chr2 307682 309424 ENSG00000277997.1 RP11-356M6.1 + 9 | chr2 317911 342118 ENSG00000233684.2 AC079779.6 + 10 | chr2 388411 416885 ENSG00000236856.1 AC105393.1 + 11 | chr2 421056 422303 ENSG00000226277.1 AC105393.2 + 12 | chr2 490943 492655 ENSG00000223985.1 AC093326.1 - 13 | chr2 545804 546667 ENSG00000225942.1 AC093326.2 + 14 | chr2 558203 578145 ENSG00000233633.1 AC093326.3 + 15 | chr2 667334 677439 ENSG00000151353.14 TMEM18 - 16 | chr2 677185 697371 ENSG00000233296.1 AC092159.2 + 17 | chr2 687798 688348 ENSG00000280360.1 AC092159.1 + 18 | chr2 692082 693235 ENSG00000233970.1 AC092159.3 - 19 | chr2 724965 731224 ENSG00000227713.1 AC116609.1 - 20 | chr2 739587 740164 ENSG00000272342.1 RP13-539J13.1 - 21 | chr2 741976 749856 ENSG00000231173.1 AC116609.3 + 22 | chr2 742487 747767 ENSG00000223751.1 AC116609.2 + 23 | chr2 779839 868426 ENSG00000237667.5 LINC01115 - 24 | chr2 900215 905451 ENSG00000228799.5 AC113607.2 - 25 | chr2 910925 921124 ENSG00000234796.1 AC113607.3 - 26 | chr2 949626 950274 ENSG00000235688.2 AC116614.1 - 27 | chr2 950867 1367613 ENSG00000172554.11 SNTG2 + 28 | chr2 1059132 1068341 ENSG00000235403.1 AC114808.3 - 29 | chr2 1158309 1160424 ENSG00000236665.1 AC114808.2 - 30 | chr2 1341043 1346568 ENSG00000233553.1 AC108462.1 - 31 | chr2 1374222 1543711 ENSG00000115705.20 TPO + 32 | chr2 1546664 1620113 ENSG00000228613.1 AC144450.1 - 33 | chr2 1572553 1580311 ENSG00000231482.2 AC141930.2 - 34 | chr2 1620509 1625419 ENSG00000203635.2 AC144450.2 - 35 | chr2 1631886 1744852 ENSG00000130508.10 PXDN - 36 | chr2 1789112 2331260 ENSG00000186487.17 MYT1L - 37 | chr2 1824411 1828667 ENSG00000232057.1 AC093390.1 + 38 | chr2 2319231 2327110 ENSG00000225619.1 MYT1L-AS1 + 39 | chr2 2641988 2656630 ENSG00000234929.1 AC018685.1 - 40 | chr2 2729907 2730957 ENSG00000227364.1 AC018685.2 - 41 | chr2 2834263 2838391 ENSG00000237720.1 AC011995.1 - 42 | chr2 2870557 2871231 ENSG00000228391.1 AC011995.3 - 43 | chr2 2895047 3126026 ENSG00000234423.1 LINC01250 - 44 | chr2 3017218 3017330 ENSG00000263570.1 AC074264.1 - 45 | chr2 3131580 3145780 ENSG00000236760.1 AC019118.3 - 46 | chr2 3156755 3157797 ENSG00000226649.1 AC019118.4 + 47 | chr2 3188924 3377882 ENSG00000032389.12 TSSC1 - 48 | chr2 3298340 3301465 ENSG00000224885.1 TSSC1-IT1 - 49 | chr2 3379674 3485094 ENSG00000171853.15 TRAPPC12 + 50 | chr2 3481241 3482409 ENSG00000225234.1 TRAPPC12-AS1 - 51 | chr2 3496955 3497428 ENSG00000271868.1 RP11-1293J14.1 + 52 | chr2 3497360 3519736 ENSG00000182551.13 ADI1 - 53 | chr2 3519274 3523197 ENSG00000235078.1 AC142528.1 + 54 | chr2 3531812 3536873 ENSG00000242282.6 AC108488.4 - 55 | chr2 3531983 3547957 ENSG00000255767.1 RP13-512J5.1 - 56 | chr2 3544792 3558616 ENSG00000171865.9 RNASEH1 - 57 | chr2 3558491 3561745 ENSG00000234171.2 RNASEH1-AS1 + 58 | chr2 3575204 3580919 ENSG00000171863.12 RPS7 + 59 | chr2 3594831 3644644 ENSG00000118004.17 COLEC11 + 60 | chr2 3603396 3604242 ENSG00000237370.1 AC010907.2 - 61 | chr2 3617547 3617757 ENSG00000188765.7 TMSB4XP2 - 62 | chr2 3658194 3702671 ENSG00000151360.9 ALLC + 63 | chr2 3688020 3688981 ENSG00000232718.1 GAPDHP48 - 64 | chr2 3702584 3704153 ENSG00000224661.1 AC010907.5 - 65 | chr2 3703591 3847408 ENSG00000214866.7 DCDC2C + 66 | chr2 3844183 3847411 ENSG00000227363.1 AC019172.2 + 67 | chr2 3957654 3974070 ENSG00000237401.6 LINC01304 - 68 | chr2 4136643 4140731 ENSG00000229550.1 AC012445.1 - 69 | chr2 4228427 4228518 ENSG00000215960.2 AC068292.1 - 70 | chr2 4514203 4515056 ENSG00000231821.1 NPM1P48 - 71 | chr2 4628221 4656215 ENSG00000231532.5 LINC01249 - 72 | chr2 4827000 4827084 ENSG00000252238.1 SNORA31 - 73 | chr2 4945276 4945383 ENSG00000207192.1 RNU6-649P + 74 | chr2 5313739 5314134 ENSG00000228585.1 AC073143.1 - 75 | chr2 5549779 5556031 ENSG00000232835.1 AC107057.1 - 76 | chr2 5602504 5691488 ENSG00000224128.1 LINC01248 - 77 | chr2 5618326 5691118 ENSG00000230090.5 AC108025.2 - 78 | chr2 5692666 5701385 ENSG00000176887.6 SOX11 + 79 | chr2 5696219 5708095 ENSG00000242540.2 AC010729.1 + 80 | chr2 5726448 5730342 ENSG00000236106.1 AC010729.2 + 81 | chr2 5810640 5812596 ENSG00000237266.1 AC010729.3 - 82 | chr2 5932686 6001275 ENSG00000232044.6 LINC01105 + 83 | chr2 5974661 5974732 ENSG00000276733.1 MIR7158 + 84 | chr2 6312953 6325646 ENSG00000234275.1 AC017053.1 - 85 | chr2 6366009 6375422 ENSG00000227007.1 LINC01247 - 86 | chr2 6495876 6496798 ENSG00000231610.1 AC021021.1 - 87 | chr2 6496002 6503806 ENSG00000226488.1 AC021021.2 + 88 | chr2 6615388 6650535 ENSG00000236172.6 MIR7515HG - 89 | chr2 6728176 6770311 ENSG00000205837.7 LINC00487 - 90 | chr2 6828513 6840464 ENSG00000225964.5 NRIR - 91 | chr2 6840569 6866635 ENSG00000134326.11 CMPK2 - 92 | chr2 6855089 6855177 ENSG00000220999.3 AC017076.1 - 93 | chr2 6865805 6898239 ENSG00000134321.11 RSAD2 + 94 | chr2 6905723 6906301 ENSG00000271947.1 RP11-439M11.1 - 95 | chr2 6912276 6918709 ENSG00000228203.6 RNF144A-AS1 - 96 | chr2 6917391 7068286 ENSG00000151692.14 RNF144A + 97 | chr2 7062726 7077880 ENSG00000223884.5 AC019048.1 - 98 | chr2 7141226 7141544 ENSG00000223145.1 RN7SKP112 - 99 | chr2 7260870 7261504 ENSG00000272002.1 RP11-557L19.1 + 100 | chr2 7324747 7325062 ENSG00000213774.3 AC010904.1 - 101 | chr2 7421260 7450254 ENSG00000229727.6 AC013460.1 + 102 | chr2 7576840 7576971 ENSG00000221255.1 RNU6ATAC37P + 103 | chr2 7671603 7672246 ENSG00000230515.1 AC092580.3 - 104 | chr2 7725800 7730705 ENSG00000235576.1 AC092580.4 + 105 | chr2 7735644 7735783 ENSG00000232979.1 AC092580.2 - 106 | chr2 7736437 7737095 ENSG00000229405.1 AC092580.1 - 107 | chr2 7886769 7899655 ENSG00000226506.5 AC007463.2 - 108 | chr2 7922424 8278084 ENSG00000235665.5 LINC00298 - 109 | chr2 8007770 8383621 ENSG00000236790.5 LINC00299 - 110 | chr2 8139401 8143269 ENSG00000229740.1 U91324.1 + 111 | chr2 8543591 8575501 ENSG00000231435.1 AC011747.3 - 112 | chr2 8559832 8583792 ENSG00000236008.1 AC011747.4 - 113 | chr2 8600891 8622942 ENSG00000231083.1 AC011747.6 - 114 | chr2 8603081 8603359 ENSG00000225642.1 SNRPEP5 + 115 | chr2 8666635 8681863 ENSG00000235092.5 ID2-AS1 - 116 | chr2 8678844 8684453 ENSG00000115738.9 ID2 + 117 | chr2 8721133 8722686 ENSG00000260837.1 RP11-434B12.1 - 118 | chr2 8725277 8837630 ENSG00000134313.14 KIDINS220 - 119 | chr2 8852689 9003813 ENSG00000143797.11 MBOAT2 - 120 | chr2 9018292 9018899 ENSG00000230886.3 HMGB1P25 - 121 | chr2 9081394 9081727 ENSG00000223640.1 RPL30P3 - 122 | chr2 9103439 9105114 ENSG00000242136.1 RP11-734K21.2 + 123 | chr2 9106592 9109865 ENSG00000261104.1 RP11-734K21.5 + 124 | chr2 9115196 9116884 ENSG00000244310.1 RP11-734K21.3 + 125 | chr2 9143165 9146106 ENSG00000240980.1 RP11-734K21.4 + 126 | chr2 9206764 9405683 ENSG00000151693.9 ASAP2 + 127 | chr2 9271291 9271628 ENSG00000213772.3 EIF1P7 - 128 | chr2 9403474 9423547 ENSG00000119185.12 ITGB1BP1 - 129 | chr2 9423567 9473101 ENSG00000119203.13 CPSF3 + 130 | chr2 9473657 9496543 ENSG00000134330.18 IAH1 + 131 | chr2 9488485 9555792 ENSG00000151694.12 ADAM17 - 132 | chr2 9505444 9512412 ENSG00000239300.5 RP11-400L8.2 + 133 | chr2 9555898 9556775 ENSG00000271855.1 RP11-214N9.1 + 134 | chr2 9583971 9631014 ENSG00000134308.13 YWHAQ - 135 | chr2 9615266 9615373 ENSG00000207086.1 Y_RNA + 136 | chr2 9638771 9649439 ENSG00000240687.1 RP11-521D12.1 + 137 | chr2 9674022 9708413 ENSG00000244260.1 RP11-521D12.2 + 138 | chr2 9740642 9740783 ENSG00000200034.1 RNU4-73P - 139 | chr2 9746703 9746869 ENSG00000240960.1 RP11-521D12.4 + 140 | chr2 9757495 9770341 ENSG00000243491.1 RP11-521D12.5 - 141 | chr2 9843353 9934416 ENSG00000115750.16 TAF1B + 142 | chr2 9936359 9939590 ENSG00000269973.1 RP11-95D17.1 + 143 | chr2 9951692 10002277 ENSG00000134317.17 GRHL1 + 144 | -------------------------------------------------------------------------------- /test/2-GFA1/tiny.gfa: -------------------------------------------------------------------------------- 1 | H VN:Z:1.0 2 | S 5 C 3 | S 7 A 4 | S 12 ATAT 5 | S 8 G 6 | S 1 CAAATAAG 7 | S 4 T 8 | S 6 TTG 9 | S 15 CCAACTCTCTG 10 | S 2 A 11 | S 10 A 12 | S 9 AAATTTTCTGGAGTTCTAT 13 | S 11 T 14 | S 13 A 15 | S 14 T 16 | S 3 G 17 | P x 1+,3+,5+,6+,8+,9+,11+,12+,14+,15+ 8M,1M,1M,3M,1M,19M,1M,4M,1M,11M 18 | L 5 + 6 + 0M 19 | L 7 + 9 + 0M 20 | L 12 + 13 + 0M 21 | L 12 + 14 + 0M 22 | L 8 + 9 + 0M 23 | L 1 + 2 + 0M 24 | L 1 + 3 + 0M 25 | L 4 + 6 + 0M 26 | L 6 + 7 + 0M 27 | L 6 + 8 + 0M 28 | L 2 + 4 + 0M 29 | L 2 + 5 + 0M 30 | L 10 + 12 + 0M 31 | L 9 + 10 + 0M 32 | L 9 + 11 + 0M 33 | L 11 + 12 + 0M 34 | L 13 + 15 + 0M 35 | L 14 + 15 + 0M 36 | L 3 + 4 + 0M 37 | L 3 + 5 + 0M 38 | -------------------------------------------------------------------------------- /test/2-GFA1/tiny.gtf: -------------------------------------------------------------------------------- 1 | ##description: 2 | ##format: gtf 3 | x SOURCE gene 2 40 . + . gene_id "gene"; gene_type "protein_coding"; gene_name "GENE1"; 4 | x SOURCE transcript 2 40 . + . gene_id "gene"; gene_type "protein_coding"; gene_name "GENE1"; transcript_id "transcript1"; 5 | x SOURCE exon 2 10 . + . gene_id "gene"; gene_type "protein_coding"; gene_name "GENE1"; transcript_id "transcript1"; exon_number 1; 6 | x SOURCE exon 20 25 . + . gene_id "gene"; gene_type "protein_coding"; gene_name "GENE1"; transcript_id "transcript1"; exon_number 2; 7 | x SOURCE exon 29 40 . + . gene_id "gene"; gene_type "protein_coding"; gene_name "GENE1"; transcript_id "transcript1"; exon_number 3; 8 | x SOURCE transcript 2 40 . + . gene_id "gene"; gene_type "protein_coding"; gene_name "GENE1"; transcript_id "transcript2"; 9 | x SOURCE exon 2 10 . + . gene_id "gene"; gene_type "protein_coding"; gene_name "GENE1"; transcript_id "transcript2"; exon_number 1; 10 | x SOURCE exon 29 40 . + . gene_id "gene"; gene_type "protein_coding"; gene_name "GENE1"; transcript_id "transcript2"; exon_number 2; 11 | -------------------------------------------------------------------------------- /test/README.md: -------------------------------------------------------------------------------- 1 | ## Welcome to the test data folder 2 | 3 | In this folder, we have provided some test files for you to quickly get familiar with PanGraphViewer 4 | 5 | Here are some brief descriptions for the folders 6 | 7 | * 1-rGFA contains a DNA sequence segment from chr02 of human genome. It was constructed using hg19, hg38 and the T2T assemblies with [minigraph](https://github.com/lh3/minigraph). 8 | * 2-GFA1 contains a GFA_v1 file adopted from [VG](https://github.com/vgteam/vg) 9 | * 3-VCF contains a DNA sequence segment from chr01 of a species. The variants are found in one test sample. 10 | 11 | --- 12 | Enjoy the use of panGraphViewer! 13 | -------------------------------------------------------------------------------- /thirdPartyTools/README.md: -------------------------------------------------------------------------------- 1 | **Note:** 2 | 3 | * The SAMtools package here is the windows version 4 | 5 | * Please **DO NOT** change the folder name when using it. 6 | -------------------------------------------------------------------------------- /thirdPartyTools/SAMtools/ace2sam.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/thirdPartyTools/SAMtools/ace2sam.exe -------------------------------------------------------------------------------- /thirdPartyTools/SAMtools/bcftools.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/thirdPartyTools/SAMtools/bcftools.exe -------------------------------------------------------------------------------- /thirdPartyTools/SAMtools/bgzip.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/thirdPartyTools/SAMtools/bgzip.exe -------------------------------------------------------------------------------- /thirdPartyTools/SAMtools/blast2sam.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | # 3 | # Copyright (C) 2009 Genome Research Ltd. 4 | # Portions copyright (C) 2014 Ontario Institute for Cancer Research. 5 | # 6 | # Author: Heng Li 7 | # 8 | # Permission is hereby granted, free of charge, to any person obtaining a copy 9 | # of this software and associated documentation files (the "Software"), to deal 10 | # in the Software without restriction, including without limitation the rights 11 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | # copies of the Software, and to permit persons to whom the Software is 13 | # furnished to do so, subject to the following conditions: 14 | # 15 | # The above copyright notice and this permission notice shall be included in 16 | # all copies or substantial portions of the Software. 17 | # 18 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21 | # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | # DEALINGS IN THE SOFTWARE. 25 | 26 | use strict; 27 | use warnings; 28 | use Getopt::Std; 29 | 30 | my $dummy_score; 31 | 32 | &blast2sam; 33 | 34 | sub blast2sam { 35 | my %opts = (); 36 | getopts('sd', \%opts); 37 | die("Usage: blast2sam.pl \n") if (-t STDIN && @ARGV == 0); 38 | my ($qlen, $slen, $q, $s, $qbeg, $qend, @sam, @cigar, @cmaux, $show_seq); 39 | $show_seq = defined($opts{s}); 40 | $dummy_score = defined($opts{d}); 41 | @sam = (); @sam[0,4,6..8,10] = ('', 255, '*', 0, 0, '*'); 42 | while (<>) { 43 | if (@cigar && (/^Query=/ || /Score =.*bits.*Expect/ || /^>\S+/)) { # print 44 | &blast_print_sam(\@sam, \@cigar, \@cmaux, $qlen - $qend); 45 | @cigar = (); 46 | } 47 | if (/^Query=\s(\S+)/) { 48 | $sam[2] = undef; 49 | $sam[0] = $1; 50 | my $next_line = <>; 51 | if ($next_line=~/^(\S+)$/) { 52 | $sam[0] .= $1; 53 | } 54 | } elsif (/(\S+)\s+total letters/) { 55 | $qlen = $1; $qlen =~ s/,//g; 56 | } elsif (/^>(\S+)/) { 57 | $sam[2] = $1; 58 | } elsif (/Length\s*=\s*(\d+)/) { 59 | $slen = $1; 60 | } elsif (/Score\s+=\s+(\S+) bits.+Expect(\(\d+\))?\s+=\s+(\S+)/) { # the start of an alignment block 61 | my ($as, $ev) = (int($1 + .499), $3); 62 | $ev = "1$ev" if ($ev =~ /^e/); 63 | @sam[1,3,9,11,12] = (0, 0, '', "AS:i:$as", "EV:Z:$ev"); 64 | @cigar = (); $qbeg = 0; 65 | @cmaux = (0, 0, 0, ''); 66 | } elsif (/Strand=(\S+)\/(\S+)/) { 67 | $sam[1] |= 0x10 if ($2 eq 'Minus'); 68 | } elsif (/Query\s+(\d+)\s*(\S+)\s+(\d+)/) { 69 | $q = $2; 70 | unless ($qbeg) { 71 | $qbeg = $1; 72 | push(@cigar, ($1-1) . "H") if ($1 > 1); 73 | } 74 | $qend = $3; 75 | if ($show_seq) { 76 | my $x = $q; 77 | $x =~ s/-//g; $sam[9] .= $x; 78 | } 79 | } elsif (/Sbjct\:*\s+(\d+)\s*(\S+)\s+(\d+)/) { 80 | $s = $2; 81 | if ($sam[1] & 0x10) { 82 | $sam[3] = $3; 83 | } else { 84 | $sam[3] = $1 unless ($sam[3]); 85 | } 86 | &aln2cm(\@cigar, \$q, \$s, \@cmaux); 87 | } 88 | } 89 | if ($sam[2]) { 90 | &blast_print_sam(\@sam, \@cigar, \@cmaux, $qlen - $qend); # the last argument may be a problem 91 | } 92 | } 93 | 94 | sub blast_print_sam { 95 | my ($sam, $cigar, $cmaux, $qrest) = @_; 96 | push(@$cigar, $cmaux->[1] . substr("MDI", $cmaux->[0], 1)); 97 | #push(@$cigar, $qrest . 'H') if ($qrest); 98 | if ($sam->[1] & 0x10) { 99 | @$cigar = reverse(@$cigar); 100 | $sam->[9] = reverse($sam->[9]); 101 | $sam->[9] =~ tr/atgcrymkswATGCRYMKSW/tacgyrkmswTACGYRKMSW/; 102 | } 103 | if ($sam->[9]) { 104 | if ($dummy_score) { 105 | $sam->[10] = ""; 106 | map {$sam->[10].="I"} (1..length($sam->[9])); 107 | } 108 | } else { 109 | $sam->[9] = '*'; 110 | } 111 | $sam->[5] = join('', @$cigar); 112 | print join("\t", @$sam), "\n"; 113 | } 114 | 115 | sub aln2cm { 116 | my ($cigar, $q, $s, $cmaux) = @_; 117 | my $l = length($$q); 118 | for (my $i = 0; $i < $l; ++$i) { 119 | my $op; 120 | # set $op 121 | if (substr($$q, $i, 1) eq '-') { $op = 1; } 122 | elsif (substr($$s, $i, 1) eq '-') { $op = 2; } 123 | else { $op = 0; } 124 | # for CIGAR 125 | if ($cmaux->[0] == $op) { 126 | ++$cmaux->[1]; 127 | } else { 128 | push(@$cigar, $cmaux->[1] . substr("MDI", $cmaux->[0], 1)); 129 | $cmaux->[0] = $op; $cmaux->[1] = 1; 130 | } 131 | } 132 | } 133 | 134 | =head2 SYNOPSIS 135 | 136 | blast2sam.pl is a script for parsing output of NCBI's blastn output (default format) into sam format 137 | 138 | =over 139 | 140 | blast2sam.pl out.blast > out.blast.sam 141 | 142 | =back 143 | 144 | =head2 OPTIONS 145 | 146 | The script has some (hopefully) useful options for tweaking the output sam 147 | 148 | B<-s> Print out sequence of the query. 149 | 150 | Note that the current implementation prints out 151 | the sequence of aligned query which may be trimmed or otherwise 152 | different from the sequence of raw read in the input fastq. The CIGAR string 153 | is also calculated for this query sequence, not the original read 154 | 155 | B<-d> Dummy base quality score will be printed as field #11 in sam file. 156 | 157 | Blast output does not have base quality information for a read, so this option 158 | allows to have some fake value instead, may help when using sam file with some 159 | programs. Hardcoded to be a string of 'I' that corresponds to Phred score 40 160 | according to Sanger format. 161 | 162 | Using both options: 163 | 164 | =over 165 | 166 | blast2sam.pl -sd out.blast > out.blast.sam 167 | 168 | =back 169 | 170 | Note that there is no header generated, so you will need to run 171 | 172 | =over 173 | 174 | samtools -hT your_ref.fasta your_file.sam > your_file_with_header.sam 175 | 176 | =back 177 | 178 | =cut 179 | -------------------------------------------------------------------------------- /thirdPartyTools/SAMtools/bowtie2sam.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | # 3 | # Copyright (C) 2009 Genome Research Ltd. 4 | # 5 | # Author: Heng Li 6 | # 7 | # Permission is hereby granted, free of charge, to any person obtaining a copy 8 | # of this software and associated documentation files (the "Software"), to deal 9 | # in the Software without restriction, including without limitation the rights 10 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | # copies of the Software, and to permit persons to whom the Software is 12 | # furnished to do so, subject to the following conditions: 13 | # 14 | # The above copyright notice and this permission notice shall be included in 15 | # all copies or substantial portions of the Software. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20 | # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | # DEALINGS IN THE SOFTWARE. 24 | 25 | use strict; 26 | use warnings; 27 | use Getopt::Std; 28 | 29 | &bowtie2sam; 30 | exit; 31 | 32 | sub bowtie2sam { 33 | my %opts = (); 34 | die("Usage: bowtie2sam.pl \n") if (@ARGV == 0 && -t STDIN); 35 | # core loop 36 | my (@s, $last, @staging, $k, $best_s, $subbest_s, $best_k); 37 | $last = ''; 38 | while (<>) { 39 | my ($name, $nm) = &bowtie2sam_aux($_, \@s); # read_name, number of mismatches 40 | if ($name eq $last) { 41 | # I do not know whether the multiple hits are ordered on the 42 | # number of mismatches. I assume they are not and so I have to 43 | # keep all these multiple hits in memory. 44 | @{$staging[$k]} = @s; 45 | if ($best_s > $nm) { 46 | $subbest_s = $best_s; 47 | $best_s = $nm; 48 | $best_k = $k; 49 | } elsif ($subbest_s > $nm) { 50 | $subbest_s = $nm; 51 | } 52 | ++$k; 53 | } else { 54 | if ($last) { 55 | if ($best_s == $subbest_s) { 56 | $staging[$best_k][4] = 0; 57 | } elsif ($subbest_s - $best_s == 1) { 58 | $staging[$best_k][4] = 15 if ($staging[$best_k][4] > 15); 59 | } 60 | print join("\t", @{$staging[$best_k]}), "\n"; 61 | } 62 | $k = 1; $best_s = $nm; $subbest_s = 1000; $best_k = 0; 63 | @{$staging[0]} = @s; 64 | $last = $name; 65 | } 66 | } 67 | print join("\t", @{$staging[$best_k]}), "\n" if ($best_k >= 0); 68 | } 69 | 70 | sub bowtie2sam_aux { 71 | my ($line, $s) = @_; 72 | chomp($line); 73 | my @t = split("\t", $line); 74 | my $ret; 75 | @$s = (); 76 | # read name 77 | $s->[0] = $ret = $t[0]; 78 | $s->[0] =~ s/\/[12]$//g; 79 | # initial flag (will be updated later) 80 | $s->[1] = 0; 81 | # read & quality 82 | $s->[9] = $t[4]; $s->[10] = $t[5]; 83 | # cigar 84 | $s->[5] = length($s->[9]) . "M"; 85 | # coor 86 | $s->[2] = $t[2]; $s->[3] = $t[3] + 1; 87 | $s->[1] |= 0x10 if ($t[1] eq '-'); 88 | # mapQ 89 | $s->[4] = $t[6] == 0? 25 : 0; 90 | # mate coordinate 91 | $s->[6] = '*'; $s->[7] = $s->[8] = 0; 92 | # aux 93 | my $nm = @t - 7; 94 | push(@$s, "NM:i:" . (@t-7)); 95 | push(@$s, "X$nm:i:" . ($t[6]+1)); 96 | my $md = ''; 97 | if ($t[7]) { 98 | $_ = $t[7]; 99 | my $a = 0; 100 | while (/(\d+):[ACGTN]>([ACGTN])/gi) { 101 | my ($y, $z) = ($1, $2); 102 | $md .= (int($y)-$a) . $z; 103 | $a += $y - $a + 1; 104 | } 105 | $md .= length($s->[9]) - $a; 106 | } else { 107 | $md = length($s->[9]); 108 | } 109 | push(@$s, "MD:Z:$md"); 110 | return ($ret, $nm); 111 | } 112 | -------------------------------------------------------------------------------- /thirdPartyTools/SAMtools/htsfile.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/thirdPartyTools/SAMtools/htsfile.exe -------------------------------------------------------------------------------- /thirdPartyTools/SAMtools/interpolate_sam.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | # 3 | # Copyright (C) 2009 Genome Research Ltd. 4 | # 5 | # Author: Heng Li 6 | # 7 | # Permission is hereby granted, free of charge, to any person obtaining a copy 8 | # of this software and associated documentation files (the "Software"), to deal 9 | # in the Software without restriction, including without limitation the rights 10 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | # copies of the Software, and to permit persons to whom the Software is 12 | # furnished to do so, subject to the following conditions: 13 | # 14 | # The above copyright notice and this permission notice shall be included in 15 | # all copies or substantial portions of the Software. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20 | # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | # DEALINGS IN THE SOFTWARE. 24 | 25 | use strict; 26 | use warnings; 27 | 28 | ###Builds interpolated pileup from SAM file 29 | ##@description counts bases between paired ends and piles up single end reads. 30 | ##@output, uses a #header for the RNAME and then the number of reads per base 31 | ##@author sm8@sanger.ac.uk, Stephen B. Montgomery 32 | 33 | ##@caveats 34 | ##Requires RNAME to have format as per example 35 | ## chromosome:NCBI36:18:1:76117153:1 36 | ## supercontig::NT_113883:1:137703:1 37 | ## clone::AC138827.3:1:149397:1 38 | ##Expects simple CIGAR characters, M, I and D 39 | ##Expects SAM file to be sorted. 40 | ##Expects 0x0010 to mark second read in PE file (as has been the observed case from MAQ output) (important for line 77) 41 | 42 | ##Verify and read in SAM file 43 | my $sam_file = $ARGV[0]; 44 | if(!defined($sam_file)) { die("No sam file defined on arg 1"); } 45 | unless(-f $sam_file) { die("Sam file does not exist: $sam_file"); } 46 | open(SAM, $sam_file) || die("Cannot open sam file"); 47 | 48 | ##Globals 49 | my $current_location = ""; ##Current RNAME being processed 50 | my $current_size = 0; ##Size of sequence region being processed 51 | my $current_position = 1; ##Current base being processed 52 | my $open = 0; ##Number of open reads (PE reads that have not been closed) 53 | my %close = (); ##Hash of closing positions, when the current_position gets to this position it subtracts the 54 | ##contained value from those open and deletes the indexed position from the hash 55 | 56 | while (my $line = ) { 57 | my @tokens = split /\t/, $line; 58 | 59 | if ($current_location ne $tokens[2]) { ##Start a new sequence region 60 | for (my $i = $current_position; $i <= $current_size; $i++) { ##Close the previous sequence region 61 | if (defined($close{$i})) { 62 | $open = $open - $close{$i}; 63 | delete $close{$i}; 64 | } 65 | print $open . "\n"; 66 | } 67 | if ($current_location ne "") { 68 | print "\n"; 69 | } 70 | 71 | ##Initiate a new sequence region 72 | my @location_tokens = split /:/, $tokens[2]; 73 | $current_position = 1; 74 | $current_location = $tokens[2]; 75 | $current_size = $location_tokens[4]; 76 | $open = 0; 77 | %close = (); 78 | print "#" . $tokens[2] . "\n"; 79 | 80 | ##Print pileup to just before the first read (will be 0) 81 | for (my $current_position = 1; $current_position < $tokens[3]; $current_position++) { 82 | print $open . "\n"; 83 | } 84 | $current_position = $tokens[3]; 85 | 86 | } else { ##Sequence region already open 87 | if ($tokens[3] > $current_position) { ##If the new read's position is greater than the current position 88 | ##cycle through to catch up to the current position 89 | for (my $i = $current_position; $i < $tokens[3]; $i++) { 90 | if (defined($close{$i})) { 91 | $open = $open - $close{$i}; 92 | delete $close{$i}; 93 | } 94 | print $open . "\n"; 95 | } 96 | $current_position = $tokens[3]; 97 | } 98 | } 99 | $open++; ##Increment the number of open reads 100 | 101 | if (($tokens[1] & 0x0080 || $tokens[1] & 0x0040) && $tokens[1] & 0x0010 && $tokens[1] & 0x0002) { ##if second read of mate pair, add close condition 102 | $open--; 103 | my $parsed_cig = &parseCigar($tokens[5]); 104 | my $seq_region_end = $tokens[3] + $parsed_cig->{'M'} + $parsed_cig->{'D'} - 1; 105 | if (!defined($close{$seq_region_end + 1})) { $close{$seq_region_end + 1} = 0; } 106 | $close{$seq_region_end + 1} = $close{$seq_region_end + 1} + 1; 107 | } elsif (!($tokens[1] & 0x0001) || !($tokens[1] & 0x0002)) { ##if unpaired, add close condition 108 | my $parsed_cig = &parseCigar($tokens[5]); 109 | my $seq_region_end = $tokens[3] + $parsed_cig->{'M'} + $parsed_cig->{'D'} - 1; 110 | if (!defined($close{$seq_region_end + 1})) { $close{$seq_region_end + 1} = 0; } 111 | $close{$seq_region_end + 1} = $close{$seq_region_end + 1} + 1; 112 | } else { 113 | #do nothing 114 | } 115 | } 116 | for (my $i = $current_position; $i <= $current_size; $i++) { ##Finish up the last sequence region 117 | if (defined($close{$i})) { 118 | $open = $open - $close{$i}; 119 | delete $close{$i}; 120 | } 121 | print $open . "\n"; 122 | } 123 | print "\n"; 124 | close(SAM); 125 | exit(0); 126 | 127 | ##reads and tokenizes simple cigarline 128 | sub parseCigar() { 129 | my $cigar_line = shift; 130 | $cigar_line =~ s/([0-9]*[A-Z]{1})/$1\t/g; 131 | my @cigar_tokens = split /\t/, $cigar_line; 132 | my %parsed = ('M' => 0, 133 | 'I' => 0, 134 | 'D' => 0); 135 | my @events = (); 136 | for(my $i = 0; $i < scalar(@cigar_tokens); $i++) { 137 | if ($cigar_tokens[$i] =~ /([0-9]+)([A-Z]{1})/g) { 138 | if (!defined($parsed{$2})) { $parsed{$2} = 0; } 139 | my $nt = $2; 140 | if ($nt ne "M" && $nt ne "D" && $nt ne "I") { $nt = "M"; } 141 | $parsed{$nt} += $1; 142 | my %event_el = ("t" => $nt, 143 | "n" => $1); 144 | push @events, \%event_el; 145 | } 146 | } 147 | $parsed{'events'} = \@events; 148 | return \%parsed; 149 | } 150 | -------------------------------------------------------------------------------- /thirdPartyTools/SAMtools/maq2sam-long.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/thirdPartyTools/SAMtools/maq2sam-long.exe -------------------------------------------------------------------------------- /thirdPartyTools/SAMtools/maq2sam-short.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/thirdPartyTools/SAMtools/maq2sam-short.exe -------------------------------------------------------------------------------- /thirdPartyTools/SAMtools/md5fa.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/thirdPartyTools/SAMtools/md5fa.exe -------------------------------------------------------------------------------- /thirdPartyTools/SAMtools/md5sum-lite.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/thirdPartyTools/SAMtools/md5sum-lite.exe -------------------------------------------------------------------------------- /thirdPartyTools/SAMtools/msys-2.0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/thirdPartyTools/SAMtools/msys-2.0.dll -------------------------------------------------------------------------------- /thirdPartyTools/SAMtools/msys-ncursesw6.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/thirdPartyTools/SAMtools/msys-ncursesw6.dll -------------------------------------------------------------------------------- /thirdPartyTools/SAMtools/msys-z.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/thirdPartyTools/SAMtools/msys-z.dll -------------------------------------------------------------------------------- /thirdPartyTools/SAMtools/novo2sam.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | 3 | # Contact: lh3 4 | # Version: 0.1.3 5 | 6 | #Modified by Zayed Albertyn(zayed.albertyn@gmail.com) & Colin Hercus(colin@novocraft.com) 7 | 8 | use strict; 9 | use warnings; 10 | use Data::Dumper; 11 | use Getopt::Std; 12 | 13 | &novo2sam; 14 | exit; 15 | 16 | sub mating { 17 | my ($s1, $s2) = @_; 18 | my $isize = 0; 19 | if ($s1->[2] ne '*' && $s1->[2] eq $s2->[2]) { # then calculate $isize 20 | my $x1 = ($s1->[1] & 0x10)? $s1->[3] + length($s1->[9]) : $s1->[3]; 21 | my $x2 = ($s2->[1] & 0x10)? $s2->[3] + length($s2->[9]) : $s2->[3]; 22 | $isize = $x2 - $x1; 23 | } 24 | # update mate coordinate 25 | if ($s2->[2] ne '*') { 26 | @$s1[6..8] = (($s2->[2] eq $s1->[2])? "=" : $s2->[2], $s2->[3], $isize); 27 | $s1->[1] |= 0x20 if ($s2->[1] & 0x10); 28 | } else { 29 | $s1->[1] |= 0x8; 30 | } 31 | if ($s1->[2] ne '*') { 32 | @$s2[6..8] = (($s1->[2] eq $s2->[2])? "=" : $s1->[2], $s1->[3], -$isize); 33 | $s2->[1] |= 0x20 if ($s1->[1] & 0x10); 34 | } else { 35 | $s2->[1] |= 0x8; 36 | } 37 | } 38 | 39 | sub novo2sam { 40 | my %opts = (); 41 | getopts("p", \%opts); 42 | die("Usage: novo2sam.pl [-p] \n") if (@ARGV == 0); 43 | my $is_paired = defined($opts{p}); 44 | # core loop 45 | my @s1 = (); 46 | my @s2 = (); 47 | my ($s_last, $s_curr) = (\@s1, \@s2); 48 | while (<>) { 49 | next if (/^#/); 50 | next if (/(QC|NM)\s*$/ || /(R\s+\d+)\s*$/); 51 | &novo2sam_aux($_, $s_curr, $is_paired); 52 | if (@$s_last != 0 && $s_last->[0] eq $s_curr->[0]) { 53 | &mating($s_last, $s_curr); 54 | print join("\t", @$s_last), "\n"; 55 | print join("\t", @$s_curr), "\n"; 56 | @$s_last = (); @$s_curr = (); 57 | } else { 58 | print join("\t", @$s_last), "\n" if (@$s_last != 0); 59 | my $s = $s_last; $s_last = $s_curr; $s_curr = $s; 60 | } 61 | } 62 | print join("\t", @$s_last), "\n" if (@$s_last != 0); 63 | } 64 | 65 | sub novo2sam_aux { 66 | my ($line, $s, $is_paired) = @_; 67 | 68 | chomp($line); 69 | my @t = split(/\s+/, $line); 70 | my @variations = @t[13 .. $#t]; 71 | @$s = (); 72 | return if ($t[4] ne 'U'); 73 | my $len = length($t[2]); 74 | # read name 75 | $s->[0] = substr($t[0], 1); 76 | $s->[0] =~ s/\/[12]$//g; 77 | # initial flag (will be updated later) 78 | $s->[1] = 0; 79 | $s->[1] |= 1 | 1<<($t[1] eq 'L'? 6 : 7); 80 | $s->[1] |= 2 if ($t[10] eq '.'); 81 | # read & quality 82 | if ($t[9] eq 'R') { 83 | $s->[9] = reverse($t[2]); 84 | $s->[10] = reverse($t[3]); 85 | $s->[9] =~ tr/ACGTRYMKWSNacgtrymkwsn/TGCAYRKMWSNtgcayrkmwsn/; 86 | } else { 87 | $s->[9] = $t[2]; $s->[10] = $t[3]; 88 | } 89 | # cigar 90 | my $cigarstring =""; 91 | if (scalar @variations ==0 ) { 92 | $s->[5] = $len . "M"; # IMPORTANT: this cigar is not correct for gapped alignment 93 | } else { 94 | #convert to correct CIGAR 95 | my $tmpstr = join" ",@variations ; 96 | if ( $tmpstr=~ /\+|\-/ ) { 97 | $cigarstring = cigar_method($line,\@variations,$len); 98 | $s->[5]=$cigarstring; 99 | } else { 100 | $s->[5]=$len. "M"; 101 | } 102 | } 103 | 104 | # coor 105 | $s->[2] = substr($t[7], 1); $s->[3] = $t[8]; 106 | $s->[1] |= 0x10 if ($t[9] eq 'R'); 107 | # mapQ 108 | $s->[4] = $t[5] > $t[6]? $t[5] : $t[6]; 109 | # mate coordinate 110 | $s->[6] = '*'; $s->[7] = $s->[8] = 0; 111 | # aux 112 | push(@$s, "NM:i:".(@t-13)); 113 | my $md = ''; 114 | $md = mdtag($md,$line,\@variations,$len); 115 | push(@$s, "MD:Z:$md"); 116 | 117 | } 118 | 119 | sub mdtag { 120 | my $oldmd = shift; 121 | my $line = shift; 122 | my $ref =shift; 123 | my $rdlen = shift; 124 | my @variations = @$ref; 125 | my $string=""; 126 | my $mdtag=""; 127 | my $t=1; 128 | my $q=1; 129 | my $deleteflag=0; 130 | my $len =0; 131 | foreach $string (@variations) { 132 | my ($indeltype,$insert) = indeltype($string); 133 | if ($indeltype eq "+") { 134 | $len = length ($insert); 135 | $q+=$len; 136 | next; 137 | } 138 | my $pos = $1 if $string =~ /^(\d+)/; 139 | $len = $pos - $t; 140 | if ($len !=0 || ($deleteflag eq 1 && $indeltype eq ">")) { 141 | $mdtag.=$len; 142 | } 143 | $t+=$len; 144 | $q+=$len; 145 | if ($indeltype eq ">") { 146 | $mdtag.=$insert; 147 | $deleteflag=0; 148 | $t+=1; 149 | $q+=1; 150 | } 151 | if ($indeltype eq "-") { 152 | my $deletedbase = $2 if $string =~ /(\d+)\-([A-Za-z]+)/; 153 | if ($deleteflag == 0 ) { 154 | $mdtag.="^"; 155 | } 156 | $mdtag.=$deletedbase; 157 | $deleteflag=1; 158 | $t+=1; 159 | } 160 | } 161 | $len = $rdlen - $q + 1; 162 | if ($len > 0) { 163 | $mdtag.="$len"; 164 | } 165 | # print "In:$line\n"; 166 | # print "MD: OLD => NEW\nMD: $oldmd => $mdtag\n\n"; 167 | 168 | return $mdtag; 169 | } 170 | 171 | sub indeltype { 172 | my $string = shift; 173 | my $insert=""; 174 | my $indeltype; 175 | if ($string =~ /([A-Za-z]+)\>/) { 176 | $indeltype=">"; 177 | $insert=$1; 178 | } elsif ($string =~ /\-/) { 179 | $indeltype="-"; 180 | } elsif ($string =~ /\+([A-Za-z]+)/) { 181 | $indeltype="+"; 182 | $insert=$1; 183 | } 184 | return ($indeltype,$insert); 185 | 186 | } 187 | 188 | 189 | sub cigar_method { 190 | my $line = shift; 191 | my $ref =shift; 192 | my $rdlen = shift; 193 | my @variations = @$ref; 194 | my $string=""; 195 | my $type=""; 196 | my $t =1; 197 | my $q=1; 198 | my $indeltype=""; 199 | my $cigar= ""; 200 | my $insert = ""; 201 | my $len=0; 202 | my @cig=(); 203 | foreach $string (@variations) { 204 | next if $string =~ />/; 205 | my $pos = $1 if $string =~ /^(\d+)/; 206 | 207 | if ($string =~ /\+([A-Za-z]+)/) { 208 | $indeltype="+"; 209 | $insert = $1; 210 | }elsif ($string =~ /\-([A-Za-z]+)/) { 211 | $indeltype="-"; 212 | $insert = $1; 213 | } 214 | #print "$pos $indeltype $insert $t $q\n"; 215 | $len = $pos - $t; 216 | if ( $len > 0) { 217 | $cigar.=$len."M"; 218 | push(@cig,$len."M"); 219 | } 220 | $t+=$len; 221 | $q+=$len; 222 | 223 | if ($indeltype eq "-") { 224 | $cigar.="D"; 225 | push(@cig,"D"); 226 | $t++; 227 | } 228 | if ($indeltype eq "+") { 229 | $len = length ($insert); 230 | if ($len == 1) { 231 | $cigar.="I"; 232 | push(@cig,"I"); 233 | } 234 | if ($len > 1) { 235 | $cigar.=$len."I"; 236 | push(@cig,$len."I") 237 | } 238 | $q+=$len; 239 | } 240 | $insert=""; 241 | } 242 | $len= $rdlen - $q + 1; 243 | if ($len > 0) { 244 | $cigar.=$len."M"; 245 | push(@cig,$len."M"); 246 | } 247 | 248 | $cigar = newcigar($cigar,'D'); 249 | $cigar = newcigar($cigar,'I'); 250 | 251 | #print "$line\n"; 252 | #print "c CIGAR:\t$cigar\n\n"; 253 | return $cigar; 254 | 255 | } 256 | 257 | 258 | 259 | sub newcigar { 260 | my $cigar = shift; 261 | my $char = shift; 262 | my $new = ""; 263 | my $copy = $cigar; 264 | #print "$cigar\n"; 265 | $copy =~ s/^($char+)/$1;/g; 266 | #print "$copy\n"; 267 | $copy =~ s/([^0-9$char])($char+)/$1;$2;/g; 268 | #print "$copy\n"; 269 | my @parts = split(/;/,$copy); 270 | my $el=""; 271 | foreach $el (@parts) { 272 | #print "$el\n"; 273 | if ($el =~ /^$char+$/) { 274 | $new.=length($el).$char; 275 | }else { 276 | $new.=$el; 277 | } 278 | 279 | } 280 | return $new; 281 | } 282 | -------------------------------------------------------------------------------- /thirdPartyTools/SAMtools/psl2sam.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | # 3 | # Copyright (C) 2009 Genome Research Ltd. 4 | # 5 | # Author: Heng Li 6 | # 7 | # Permission is hereby granted, free of charge, to any person obtaining a copy 8 | # of this software and associated documentation files (the "Software"), to deal 9 | # in the Software without restriction, including without limitation the rights 10 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | # copies of the Software, and to permit persons to whom the Software is 12 | # furnished to do so, subject to the following conditions: 13 | # 14 | # The above copyright notice and this permission notice shall be included in 15 | # all copies or substantial portions of the Software. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20 | # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | # DEALINGS IN THE SOFTWARE. 24 | 25 | # This script calculates a score using the BLAST scoring 26 | # system. However, I am not sure how to count gap opens and gap 27 | # extensions. It seems to me that column 5-8 are not what I am 28 | # after. This script counts gaps from the last three columns. It does 29 | # not generate reference skip (N) in the CIGAR as it is not easy to 30 | # directly tell which gaps correspond to introns. 31 | 32 | use strict; 33 | use warnings; 34 | use Getopt::Std; 35 | 36 | my %opts = (a=>1, b=>3, q=>5, r=>2); 37 | getopts('a:b:q:r:', \%opts); 38 | die("Usage: psl2sam.pl [-a $opts{a}] [-b $opts{b}] [-q $opts{q}] [-r $opts{r}] \n") if (@ARGV == 0 && -t STDIN); 39 | 40 | my @stack; 41 | my $last = ''; 42 | my ($a, $b, $q, $r) = ($opts{a}, $opts{b}, $opts{q}, $opts{r}); 43 | while (<>) { 44 | next unless (/^\d/); 45 | my @t = split; 46 | my @s; 47 | my $cigar = ''; 48 | if ($t[8] eq '-') { 49 | my $tmp = $t[11]; 50 | $t[11] = $t[10] - $t[12]; 51 | $t[12] = $t[10] - $tmp; 52 | } 53 | @s[0..4] = ($t[9], (($t[8] eq '+')? 0 : 16), $t[13], $t[15]+1, 0); 54 | @s[6..10] = ('*', 0, 0, '*', '*'); 55 | $cigar .= $t[11].'H' if ($t[11]); # 5'-end clipping 56 | my @x = split(',', $t[18]); 57 | my @y = split(',', $t[19]); 58 | my @z = split(',', $t[20]); 59 | my ($y0, $z0) = ($y[0], $z[0]); 60 | my ($gap_open, $gap_ext) = (0, 0, 0); 61 | for (1 .. $t[17]-1) { 62 | my $ly = $y[$_] - $y[$_-1] - $x[$_-1]; 63 | my $lz = $z[$_] - $z[$_-1] - $x[$_-1]; 64 | if ($ly < $lz) { # del: the reference gap is longer 65 | ++$gap_open; 66 | $gap_ext += $lz - $ly; 67 | $cigar .= ($y[$_] - $y0) . 'M'; 68 | $cigar .= ($lz - $ly) . 'D'; 69 | ($y0, $z0) = ($y[$_], $z[$_]); 70 | } elsif ($lz < $ly) { # ins: the query gap is longer 71 | ++$gap_open; 72 | $gap_ext += $ly - $lz; 73 | $cigar .= ($z[$_] - $z0) . 'M'; 74 | $cigar .= ($ly - $lz) . 'I'; 75 | ($y0, $z0) = ($y[$_], $z[$_]); 76 | } 77 | } 78 | $cigar .= ($t[12] - $y0) . 'M'; 79 | $cigar .= ($t[10] - $t[12]).'H' if ($t[10] != $t[12]); # 3'-end clipping 80 | $s[5] = $cigar; 81 | my $score = $a * $t[0] - $b * $t[1] - $q * $gap_open - $r * $gap_ext; 82 | $score = 0 if ($score < 0); 83 | $s[11] = "AS:i:$score"; 84 | print join("\t", @s), "\n"; 85 | } 86 | -------------------------------------------------------------------------------- /thirdPartyTools/SAMtools/samtools.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/thirdPartyTools/SAMtools/samtools.exe -------------------------------------------------------------------------------- /thirdPartyTools/SAMtools/soap2sam.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | # 3 | # Copyright (C) 2009 Genome Research Ltd. 4 | # 5 | # Author: Heng Li 6 | # 7 | # Permission is hereby granted, free of charge, to any person obtaining a copy 8 | # of this software and associated documentation files (the "Software"), to deal 9 | # in the Software without restriction, including without limitation the rights 10 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | # copies of the Software, and to permit persons to whom the Software is 12 | # furnished to do so, subject to the following conditions: 13 | # 14 | # The above copyright notice and this permission notice shall be included in 15 | # all copies or substantial portions of the Software. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20 | # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | # DEALINGS IN THE SOFTWARE. 24 | 25 | use strict; 26 | use warnings; 27 | use Getopt::Std; 28 | 29 | &soap2sam; 30 | exit; 31 | 32 | sub mating { 33 | my ($s1, $s2) = @_; 34 | my $isize = 0; 35 | if ($s1->[2] ne '*' && $s1->[2] eq $s2->[2]) { # then calculate $isize 36 | my $x1 = ($s1->[1] & 0x10)? $s1->[3] + length($s1->[9]) : $s1->[3]; 37 | my $x2 = ($s2->[1] & 0x10)? $s2->[3] + length($s2->[9]) : $s2->[3]; 38 | $isize = $x2 - $x1; 39 | } 40 | # update mate coordinate 41 | if ($s2->[2] ne '*') { 42 | @$s1[6..8] = (($s2->[2] eq $s1->[2])? "=" : $s2->[2], $s2->[3], $isize); 43 | $s1->[1] |= 0x20 if ($s2->[1] & 0x10); 44 | } else { 45 | $s1->[1] |= 0x8; 46 | } 47 | if ($s1->[2] ne '*') { 48 | @$s2[6..8] = (($s1->[2] eq $s2->[2])? "=" : $s1->[2], $s1->[3], -$isize); 49 | $s2->[1] |= 0x20 if ($s1->[1] & 0x10); 50 | } else { 51 | $s2->[1] |= 0x8; 52 | } 53 | } 54 | 55 | sub soap2sam { 56 | my %opts = (); 57 | getopts("p", \%opts); 58 | die("Usage: soap2sam.pl [-p] \n") if (@ARGV == 0 && -t STDIN); 59 | my $is_paired = defined($opts{p}); 60 | # core loop 61 | my @s1 = (); 62 | my @s2 = (); 63 | my ($s_last, $s_curr) = (\@s1, \@s2); 64 | while (<>) { 65 | s/[\177-\377]|[\000-\010]|[\012-\040]//g; 66 | next if (&soap2sam_aux($_, $s_curr, $is_paired) < 0); 67 | if (@$s_last != 0 && $s_last->[0] eq $s_curr->[0]) { 68 | &mating($s_last, $s_curr); 69 | print join("\t", @$s_last), "\n"; 70 | print join("\t", @$s_curr), "\n"; 71 | @$s_last = (); @$s_curr = (); 72 | } else { 73 | print join("\t", @$s_last), "\n" if (@$s_last != 0); 74 | my $s = $s_last; $s_last = $s_curr; $s_curr = $s; 75 | } 76 | } 77 | print join("\t", @$s_last), "\n" if (@$s_last != 0); 78 | } 79 | 80 | sub soap2sam_aux { 81 | my ($line, $s, $is_paired) = @_; 82 | chomp($line); 83 | my @t = split(/\s+/, $line); 84 | return -1 if (@t < 9 || $line =~ /^\s/ || !$t[0]); 85 | @$s = (); 86 | # fix SOAP-2.1.x bugs 87 | @t = @t[0..2,4..$#t] unless ($t[3] =~ /^\d+$/); 88 | # read name 89 | $s->[0] = $t[0]; 90 | $s->[0] =~ s/\/[12]$//g; 91 | # initial flag (will be updated later) 92 | $s->[1] = 0; 93 | $s->[1] |= 1 | 1<<($t[4] eq 'a'? 6 : 7); 94 | $s->[1] |= 2 if ($is_paired); 95 | # read & quality 96 | $s->[9] = $t[1]; 97 | $s->[10] = (length($t[2]) > length($t[1]))? substr($t[2], 0, length($t[1])) : $t[2]; 98 | # cigar 99 | $s->[5] = length($s->[9]) . "M"; 100 | # coor 101 | $s->[2] = $t[7]; $s->[3] = $t[8]; 102 | $s->[1] |= 0x10 if ($t[6] eq '-'); 103 | # mapQ 104 | $s->[4] = $t[3] == 1? 30 : 0; 105 | # mate coordinate 106 | $s->[6] = '*'; $s->[7] = $s->[8] = 0; 107 | # aux 108 | push(@$s, "NM:i:$t[9]"); 109 | my $md = ''; 110 | if ($t[9]) { 111 | my @x; 112 | for (10 .. $#t) { 113 | push(@x, sprintf("%.3d,$1", $2)) if ($t[$_] =~ /^([ACGT])->(\d+)/i); 114 | } 115 | @x = sort(@x); 116 | my $a = 0; 117 | for (@x) { 118 | my ($y, $z) = split(","); 119 | $md .= (int($y)-$a) . $z; 120 | $a += $y - $a + 1; 121 | } 122 | $md .= length($t[1]) - $a; 123 | } else { 124 | $md = length($t[1]); 125 | } 126 | push(@$s, "MD:Z:$md"); 127 | return 0; 128 | } 129 | -------------------------------------------------------------------------------- /thirdPartyTools/SAMtools/tabix.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/thirdPartyTools/SAMtools/tabix.exe -------------------------------------------------------------------------------- /thirdPartyTools/SAMtools/wgsim.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TF-Chan-Lab/panGraphViewer/7ecc405b47648de7a0c78e3480d0aacf3fb7117b/thirdPartyTools/SAMtools/wgsim.exe -------------------------------------------------------------------------------- /thirdPartyTools/SAMtools/zoom2sam.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | # 3 | # Copyright (C) 2009 Genome Research Ltd. 4 | # 5 | # Author: Heng Li 6 | # 7 | # Permission is hereby granted, free of charge, to any person obtaining a copy 8 | # of this software and associated documentation files (the "Software"), to deal 9 | # in the Software without restriction, including without limitation the rights 10 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | # copies of the Software, and to permit persons to whom the Software is 12 | # furnished to do so, subject to the following conditions: 13 | # 14 | # The above copyright notice and this permission notice shall be included in 15 | # all copies or substantial portions of the Software. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20 | # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | # DEALINGS IN THE SOFTWARE. 24 | 25 | use strict; 26 | use warnings; 27 | use Getopt::Std; 28 | 29 | &zoom2sam; 30 | exit; 31 | 32 | sub mating { 33 | my ($s1, $s2) = @_; 34 | my $isize = 0; 35 | if ($s1->[2] ne '*' && $s1->[2] eq $s2->[2]) { # then calculate $isize 36 | my $x1 = ($s1->[1] & 0x10)? $s1->[3] + length($s1->[9]) : $s1->[3]; 37 | my $x2 = ($s2->[1] & 0x10)? $s2->[3] + length($s2->[9]) : $s2->[3]; 38 | $isize = $x2 - $x1; 39 | } 40 | # update mate coordinate 41 | if ($s2->[2] ne '*') { 42 | @$s1[6..8] = (($s2->[2] eq $s1->[2])? "=" : $s2->[2], $s2->[3], $isize); 43 | $s1->[1] |= 0x20 if ($s2->[1] & 0x10); 44 | } else { 45 | $s1->[1] |= 0x8; 46 | } 47 | if ($s1->[2] ne '*') { 48 | @$s2[6..8] = (($s1->[2] eq $s2->[2])? "=" : $s1->[2], $s1->[3], -$isize); 49 | $s2->[1] |= 0x20 if ($s1->[1] & 0x10); 50 | } else { 51 | $s2->[1] |= 0x8; 52 | } 53 | } 54 | 55 | sub zoom2sam { 56 | my %opts = (); 57 | getopts("p", \%opts); 58 | die("Usage: zoom2sam.pl [-p] 59 | Warnings: This script only supports the default Illumina outputs.\n") if (@ARGV < 2); 60 | my $is_paired = defined($opts{p}); 61 | my $len = shift(@ARGV); 62 | # core loop 63 | my @s1 = (); 64 | my @s2 = (); 65 | my ($s_last, $s_curr) = (\@s1, \@s2); 66 | while (<>) { 67 | &zoom2sam_aux($_, $s_curr, $is_paired, $len); 68 | if (@$s_last != 0 && $s_last->[0] eq $s_curr->[0]) { 69 | &mating($s_last, $s_curr); 70 | print join("\t", @$s_last), "\n"; 71 | print join("\t", @$s_curr), "\n"; 72 | @$s_last = (); @$s_curr = (); 73 | } else { 74 | print join("\t", @$s_last), "\n" if (@$s_last != 0); 75 | my $s = $s_last; $s_last = $s_curr; $s_curr = $s; 76 | } 77 | } 78 | print join("\t", @$s_last), "\n" if (@$s_last != 0); 79 | } 80 | 81 | sub zoom2sam_aux { 82 | my ($line, $s, $is_paired, $len) = @_; 83 | chomp($line); 84 | my @t = split("\t", $line); 85 | @$s = (); 86 | # read name 87 | $s->[0] = $t[0]; 88 | # initial flag (will be updated later) 89 | $s->[1] = 0; 90 | $s->[1] |= 1 | 1<<6 if ($s->[0] =~ /_F$/); 91 | $s->[1] |= 1 | 1<<7 if ($s->[0] =~ /_R$/); 92 | $s->[1] |= 2 if ($is_paired); 93 | # read & quality 94 | $s->[9] = "*"; $s->[10] = "*"; 95 | # cigar 96 | $s->[5] = $len . "M"; 97 | # coor 98 | my @s = split(/\s+/, $t[1]); 99 | $s->[2] = $s[0]; 100 | $t[1] =~ /:(\d+)$/; 101 | $s->[3] = $1 + 1; 102 | if ($s->[0] =~ /_[FR]$/) { 103 | my $u = ($s->[0] =~ /_F$/)? 1 : 0; 104 | my $w = ($t[2] eq '+')? 1 : 0; 105 | $s->[1] |= 0x10 if ($u ^ $w); 106 | $s->[0] =~ s/_[FR]$//; 107 | } else { 108 | $s->[1] |= 0x10 if ($t[2] eq '-'); 109 | } 110 | # mapQ 111 | $s->[4] = 30; 112 | # mate coordinate 113 | $s->[6] = '*'; $s->[7] = $s->[8] = 0; 114 | # aux 115 | push(@$s, "NM:i:$t[3]"); 116 | } 117 | --------------------------------------------------------------------------------