Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlphaPulldown-ModelCIF-Conversion
Manage
Activity
Members
Labels
Plan
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
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
Bienchen
AlphaPulldown-ModelCIF-Conversion
Commits
4bc46ca8
Commit
4bc46ca8
authored
1 year ago
by
Bienchen
Browse files
Options
Downloads
Patches
Plain Diff
Outsource PAE file into Zip archive
parent
50f76d7e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitignore
+7
-0
7 additions, 0 deletions
.gitignore
convert_to_modelcif.py
+39
-6
39 additions, 6 deletions
convert_to_modelcif.py
with
46 additions
and
6 deletions
.gitignore
0 → 100644
+
7
−
0
View file @
4bc46ca8
# Don't have Emac's backup files
*~
# ignore some files used for testing
1ake.1.pdb
3lre.3.A.pdb
6xne.pdb
This diff is collapsed.
Click to expand it.
convert_to_modelcif.py
+
39
−
6
View file @
4bc46ca8
...
@@ -10,6 +10,7 @@ import os
...
@@ -10,6 +10,7 @@ import os
import
pickle
import
pickle
import
re
import
re
import
sys
import
sys
import
zipfile
from
Bio
import
SeqIO
from
Bio
import
SeqIO
from
Bio.PDB
import
PDBParser
,
PPBuilder
from
Bio.PDB
import
PDBParser
,
PPBuilder
...
@@ -18,6 +19,7 @@ from absl import app, flags, logging
...
@@ -18,6 +19,7 @@ from absl import app, flags, logging
import
numpy
as
np
import
numpy
as
np
import
modelcif
import
modelcif
import
modelcif.associated
import
modelcif.dumper
import
modelcif.dumper
import
modelcif.model
import
modelcif.model
...
@@ -116,7 +118,7 @@ class _Biopython2ModelCIF(modelcif.model.AbInitioModel):
...
@@ -116,7 +118,7 @@ class _Biopython2ModelCIF(modelcif.model.AbInitioModel):
occupancy
=
atm
.
occupancy
,
occupancy
=
atm
.
occupancy
,
)
)
def
add_scores
(
self
,
scores_json
,
entry_id
):
def
add_scores
(
self
,
scores_json
,
entry_id
,
file_prefix
):
"""
Add QA metrics
"""
"""
Add QA metrics
"""
# global scores
# global scores
self
.
qa_metrics
.
extend
(
self
.
qa_metrics
.
extend
(
...
@@ -171,6 +173,31 @@ class _Biopython2ModelCIF(modelcif.model.AbInitioModel):
...
@@ -171,6 +173,31 @@ class _Biopython2ModelCIF(modelcif.model.AbInitioModel):
i
+=
1
i
+=
1
self
.
qa_metrics
.
extend
(
lpae
)
self
.
qa_metrics
.
extend
(
lpae
)
# outsource PAE to associated file
arc_files
=
[
modelcif
.
associated
.
LocalPairwiseQAScoresFile
(
f
"
{
file_prefix
}
_local_pairwise_qa.cif
"
,
categories
=
[
"
_ma_qa_metric_local_pairwise
"
],
copy_categories
=
[
"
_ma_qa_metric
"
],
entry_id
=
entry_id
,
entry_details
=
"
This file is an associated file consisting
"
+
"
of local pairwise QA metrics. This is a partial mmCIF
"
+
"
file and can be validated by merging with the main
"
+
"
mmCIF file containing the model coordinates and other
"
+
"
associated data.
"
,
details
=
"
Predicted aligned error
"
,
)
]
return
modelcif
.
associated
.
Repository
(
""
,
[
modelcif
.
associated
.
ZipFile
(
f
"
{
file_prefix
}
.zip
"
,
files
=
arc_files
)
],
)
def
_get_modelcif_entities
(
target_ents
,
asym_units
,
system
):
def
_get_modelcif_entities
(
target_ents
,
asym_units
,
system
):
"""
Create ModelCIF entities and asymmetric units.
"""
"""
Create ModelCIF entities and asymmetric units.
"""
...
@@ -225,9 +252,8 @@ def _store_as_modelcif(
...
@@ -225,9 +252,8 @@ def _store_as_modelcif(
)
)
# process scores
# process scores
# system.repositories.append(
mdl_file
=
os
.
path
.
splitext
(
os
.
path
.
basename
(
mdl_file
))[
0
]
model
.
add_scores
(
data_json
,
system
.
id
)
system
.
repositories
.
append
(
model
.
add_scores
(
data_json
,
system
.
id
,
mdl_file
))
# )
system
.
model_groups
.
append
(
modelcif
.
model
.
ModelGroup
([
model
]))
system
.
model_groups
.
append
(
modelcif
.
model
.
ModelGroup
([
model
]))
...
@@ -257,12 +283,19 @@ def _store_as_modelcif(
...
@@ -257,12 +283,19 @@ def _store_as_modelcif(
os
.
chdir
(
out_dir
)
os
.
chdir
(
out_dir
)
try
:
try
:
with
open
(
with
open
(
f
"
{
os
.
path
.
splitext
(
os
.
path
.
basename
(
mdl_file
))[
0
]
}
.cif
"
,
f
"
{
mdl_file
}
.cif
"
,
"
w
"
,
"
w
"
,
encoding
=
"
ascii
"
,
encoding
=
"
ascii
"
,
)
as
mmcif_fh
:
)
as
mmcif_fh
:
modelcif
.
dumper
.
write
(
mmcif_fh
,
[
system
])
modelcif
.
dumper
.
write
(
mmcif_fh
,
[
system
])
# _package_associated_files(system.repositories[0])
# Create associated archive
for
archive
in
system
.
repositories
[
0
].
files
:
with
zipfile
.
ZipFile
(
archive
.
path
,
"
w
"
,
zipfile
.
ZIP_BZIP2
)
as
cif_zip
:
for
zfile
in
archive
.
files
:
cif_zip
.
write
(
zfile
.
path
,
arcname
=
zfile
.
path
)
os
.
remove
(
zfile
.
path
)
# if compress:
# if compress:
# _compress_cif_file(mdl_fle)
# _compress_cif_file(mdl_fle)
finally
:
finally
:
...
...
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