Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
SENSE-PPI
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Konstantin Volzhenin
SENSE-PPI
Commits
ccdf1277
Commit
ccdf1277
authored
Jul 27, 2023
by
Konstantin Volzhenin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
0.1.7
GPU running fixed
parent
52747bde
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
4 deletions
+9
-4
__init__.py
senseppi/__init__.py
+1
-1
__main__.py
senseppi/__main__.py
+2
-0
esm2_model.py
senseppi/esm2_model.py
+2
-2
network_utils.py
senseppi/network_utils.py
+4
-1
No files found.
senseppi/__init__.py
View file @
ccdf1277
__version__
=
"0.1.
6
"
__version__
=
"0.1.
7
"
__author__
=
"Konstantin Volzhenin"
from
.
import
model
,
commands
,
esm2_model
,
dataset
,
utils
,
network_utils
...
...
senseppi/__main__.py
View file @
ccdf1277
...
...
@@ -42,6 +42,8 @@ def main():
if
params
.
device
==
'gpu'
:
torch
.
set_float32_matmul_precision
(
'high'
)
logging
.
info
(
'Device used: {}'
.
format
(
params
.
device
))
params
.
func
(
params
)
...
...
senseppi/esm2_model.py
View file @
ccdf1277
...
...
@@ -47,7 +47,7 @@ def run(args):
model
,
alphabet
=
pretrained
.
load_model_and_alphabet
(
args
.
model_location_esm
)
model
.
eval
()
if
args
.
device
==
'
cuda
'
:
if
args
.
device
==
'
gpu
'
:
model
=
model
.
cuda
()
print
(
"Transferred the ESM2 model to GPU"
)
elif
args
.
device
==
'mps'
:
...
...
@@ -71,7 +71,7 @@ def run(args):
print
(
f
"Processing {batch_idx + 1} of {len(batches)} batches ({toks.size(0)} sequences)"
)
if
args
.
device
==
'
cuda
'
:
if
args
.
device
==
'
gpu
'
:
toks
=
toks
.
to
(
device
=
"cuda"
,
non_blocking
=
True
)
elif
args
.
device
==
'mps'
:
toks
=
toks
.
to
(
device
=
"mps"
,
non_blocking
=
True
)
...
...
senseppi/network_utils.py
View file @
ccdf1277
...
...
@@ -14,6 +14,7 @@ import shutil
DOWNLOAD_LINK_STRING
=
"https://stringdb-downloads.org/download/"
def
generate_pairs_string
(
fasta_file
,
output_file
,
with_self
=
False
,
delete_proteins
=
None
):
ids
=
[]
for
record
in
SeqIO
.
parse
(
fasta_file
,
"fasta"
):
...
...
@@ -85,7 +86,8 @@ def get_interactions_from_string(gene_names, species=9606, add_nodes=10, require
# Download protein sequences for given species if not downloaded yet
if
not
os
.
path
.
isfile
(
'{}.protein.sequences.v{}.fa'
.
format
(
species
,
version
)):
print
(
'Downloading protein sequences'
)
url
=
'{0}protein.sequences.v{1}/{2}.protein.sequences.v{1}.fa.gz'
.
format
(
DOWNLOAD_LINK_STRING
,
version
,
species
)
url
=
'{0}protein.sequences.v{1}/{2}.protein.sequences.v{1}.fa.gz'
.
format
(
DOWNLOAD_LINK_STRING
,
version
,
species
)
urllib
.
request
.
urlretrieve
(
url
,
'{}.protein.sequences.v{}.fa.gz'
.
format
(
species
,
version
))
print
(
'Unzipping protein sequences'
)
with
gzip
.
open
(
'{}.protein.sequences.v{}.fa.gz'
.
format
(
species
,
version
),
'rb'
)
as
f_in
:
...
...
@@ -145,5 +147,6 @@ def get_interactions_from_string(gene_names, species=9606, add_nodes=10, require
SeqIO
.
write
(
record
,
f
,
"fasta"
)
string_interactions
.
to_csv
(
'string_interactions.tsv'
,
sep
=
'
\t
'
,
index
=
False
)
if
__name__
==
'__main__'
:
get_interactions_from_string
(
'RFC5'
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment