Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@

import org.biojava.nbio.structure.Atom;
import org.biojava.nbio.structure.StructureException;
import org.biojava.nbio.structure.align.cemc.CeMcMain;
import org.biojava.nbio.structure.align.ce.CeCPMain;
import org.biojava.nbio.structure.align.gui.MultipleAlignmentDisplay;
import org.biojava.nbio.structure.align.multiple.MultipleAlignment;
import org.biojava.nbio.structure.align.multiple.mc.MultipleMcMain;
import org.biojava.nbio.structure.align.multiple.mc.MultipleMcParameters;
import org.biojava.nbio.structure.align.util.AtomCache;

/**
Expand All @@ -20,7 +22,7 @@
* @author Aleix Lafita
*
*/
public class DemoCEMC {
public class DemoMultipleMC {

public static void main(String[] args) throws IOException, StructureException, InterruptedException, ExecutionException {

Expand All @@ -30,11 +32,9 @@ public static void main(String[] args) throws IOException, StructureException, I
//Protein Kinases (CEMC paper)
//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");
//DHFR (Gerstein 1998 paper)
//List<String> names = Arrays.asList("d1dhfa_", "8dfr", "d4dfra_", "3dfr");
List<String> names = Arrays.asList("d1dhfa_", "8dfr", "d4dfra_", "3dfr");
//TIM barrels (MUSTA paper)
//List<String> names = Arrays.asList("1tim.A", "1vzw", "1nsj", "3tha.A", "4enl", "2mnr", "7tim.A", "1tml", "1btc", "a1piia1", "6xia", "5rub.A", "2taa.B");
//Helix-bundle (MUSTA paper)
List<String> names = Arrays.asList("1bbh.A", "1aep", "1bge.B", "256b.A", "2ccy.A", "2hmz.A", "3ink.C");
//Calcium Binding (MUSTA paper)
//List<String> names = Arrays.asList("4cpv", "2scp.A", "2sas", "1top", "1scm.B", "3icb");
//Serine Rich Proteins SERP (MUSTA paper)
Expand All @@ -45,7 +45,7 @@ public static void main(String[] args) throws IOException, StructureException, I
//List<String> names = Arrays.asList("2z73.A", "1u19.A", "4ug2.A", "4xt3", "4or2.A", "3odu.A");
//Immunoglobulins (MAMMOTH paper)
//List<String> names = Arrays.asList("2hla.B", "3hla.B", "1cd8", "2rhe", "1tlk", "1ten", "1ttf");
//Globins (MAMMOTH and MUSTA papers)
//Globins (MAMMOTH, POSA, Gerstein&Levitt and MUSTA papers)
//List<String> names = Arrays.asList("1mbc", "1hlb", "1thb.A", "1ith.A", "1idr.A", "1dlw", "1kr7.A", "1ew6.A", "1it2.A", "1eco", "3sdh.A", "1cg5.B", "1fhj.B", "1ird.A", "1mba", "2gdm", "1b0b", "1h97.A", "1ash.A", "1jl7.A");
//Rossman-Fold (POSA paper)
//List<String> names = Arrays.asList("d1heta2", "d1ek6a_", "d1obfo1", "2cmd", "d1np3a2", "d1bgva1", "d1id1a_", "d1id1a_", "d1oi7a1");
Expand All @@ -66,7 +66,10 @@ public static void main(String[] args) throws IOException, StructureException, I
}

//Here the multiple structural alignment algorithm comes in place to generate the alignment object
CeMcMain algorithm = new CeMcMain();
MultipleMcMain algorithm = new MultipleMcMain();
MultipleMcParameters params = (MultipleMcParameters) algorithm.getParameters();
params.setPairwiseAlgorithm(CeCPMain.algorithmName);

MultipleAlignment result = algorithm.align(atomArrays);
result.getEnsemble().setStructureNames(names);

Expand Down
87 changes: 87 additions & 0 deletions biojava-structure/src/main/java/demo/DemoMultipleMC.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
package demo;

import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
import java.util.concurrent.ExecutionException;

import org.biojava.nbio.structure.Atom;
import org.biojava.nbio.structure.StructureException;
import org.biojava.nbio.structure.align.ce.CeCPMain;
import org.biojava.nbio.structure.align.multiple.MultipleAlignment;
import org.biojava.nbio.structure.align.multiple.MultipleAlignmentWriter;
import org.biojava.nbio.structure.align.multiple.mc.MultipleMcMain;
import org.biojava.nbio.structure.align.multiple.mc.MultipleMcParameters;
import org.biojava.nbio.structure.align.util.AtomCache;

/**
* Demo for running the MultipleMC Algorithm on a protein family.
* For visualizing the results in jmol use the same Demo in the GUI module.
* Here only the sequence alignment will be displayed.
* Choose the family by commenting out the protein family names.
*
* @author Aleix Lafita
*
*/
public class DemoMultipleMC {

public static void main(String[] args) throws IOException, StructureException, InterruptedException, ExecutionException {

//Specify the structures to align
//ASP-proteinases (CEMC paper)
//List<String> names = Arrays.asList("3app", "4ape", "2apr", "5pep", "1psn", "4cms", "1bbs.A", "1smr.A", "2jxr.A", "1mpp", "2asi", "1am5");
//Protein Kinases (CEMC paper)
//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");
//DHFR (Gerstein 1998 paper)
List<String> names = Arrays.asList("d1dhfa_", "8dfr", "d4dfra_", "3dfr");
//TIM barrels (MUSTA paper)
//List<String> names = Arrays.asList("1tim.A", "1vzw", "1nsj", "3tha.A", "4enl", "2mnr", "7tim.A", "1tml", "1btc", "a1piia1", "6xia", "5rub.A", "2taa.B");
//Calcium Binding (MUSTA paper)
//List<String> names = Arrays.asList("4cpv", "2scp.A", "2sas", "1top", "1scm.B", "3icb");
//Serine Rich Proteins SERP (MUSTA paper)
//List<String> names = Arrays.asList("7api.A", "8api.A", "1hle.A", "1ova.A", "2ach.A", "9api.A", "1psi", "1atu", "1kct", "1ath.A", "1att.A");
//Serine Proteases (MUSTA paper)
//List<String> names = Arrays.asList("1cse.E", "1sbn.E", "1pek.E", "3prk", "3tec.E");
//GPCRs
//List<String> names = Arrays.asList("2z73.A", "1u19.A", "4ug2.A", "4xt3", "4or2.A", "3odu.A");
//Immunoglobulins (MAMMOTH paper)
//List<String> names = Arrays.asList("2hla.B", "3hla.B", "1cd8", "2rhe", "1tlk", "1ten", "1ttf");
//Globins (MAMMOTH, POSA, Gerstein&Levitt and MUSTA papers)
//List<String> names = Arrays.asList("1mbc", "1hlb", "1thb.A", "1ith.A", "1idr.A", "1dlw", "1kr7.A", "1ew6.A", "1it2.A", "1eco", "3sdh.A", "1cg5.B", "1fhj.B", "1ird.A", "1mba", "2gdm", "1b0b", "1h97.A", "1ash.A", "1jl7.A");
//Rossman-Fold (POSA paper)
//List<String> names = Arrays.asList("d1heta2", "d1ek6a_", "d1obfo1", "2cmd", "d1np3a2", "d1bgva1", "d1id1a_", "d1id1a_", "d1oi7a1");
//Circular Permutations (Bliven CECP paper) - dynamin GTP-ase with CP G-domain
//List<String> names = Arrays.asList("d1u0la2", "d1jwyb_");
//Circular Permutations: SAND and MFPT domains
//List<String> names = Arrays.asList("d2bjqa1", "d1h5pa_", "d1ufna_"); //"d1oqja"
//Flexible domain family of proteins (FatCat paper?)

//Ankyrin Repeats
//List<String> names = Arrays.asList("d1n0ra_", "3ehq.A", "1awc.B"); //ankyrin

//Load the CA atoms of the structures
AtomCache cache = new AtomCache();
List<Atom[]> atomArrays = new ArrayList<Atom[]>();
for (String name:names) {
atomArrays.add(cache.getAtoms(name));
}

//Here the multiple structural alignment algorithm comes in place to generate the alignment object
MultipleMcMain algorithm = new MultipleMcMain();
MultipleMcParameters params = (MultipleMcParameters) algorithm.getParameters();
params.setPairwiseAlgorithm(CeCPMain.algorithmName);

MultipleAlignment result = algorithm.align(atomArrays);
result.getEnsemble().setStructureNames(names);

//Information about the alignment
result.getEnsemble().setAlgorithmName(algorithm.getAlgorithmName());
result.getEnsemble().setVersion(algorithm.getVersion());

//Output the sequence alignment + transformations
System.out.println(MultipleAlignmentWriter.toFatCat(result));
//System.out.println(MultipleAlignmentWriter.toFASTA(result));
System.out.println(MultipleAlignmentWriter.toTransformMatrices(result));
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class BlockImpl extends AbstractScoresCache implements Serializable, Bloc
private int coreLength; //number of residues aligned without gaps (cache)

/**
* Constructor.
* Constructor. Links also the parent to this instance.
* @param blockSet the parent BlockSet of the BlockImpl instance.
* @return BlockImpl a BlockImpl instance linked to its parent BlockSet.
*/
Expand All @@ -41,7 +41,7 @@ public BlockImpl(BlockSet blockSet) {
public BlockImpl(BlockImpl b) {

this.parent = b.parent;
this.coreLength = b.coreLength;
this.coreLength = -1;

this.alignRes = null;
if (b.alignRes!=null){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import javax.vecmath.Matrix4d;

/**
* A general implementation of a BlockSet to store multiple alignments.
* A general implementation of a BlockSet to store flexible parts of a multiple alignments.
*
* @author Aleix Lafita
*
Expand All @@ -25,7 +25,7 @@ public class BlockSetImpl extends AbstractScoresCache implements Serializable, B
private int coreLength; //number of aligned positions without gaps (cache)

/**
* Constructor.
* Constructor. Links also the parent to this instance.
* @param multipleAlignment the parent MultipleAlignment of the BlockImpl instance.
* @return BlockSetImpl a BlockSetImpl instance linked to its parent MultipleAlignment.
*/
Expand All @@ -49,10 +49,18 @@ public BlockSetImpl(MultipleAlignment multipleAlignment) {
public BlockSetImpl(BlockSetImpl bs){

this.parent = bs.parent;
this.length = bs.length;
this.coreLength = bs.coreLength;
this.length = -1;
this.coreLength = -1;

this.pose = null; pose = null; //Because the pose is a cache variable it has to be updated/calculated again.
this.pose = null;
if (bs.pose != null){
//Make a deep copy of everything
this.pose = new ArrayList<Matrix4d>();
for (Matrix4d trans:bs.pose){
Matrix4d newTrans = (Matrix4d) trans.clone();
pose.add(newTrans);
}
}

blocks = null;
if (bs.blocks!=null){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,18 @@ public MultipleAlignmentImpl(MultipleAlignmentImpl ma) {
super(ma);

parent = ma.parent;
pose = null; //Because the pose is a cache variable it has to be updated/calculated again.
pose = null;
if (ma.pose != null){
//Make a deep copy of everything
this.pose = new ArrayList<Matrix4d>();
for (Matrix4d trans:ma.pose){
Matrix4d newTrans = (Matrix4d) trans.clone();
pose.add(newTrans);
}
}

length = -1;
coreLength = -1;

blockSets = null;
if (ma.blockSets!=null){
Expand Down
Loading