Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Priming site predictor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
zavolan_group
tools
Priming site predictor
Commits
4edd965f
Commit
4edd965f
authored
2 years ago
by
Max Bär
Browse files
Options
Downloads
Patches
Plain Diff
First attempt on postprocess
parent
97e28760
Branches
Branches containing commit
No related tags found
1 merge request
!24
First attempt on postprocess
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
primingsitepredictor/createtranscript.py
+47
-17
47 additions, 17 deletions
primingsitepredictor/createtranscript.py
with
47 additions
and
17 deletions
primingsitepredictor/createtranscript.py
+
47
−
17
View file @
4edd965f
...
@@ -12,27 +12,57 @@ Created on Wed Nov 16 17:48:04 2022
...
@@ -12,27 +12,57 @@ Created on Wed Nov 16 17:48:04 2022
# print(len(content[3:]))
# print(len(content[3:]))
# print((content[3:]))
# print((content[3:]))
import
pandas
as
pd
import
math
class
CreateTranscript
():
class
CreateTranscript
():
def
__init__
(
self
):
def
__init__
(
self
):
with
open
(
"
RIBlast output example.txt
"
,
'
r
'
)
as
file
:
with
open
(
"
RIBlast output example.txt
"
,
'
r
'
)
as
file
:
self
.
list_of
_interactions
=
file
.
readlines
()[
3
:]
self
.
raw
_interactions
=
file
.
readlines
()[
3
:]
def
generate_interaction_list
(
self
):
def
generate_interaction_df
(
self
):
interaction_list
=
[]
for
i
in
range
(
0
,
(
len
(
self
.
list_of_interactions
)
-
1
)):
self
.
interaction_list
=
[]
current_interaction
=
self
.
list_of_interactions
[
i
].
strip
(
'
\n
'
).
split
(
'
,
'
)
#print(self.list_of_interactions[i].strip(' \n').split(','))
#clean up the original list so that we have a neet list
interaction_list
.
append
(
current_interaction
)
for
i
in
range
(
0
,
(
len
(
self
.
raw_interactions
)
-
1
)):
return
interaction_list
current_interaction
=
self
.
raw_interactions
[
i
].
strip
(
'
\n
'
).
replace
(
'
(
'
,
''
).
replace
(
'
)
'
,
''
).
replace
(
'
-
'
,
'
,
'
).
replace
(
'
:
'
,
'
,
'
).
split
(
'
,
'
)
self
.
interaction_list
.
append
(
current_interaction
)
#identify if the interaction is the same as the previous one, just shifted by 1 bp (if we have 20 A in the transcript the 15 T primer has 5 matching possibilities although it is only 1 bindingsite)
transcriptlist
=
CreateTranscript
()
previous_interaction_base
=
int
print
(
transcriptlist
.
generate_interaction_list
())
for
i
in
range
(
0
,
len
(
self
.
interaction_list
)):
previous_interaction_base
=
int
(
self
.
interaction_list
[
i
-
1
][
13
])
#go from interaction list to transcript list? -no we will serve them a interaction list.
if
int
(
self
.
interaction_list
[
i
][
13
])
in
range
(
previous_interaction_base
-
1
,
previous_interaction_base
-
15
,
-
1
):
self
.
interaction_list
[
i
].
append
(
'
Repeat
'
)
# print(content[3:][0].strip(' \n').split(',')[-1].strip('()').split(':'))
else
:
self
.
interaction_list
[
i
].
append
(
'
Not_repeat
'
)
#exclude all interactions which are a repeat and belong to the same bindingsite
self
.
cleaned_interaction_list
=
[
item
for
item
in
self
.
interaction_list
if
item
[
-
1
]
==
'
Not_repeat
'
]
#add total number of interactions per transcript and calculate energy
self
.
df
=
pd
.
DataFrame
(
self
.
cleaned_interaction_list
)
self
.
df
[
'
Number of interactions
'
]
=
int
self
.
df
[
'
Interaction Energy
'
]
=
float
energy_constant
=
1.380649
*
10
**
(
-
23
)
*
298
kcalmol_joul
=
6.9477
*
10
**-
21
for
ind
in
self
.
df
.
index
:
self
.
df
[
'
Number of interactions
'
][
ind
]
=
self
.
df
[
3
].
value_counts
()[
self
.
df
[
3
][
ind
]]
self
.
df
[
'
Interaction Energy
'
][
ind
]
=
math
.
exp
(
-
float
(
self
.
df
[
5
][
ind
])
*
kcalmol_joul
/
energy_constant
)
print
(
self
.
df
[
'
Interaction Energy
'
])
print
(
self
.
df
)
return
self
.
df
transcripts
=
CreateTranscript
()
interaction_df
=
transcripts
.
generate_interaction_df
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment