Repository navigation
Expand file tree
/
Copy pathSourceCompoundTest.java
More file actions
233 lines (203 loc) · 8.95 KB
/
Copy pathSourceCompoundTest.java
File metadata and controls
233 lines (203 loc) · 8.95 KB
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
229
230
231
232
233
/*
* BioJava development code
*
* This code may be freely distributed and modified under the
* terms of the GNU Lesser General Public Licence. This should
* be distributed with the code. If you do not have a copy,
* see:
*
* http://www.gnu.org/copyleft/lesser.html
*
* Copyright for this code is held jointly by the individual
* authors. These should be listed in @author doc comments.
*
* For more information on the BioJava project and its aims,
* or to join the biojava-l mailing list, visit the home page
* at:
*
* http://www.biojava.org/
*
* created at Apr 5, 2008
*/
package org.biojava.nbio.structure;
import org.biojava.nbio.structure.io.PDBFileParser;
import org.junit.Assert;
import org.junit.Test;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
public class SourceCompoundTest {
private Structure getStructure(String fileName){
InputStream inStream = this.getClass().getResourceAsStream(fileName);
Assert.assertNotNull(inStream);
PDBFileParser pdbpars = new PDBFileParser();
Structure structure = null;
try {
structure = pdbpars.parsePDBFile(inStream) ;
} catch (IOException e) {
e.printStackTrace();
}
return structure;
}
@Test
public void testCompoundSourceStructure(){
Structure s2 = getStructure("/2gox.pdb");
// note since biojava 5.0 we are finding entities for all molecules even if
// the annotation is not present for them
// 2 protein entities and 1 water entity
Assert.assertEquals(3, s2.getEntityInfos().size());
for (EntityInfo compound : s2.getEntityInfos()){
if (compound.getMolId()==1) {
Assert.assertEquals("COMPLEMENT C3", compound.getDescription());
Assert.assertEquals("[A, C]", compound.getChainIds().toString());
Assert.assertEquals("FRAGMENT OF ALPHA CHAIN: RESIDUES 996-1287", compound.getFragment());
Assert.assertEquals("YES", compound.getEngineered());
Assert.assertEquals("YES", compound.getMutation());
Assert.assertEquals("HOMO SAPIENS", compound.getOrganismScientific());
Assert.assertEquals("HUMAN", compound.getOrganismCommon());
Assert.assertEquals("C3", compound.getGene());
Assert.assertEquals("ESCHERICHIA COLI", compound.getExpressionSystem());
Assert.assertEquals("BL21(DE3)", compound.getExpressionSystemStrain());
Assert.assertEquals("PLASMID", compound.getExpressionSystemVectorType());
Assert.assertEquals("PT7-", compound.getExpressionSystemPlasmid());
}
if (compound.getMolId()==2) {
Assert.assertEquals("FIBRINOGEN-BINDING PROTEIN", compound.getDescription());
Assert.assertEquals("[B, D]", compound.getChainIds().toString());
Assert.assertEquals("C-TERMINAL DOMAIN: RESIDUES 101-165", compound.getFragment());
Assert.assertEquals("YES", compound.getEngineered());
Assert.assertEquals("STAPHYLOCOCCUS AUREUS", compound.getOrganismScientific());
Assert.assertEquals("BACTERIA", compound.getOrganismCommon());
Assert.assertEquals("MU50 / ATCC 700699", compound.getStrain());
Assert.assertEquals("EFB", compound.getGene());
Assert.assertEquals("ESCHERICHIA COLI", compound.getExpressionSystem());
Assert.assertEquals("BL21(DE3)", compound.getExpressionSystemStrain());
Assert.assertEquals("PLASMID", compound.getExpressionSystemVectorType());
Assert.assertEquals("PT7HMT", compound.getExpressionSystemPlasmid());
}
}
}
@Test
public void testCOMPNDsectionFRAGMENT(){
Structure s2 = getStructure("/2gox.pdb");
Structure s4 = getStructure("/3cfy.pdb");
// this file has a CHAIN: string in the value for the FRAGMENT: filed which breaks the version 1.4 parser
for (EntityInfo compound : s2.getEntityInfos()) {
if (compound.getMolId()==1) {
Assert.assertEquals("FRAGMENT OF ALPHA CHAIN: RESIDUES 996-1287", compound.getFragment());
}
}
for (EntityInfo compound : s4.getEntityInfos()) {
if (compound.getMolId()==1) {
Assert.assertEquals("SIGNAL RECEIVER DOMAIN: RESIDUES 2-128", compound.getFragment());
}
}
}
@Test
public void testCOMPNDsectionCHAINS(){
Structure s3 = getStructure("/2pos.pdb");
// note since biojava 5.0 we are finding entities for all molecules even if
// the annotation is not present for them
// thus for 2pos.pdb we have 1 protein entity, but 3 non-polymer entities and 1 water entity
EntityInfo compound = s3.getEntityById(1);
Assert.assertEquals(5, s3.getEntityInfos().size());
Assert.assertEquals(1, compound.getMolId());
Assert.assertEquals("SYLVATICIN", compound.getDescription());
Assert.assertEquals("[A, B, C, D]", compound.getChainIds().toString());
Assert.assertEquals("PYTHIUM SYLVATICUM", compound.getOrganismScientific());
Assert.assertEquals("STRAIN 37", compound.getStrain());
}
@Test
public void testSOURCEsectionSTRAIN(){
Structure s4 = getStructure("/3cfy.pdb");
for (EntityInfo compound : s4.getEntityInfos()){
if (compound.getMolId()==1) {
/*System.out.println(compound.getMolId());
System.out.println(compound.getMolName());
System.out.println(compound.getChainName().toString());
System.out.println(compound.getFragment());
System.out.println(compound.getEngineered());
System.out.println(compound.getOrganismScientific());
System.out.println(compound.getOrganismCommon());
System.out.println(compound.getStrain());
System.out.println(compound.getGene());
System.out.println(compound.getExpressionSystem());
System.out.println(compound.getExpressionSystemVectorType());
System.out.println(compound.getExpressionSystemVector());
System.out.println(compound.getExpressionSystemPlasmid());
*/
Assert.assertEquals(1, compound.getMolId());
Assert.assertEquals("PUTATIVE LUXO REPRESSOR PROTEIN", compound.getDescription());
Assert.assertEquals("[A]", compound.getChainIds().toString());
Assert.assertEquals("SIGNAL RECEIVER DOMAIN: RESIDUES 2-128", compound.getFragment());
Assert.assertEquals("YES", compound.getEngineered());
Assert.assertEquals("VIBRIO PARAHAEMOLYTICUS RIMD 2210633", compound.getOrganismScientific());
Assert.assertEquals("BACTERIA", compound.getOrganismCommon());
Assert.assertEquals("RIMD 2210633 / SEROTYPE O3:K6", compound.getStrain());
Assert.assertEquals("VP1469", compound.getGene());
Assert.assertEquals("ESCHERICHIA COLI", compound.getExpressionSystem());
Assert.assertEquals("PLASMID", compound.getExpressionSystemVectorType());
Assert.assertEquals("PET", compound.getExpressionSystemVector());
Assert.assertEquals("BC-PSGX3(BC)", compound.getExpressionSystemPlasmid());
}
}
}
@Test
public void testSOURCEsectionORGSCI(){
Structure s5 = getStructure("/3cdl.pdb");
for (EntityInfo compound : s5.getEntityInfos()){
if (compound.getMolId()==1) {
//System.out.println(compound.getOrganismScientific());
Assert.assertEquals("PSEUDOMONAS SYRINGAE PV. TOMATO STR. DC3000", compound.getOrganismScientific());
}
}
}
/**
* There is a file format change in v3.2 of the PDB file format, adding the
* tax id.
* This test makes sure that the tax id for the organism and expression
* systems is set correctly.
*/
@Test
public void testSourceTaxIdVersion32File(){
Structure structure = getStructure("/3dl7_v32.pdb");
EntityInfo comp = structure.getEntityById(1);
Assert.assertEquals("10090", comp.getOrganismTaxId());
Assert.assertEquals("9606", comp.getExpressionSystemTaxId());
}
/**
* 3.2 format includes PMID and DOI in the JRNL section.
*/
@Test
public void testJournalRefs(){
// JRNL AUTH M.HAMMEL,G.SFYROERA,D.RICKLIN,P.MAGOTTI,
// JRNL AUTH 2 J.D.LAMBRIS,B.V.GEISBRECHT
// JRNL TITL A STRUCTURAL BASIS FOR COMPLEMENT INHIBITION BY
// JRNL TITL 2 STAPHYLOCOCCUS AUREUS.
// JRNL REF NAT.IMMUNOL. V. 8 430 2007
// JRNL REFN ISSN 1529-2908
// JRNL PMID 17351618
// JRNL DOI 10.1038/NI1450
Structure structure = getStructure("/2gox_v315.pdb");
//check that there really is an publication
Assert.assertTrue(structure.hasJournalArticle());
if (structure.hasJournalArticle()) {
JournalArticle journal = structure.getJournalArticle();
List<Author> authorList = journal.getAuthorList();
Author firstAuthor = authorList.get(0);
//check the authors
Assert.assertEquals(6, authorList.size());
Assert.assertEquals("HAMMEL", firstAuthor.getSurname());
Assert.assertEquals("M.", firstAuthor.getInitials());
//check the other publication details
Assert.assertEquals("A STRUCTURAL BASIS FOR COMPLEMENT INHIBITION BY STAPHYLOCOCCUS AUREUS.", journal.getTitle());
Assert.assertEquals("NAT.IMMUNOL.", journal.getJournalName());
Assert.assertEquals(2007, journal.getPublicationDate());
Assert.assertEquals("8", journal.getVolume());
Assert.assertEquals("430", journal.getStartPage());
Assert.assertEquals("ISSN 1529-2908", journal.getRefn());
Assert.assertEquals("17351618", journal.getPmid());
Assert.assertEquals("10.1038/NI1450", journal.getDoi());
}
}
}