-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate_connect.f
executable file
·228 lines (179 loc) · 4.81 KB
/
generate_connect.f
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
C generate_connect.f
C May 2023 David S. Goodsell, provided as is for unrestricted use
C generates a ".connect" file used by ModularLattice
C this version is hardwired for a syn3A genome with 54300 beads, lattice units of 10 bp/bead
C reads genome information from an input file with RNApol positions and nascent mRNA length
C SMC loops are placed between RNApol positions greater than a user defined minimum DNA segment length
C mature mRNA is chosen randomly from nascent mRNA length, and one ribosome is placed at the center
C
C input parameters:
C syn3A.genome #genome file with RNApol positions and mRNA length (bp units)
C syn3A.connect #output .connect file
C 503,187,187 #number of ribosomes, RNApol, and SMC
C 120 #minimum DNA length to add SMC (lattice units)
integer*4 poloffset,smcoffset,riboffset
integer*4 seglength
integer*4 rnarib(1000)
integer*4 position(200),length(200),segment(200)
integer*4 direction(200),translated(200)
integer*4 ipolindex(200,2)
character*80 line
character chainID
read(5,1) line
open(10,file=line)
write(6,*) "input genome file",line
read(5,1) line
open(1,file=line)
write(6,*) "output connect file",line
1 format(a80)
read(5,*) nrib,npol,nsmc
write(6,*) "ribosomes, polymerases, SMC: ",
& nrib,npol,nsmc
read(5,*) seglength
write(6,*) "Minimum DNA segment length for SMC: ",seglength
C read in genomic information
C hardwired for 10 bp/bead
C hardwired for syn3A genome with 54300 beads
do i=1,npol
read(10,11) position(i),length(i),segment(i),
& direction(i),translated(i)
position(i)=position(i)/10
length(i)=length(i)/10
segment(i)=segment(i)/10
if (direction(i).eq.1) then
ipolindex(i,1)=1
ipolindex(i,2)=2
else
ipolindex(i,1)=2
ipolindex(i,2)=1
endif
enddo
11 format(3i8,2i3)
ntot=0
do i=1,npol
ntot=ntot+segment(i)
enddo
segment(npol+1)=segment(1)+54300-ntot
ntot2=0
do i=2,npol+1
ntot2=ntot2+segment(i)
enddo
write(6,*)
write(6,*) "total DNA length: ",ntot,ntot2
poloffset=nrib
smcoffset=nrib+npol
riboffset=0
write(1,10) "DNA",1
10 format(a3,i8)
icount=0
C DNA
C-------SMC loops with only DNA---------------
itot=0
do ipol=1,npol
C----
if (segment(ipol+1).gt.seglength+40) then
C -5 accounts for segments inside masks
ipolsmc=seglength/2-5
ismc=segment(ipol+1)-seglength-5
itot=itot+ipolsmc*2+ismc
icount=icount+1
write(1,20) "SEG",icount,
& "POL",poloffset+ipol,ipolindex(ipol,2),
& "SMC",smcoffset+ipol,1,
& ipolsmc,"A"
icount=icount+1
write(1,20) "SEG",icount,
& "SMC",smcoffset+ipol,2,
& "SMC",smcoffset+ipol,3,
& ismc,"A"
ipolnext=ipol+1
if (ipol.eq.npol) ipolnext=1
icount=icount+1
write(1,20) "SEG",icount,
& "SMC",smcoffset+ipol,4,
& "POL",poloffset+ipolnext,ipolindex(ipolnext,1),
& ipolsmc,"A"
C----
else
itot=itot+segment(ipol+1)
ipolsmc=segment(ipol+1)/2-5
icount=icount+1
icount=icount+1
write(1,20) "SEG",icount,
& "POL",poloffset+ipol,ipolindex(ipol,2),
& "SMC",smcoffset+ipol,1,
& ipolsmc,"A"
ipolnext=ipol+1
if (ipol.eq.npol) ipolnext=1
icount=icount+1
write(1,20) "SEG",icount,
& "SMC",smcoffset+ipol,2,
& "POL",poloffset+ipolnext,ipolindex(ipolnext,1),
& ipolsmc,"A"
C----
endif
enddo
write(1,20) "SEG",icount,
& "POL",poloffset+1,ipolindex(1,1),
& "TER",0,0,0,"A"
write(1,20) "END"
20 format(a3,i8,2x,a3,i8,i4,3x,a3,i8,i4,i8,2x,a1)
C nascent mRNA
ichaincount=1
do ipol=1,npol
ichaincount=ichaincount+1
icount=0
chainID="B"
if (translated(ipol).eq.0) chainID="C"
write(1,10) "RNA",ichaincount
icount=icount+1
write(1,20) "SEG",icount,
& "TER",0,0,
& "POL",poloffset+ipol,3,
& length(ipol),chainID
icount=icount+1
write(1,20) "SEG",icount,
& "POL",poloffset+ipol,3,
& "TER",0,0,0,chainID
write(1,20) "END"
enddo
C mature mRNA
do i=1,1000
r=rand()
enddo
do irib=1,nrib
ichaincount=ichaincount+1
icount=0
600 irna=int(rand()*float(npol))+1
rnarib(irib)=length(irna)
if (translated(irna).eq.0) goto 600
cwrite(6,*) "mature RNA half length ",irib,rnarib(irib)
write(1,10) "RNA",ichaincount
icount=icount+1
write(1,20) "SEG",icount,
& "TER",0,0,
& "RIB",riboffset+irib,1,
& rnarib(irib),"D"
icount=icount+1
write(1,20) "SEG",icount,
& "RIB",riboffset+irib,2,
& "TER",0,0,rnarib(irib),"D"
write(1,20) "END"
enddo
C nascent protein
do irib=1,nrib
ichaincount=ichaincount+1
icount=0
write(1,10) "PRO",ichaincount
icount=icount+1
write(1,20) "SEG",icount,
& "TER",0,0,
& "RIB",riboffset+irib,3,
& rnarib(irib)/3,"E"
icount=icount+1
write(1,20) "SEG",icount,
& "RIB",riboffset+irib,3,
& "TER",0,0,0,"E"
write(1,20) "END"
enddo
end