-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4fe3b15
commit e74fcf3
Showing
2 changed files
with
27 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,29 @@ | ||
export assign_secondary_structure! | ||
export assign_secondary_structure!, assign_secondary_structure | ||
|
||
import AssigningSecondaryStructure as ASS | ||
import AssigningSecondaryStructure: assign_secondary_structure!, assign_secondary_structure | ||
|
||
""" | ||
assign_secondary_structure!(protein) | ||
Uses a simplified version of DSSP to fill the secondary structure vector of each chain with Loop, Helix, and Strand. | ||
""" | ||
function assign_secondary_structure!(protein::Protein) | ||
ss_num_vectors = ASS.assign_secondary_structure([chain.backbone.coords for chain in protein]) | ||
ss_num_vectors = assign_secondary_structure([chain.backbone.coords for chain in protein]) | ||
for (chain, ss_num_vector) in zip(protein, ss_num_vectors) | ||
ssvec = SecondaryStructure.(ss_num_vector) | ||
@assert length(chain.ssvec) == length(ssvec) | ||
chain.ssvec .= ssvec | ||
end | ||
return protein | ||
end | ||
|
||
""" | ||
assign_secondary_structure(protein) | ||
Returns a new protein with secondary structure assigned. | ||
""" | ||
function assign_secondary_structure(protein::Protein) | ||
new_protein = deepcopy(protein) | ||
assign_secondary_structure!(new_protein) | ||
return new_protein | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,18 @@ | ||
@testset "assign.jl" begin | ||
|
||
@testset "assign_secondary_structure!" begin | ||
backbone = pdb_to_protein("data/1ASS.pdb") | ||
@test has_missing_ss(backbone) | ||
assign_secondary_structure!(backbone) | ||
@test !has_missing_ss(backbone) | ||
protein = pdb_to_protein("data/1ASS.pdb") | ||
@test has_missing_ss(protein) | ||
assign_secondary_structure!(protein) | ||
@test !has_missing_ss(protein) | ||
end | ||
|
||
@testset "assign_secondary_structure" begin | ||
protein = pdb_to_protein("data/1ASS.pdb") | ||
@test has_missing_ss(protein) | ||
new_protein = assign_secondary_structure(protein) | ||
@test has_missing_ss(protein) | ||
@test !has_missing_ss(new_protein) | ||
end | ||
|
||
end |