Skip to content

Commit

Permalink
Merge pull request #573 from josemduarte/issue572
Browse files Browse the repository at this point in the history
Solving #572
  • Loading branch information
andreasprlic committed Sep 15, 2016
2 parents 89f710c + b696eac commit 359dce8
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public class AtomCache {
* The default output bioassembly style: if true the bioassemblies are multimodel,
* if false the bioassemblies are flat with renamed chains for symmetry-partners.
*/
public static final boolean DEFAULT_BIOASSEMBLY_STYLE = true;
public static final boolean DEFAULT_BIOASSEMBLY_STYLE = false;

public static final String BIOL_ASSEMBLY_IDENTIFIER = "BIO:";
public static final String CHAIN_NR_SYMBOL = ":";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,31 +68,24 @@ public static List<Subunit> extractSubunits(Structure structure,
// The extracted subunit container
List<Subunit> subunits = new ArrayList<Subunit>();

// Biological assemblies require all models
int models = 1;
if (structure.isBiologicalAssembly())
models = structure.nrModels();

for (Chain c : structure.getChains()) {

logger.info("Protein models used in calculation: " + models);
// Only take protein chains
if (c.isProtein()) {
Atom[] ca = StructureTools.getRepresentativeAtomArray(c);
logger.debug("Chain " + c.getId() + "; CA Atoms: "
+ ca.length + "; SEQRES: " + c.getSeqResSequence());
subunits.add(new Subunit(ca, c.getName(), null, structure));

for (int i = 0; i < models; i++) {
for (Chain c : structure.getChains(i)) {

// Only take protein chains
if (StructureTools.isProtein(c)) {
Atom[] ca = StructureTools.getRepresentativeAtomArray(c);
logger.info("Chain " + c.getId() + "; CA Atoms: "
+ ca.length + "; SEQRES: " + c.getSeqResSequence());
subunits.add(new Subunit(ca, c.getName(), null, structure));

}
}
}


// Calculate the minimum length of a Subunit
int adjustedMinLen = calcAdjustedMinimumSequenceLength(subunits,
absMinLen, fraction, minLen);
logger.info("Adjusted minimum sequence length: " + adjustedMinLen);
logger.debug("Adjusted minimum sequence length: " + adjustedMinLen);

// Filter out short Subunits
for (int s = subunits.size() - 1; s >= 0; s--) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ public void test() throws IOException, StructureException {
// first assembly
id = new BioAssemblyIdentifier("BIO:2ehz:1");
s = cache.getStructure(id);
assertEquals("Number of models",8, s.nrModels());
assertEquals("Number of chains per model",11, s.getChains(0).size());
assertEquals("Number of models",1, s.nrModels());
assertEquals("Number of chains",88, s.getChains().size());
// equivalent
id = new BioAssemblyIdentifier("BIO:2ehz");
s = cache.getStructure(id);
assertEquals("Number of models",8, s.nrModels());
assertEquals("Number of chains per model",1,s.getPolyChains(0).size());
assertEquals("Number of models",1, s.nrModels());
assertEquals("Number of chains",8,s.getPolyChains().size());
// No second
id = new BioAssemblyIdentifier("BIO:2ehz:2");
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,12 @@ public void test4A1I() throws IOException, StructureException {

//System.out.println(bioAssembly.toPDB());

assertEquals(bioAssembly.nrModels(), 2);
assertEquals(1, bioAssembly.nrModels());

assertTrue(bioAssembly.getChains().size() > 0);
assertEquals(2, bioAssembly.getPolyChains().size());

// Check that one model has Chain B and the other has chain G
Chain g = bioAssembly.getPolyChainByPDB("G", 0);
Chain b = bioAssembly.getPolyChainByPDB("B", 1);
// Anthony Bradley - I think the model numbering here is arbitrary???
if(g==null){
g = bioAssembly.getPolyChainByPDB("G", 1);
b = bioAssembly.getPolyChainByPDB("B", 0);
}
Chain g = bioAssembly.getPolyChainByPDB("G_1");
Chain b = bioAssembly.getPolyChainByPDB("B_2");

assertNotNull(g);

Expand All @@ -84,8 +78,6 @@ public void test4A1I() throws IOException, StructureException {

assertFalse(bioAssembly.hasChain("H"));

assertEquals(1,bioAssembly.getPolyChains(0).size());
assertEquals(1,bioAssembly.getPolyChains(1).size());


}
Expand Down

0 comments on commit 359dce8

Please sign in to comment.