Skip to content

Commit 400a7d5

Browse files
committed
changing get*ChainByPDB methods signature to return List<Chain>
1 parent 8459e6f commit 400a7d5

35 files changed

+180
-148
lines changed

biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/MMcifTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ private void comparePDB2cif(String id, String chainId) throws IOException {
135135
//System.out.println(cifStructure);
136136

137137
// compare amino acids in chain 1:
138-
Chain a_pdb = pdbStructure.getPolyChainByPDB(chainId);
139-
Chain a_cif = cifStructure.getPolyChainByPDB(chainId);
138+
Chain a_pdb = pdbStructure.getPolyChainsByPDB(chainId);
139+
Chain a_cif = cifStructure.getPolyChainsByPDB(chainId);
140140
//System.out.println(a_pdb.getAtomGroups());
141141

142142
//System.out.println(id + "_" + chainName + " pdb atom groups: " + a_pdb.getAtomGroups(GroupType.AMINOACID).size());

biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/StructureToolsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ public void testRevisedConvention() throws IOException, StructureException{
268268
s = cache.getStructure(name9);
269269

270270
assertTrue(s.getChains().size() == 1);
271-
Chain c = s.getPolyChainByPDB(chainId);
271+
Chain c = s.getPolyChainsByPDB(chainId);
272272
assertEquals(c.getName(),chainId);
273273
Atom[] ca = StructureTools.getRepresentativeAtomArray(s);
274274
assertEquals(83,ca.length);

biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/align/fatcat/AFPChainSerialisationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ private Structure getStructure(String pdbId, String chainId) throws IOException,
130130
AtomCache cache = new AtomCache();
131131
Structure structure1 = cache.getStructure(pdbId);
132132

133-
Chain c = structure1.getPolyChainByPDB(chainId);
133+
Chain c = structure1.getPolyChainsByPDB(chainId);
134134

135135
Structure s = new StructureImpl();
136136
s.addChain(c);

biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/align/fatcat/MyTestHelper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ public static String compareAlignment(String pdb1, String chain1, String pdb2, S
7070
structure2 = pdbpars.getStructureById(pdb2);
7171

7272
//structure1 = pdbpars.getStructureById("1cdg");
73-
Chain c1 = structure1.getPolyChainByPDB(chain1);
73+
Chain c1 = structure1.getPolyChainsByPDB(chain1);
7474

7575
//structure2 = pdbpars.getStructureById("2aaa");
76-
Chain c2 = structure2.getPolyChainByPDB(chain2);
76+
Chain c2 = structure2.getPolyChainsByPDB(chain2);
7777

7878
Structure s3 = new StructureImpl();
7979
s3.addChain(c1);

biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/ecod/EcodParseTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ private static int testVersion(String ecodVersion) throws IOException {
125125
try {
126126
Integer start = map.getPosition(range.getStart());
127127
if(start == null) {
128-
Group g = struct.getPolyChainByPDB(range.getStart().getChainName()).getGroupByPDB(range.getStart());
128+
Group g = struct.getPolyChainsByPDB(range.getStart().getChainName()).getGroupByPDB(range.getStart());
129129
if(g!=null) {
130130
logger.warn("No CA atom for starting residue "+d.getDomainId()+"_"+range);
131131
clean = false;
@@ -143,7 +143,7 @@ private static int testVersion(String ecodVersion) throws IOException {
143143
if(end == null) {
144144
Group g = null;
145145
try {
146-
g = struct.getPolyChainByPDB(range.getEnd().getChainName()).getGroupByPDB(range.getEnd());
146+
g = struct.getPolyChainsByPDB(range.getEnd().getChainName()).getGroupByPDB(range.getEnd());
147147
} catch(StructureException e ) {}
148148
if(g!=null) {
149149
logger.warn("No CA atom for ending residue "+d.getDomainId()+"_"+range);

biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/io/Test3th3.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public void test3th3() throws StructureException, IOException {
5858
// since biojava 5.0 polymer and nonpolymer chains are separated, we've modified the
5959
// test accordingly below
6060

61-
Chain c = s.getPolyChainByPDB("T");
61+
Chain c = s.getPolyChainsByPDB("T");
6262

6363
ResidueNumber rn = ResidueNumber.fromString("201");
6464
rn.setChainName("T");
@@ -78,7 +78,7 @@ public void test3th3() throws StructureException, IOException {
7878

7979
assertEquals(1, count);
8080

81-
c = s.getNonPolyChainByPDB("T");
81+
c = s.getNonPolyChainsByPDB("T");
8282

8383
g = c.getGroupByPDB(rn);
8484

biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/io/TestLongPdbVsMmCifParsing.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ private void testChains(Structure sPdb, Structure sCif) throws StructureExceptio
413413
}
414414

415415
for (String chainId:chainIds) {
416-
testSingleChain(sPdb.getPolyChainByPDB(chainId), sCif.getPolyChainByPDB(chainId));
416+
testSingleChain(sPdb.getPolyChainsByPDB(chainId), sCif.getPolyChainsByPDB(chainId));
417417
}
418418
}
419419

biojava-integrationtest/src/test/java/org/biojava/nbio/structure/test/scop/ScopTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ private void runSCOPTests() throws IOException, StructureException {
153153

154154
s = cache.getStructureForDomain(domains1xzp.get(0));
155155

156-
Chain a = s.getPolyChainByPDB("A");
156+
Chain a = s.getPolyChainsByPDB("A");
157157

158158
// since biojava 5.0, there's no ligands in the polymer chains: thus we substract 3 SO4 molecules present in chain A
159159
assertEquals(176 -3,a.getAtomGroups().size());
@@ -170,7 +170,7 @@ private void runSCOPTests() throws IOException, StructureException {
170170

171171
s = cache.getStructureForDomain(target);
172172

173-
a = s.getPolyChainByPDB("A");
173+
a = s.getPolyChainsByPDB("A");
174174
assertEquals(a.getAtomGroups().size(),52);
175175
checkRange(s,"A:1A-49");
176176

biojava-structure/src/main/java/demo/DemoContacts.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.biojava.nbio.structure.contact.GroupContactSet;
2828

2929
import java.io.IOException;
30+
import java.util.List;
3031

3132

3233
public class DemoContacts {
@@ -48,8 +49,9 @@ private static void demoContacts(String pdbCode) throws IOException, StructureEx
4849

4950
Structure structure = StructureIO.getStructure(pdbCode);
5051

51-
Chain chain = structure.getPolyChainByPDB("A");
52+
List<Chain> chains = structure.getPolyChainsByPDB("A");
5253

54+
Chain chain = chains.get(0);
5355

5456
String[] atoms = {"CA"};
5557
AtomContactSet contacts = StructureTools.getAtomsInContact(chain, atoms, 8.0);

biojava-structure/src/main/java/demo/DemoLoadStructure.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
import org.biojava.nbio.structure.io.PDBFileReader;
3131
import org.biojava.nbio.core.util.InputStreamProvider;
3232

33+
import java.util.List;
34+
3335

3436
/** Example for how to load protein structures (from PDB files).
3537
*
@@ -101,11 +103,13 @@ public void basicLoad(){
101103

102104
System.out.println(structure);
103105

104-
Chain c = structure.getPolyChainByPDB("C");
106+
List<Chain> chains = structure.getPolyChainsByPDB("C");
105107

106-
System.out.print(c);
108+
for ( Chain c : chains) {
109+
System.out.print(c);
107110

108-
System.out.println(c.getEntityInfo());
111+
System.out.println(c.getEntityInfo());
112+
}
109113

110114
} catch (Exception e){
111115
e.printStackTrace();

0 commit comments

Comments
 (0)