1 2 3 4 5 6 7 8 9 10 11 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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 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 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274
| # -*- coding: utf-8 -*-
import os, sys
import re
import numpy as np
from Bio import pairwise2
import networkx as nx
import matplotlib.pyplot as plt
def network_project():
File "<ipython-input-8-4b069aa68b05>", line 1
def network_project():
^
SyntaxError: unexpected EOF while parsing
gene=[]
header=[]
lecture=''
i=0
j=0
file='exemple_sequence.txt'
lecture=open(file,"r")
seq=''
for line in lecture:
File "<ipython-input-17-ee7616045115>", line 1
for line in lecture:
^
SyntaxError: unexpected EOF while parsing
sequence=len(re.findall(r"[>]",line))
Traceback (most recent call last):
File "<ipython-input-18-5b6993129435>", line 1, in <module>
sequence=len(re.findall(r"[>]",line))
NameError: name 'line' is not defined
if(sequence>0):
File "<ipython-input-19-097ba0cab013>", line 1
if(sequence>0):
^
SyntaxError: unexpected EOF while parsing
gene.append(seq)
seq=''
sequence=0
header.append(line[1:-1])
Traceback (most recent call last):
File "<ipython-input-23-2c9773132d5f>", line 1, in <module>
header.append(line[1:-1])
NameError: name 'line' is not defined
i=i+1
else:
File "<ipython-input-25-64c43b55f0b0>", line 1
else:
^
SyntaxError: invalid syntax
seq=seq+line[:-1]
Traceback (most recent call last):
File "<ipython-input-26-5ca41cc41d17>", line 1, in <module>
seq=seq+line[:-1]
NameError: name 'line' is not defined
gene.append(seq)
lecture.close()
score=[]
for i in range(len(gene)):
File "<ipython-input-30-6371b26cf076>", line 1
for i in range(len(gene)):
^
SyntaxError: unexpected EOF while parsing
for j in range((i+1),len(gene)):
File "<ipython-input-31-1264f3241f7e>", line 1
for j in range((i+1),len(gene)):
^
SyntaxError: unexpected EOF while parsing
score.append(pairwise2.align.globalms(gene[i],gene[j], 3, -2, -1, -.5,score_only=True))
liste=[]
seuil=(np.mean(score)+0.05*np.std(score))
C:\Users\Amandine\Anaconda3\lib\site-packages\numpy\core\fromnumeric.py:2957: RuntimeWarning: Mean of empty slice.
out=out, **kwargs)
C:\Users\Amandine\Anaconda3\lib\site-packages\numpy\core\_methods.py:135: RuntimeWarning: Degrees of freedom <= 0 for slice
keepdims=keepdims)
s=0
edge_labels={}
for i in range(len(gene)):
File "<ipython-input-37-6371b26cf076>", line 1
for i in range(len(gene)):
^
SyntaxError: unexpected EOF while parsing
for j in range((i+1),len(gene)):
File "<ipython-input-38-1264f3241f7e>", line 1
for j in range((i+1),len(gene)):
^
SyntaxError: unexpected EOF while parsing
if(score[s]>seuil):
File "<ipython-input-39-029433cbe1f7>", line 1
if(score[s]>seuil):
^
SyntaxError: unexpected EOF while parsing
liste.append((header[i],header[j]))
Traceback (most recent call last):
File "<ipython-input-40-d41a38bfa2d3>", line 1, in <module>
liste.append((header[i],header[j]))
IndexError: list index out of range
edge_labels[(header[i],header[j])]=score[s]
Traceback (most recent call last):
File "<ipython-input-41-aabbbf916451>", line 1, in <module>
edge_labels[(header[i],header[j])]=score[s]
IndexError: list index out of range
s=s+1
G=nx.Graph()
G.add_nodes_from(header)
G.add_edges_from(liste)
pos=nx.spring_layout(G)
node_s=[]
t=0
for t in range(len(gene)):
File "<ipython-input-49-a4f1e5ab6d2b>", line 1
for t in range(len(gene)):
^
SyntaxError: unexpected EOF while parsing
node_s.append(20*np.log(len(seq[t])))
Traceback (most recent call last):
File "<ipython-input-50-b1d4c0a30894>", line 1, in <module>
node_s.append(20*np.log(len(seq[t])))
IndexError: string index out of range
nx.draw_networkx_nodes(G,pos,node_color='green',label=True,alpha=1,node_size=node_s)

Width=dict(edge_labels)
for key,value in Width.items() :
File "<ipython-input-53-2b9e3955cfe0>", line 1
for key,value in Width.items() :
^
SyntaxError: unexpected EOF while parsing
Width[key] = np.log10(value)/2
Traceback (most recent call last):
File "<ipython-input-54-cbae24bb3a3e>", line 1, in <module>
Width[key] = np.log10(value)/2
NameError: name 'value' is not defined
nx.draw_networkx_edges(G,pos,width=Width.values(),style='solid',edge_color='red',alpha=1)

nx.draw_networkx_edge_labels(G,pos,edge_labels=edge_labels,font_size=2,alpha=0.5,font_color='black')
Out[56]: {}

nx.draw_networkx_labels(G,pos,font_size=3,font_color='blue')
Out[57]: {}

namefordoc=input('Nom du PDF sans .pdf ?\n')
Nom du PDF sans .pdf ?
file
plt.savefig(namefordoc+'.pdf')
<Figure size 432x288 with 0 Axes> |
Partager