File: SourceCompoundTest.java

package info (click to toggle)
biojava-live 1%3A1.7.1-8
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 55,160 kB
  • sloc: java: 180,820; xml: 6,908; sql: 510; makefile: 50
file content (231 lines) | stat: -rw-r--r-- 8,895 bytes parent folder | download | duplicates (5)
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
/*
 *                    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.bio.structure;

import java.io.IOException;
import java.io.InputStream;

import java.util.List;

import org.biojava.bio.structure.io.PDBFileParser;


import junit.framework.TestCase;


public class SourceCompoundTest extends TestCase{

	private Structure getStructure(String fileName){

		InputStream inStream = this.getClass().getResourceAsStream(fileName);
		assertNotNull(inStream);

		PDBFileParser pdbpars = new PDBFileParser();
		Structure structure = null;
		try {
			structure = pdbpars.parsePDBFile(inStream) ;
		} catch (IOException e) {
			e.printStackTrace();
		}
		return structure;
	}


	public void testCompoundSourceStructure(){

		Structure s2 = getStructure("/files/2gox.pdb");
		assertEquals(2, s2.getCompounds().size());
		for (Compound compound : s2.getCompounds()){
			if (compound.getMolId().equals("1")) {
				assertEquals("COMPLEMENT C3", compound.getMolName());
				assertEquals("[A, C]", compound.getChainId().toString());
				assertEquals("FRAGMENT OF ALPHA CHAIN: RESIDUES 996-1287", compound.getFragment());
				assertEquals("YES", compound.getEngineered());
				assertEquals("YES", compound.getMutation());
				assertEquals("HOMO SAPIENS", compound.getOrganismScientific());
				assertEquals("HUMAN", compound.getOrganismCommon());
				assertEquals("C3", compound.getGene());
				assertEquals("ESCHERICHIA COLI", compound.getExpressionSystem());
				assertEquals("BL21(DE3)", compound.getExpressionSystemStrain());
				assertEquals("PLASMID", compound.getExpressionSystemVectorType());
				assertEquals("PT7-", compound.getExpressionSystemPlasmid());
			}
			if (compound.getMolId().equals("2")) {
				assertEquals("FIBRINOGEN-BINDING PROTEIN", compound.getMolName());
				assertEquals("[B, D]", compound.getChainId().toString());
				assertEquals("C-TERMINAL DOMAIN: RESIDUES 101-165", compound.getFragment());
				assertEquals("YES", compound.getEngineered());
				assertEquals("STAPHYLOCOCCUS AUREUS", compound.getOrganismScientific());
				assertEquals("BACTERIA", compound.getOrganismCommon());
				assertEquals("MU50 / ATCC 700699", compound.getStrain());
				assertEquals("EFB", compound.getGene());
				assertEquals("ESCHERICHIA COLI", compound.getExpressionSystem());
				assertEquals("BL21(DE3)", compound.getExpressionSystemStrain());
				assertEquals("PLASMID", compound.getExpressionSystemVectorType());
				assertEquals("PT7HMT", compound.getExpressionSystemPlasmid());
			}
		}

	}

	public void testCOMPNDsectionFRAGMENT(){
		Structure s2 = getStructure("/files/2gox.pdb");
		Structure s4 = getStructure("/files/3cfy.pdb");

		// this file has a CHAIN: string in the value for the FRAGMENT: filed which breaks the version 1.4 parser

		for (Compound compound : s2.getCompounds()) {
			if (compound.getMolId().equals("1")) {
				assertEquals("FRAGMENT OF ALPHA CHAIN: RESIDUES 996-1287", compound.getFragment());
			}

		}

		for (Compound compound : s4.getCompounds()) {
			if (compound.getMolId().equals("1")) {
				assertEquals("SIGNAL RECEIVER DOMAIN: RESIDUES 2-128", compound.getFragment());
			}

		}

	}

	public void testCOMPNDsectionCHAINS(){
		Structure s3 = getStructure("/files/2pos.pdb");
		assertEquals(1, s3.getCompounds().size());
		for (Compound compound : s3.getCompounds()){
			/*System.out.println(compound.getMolId());
			System.out.println(compound.getMolName());
			System.out.println(compound.getChainId().toString());
			System.out.println(compound.getOrganismScientific());
			System.out.println(compound.getStrain());
	*/
			assertEquals("1", compound.getMolId());
			assertEquals("SYLVATICIN", compound.getMolName());
			assertEquals("[A, B, C, D]", compound.getChainId().toString());
			assertEquals("PYTHIUM SYLVATICUM", compound.getOrganismScientific());
			assertEquals("STRAIN 37", compound.getStrain());

		}
	}

	public void testSOURCEsectionSTRAIN(){
		Structure s4 = getStructure("/files/3cfy.pdb");
		for (Compound compound : s4.getCompounds()){
			if (compound.getMolId().equals("1")) {
				/*System.out.println(compound.getMolId());
				System.out.println(compound.getMolName());
				System.out.println(compound.getChainId().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());
				 */
				assertEquals("1", compound.getMolId());
				assertEquals("PUTATIVE LUXO REPRESSOR PROTEIN", compound.getMolName());
				assertEquals("[A]", compound.getChainId().toString());
				assertEquals("SIGNAL RECEIVER DOMAIN: RESIDUES 2-128", compound.getFragment());
				assertEquals("YES", compound.getEngineered());
				assertEquals("VIBRIO PARAHAEMOLYTICUS RIMD 2210633", compound.getOrganismScientific());
				assertEquals("BACTERIA", compound.getOrganismCommon());
				assertEquals("RIMD 2210633 / SEROTYPE O3:K6", compound.getStrain());
				assertEquals("VP1469", compound.getGene());
				assertEquals("ESCHERICHIA COLI", compound.getExpressionSystem());
				assertEquals("PLASMID", compound.getExpressionSystemVectorType());
				assertEquals("PET", compound.getExpressionSystemVector());
				assertEquals("BC-PSGX3(BC)", compound.getExpressionSystemPlasmid());

			}
		}
	}

	public void testSOURCEsectionORGSCI(){
		Structure s5 = getStructure("/files/3cdl.pdb");
		for (Compound compound : s5.getCompounds()){
			if (compound.getMolId().equals("1")) {
				//System.out.println(compound.getOrganismScientific());
				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.
	 */
	public void testSourceTaxIdVersion32File(){
		Structure structure = getStructure("/files/3dl7_v32.pdb");

        Compound comp = structure.getCompoundById("1");

        comp.showSource();

        assertEquals("10090", comp.getOrganismTaxId());
        assertEquals("9606", comp.getExpressionSystemTaxId());

	}

    /**
     * 3.2 format includes PMID and DOI in the JRNL section.
     */
    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("/files/2gox_v315.pdb");
        //check that there really is an publication
        assertTrue(structure.hasJournalArticle());

        if (structure.hasJournalArticle()) {
            JournalArticle journal = structure.getJournalArticle();
            List<Author> authorList = journal.getAuthorList();
            Author firstAuthor = authorList.get(0);
            //check the authors
            assertEquals(6, authorList.size());
            assertEquals("HAMMEL", firstAuthor.getSurname());
            assertEquals("M.", firstAuthor.getInitials());
            //check the other publication details
            assertEquals("A STRUCTURAL BASIS FOR COMPLEMENT INHIBITION BY STAPHYLOCOCCUS AUREUS.", journal.getTitle());               
            assertEquals("NAT.IMMUNOL.", journal.getJournalName());
            assertEquals(2007, journal.getPublicationDate());
            assertEquals("8", journal.getVolume());
            assertEquals("430", journal.getStartPage());
            assertEquals("ISSN 1529-2908", journal.getRefn());
            assertEquals("17351618", journal.getPmid());
            assertEquals("10.1038/NI1450", journal.getDoi());
        }
    }
}