Nucleone 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Nucleone/__init__.py
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
|
|
2
|
+
def Kernel(u,h):
|
|
3
|
+
return pow(1-pow(u/h,2),3)
|
|
4
|
+
|
|
5
|
+
def Tri(M,h):
|
|
6
|
+
S=[]
|
|
7
|
+
for i in range(h):
|
|
8
|
+
S.append(0)
|
|
9
|
+
for D in M:
|
|
10
|
+
S.append(D)
|
|
11
|
+
for i in range(h):
|
|
12
|
+
S.append(0)
|
|
13
|
+
for i in range(h,len(S)-h):
|
|
14
|
+
s=0
|
|
15
|
+
for j in range(i-h,i+h):
|
|
16
|
+
s=s+Kernel(i-j,h)*S[j]
|
|
17
|
+
M[i-h]=s/h
|
|
18
|
+
|
|
19
|
+
def ComSeq(seq):
|
|
20
|
+
s=''
|
|
21
|
+
seq=seq[::-1]
|
|
22
|
+
for i in range(0,len(seq)):
|
|
23
|
+
if seq[i]=='A':
|
|
24
|
+
s=s+'T'
|
|
25
|
+
if seq[i]=='T':
|
|
26
|
+
s=s+'A'
|
|
27
|
+
if seq[i]=='C':
|
|
28
|
+
s=s+'G'
|
|
29
|
+
if seq[i]=='G':
|
|
30
|
+
s=s+'C'
|
|
31
|
+
return s
|
|
32
|
+
|
|
33
|
+
def DisSC(Seq,Dyad):
|
|
34
|
+
sc=0
|
|
35
|
+
PTR=['AG','AG','AGT','TTA','CAT','CTT','CCA','CCG','GAC','GC','GGA','GGG','AT','AAA','TTC','CAT','GAC','GTA','GC']
|
|
36
|
+
Dis=[61,-45,18,12,19,60,35,-20,70,-34,47,3,-98,-96,-90,-98,-82,881,-79]
|
|
37
|
+
cSeq=ComSeq(Seq)
|
|
38
|
+
for i in range(len(PTR)):
|
|
39
|
+
cp=ComSeq(PTR[i])
|
|
40
|
+
if cp not in PTR:
|
|
41
|
+
PTR.append(cp)
|
|
42
|
+
Dis.append(Dis[i])
|
|
43
|
+
for i in range(len(PTR)):
|
|
44
|
+
P=PTR[i]
|
|
45
|
+
D=Dis[i]
|
|
46
|
+
s=1
|
|
47
|
+
if D<0:
|
|
48
|
+
s=-1
|
|
49
|
+
l=len(P)
|
|
50
|
+
if (Seq[Dyad-D:Dyad-D+l]==P)|(cSeq[Dyad-D:Dyad-D+l]==P):
|
|
51
|
+
sc+=s
|
|
52
|
+
if (Seq[Dyad+D:Dyad+D+l]==P)|(cSeq[Dyad+D:Dyad+D+l]==P):
|
|
53
|
+
sc+=s
|
|
54
|
+
return sc
|
|
55
|
+
|
|
56
|
+
def CS(Seq,Dyad):
|
|
57
|
+
sc=0
|
|
58
|
+
MO=['ACT','AG','CAT','CA','GCA','CC','GG','CG','GC']
|
|
59
|
+
MI=['AT','AAAA','AAA']
|
|
60
|
+
MIL=[]
|
|
61
|
+
for i in range(Dyad-5,Dyad-70,-10):
|
|
62
|
+
MIL.append(i)
|
|
63
|
+
for i in range(Dyad+5,Dyad+70,10):
|
|
64
|
+
MIL.append(i)
|
|
65
|
+
MOL=[]
|
|
66
|
+
for i in range(Dyad-10,Dyad-70,-10):
|
|
67
|
+
MOL.append(i)
|
|
68
|
+
for i in range(Dyad+10,Dyad+70,10):
|
|
69
|
+
MOL.append(i)
|
|
70
|
+
ComSq=ComSeq(Seq)
|
|
71
|
+
for i in MIL:
|
|
72
|
+
for M in MI:
|
|
73
|
+
l=int(len(M)/2)
|
|
74
|
+
r=int(len(M)/2)+1
|
|
75
|
+
SS=Seq[i-l:i+r]
|
|
76
|
+
SSC=ComSq[i-l:i+r]
|
|
77
|
+
if (M in SS)|(M in SSC):
|
|
78
|
+
sc+=1
|
|
79
|
+
for M in MO:
|
|
80
|
+
l=int(len(M)/2)
|
|
81
|
+
r=int(len(M)/2)+1
|
|
82
|
+
SS=Seq[i-l:i+r]
|
|
83
|
+
SSC=ComSq[i-l:i+r]
|
|
84
|
+
if (M in SS)|(M in SSC):
|
|
85
|
+
sc-=1
|
|
86
|
+
for i in MOL:
|
|
87
|
+
for M in MO:
|
|
88
|
+
l=int(len(M)/2)
|
|
89
|
+
r=int(len(M)/2)+1
|
|
90
|
+
SS=Seq[i-l:i+r]
|
|
91
|
+
SSC=ComSq[i-l:i+r]
|
|
92
|
+
if (M in SS)|(M in SSC):
|
|
93
|
+
sc+=1
|
|
94
|
+
for M in MI:
|
|
95
|
+
l=int(len(M)/2)
|
|
96
|
+
r=int(len(M)/2)+1
|
|
97
|
+
SS=Seq[i-l:i+r]
|
|
98
|
+
SSC=ComSq[i-l:i+r]
|
|
99
|
+
if (M in SS)|(M in SSC):
|
|
100
|
+
sc-=1
|
|
101
|
+
return sc
|
|
102
|
+
|
|
103
|
+
def GetFre(Seq,W,S):
|
|
104
|
+
WW=['AA','TT','AT','TA']
|
|
105
|
+
SS=['CC','GG','CG','GC']
|
|
106
|
+
for i in range(0,141):
|
|
107
|
+
if Seq[i:i+2] in WW:
|
|
108
|
+
W[i]=W[i]+1
|
|
109
|
+
if Seq[i:i+2] in SS:
|
|
110
|
+
S[i]=S[i]+1
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def DetDyad(Seq,SC,l,h,Po):
|
|
114
|
+
if h-l>200:
|
|
115
|
+
S=SC[l:h]
|
|
116
|
+
ma=max(S)
|
|
117
|
+
D=S.index(ma)+l
|
|
118
|
+
sl=[]
|
|
119
|
+
for d in range(D-5,D+6):
|
|
120
|
+
DNA=Seq[d-100:d+101]
|
|
121
|
+
sc=CS(DNA,101)
|
|
122
|
+
sc=sc+DisSC(DNA,101)
|
|
123
|
+
sl.append(sc)
|
|
124
|
+
ma=max(sl)
|
|
125
|
+
inx=sl.index(ma)
|
|
126
|
+
inx=inx-5
|
|
127
|
+
dyad=D+inx
|
|
128
|
+
Po[dyad]=1
|
|
129
|
+
DetDyad(Seq,SC,l,dyad-150,Po)
|
|
130
|
+
DetDyad(Seq,SC,dyad+150,h,Po)
|
|
131
|
+
|
|
132
|
+
def GetDyad(Seq,Sc):
|
|
133
|
+
Po=[]
|
|
134
|
+
Tri(Sc,15)
|
|
135
|
+
for i in range(len(Sc)):
|
|
136
|
+
Po.append(0)
|
|
137
|
+
DetDyad(Seq,Sc,100,len(Seq)-100,Po)
|
|
138
|
+
Dy=[]
|
|
139
|
+
for i in range(len(Po)):
|
|
140
|
+
if Po[i]==1:
|
|
141
|
+
Dy.append(i)
|
|
142
|
+
return Dy
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
def Nucleone(SEFP,SCFP,OF):
|
|
147
|
+
F=open(SEFP,'r')
|
|
148
|
+
seq=F.readlines()
|
|
149
|
+
F.close()
|
|
150
|
+
Seq=''
|
|
151
|
+
for S in seq:
|
|
152
|
+
if '>' in S:
|
|
153
|
+
continue
|
|
154
|
+
Seq=Seq+S.replace("\n",'').replace("\r","")
|
|
155
|
+
F=open(SCFP,'r')
|
|
156
|
+
DY=F.readlines()
|
|
157
|
+
F.close()
|
|
158
|
+
dc=[]
|
|
159
|
+
for d in DY:
|
|
160
|
+
if '>' in d:
|
|
161
|
+
continue
|
|
162
|
+
DC=d.replace("\n",'').replace("\t",'').replace("\r","").split(',')
|
|
163
|
+
for D in DC:
|
|
164
|
+
dc.append(D)
|
|
165
|
+
print('The algorithm is processing your input data. Please wait while the results are being generated.')
|
|
166
|
+
Sc=[]
|
|
167
|
+
for D in dc:
|
|
168
|
+
if len(D)>0:
|
|
169
|
+
Sc.append(int(D))
|
|
170
|
+
import matplotlib.pyplot as plt
|
|
171
|
+
plt.figure(figsize=(12, 6))
|
|
172
|
+
plt.subplot(2,1,1)
|
|
173
|
+
for i in range(len(Sc)):
|
|
174
|
+
plt.bar(i,Sc[i],color='blue')
|
|
175
|
+
plt.xlabel('Coordinate',fontsize=14)
|
|
176
|
+
plt.ylabel('Dyad Count',fontsize=14)
|
|
177
|
+
plt.title('The Given Nucleosome Occupancy Profile',fontsize=16)
|
|
178
|
+
Dy=GetDyad(Seq,Sc)
|
|
179
|
+
plt.subplot(2,1,2)
|
|
180
|
+
for i in range(len(Sc)):
|
|
181
|
+
plt.bar(i,Sc[i],color='green')
|
|
182
|
+
for i in range(len(Dy)):
|
|
183
|
+
plt.scatter(Dy[i],Sc[Dy[i]],color='brown', s=120, marker='o', zorder=5)
|
|
184
|
+
plt.xlabel('Coordinate',fontsize=14)
|
|
185
|
+
plt.ylabel('Smoothed Dyad Count',fontsize=14)
|
|
186
|
+
plt.title('The Smoothed Nucleosome Occupancy Profile',fontsize=16)
|
|
187
|
+
plt.tight_layout()
|
|
188
|
+
plt.savefig(OF+'.jpg',dpi=300,bbox_inches='tight')
|
|
189
|
+
plt.close()
|
|
190
|
+
FI=open(OF+'.txt','w')
|
|
191
|
+
FI.write('> Smoothed Dyad Counts\n')
|
|
192
|
+
for i in range(len(Sc)-1):
|
|
193
|
+
FI.write(str(Sc[i])+',')
|
|
194
|
+
FI.write(str(Sc[-1])+'\n\n')
|
|
195
|
+
FI.write('> Identified dyads\n')
|
|
196
|
+
for i in range(len(Dy)):
|
|
197
|
+
FI.write(str(Dy[i])+'\n')
|
|
198
|
+
FI.close()
|
|
199
|
+
print('The analysis has been completed, and the output files have been generated.')
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: Nucleone
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Dyad identification from nucleosome occupancy profile
|
|
5
|
+
Author: Yosef Masoudi-Sobhanzadeh, Sushant Kumar
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://nucleone.org/
|
|
8
|
+
Project-URL: Repository, https://nucleone.org/
|
|
9
|
+
Requires-Python: >=3.0
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: matplotlib>=3.5
|
|
13
|
+
Dynamic: license-file
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
Nucleone/__init__.py,sha256=6TNH2bfmzkqAGVGRYudzoFtLwE4g5J6ErwdcbAQiG7k,5421
|
|
2
|
+
nucleone-1.0.0.dist-info/licenses/LICENSE,sha256=wUNcwhy3qGifYqVaXt9qUVxmziv7KYGFzkFMK3-uaws,1101
|
|
3
|
+
nucleone-1.0.0.dist-info/METADATA,sha256=1Fivq6T3lNXaJJ_pEJaKPgx_x3P1EJFFVlfJmWiJmfY,420
|
|
4
|
+
nucleone-1.0.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
5
|
+
nucleone-1.0.0.dist-info/top_level.txt,sha256=KeeJrStf291rJ7ajmQ7w2ifk8RJkVjCD2iduX-8weRI,9
|
|
6
|
+
nucleone-1.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Yosef Masoudi-Sobhanzadeh
|
|
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.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Nucleone
|