@@ -91,11 +91,14 @@ def multipleReplace(text, wordDict):
91
91
def which (name ):
92
92
try :
93
93
with open (os .devnull ) as devnull :
94
- diff = ['tbl2asn' , 'dustmasker' , 'mafft' ]
94
+ diff = ['tbl2asn' , 'dustmasker' , 'mafft' , 'signalp' ]
95
95
if not any (name in x for x in diff ):
96
96
subprocess .Popen ([name ], stdout = devnull , stderr = devnull ).communicate ()
97
97
else :
98
- subprocess .Popen ([name , '--version' ], stdout = devnull , stderr = devnull ).communicate ()
98
+ if name == 'signalp' :
99
+ subprocess .Popen ([name , '-V' ], stdout = devnull , stderr = devnull ).communicate ()
100
+ else :
101
+ subprocess .Popen ([name , '--version' ], stdout = devnull , stderr = devnull ).communicate ()
99
102
except OSError as e :
100
103
if e .errno == os .errno .ENOENT :
101
104
return False
@@ -573,6 +576,29 @@ def dbCANsearch(input, cpus, evalue, tmpdir, output):
573
576
query = query + '-T1'
574
577
out .write ("%s\t note\t CAZy:%s\n " % (query , hit ))
575
578
579
+ def signalP (input , tmpdir , output ):
580
+ log .info ("Predicting secreted proteins with SignalP" )
581
+ FNULL = open (os .devnull , 'w' )
582
+ signalp_result = os .path .join (tmpdir , 'signalp.txt' )
583
+ with open (signalp_result , 'w' ) as out :
584
+ subprocess .call (['signalp' , '-t' , 'euk' , '-f' , 'short' , input ], stdout = out , stderr = FNULL )
585
+ #parse output and turn into annotation file
586
+ with open (output , 'w' ) as signalp :
587
+ with open (signalp_result , 'rU' ) as results :
588
+ for line in results :
589
+ line = line .replace ('\n ' , '' )
590
+ if line .startswith ('#' ):
591
+ continue
592
+ col = line .split (' ' ) #not tab delimited
593
+ col = filter (None , col ) #clean up empty spaces
594
+ if col [9 ] == 'Y' : #then there is signal peptide
595
+ ID = col [0 ]
596
+ if not ID .endswith ('-T1' ):
597
+ ID = ID + '-T1'
598
+ start = 1
599
+ end = int (col [2 ]) - 1
600
+ signalp .write ("%s\t note\t SECRETED:SignalP(%i-%i)\n " % (ID , start , end ))
601
+
576
602
def RepeatModelMask (input , cpus , tmpdir , output , debug ):
577
603
log .info ("Loading sequences and soft-masking genome" )
578
604
FNULL = open (os .devnull , 'w' )
@@ -1263,6 +1289,21 @@ def drawHeatmap(df, color, output, annotate):
1263
1289
item .set_fontsize (4 )
1264
1290
fig .savefig (output , format = 'pdf' , dpi = 1000 , bbox_inches = 'tight' )
1265
1291
plt .close (fig )
1292
+
1293
+ def drawbarplot (df , output ):
1294
+ with warnings .catch_warnings ():
1295
+ warnings .simplefilter ('ignore' )
1296
+ import matplotlib .pyplot as plt
1297
+ import seaborn as sns
1298
+ #num = len(df.columns) + 1
1299
+ sns .set (style = "darkgrid" )
1300
+ fig = plt .figure ()
1301
+ ax = sns .barplot (data = df , palette = pref_colors )
1302
+ plt .xlabel ('Genomes' )
1303
+ plt .ylabel ('Secreted Proteins' )
1304
+ fig .savefig (output , format = 'pdf' , dpi = 1000 , bbox_inches = 'tight' )
1305
+ plt .close (fig )
1306
+
1266
1307
1267
1308
def distance2mds (df , distance , type , output ):
1268
1309
import numpy as np
@@ -1515,18 +1556,20 @@ def ortho2phylogeny(folder, df, num, dict, cpus, bootstrap, tmpdir, outgroup, sp
1515
1556
<span class="icon-bar"></span>
1516
1557
<span class="icon-bar"></span>
1517
1558
<span class="icon-bar"></span>
1559
+ <span class="icon-bar"></span>
1518
1560
</button>
1519
1561
<a class="navbar-brand" href="index.html">Funannotate</a>
1520
1562
</div>
1521
1563
<div id="navbar" class="collapse navbar-collapse">
1522
1564
<ul class="nav navbar-nav">
1523
- <li class="active" ><a href="stats.html">Stats</a></li>
1565
+ <li><a href="stats.html">Stats</a></li>
1524
1566
<li><a href="phylogeny.html">Phylogeny</a></li>
1525
1567
<li><a href="orthologs.html">Orthologs</a></li>
1526
1568
<li><a href="interpro.html">InterProScan</a></li>
1527
1569
<li><a href="pfam.html">PFAM</a></li>
1528
1570
<li><a href="merops.html">Merops</a></li>
1529
1571
<li><a href="cazy.html">CAZymes</a></li>
1572
+ <li><a href="signalp.html">SignalP</a></li>
1530
1573
<li><a href="go.html">GO ontology</a></li>
1531
1574
<li><a href="citation.html">Citation</a></li>
1532
1575
</ul>
@@ -1549,6 +1592,7 @@ def ortho2phylogeny(folder, df, num, dict, cpus, bootstrap, tmpdir, outgroup, sp
1549
1592
<p><a href='phylogeny.html'>Maximum likelihood Phylogeny (RAxML)</a></p>
1550
1593
<p><a href='merops.html'>MEROPS Protease Stats</a></p>
1551
1594
<p><a href='cazy.html'>CAZyme carbohydrate activating enzyme Stats</a></p>
1595
+ <p><a href='signal.html'>Secreted proteins (SignalP)</a></p>
1552
1596
<p><a href='interpro.html'>InterProScan Domain Stats</a></p>
1553
1597
<p><a href='pfam.html'>PFAM Domain Stats</a></p>
1554
1598
<p><a href='go.html'>Gene Ontology Enrichment Analysis</a></p>
@@ -1593,6 +1637,14 @@ def ortho2phylogeny(folder, df, num, dict, cpus, bootstrap, tmpdir, outgroup, sp
1593
1637
<a href='pfam/PFAM.nmds.pdf'><img src="pfam/PFAM.nmds.pdf" height="500" /></a></div>
1594
1638
<div class="table-responsive">
1595
1639
'''
1640
+ SIGNALP = '''
1641
+ <div class="container">
1642
+ <div class="starter-template">
1643
+ <h2 class="sub-header">Secreted Proteins per Genome Results</h2>
1644
+ <div class='row'>
1645
+ <a href='signalp/signalp.pdf'><img src="signalp/signalp.pdf" height="500" /></a></div>
1646
+ <div class="table-responsive">
1647
+ '''
1596
1648
CAZY = '''
1597
1649
<div class="container">
1598
1650
<div class="starter-template">
@@ -1666,6 +1718,7 @@ def ortho2phylogeny(folder, df, num, dict, cpus, bootstrap, tmpdir, outgroup, sp
1666
1718
<li><a href="pfam.html">PFAM</a></li>
1667
1719
<li><a href="merops.html">Merops</a></li>
1668
1720
<li><a href="cazy.html">CAZymes</a></li>
1721
+ <li><a href="signalp.html">SignalP</a></li>
1669
1722
<li><a href="go.html">GO ontology</a></li>
1670
1723
<li><a href="citation.html">Citation</a></li>
1671
1724
<li class="dropdown">
0 commit comments