Skip to content

Commit e505551

Browse files
committed
Core length used as the the min block length
1 parent 14e5ef8 commit e505551

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

biojava-structure-gui/src/main/java/demo/DemoMultipleMC.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public static void main(String[] args) throws IOException, StructureException, I
3232
//Protein Kinases (CEMC paper)
3333
//List<String> names = Arrays.asList("1cdk.A", "1cja.A", "1csn", "1b6c.B", "1ir3.A", "1fgk.A", "1byg.A", "1hck", "1blx.A", "3erk", "1bmk.A", "1kob.A", "1tki.A", "1phk", "1a06");
3434
//DHFR (Gerstein 1998 paper)
35-
//List<String> names = Arrays.asList("d1dhfa_", "8dfr", "d4dfra_", "3dfr");
35+
List<String> names = Arrays.asList("d1dhfa_", "8dfr", "d4dfra_", "3dfr");
3636
//TIM barrels (MUSTA paper)
3737
//List<String> names = Arrays.asList("1tim.A", "1vzw", "1nsj", "3tha.A", "4enl", "2mnr", "7tim.A", "1tml", "1btc", "a1piia1", "6xia", "5rub.A", "2taa.B");
3838
//Calcium Binding (MUSTA paper)
@@ -54,11 +54,12 @@ public static void main(String[] args) throws IOException, StructureException, I
5454
//Circular Permutations: SAND and MFPT domains
5555
//List<String> names = Arrays.asList("d2bjqa1", "d1h5pa_", "d1ufna_"); //"d1oqja"
5656
//Flexible domain family of proteins (FatCat paper?)
57+
//List<String> names = Arrays.asList();
5758
//Amonium Transporters (Aleix Bachelor's Thesis)
5859
//List<String> names = Arrays.asList("1xqf.A","2b2f.A", "3b9w.A","3hd6.A");
5960
//Cytochrome C Oxidases (Aleix Bachelor's Thesis)
6061
//List<String> names = Arrays.asList("2dyr.A","2gsm.A","2yev.A","3hb3.A","3omn.A","1fft.A","1xme.A","3o0r.B","3ayf.A");
61-
List<String> names = Arrays.asList("2dyr.A","2gsm.A","1fft.A","1xme.A","3o0r.B","3ayf.A");
62+
//List<String> names = Arrays.asList("2dyr.A","2gsm.A","1fft.A","1xme.A","3o0r.B","3ayf.A");
6263
//Cation Transporting ATPases (Aleix Bachelor's Thesis)
6364
//List<String> names = Arrays.asList("3b8e.A","2zxe.A", "3tlm.A","1iwo.A");
6465
//Ankyrin Repeats

biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/mc/MultipleMcOptimizer.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public class MultipleMcOptimizer
4545
implements Callable<MultipleAlignment> {
4646

4747
//Print info and save evolution history
48-
private static final boolean debug = true;
48+
private static final boolean debug = false;
4949

5050
private Random rnd;
5151
private MultipleSuperimposer imposer;
@@ -113,19 +113,26 @@ public MultipleMcOptimizer(MultipleAlignment seedAln,
113113
C = 20*size;
114114
Lmin = params.getMinBlockLen();
115115

116-
//Delete all shorter than Lmin blocks
116+
//Delete all shorter than Lmin blocks, and empty blocksets
117117
List<Block> toDelete = new ArrayList<Block>();
118+
List<BlockSet> emptyBs = new ArrayList<BlockSet>();
119+
118120
for (Block b : msa.getBlocks()){
119121
if (b.getCoreLength() < Lmin){
120122
toDelete.add(b);
121123
if (debug) System.err.println("Deleting Block: too short.");
122124
}
123125
}
124126
for (Block b : toDelete){
125-
for (BlockSet bs : msa.getBlockSets()){
127+
for (BlockSet bs : msa.getBlockSets()) {
126128
bs.getBlocks().remove(b);
129+
if (bs.getBlocks().size() == 0) emptyBs.add(bs);
127130
}
128131
}
132+
for (BlockSet bs : emptyBs){
133+
msa.getBlockSets().remove(bs);
134+
}
135+
129136
blockNr = msa.getBlocks().size();
130137
if (blockNr < 1){
131138
throw new IllegalArgumentException(
@@ -381,7 +388,7 @@ private boolean insertGap() {
381388
}
382389
}
383390
Block bk = msa.getBlocks().get(block);
384-
if (bk.length() <= Lmin) return false;
391+
if (bk.getCoreLength() <= Lmin) return false;
385392

386393
//Insert the gap at the position
387394
Integer residueL = bk.getAlignRes().get(structure).get(position);
@@ -411,6 +418,7 @@ private boolean shiftRow(){
411418
int res = rnd.nextInt(msa.getBlocks().get(bk).length());
412419

413420
Block block = msa.getBlocks().get(bk);
421+
if (block.getCoreLength() <= Lmin) return false;
414422

415423
//When the pivot residue is null try to add a residue from the freePool
416424
if (block.getAlignRes().get(str).get(res) == null){
@@ -746,8 +754,8 @@ private boolean shrinkBlock(){
746754
column++;
747755
}
748756
}
749-
if (msa.getBlocks().get(block).length() <= Lmin) return false;
750757
Block currentBlock = msa.getBlocks().get(block);
758+
if (currentBlock.getCoreLength() <= Lmin) return false;
751759

752760
for (int str=0; str<size; str++){
753761
Integer residue =

0 commit comments

Comments
 (0)