From khalil.elmazouari at gmail.com Tue May 3 11:56:21 2011 From: khalil.elmazouari at gmail.com (Khalil El Mazouari) Date: Tue, 3 May 2011 17:56:21 +0200 Subject: [Biojava-l] Global Alignmeent: Needle vs Biojava3 Message-ID: <50F4DA36-7308-4DCF-9833-54469B00C879@gmail.com> Hi is it possible to set an End gap penalty to false for Global alignment in biojava3. As you can see, the T in biojava3 GA is wrong. Needle gives correct result. In case of end gap penalty=true => same biojava3 result. Thanks khalil Biojava3 query MGWSWIFLFLLSGTAGVLSEVQLQQSGPELVKPGASVRMSCKSSGYIFDDFYMNWVRQSHGKSLDYIGYISPYSGVTGYNQKFKGKATLTVDKSSSTAYMELRSLTSEDSAVYYCAGSSGNKWAMDYWGHGASVTVSS target -------------------QVQLQQPGAELVKPGASVKLSCKASGYTF-----------------------------------------------------------------------------------------T Needle (Emboss) : End gap penalty = false query 1 MGWSWIFLFLLSGTAGVLSEVQLQQSGPELVKPGASVRMSCKSSGYIFDD 50 :|||||.|.|||||||||::|||:|||.|. target 1 -------------------QVQLQQPGAELVKPGASVKLSCKASGYTFT- 30 query 51 FYMNWVRQSHGKSLDYIGYISPYSGVTGYNQKFKGKATLTVDKSSSTAYM 100 target 30 -------------------------------------------------- 30 query 101 ELRSLTSEDSAVYYCAGSSGNKWAMDYWGHGASVTVSS 138 target 30 -------------------------------------- 30 From andreas at sdsc.edu Thu May 5 20:34:11 2011 From: andreas at sdsc.edu (Andreas Prlic) Date: Thu, 5 May 2011 17:34:11 -0700 Subject: [Biojava-l] Global Alignmeent: Needle vs Biojava3 In-Reply-To: <50F4DA36-7308-4DCF-9833-54469B00C879@gmail.com> References: <50F4DA36-7308-4DCF-9833-54469B00C879@gmail.com> Message-ID: Hi Khalil, I don't think you can set end gap penalties, currently. Andreas On Tue, May 3, 2011 at 8:56 AM, Khalil El Mazouari wrote: > Hi > > is it possible to set an End gap penalty to false for Global alignment in biojava3. > > As you can see, the T in biojava3 GA is wrong. > > Needle gives correct result. In case of end gap penalty=true => same biojava3 result. > > Thanks > > khalil > > > > Biojava3 > query ? MGWSWIFLFLLSGTAGVLSEVQLQQSGPELVKPGASVRMSCKSSGYIFDDFYMNWVRQSHGKSLDYIGYISPYSGVTGYNQKFKGKATLTVDKSSSTAYMELRSLTSEDSAVYYCAGSSGNKWAMDYWGHGASVTVSS > target ?-------------------QVQLQQPGAELVKPGASVKLSCKASGYTF-----------------------------------------------------------------------------------------T > > > > Needle (Emboss) : End gap penalty = false > query ? ? ? ? ? ? ?1 MGWSWIFLFLLSGTAGVLSEVQLQQSGPELVKPGASVRMSCKSSGYIFDD ? ? 50 > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?:|||||.|.|||||||||::|||:|||.|. > target ? ? ? ? ? ? 1 -------------------QVQLQQPGAELVKPGASVKLSCKASGYTFT- ? ? 30 > > query ? ? ? ? ? ? 51 FYMNWVRQSHGKSLDYIGYISPYSGVTGYNQKFKGKATLTVDKSSSTAYM ? ?100 > > target ? ? ? ? ? ?30 -------------------------------------------------- ? ? 30 > > query ? ? ? ? ? ?101 ELRSLTSEDSAVYYCAGSSGNKWAMDYWGHGASVTVSS ? ?138 > > target ? ? ? ? ? ?30 -------------------------------------- ? ? 30 > > > _______________________________________________ > Biojava-l mailing list ?- ?Biojava-l at lists.open-bio.org > http://lists.open-bio.org/mailman/listinfo/biojava-l > From tariq_cp at hotmail.com Mon May 9 01:20:00 2011 From: tariq_cp at hotmail.com (Muhammad Tariq Pervez) Date: Mon, 9 May 2011 05:20:00 +0000 Subject: [Biojava-l] An exception is being thrown while using the code related to phylogeny from BioJava cookbook Message-ID: Dear concerns, I want to develop an application for phylogenetic analysis. To get started, I took some lines of code from BioJava cookbook, modified them as per my requirement and have been trying to get the results for a few days but in vain. The code is as follows. package biojavademo; import java.io.File; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map.Entry; import org.biojava3.alignment.template.Profile; import org.biojava3.alignment.Alignments; import org.biojava3.alignment.template.AlignedSequence; import org.biojava3.core.sequence.MultipleSequenceAlignment; import org.biojava3.core.sequence.ProteinSequence; import org.biojava3.core.sequence.compound.AminoAcidCompound; import org.biojava3.core.sequence.io.FastaReaderHelper; import org.biojava3.core.sequence.template.Compound; import org.biojava3.core.sequence.template.Sequence; import org.biojava3.core.util.ConcurrencyTools; import org.biojava3.phylo.ProgessListenerStub; import org.biojava3.phylo.TreeConstructionAlgorithm; import org.biojava3.phylo.TreeConstructor; import org.biojava3.phylo.TreeType; public class MSA { MSA(){ multipleSequenceAlignment = new MultipleSequenceAlignment (); } public void multipleSequenceAlignment(List ids) throws Exception { List lst = new ArrayList(); for (String id : ids) { lst.add(getSequenceForId(id)); } profile = Alignments.getMultipleSequenceAlignment(lst); System.out.println("Compound == "+ profile.getCompoundSet()); seq=new ProteinSequence(profile.toString(),profile.getCompoundSet()); multipleSequenceAlignment.addAlignedSequence(seq); TreeConstructor treeConstructor = new TreeConstructor(multipleSequenceAlignment, TreeType.NJ, TreeConstructionAlgorithm.PID, new ProgessListenerStub()); treeConstructor.process(); String newick = treeConstructor.getNewickString(true, true); System.out.println("Clustalw:\n Multisequence Alignment\n"+ profile.toString(Profile.StringFormat.CLUSTALW)); System.out.println("Tree === "+ newick); ConcurrencyTools.shutdown(); } private static ProteinSequence getSequenceForId(String fileName) throws Exception { LinkedHashMap a = FastaReaderHelper.readFastaProteinSequence(new File(fileName)); String seqStr; ProteinSequence seq=null; for ( Entry entry : a.entrySet() ) { seqStr=entry.getValue().getSequenceAsString(); seq=new ProteinSequence(seqStr);//entry.getValue(); } return seq; } public Profile getMSAProfile(){ return profile; } Profile profile; MultipleSequenceAlignment multipleSequenceAlignment; ProteinSequence seq=null; } When I run this code the following exception is thrown Exception in thread "AWT-EventQueue-0" org.biojava3.core.exceptions.CompoundNotFoundError: Compound not found for: Cannot find compound for: at org.biojava3.core.sequence.storage.ArrayListSequenceReader.setContents(ArrayListSequenceReader.java:196) at org.biojava3.core.sequence.template.AbstractSequence.(AbstractSequence.java:88) at org.biojava3.core.sequence.ProteinSequence.(ProteinSequence.java:52) at biojavademo.MSA.multipleSequenceAlignment(MSA.java:41) at biojavademo.MSAJFrame.jButton2ActionPerformed(MSAJFrame.java:160) at biojavademo.MSAJFrame.access$100(MSAJFrame.java:27) at biojavademo.MSAJFrame$2.actionPerformed(MSAJFrame.java:72) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236) at java.awt.Component.processMouseEvent(Component.java:6038) at javax.swing.JComponent.processMouseEvent(JComponent.java:3265) at java.awt.Component.processEvent(Component.java:5803) at java.awt.Container.processEvent(Container.java:2058) at java.awt.Component.dispatchEventImpl(Component.java:4410) at java.awt.Container.dispatchEventImpl(Container.java:2116) at java.awt.Component.dispatchEvent(Component.java:4240) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916) at java.awt.Container.dispatchEventImpl(Container.java:2102) at java.awt.Window.dispatchEventImpl(Window.java:2429) at java.awt.Component.dispatchEvent(Component.java:4240) at java.awt.EventQueue.dispatchEvent(EventQueue.java:599) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160) at java.awt.EventDispatchThread.run(EventDispatchThread.java:121) Actually I don't know how to construct the multiple sequence alignment object which is given as a parameter while constructing the 'TreeConstructor' object. Kindly guide/help me to resolve this issue. Muhammad Tariq Pervez Ph.D (Scholar) - Bioinformatics, University of Veterinary and Animal Science, Lahore, Pakistan From andreas at sdsc.edu Mon May 9 20:13:01 2011 From: andreas at sdsc.edu (Andreas Prlic) Date: Mon, 9 May 2011 17:13:01 -0700 Subject: [Biojava-l] An exception is being thrown while using the code related to phylogeny from BioJava cookbook In-Reply-To: References: Message-ID: Hi Muhammad, did you see the Cookbook pages? Best to start with a simple example like http://biojava.org/wiki/BioJava:CookBook3:MSA I suspect there is something going wrong with your input file. Try to get the file parsing right first. E.g.: http://biojava.org/wiki/BioJava:CookBook:Core:FastaReadWrite Andreas On Sun, May 8, 2011 at 10:20 PM, Muhammad Tariq Pervez wrote: > Dear concerns, > I want to develop an application for phylogenetic analysis. To get started, > I took some lines of code from BioJava cookbook, modified them as per my > requirement and have been trying to get the results for a few days but in > vain. The code is as follows. > > > package biojavademo; > > > import java.io.File; > import java.util.ArrayList; > import java.util.LinkedHashMap; > import java.util.List; > import java.util.Map.Entry; > > import org.biojava3.alignment.template.Profile; > import org.biojava3.alignment.Alignments; > import org.biojava3.alignment.template.AlignedSequence; > import org.biojava3.core.sequence.MultipleSequenceAlignment; > import org.biojava3.core.sequence.ProteinSequence; > import org.biojava3.core.sequence.compound.AminoAcidCompound; > import org.biojava3.core.sequence.io.FastaReaderHelper; > import org.biojava3.core.sequence.template.Compound; > import org.biojava3.core.sequence.template.Sequence; > import org.biojava3.core.util.ConcurrencyTools; > import org.biojava3.phylo.ProgessListenerStub; > import org.biojava3.phylo.TreeConstructionAlgorithm; > import org.biojava3.phylo.TreeConstructor; > import org.biojava3.phylo.TreeType; > > public class MSA { > > > MSA(){ > multipleSequenceAlignment = new MultipleSequenceAlignment > (); > } > public void multipleSequenceAlignment(List ids) throws > Exception { > List lst = new ArrayList(); > > for (String id : ids) { > lst.add(getSequenceForId(id)); > > } > > profile = Alignments.getMultipleSequenceAlignment(lst); > System.out.println("Compound == "+ profile.getCompoundSet()); > seq=new > ProteinSequence(profile.toString(),profile.getCompoundSet()); > multipleSequenceAlignment.addAlignedSequence(seq); > TreeConstructor treeConstructor > = new TreeConstructor AminoAcidCompound>(multipleSequenceAlignment, TreeType.NJ, > TreeConstructionAlgorithm.PID, new ProgessListenerStub()); > treeConstructor.process(); > String newick = treeConstructor.getNewickString(true, true); > System.out.println("Clustalw:\n Multisequence Alignment\n"+ > profile.toString(Profile.StringFormat.CLUSTALW)); > System.out.println("Tree === "+ newick); > ConcurrencyTools.shutdown(); > } > > private static ProteinSequence getSequenceForId(String fileName) > throws Exception { > > LinkedHashMap a = > FastaReaderHelper.readFastaProteinSequence(new File(fileName)); > > String seqStr; > ProteinSequence seq=null; > for ( Entry entry : a.entrySet() ) { > seqStr=entry.getValue().getSequenceAsString(); > seq=new ProteinSequence(seqStr);//entry.getValue(); > > } > return seq; > } > public Profile getMSAProfile(){ > return profile; > } > > Profile profile; > MultipleSequenceAlignment > multipleSequenceAlignment; > ProteinSequence seq=null; > } > > When I run this code the following exception is thrown > > Exception in thread "AWT-EventQueue-0" > org.biojava3.core.exceptions.CompoundNotFoundError: Compound not found for: > Cannot find compound for: > at > org.biojava3.core.sequence.storage.ArrayListSequenceReader.setContents(ArrayListSequenceReader.java:196) > at > org.biojava3.core.sequence.template.AbstractSequence.(AbstractSequence.java:88) > at > org.biojava3.core.sequence.ProteinSequence.(ProteinSequence.java:52) > at biojavademo.MSA.multipleSequenceAlignment(MSA.java:41) > at > biojavademo.MSAJFrame.jButton2ActionPerformed(MSAJFrame.java:160) > at biojavademo.MSAJFrame.access$100(MSAJFrame.java:27) > at biojavademo.MSAJFrame$2.actionPerformed(MSAJFrame.java:72) > at > javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995) > at > javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318) > at > javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387) > at > javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242) > at > javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236) > at java.awt.Component.processMouseEvent(Component.java:6038) > at javax.swing.JComponent.processMouseEvent(JComponent.java:3265) > at java.awt.Component.processEvent(Component.java:5803) > at java.awt.Container.processEvent(Container.java:2058) > at java.awt.Component.dispatchEventImpl(Component.java:4410) > at java.awt.Container.dispatchEventImpl(Container.java:2116) > at java.awt.Component.dispatchEvent(Component.java:4240) > at > java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322) > at > java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986) > at > java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916) > at java.awt.Container.dispatchEventImpl(Container.java:2102) > at java.awt.Window.dispatchEventImpl(Window.java:2429) > at java.awt.Component.dispatchEvent(Component.java:4240) > at java.awt.EventQueue.dispatchEvent(EventQueue.java:599) > at > java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273) > at > java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183) > at > java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173) > at > java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168) > at > java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160) > at java.awt.EventDispatchThread.run(EventDispatchThread.java:121) > > Actually I don't know how to construct the multiple sequence alignment > object which is given as a parameter while constructing the > 'TreeConstructor' object. > > Kindly guide/help me to resolve this issue. > > > Muhammad Tariq Pervez > Ph.D (Scholar) - Bioinformatics, > University of Veterinary and Animal Science, Lahore, Pakistan > > > > > From tariq_cp at hotmail.com Wed May 11 02:00:24 2011 From: tariq_cp at hotmail.com (Muhammad Tariq Pervez) Date: Wed, 11 May 2011 06:00:24 +0000 Subject: [Biojava-l] Biojava-l Digest, Vol 100, Issue 4 In-Reply-To: References: Message-ID: Dear Andreas, now I took code from BioJavaCookbook as it is and tried again to create the tree but in vain. Problem is not with http://biojava.org/wiki/BioJava:CookBook3:MSA and http://biojava.org/wiki/BioJava:CookBook:Core:FastaReadWrite. Files are read and MSA is performed successfully but problem is faced when the code to build the tree is reached. Problem is how to get MultipleSequenceAlignment object to be used in the phylo module from the Profile object used in the alignment module. Kindly help me. The following exception is thrown and code is given below of this exception. Best Regards. Exception in thread "AWT-EventQueue-0" org.biojava3.core.exceptions.CompoundNotFoundError: Compound not found for: Cannot find compound for: at org.biojava3.core.sequence.storage.ArrayListSequenceReader.setContents(ArrayListSequenceReader.java:196) at org.biojava3.core.sequence.template.AbstractSequence.(AbstractSequence.java:88) at org.biojava3.core.sequence.ProteinSequence.(ProteinSequence.java:52) at biojavademo.MSA.multipleSequenceAlignment(MSA.java:41) at biojavademo.MSAJFrame.jButton2ActionPerformed(MSAJFrame.java:160) at biojavademo.MSAJFrame.access$100(MSAJFrame.java:27) at biojavademo.MSAJFrame$2.actionPerformed(MSAJFrame.java:72) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236) at java.awt.Component.processMouseEvent(Component.java:6038) at javax.swing.JComponent.processMouseEvent(JComponent.java:3265) at java.awt.Component.processEvent(Component.java:5803) at java.awt.Container.processEvent(Container.java:2058) at java.awt.Component.dispatchEventImpl(Component.java:4410) at java.awt.Container.dispatchEventImpl(Container.java:2116) at java.awt.Component.dispatchEvent(Component.java:4240) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916) at java.awt.Container.dispatchEventImpl(Container.java:2102) at java.awt.Window.dispatchEventImpl(Window.java:2429) at java.awt.Component.dispatchEvent(Component.java:4240) at java.awt.EventQueue.dispatchEvent(EventQueue.java:599) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160) at java.awt.EventDispatchThread.run(EventDispatchThread.java:121) package biojavademo; import java.net.URL; import java.util.ArrayList; import java.util.List; import org.biojava3.alignment.template.Profile; import org.biojava3.alignment.Alignments; import org.biojava3.core.sequence.MultipleSequenceAlignment; import org.biojava3.core.sequence.ProteinSequence; import org.biojava3.core.sequence.compound.AminoAcidCompound; import org.biojava3.core.sequence.io.FastaReaderHelper; import org.biojava3.core.util.ConcurrencyTools; import org.biojava3.phylo.ProgessListenerStub; import org.biojava3.phylo.TreeConstructionAlgorithm; import org.biojava3.phylo.TreeConstructor; import org.biojava3.phylo.TreeType; public class MSA { MSA(){ multipleSequenceAlignment = new MultipleSequenceAlignment (); } public void multipleSequenceAlignment() throws Exception { String[] ids = new String[] {"Q21691", "Q21495", "O48771"}; try { multipleSequenceAlignment(ids); } catch (Exception e){ e.printStackTrace(); } } private void multipleSequenceAlignment(String[] ids) throws Exception { List lst = new ArrayList(); for (String id : ids) { lst.add(getSequenceForId(id)); } Profile profile = Alignments.getMultipleSequenceAlignment(lst); System.out.printf("Clustalw:%n%s%n", profile); ProteinSequence seq=new ProteinSequence(profile.toString()); multipleSequenceAlignment.addAlignedSequence(seq); TreeConstructor treeConstructor = new TreeConstructor(multipleSequenceAlignment, TreeType.NJ, TreeConstructionAlgorithm.PID, new ProgessListenerStub()); treeConstructor.process(); String newick = treeConstructor.getNewickString(true, true); ConcurrencyTools.shutdown(); } private static ProteinSequence getSequenceForId(String uniProtId) throws Exception { URL uniprotFasta = new URL(String.format("http://www.uniprot.org/uniprot/%s.fasta", uniProtId)); ProteinSequence seq = FastaReaderHelper.readFastaProteinSequence(uniprotFasta.openStream()).get(uniProtId); System.out.printf("id : %s %s%n%s%n", uniProtId, seq, seq.getOriginalHeader()); return seq; } Muhammad Tariq Pervez Ph.D (Scholar) - Bioinformatics, University of Veterinary and Animal Science, Lahore, Pakistan > From: biojava-l-request at lists.open-bio.org > Subject: Biojava-l Digest, Vol 100, Issue 4 > To: biojava-l at lists.open-bio.org > Date: Tue, 10 May 2011 12:00:04 -0400 > > Send Biojava-l mailing list submissions to > biojava-l at lists.open-bio.org > > To subscribe or unsubscribe via the World Wide Web, visit > http://lists.open-bio.org/mailman/listinfo/biojava-l > or, via email, send a message with subject or body 'help' to > biojava-l-request at lists.open-bio.org > > You can reach the person managing the list at > biojava-l-owner at lists.open-bio.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Biojava-l digest..." > > > Today's Topics: > > 1. Re: An exception is being thrown while using the code related > to phylogeny from BioJava cookbook (Andreas Prlic) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Mon, 9 May 2011 17:13:01 -0700 > From: Andreas Prlic > Subject: Re: [Biojava-l] An exception is being thrown while using the > code related to phylogeny from BioJava cookbook > To: Muhammad Tariq Pervez > Cc: biojava-l at lists.open-bio.org > Message-ID: > Content-Type: text/plain; charset=ISO-8859-1 > > Hi Muhammad, > > did you see the Cookbook pages? > > Best to start with a simple example like > http://biojava.org/wiki/BioJava:CookBook3:MSA > > I suspect there is something going wrong with your input file. Try to get > the file parsing right first. E.g.: > http://biojava.org/wiki/BioJava:CookBook:Core:FastaReadWrite > > Andreas > > > On Sun, May 8, 2011 at 10:20 PM, Muhammad Tariq Pervez > wrote: > > > Dear concerns, > > I want to develop an application for phylogenetic analysis. To get started, > > I took some lines of code from BioJava cookbook, modified them as per my > > requirement and have been trying to get the results for a few days but in > > vain. The code is as follows. > > > > > > package biojavademo; > > > > > > import java.io.File; > > import java.util.ArrayList; > > import java.util.LinkedHashMap; > > import java.util.List; > > import java.util.Map.Entry; > > > > import org.biojava3.alignment.template.Profile; > > import org.biojava3.alignment.Alignments; > > import org.biojava3.alignment.template.AlignedSequence; > > import org.biojava3.core.sequence.MultipleSequenceAlignment; > > import org.biojava3.core.sequence.ProteinSequence; > > import org.biojava3.core.sequence.compound.AminoAcidCompound; > > import org.biojava3.core.sequence.io.FastaReaderHelper; > > import org.biojava3.core.sequence.template.Compound; > > import org.biojava3.core.sequence.template.Sequence; > > import org.biojava3.core.util.ConcurrencyTools; > > import org.biojava3.phylo.ProgessListenerStub; > > import org.biojava3.phylo.TreeConstructionAlgorithm; > > import org.biojava3.phylo.TreeConstructor; > > import org.biojava3.phylo.TreeType; > > > > public class MSA { > > > > > > MSA(){ > > multipleSequenceAlignment = new MultipleSequenceAlignment > > (); > > } > > public void multipleSequenceAlignment(List ids) throws > > Exception { > > List lst = new ArrayList(); > > > > for (String id : ids) { > > lst.add(getSequenceForId(id)); > > > > } > > > > profile = Alignments.getMultipleSequenceAlignment(lst); > > System.out.println("Compound == "+ profile.getCompoundSet()); > > seq=new > > ProteinSequence(profile.toString(),profile.getCompoundSet()); > > multipleSequenceAlignment.addAlignedSequence(seq); > > TreeConstructor treeConstructor > > = new TreeConstructor > AminoAcidCompound>(multipleSequenceAlignment, TreeType.NJ, > > TreeConstructionAlgorithm.PID, new ProgessListenerStub()); > > treeConstructor.process(); > > String newick = treeConstructor.getNewickString(true, true); > > System.out.println("Clustalw:\n Multisequence Alignment\n"+ > > profile.toString(Profile.StringFormat.CLUSTALW)); > > System.out.println("Tree === "+ newick); > > ConcurrencyTools.shutdown(); > > } > > > > private static ProteinSequence getSequenceForId(String fileName) > > throws Exception { > > > > LinkedHashMap a = > > FastaReaderHelper.readFastaProteinSequence(new File(fileName)); > > > > String seqStr; > > ProteinSequence seq=null; > > for ( Entry entry : a.entrySet() ) { > > seqStr=entry.getValue().getSequenceAsString(); > > seq=new ProteinSequence(seqStr);//entry.getValue(); > > > > } > > return seq; > > } > > public Profile getMSAProfile(){ > > return profile; > > } > > > > Profile profile; > > MultipleSequenceAlignment > > multipleSequenceAlignment; > > ProteinSequence seq=null; > > } > > > > When I run this code the following exception is thrown > > > > Exception in thread "AWT-EventQueue-0" > > org.biojava3.core.exceptions.CompoundNotFoundError: Compound not found for: > > Cannot find compound for: > > at > > org.biojava3.core.sequence.storage.ArrayListSequenceReader.setContents(ArrayListSequenceReader.java:196) > > at > > org.biojava3.core.sequence.template.AbstractSequence.(AbstractSequence.java:88) > > at > > org.biojava3.core.sequence.ProteinSequence.(ProteinSequence.java:52) > > at biojavademo.MSA.multipleSequenceAlignment(MSA.java:41) > > at > > biojavademo.MSAJFrame.jButton2ActionPerformed(MSAJFrame.java:160) > > at biojavademo.MSAJFrame.access$100(MSAJFrame.java:27) > > at biojavademo.MSAJFrame$2.actionPerformed(MSAJFrame.java:72) > > at > > javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995) > > at > > javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318) > > at > > javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387) > > at > > javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242) > > at > > javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236) > > at java.awt.Component.processMouseEvent(Component.java:6038) > > at javax.swing.JComponent.processMouseEvent(JComponent.java:3265) > > at java.awt.Component.processEvent(Component.java:5803) > > at java.awt.Container.processEvent(Container.java:2058) > > at java.awt.Component.dispatchEventImpl(Component.java:4410) > > at java.awt.Container.dispatchEventImpl(Container.java:2116) > > at java.awt.Component.dispatchEvent(Component.java:4240) > > at > > java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322) > > at > > java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986) > > at > > java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916) > > at java.awt.Container.dispatchEventImpl(Container.java:2102) > > at java.awt.Window.dispatchEventImpl(Window.java:2429) > > at java.awt.Component.dispatchEvent(Component.java:4240) > > at java.awt.EventQueue.dispatchEvent(EventQueue.java:599) > > at > > java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273) > > at > > java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183) > > at > > java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173) > > at > > java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168) > > at > > java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160) > > at java.awt.EventDispatchThread.run(EventDispatchThread.java:121) > > > > Actually I don't know how to construct the multiple sequence alignment > > object which is given as a parameter while constructing the > > 'TreeConstructor' object. > > > > Kindly guide/help me to resolve this issue. > > > > > > Muhammad Tariq Pervez > > Ph.D (Scholar) - Bioinformatics, > > University of Veterinary and Animal Science, Lahore, Pakistan > > > > > > > > > > > > > ------------------------------ > > _______________________________________________ > Biojava-l mailing list - Biojava-l at lists.open-bio.org > http://lists.open-bio.org/mailman/listinfo/biojava-l > > > End of Biojava-l Digest, Vol 100, Issue 4 > ***************************************** From jayunit100 at gmail.com Wed May 11 17:42:15 2011 From: jayunit100 at gmail.com (Jay Vyas) Date: Wed, 11 May 2011 17:42:15 -0400 Subject: [Biojava-l] Group to AminoAcid ? Message-ID: Hi Everyone : Im trying to convert a "Group" to an "AminoAcid" in biojava, so that I can use the "getPhi()" "getPsi()" on my protein. My input is just a Chain of Groups (typical pdb structure). I figured maybe I could make one using the AminoAcid constructor, so I tried //Group g new AminoAcidImpl(g) but of course, this isnt in the api. Any ideas ? From andreas at sdsc.edu Wed May 11 19:23:46 2011 From: andreas at sdsc.edu (Andreas Prlic) Date: Wed, 11 May 2011 16:23:46 -0700 Subject: [Biojava-l] Group to AminoAcid ? In-Reply-To: References: Message-ID: Hi Jay, you could do this: if ( group instanceof AminoAcid ) { AminoAcid aa = (AminoAcid) group; } A On Wed, May 11, 2011 at 2:42 PM, Jay Vyas wrote: > Hi Everyone : Im trying to convert a "Group" to an "AminoAcid" in biojava, > so that I can use the "getPhi()" "getPsi()" on my protein. My input is > just > a Chain of Groups (typical pdb structure). > > I figured maybe I could make one using the AminoAcid constructor, so I > tried > > //Group g > new AminoAcidImpl(g) > > but of course, this isnt in the api. > > Any ideas ? > _______________________________________________ > Biojava-l mailing list - Biojava-l at lists.open-bio.org > http://lists.open-bio.org/mailman/listinfo/biojava-l > From andreas at sdsc.edu Wed May 11 23:09:35 2011 From: andreas at sdsc.edu (Andreas Prlic) Date: Wed, 11 May 2011 20:09:35 -0700 Subject: [Biojava-l] Biojava-l Digest, Vol 100, Issue 4 In-Reply-To: References: Message-ID: Hi Muhammad, I am not sure how to convert a profile from the alignment module into a sequence alignment that can be used in the phylo module. Perhaps Andy, Scooter, or Mark have a suggestion on that? It would be good if there was a convenience method for that. Looking at your code it seems you are doing a profile.toString() when creating the ProteinSequence. This seems wrong, since you would dump the whole alignment representation into a single sequence object. I suspect a better approach would be to get an aligned sequence from the profile and use that instead, however I have never tried that myself... Perhaps one of the over developers has a better suggestion here? Andreas On Tue, May 10, 2011 at 11:00 PM, Muhammad Tariq Pervez < tariq_cp at hotmail.com> wrote: > > > > Dear Andreas, now I took code from BioJavaCookbook as it is and tried again > to create the tree but in vain. Problem is not with > http://biojava.org/wiki/BioJava:CookBook3:MSA and > http://biojava.org/wiki/BioJava:CookBook:Core:FastaReadWrite. Files are > read and MSA is performed successfully but problem is faced when the code to > build the tree is reached. > > Problem is how to get MultipleSequenceAlignment object to be used in the > phylo module from the Profile object used in the alignment module. > > > > > > > Kindly help me. > > The following exception is thrown and code is given below of this > exception. > > Best Regards. > > > Exception in thread "AWT-EventQueue-0" > org.biojava3.core.exceptions.CompoundNotFoundError: Compound not found > for: Cannot find compound for: > > at > org.biojava3.core.sequence.storage.ArrayListSequenceReader.setContents(ArrayListSequenceReader.java:196) > at > org.biojava3.core.sequence.template.AbstractSequence.(AbstractSequence.java:88) > > > > > at > org.biojava3.core.sequence.ProteinSequence.(ProteinSequence.java:52) > at biojavademo.MSA.multipleSequenceAlignment(MSA.java:41) > at biojavademo.MSAJFrame.jButton2ActionPerformed(MSAJFrame.java:160) > > > > > at biojavademo.MSAJFrame.access$100(MSAJFrame.java:27) > at biojavademo.MSAJFrame$2.actionPerformed(MSAJFrame.java:72) > at > javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995) > > > > > at > javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318) > at > javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387) > at > javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242) > > > > > at > javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236) > at java.awt.Component.processMouseEvent(Component.java:6038) > at javax.swing.JComponent.processMouseEvent(JComponent.java:3265) > > > > > at java.awt.Component.processEvent(Component.java:5803) > at java.awt.Container.processEvent(Container.java:2058) > at java.awt.Component.dispatchEventImpl(Component.java:4410) > at java.awt.Container.dispatchEventImpl(Container.java:2116) > > > > > at java.awt.Component.dispatchEvent(Component.java:4240) > at > java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322) > at > java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986) > > > > > at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916) > at java.awt.Container.dispatchEventImpl(Container.java:2102) > at java.awt.Window.dispatchEventImpl(Window.java:2429) > at java.awt.Component.dispatchEvent(Component.java:4240) > > > > > at java.awt.EventQueue.dispatchEvent(EventQueue.java:599) > at > java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273) > at > java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183) > > > > > at > java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173) > at > java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168) > at > java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160) > > > > > at java.awt.EventDispatchThread.run(EventDispatchThread.java:121) > > > package biojavademo; > > > import java.net.URL; > import java.util.ArrayList; > import java.util.List; > > > import org.biojava3.alignment.template.Profile; > import org.biojava3.alignment.Alignments; > import org.biojava3.core.sequence.MultipleSequenceAlignment; > import org.biojava3.core.sequence.ProteinSequence; > > > > import org.biojava3.core.sequence.compound.AminoAcidCompound; > import org.biojava3.core.sequence.io.FastaReaderHelper; > import org.biojava3.core.util.ConcurrencyTools; > import org.biojava3.phylo.ProgessListenerStub; > > > > import org.biojava3.phylo.TreeConstructionAlgorithm; > import org.biojava3.phylo.TreeConstructor; > import org.biojava3.phylo.TreeType; > > public class MSA { > > > MSA(){ > multipleSequenceAlignment = new MultipleSequenceAlignment > (); > > > > } > public void multipleSequenceAlignment() throws Exception { > String[] ids = new String[] {"Q21691", "Q21495", "O48771"}; > try { > multipleSequenceAlignment(ids); > > > > } catch (Exception e){ > e.printStackTrace(); > } > } > > private void multipleSequenceAlignment(String[] ids) throws Exception { > List lst = new ArrayList(); > > > > for (String id : ids) { > lst.add(getSequenceForId(id)); > } > Profile profile = > Alignments.getMultipleSequenceAlignment(lst); > System.out.printf("Clustalw:%n%s%n", profile); > > > > > ProteinSequence seq=new ProteinSequence(profile.toString()); > multipleSequenceAlignment.addAlignedSequence(seq); > > TreeConstructor > treeConstructor = new TreeConstructor AminoAcidCompound>(multipleSequenceAlignment, TreeType.NJ, > TreeConstructionAlgorithm.PID, new ProgessListenerStub()); > > > > treeConstructor.process(); > String newick = treeConstructor.getNewickString(true, true); > ConcurrencyTools.shutdown(); > } > > private static ProteinSequence getSequenceForId(String uniProtId) throws > Exception { > > > > URL uniprotFasta = new URL(String.format(" > http://www.uniprot.org/uniprot/%s.fasta", uniProtId)); > ProteinSequence seq = > FastaReaderHelper.readFastaProteinSequence(uniprotFasta.openStream()).get(uniProtId); > > > > System.out.printf("id : %s %s%n%s%n", uniProtId, seq, > seq.getOriginalHeader()); > return seq; > } > > Muhammad Tariq Pervez > > Ph.D (Scholar) - Bioinformatics, > University of Veterinary and Animal Science, Lahore, Pakistan > > > > > > From: biojava-l-request at lists.open-bio.org > > Subject: Biojava-l Digest, Vol 100, Issue 4 > > To: biojava-l at lists.open-bio.org > > Date: Tue, 10 May 2011 12:00:04 -0400 > > > > Send Biojava-l mailing list submissions to > > biojava-l at lists.open-bio.org > > > > To subscribe or unsubscribe via the World Wide Web, visit > > http://lists.open-bio.org/mailman/listinfo/biojava-l > > or, via email, send a message with subject or body 'help' to > > biojava-l-request at lists.open-bio.org > > > > You can reach the person managing the list at > > biojava-l-owner at lists.open-bio.org > > > > When replying, please edit your Subject line so it is more specific > > than "Re: Contents of Biojava-l digest..." > > > > > > Today's Topics: > > > > 1. Re: An exception is being thrown while using the code related > > to phylogeny from BioJava cookbook (Andreas Prlic) > > > > > > ---------------------------------------------------------------------- > > > > Message: 1 > > Date: Mon, 9 May 2011 17:13:01 -0700 > > From: Andreas Prlic > > Subject: Re: [Biojava-l] An exception is being thrown while using the > > code related to phylogeny from BioJava cookbook > > To: Muhammad Tariq Pervez > > Cc: biojava-l at lists.open-bio.org > > Message-ID: > > Content-Type: text/plain; charset=ISO-8859-1 > > > > Hi Muhammad, > > > > did you see the Cookbook pages? > > > > Best to start with a simple example like > > http://biojava.org/wiki/BioJava:CookBook3:MSA > > > > I suspect there is something going wrong with your input file. Try to > get > > the file parsing right first. E.g.: > > http://biojava.org/wiki/BioJava:CookBook:Core:FastaReadWrite > > > > Andreas > > > > > > On Sun, May 8, 2011 at 10:20 PM, Muhammad Tariq Pervez < > tariq_cp at hotmail.com > > > wrote: > > > > > Dear concerns, > > > I want to develop an application for phylogenetic analysis. To get > started, > > > I took some lines of code from BioJava cookbook, modified them as per > my > > > requirement and have been trying to get the results for a few days but > in > > > vain. The code is as follows. > > > > > > > > > package biojavademo; > > > > > > > > > import java.io.File; > > > import java.util.ArrayList; > > > import java.util.LinkedHashMap; > > > import java.util.List; > > > import java.util.Map.Entry; > > > > > > import org.biojava3.alignment.template.Profile; > > > import org.biojava3.alignment.Alignments; > > > import org.biojava3.alignment.template.AlignedSequence; > > > import org.biojava3.core.sequence.MultipleSequenceAlignment; > > > import org.biojava3.core.sequence.ProteinSequence; > > > import org.biojava3.core.sequence.compound.AminoAcidCompound; > > > import org.biojava3.core.sequence.io.FastaReaderHelper; > > > import org.biojava3.core.sequence.template.Compound; > > > import org.biojava3.core.sequence.template.Sequence; > > > import org.biojava3.core.util.ConcurrencyTools; > > > import org.biojava3.phylo.ProgessListenerStub; > > > import org.biojava3.phylo.TreeConstructionAlgorithm; > > > import org.biojava3.phylo.TreeConstructor; > > > import org.biojava3.phylo.TreeType; > > > > > > public class MSA { > > > > > > > > > MSA(){ > > > multipleSequenceAlignment = new MultipleSequenceAlignment > > > (); > > > } > > > public void multipleSequenceAlignment(List ids) throws > > > Exception { > > > List lst = new ArrayList(); > > > > > > for (String id : ids) { > > > lst.add(getSequenceForId(id)); > > > > > > } > > > > > > profile = Alignments.getMultipleSequenceAlignment(lst); > > > System.out.println("Compound == "+ profile.getCompoundSet()); > > > seq=new > > > ProteinSequence(profile.toString(),profile.getCompoundSet()); > > > multipleSequenceAlignment.addAlignedSequence(seq); > > > TreeConstructor > treeConstructor > > > = new TreeConstructor > > AminoAcidCompound>(multipleSequenceAlignment, TreeType.NJ, > > > TreeConstructionAlgorithm.PID, new ProgessListenerStub()); > > > treeConstructor.process(); > > > String newick = treeConstructor.getNewickString(true, true); > > > System.out.println("Clustalw:\n Multisequence Alignment\n"+ > > > profile.toString(Profile.StringFormat.CLUSTALW)); > > > System.out.println("Tree === "+ newick); > > > ConcurrencyTools.shutdown(); > > > } > > > > > > private static ProteinSequence getSequenceForId(String fileName) > > > throws Exception { > > > > > > LinkedHashMap a = > > > FastaReaderHelper.readFastaProteinSequence(new File(fileName)); > > > > > > String seqStr; > > > ProteinSequence seq=null; > > > for ( Entry entry : a.entrySet() ) { > > > seqStr=entry.getValue().getSequenceAsString(); > > > seq=new > ProteinSequence(seqStr);//entry.getValue(); > > > > > > } > > > return seq; > > > } > > > public Profile getMSAProfile(){ > > > return profile; > > > } > > > > > > Profile profile; > > > MultipleSequenceAlignment > > > multipleSequenceAlignment; > > > ProteinSequence seq=null; > > > } > > > > > > When I run this code the following exception is thrown > > > > > > Exception in thread "AWT-EventQueue-0" > > > org.biojava3.core.exceptions.CompoundNotFoundError: Compound not found > for: > > > Cannot find compound for: > > > at > > > > org.biojava3.core.sequence.storage.ArrayListSequenceReader.setContents(ArrayListSequenceReader.java:196) > > > at > > > > org.biojava3.core.sequence.template.AbstractSequence.(AbstractSequence.java:88) > > > at > > > > org.biojava3.core.sequence.ProteinSequence.(ProteinSequence.java:52) > > > at biojavademo.MSA.multipleSequenceAlignment(MSA.java:41) > > > at > > > biojavademo.MSAJFrame.jButton2ActionPerformed(MSAJFrame.java:160) > > > at biojavademo.MSAJFrame.access$100(MSAJFrame.java:27) > > > at biojavademo.MSAJFrame$2.actionPerformed(MSAJFrame.java:72) > > > at > > > > javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995) > > > at > > > > javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318) > > > at > > > > javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387) > > > at > > > javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242) > > > at > > > > javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236) > > > at java.awt.Component.processMouseEvent(Component.java:6038) > > > at > javax.swing.JComponent.processMouseEvent(JComponent.java:3265) > > > at java.awt.Component.processEvent(Component.java:5803) > > > at java.awt.Container.processEvent(Container.java:2058) > > > at java.awt.Component.dispatchEventImpl(Component.java:4410) > > > at java.awt.Container.dispatchEventImpl(Container.java:2116) > > > at java.awt.Component.dispatchEvent(Component.java:4240) > > > at > > > java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322) > > > at > > > java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986) > > > at > > > java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916) > > > at java.awt.Container.dispatchEventImpl(Container.java:2102) > > > at java.awt.Window.dispatchEventImpl(Window.java:2429) > > > at java.awt.Component.dispatchEvent(Component.java:4240) > > > at java.awt.EventQueue.dispatchEvent(EventQueue.java:599) > > > at > > > > java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273) > > > at > > > > java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183) > > > at > > > > java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173) > > > at > > > java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168) > > > at > > > java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160) > > > at > java.awt.EventDispatchThread.run(EventDispatchThread.java:121) > > > > > > Actually I don't know how to construct the multiple sequence alignment > > > object which is given as a parameter while constructing the > > > 'TreeConstructor' object. > > > > > > Kindly guide/help me to resolve this issue. > > > > > > > > > Muhammad Tariq Pervez > > > Ph.D (Scholar) - Bioinformatics, > > > University of Veterinary and Animal Science, Lahore, Pakistan > > > > > > > > > > > > > > > > > > > > > ------------------------------ > > > > _______________________________________________ > > Biojava-l mailing list - Biojava-l at lists.open-bio.org > > http://lists.open-bio.org/mailman/listinfo/biojava-l > > > > > > End of Biojava-l Digest, Vol 100, Issue 4 > > ***************************************** > > _______________________________________________ > Biojava-l mailing list - Biojava-l at lists.open-bio.org > http://lists.open-bio.org/mailman/listinfo/biojava-l > From benjamin.pavie at gmail.com Wed May 18 18:30:18 2011 From: benjamin.pavie at gmail.com (Benjamin Pavie) Date: Wed, 18 May 2011 17:30:18 -0500 Subject: [Biojava-l] Reading the abi format using Biojava 3.x Message-ID: Hi Everybody, I tried to find an answer on the wiki but I couldn't find it. Is there a way to read the abi file format (like in this example http://www.biojava.org/wiki/BioJava:Cookbook:SeqIO:ABItoSequence ) but using the version 3.x of Biojava? I couldn't find the class ABITrace anymore in this API. And if it exist, in which module would it be (biojava3-core, biojava3-alignment, biojava3-genome, biojava3-structure, biojava3-structure-gui, biojava3-phylo, biojava3-protmod or biojava3-ws) ? And if the API change is it possible to have a example on how to do the same things as the example provided in http://www.biojava.org/wiki/BioJava:Cookbook:SeqIO:ABItoSequence ? Benjamin From andreas at sdsc.edu Wed May 18 20:29:19 2011 From: andreas at sdsc.edu (Andreas Prlic) Date: Wed, 18 May 2011 17:29:19 -0700 Subject: [Biojava-l] Reading the abi format using Biojava 3.x In-Reply-To: References: Message-ID: Hi Benjamin, I tried to find an answer on the wiki but I couldn't find it. Is there a way to read the abi file format (like in this example > http://www.biojava.org/wiki/BioJava:Cookbook:SeqIO:ABItoSequence ) but > using > the version 3.x of Biojava? > you need to use BioJava 1.8 for this. Andreas I couldn't find the class ABITrace anymore in this API. And if it exist, in > which module would it be > (biojava3-core, biojava3-alignment, biojava3-genome, > biojava3-structure, biojava3-structure-gui, biojava3-phylo, > biojava3-protmod > or biojava3-ws) ? > And if the API change is it possible to have a example on how to do the > same > things as the example provided in > http://www.biojava.org/wiki/BioJava:Cookbook:SeqIO:ABItoSequence ? > > Benjamin > _______________________________________________ > Biojava-l mailing list - Biojava-l at lists.open-bio.org > http://lists.open-bio.org/mailman/listinfo/biojava-l > From shirleyh at gmail.com Fri May 27 11:53:23 2011 From: shirleyh at gmail.com (Shirley Hui) Date: Fri, 27 May 2011 11:53:23 -0400 Subject: [Biojava-l] DNATools lower case? Message-ID: Hi, I am using DNATools to generate dna Sequences. I noticed that the static methods in DNATools a(),c(),t(),g() map to lower case characters. I am using using DistributionLogo class to draw sequences logos for a set of dna Sequences. I think DistributionLogo is calling the static methods to map the nucleotides which is lower case. But I want the logo output the nucleotides in uppercase. How can I do this? Thanks for your help shirley From gwaldon at geneinfinity.org Fri May 27 12:15:18 2011 From: gwaldon at geneinfinity.org (George Waldon) Date: Fri, 27 May 2011 11:15:18 -0500 Subject: [Biojava-l] DNATools lower case? In-Reply-To: References: Message-ID: <20110527111518.81163axdepe9fm04@gator1273.hostgator.com> Hello Shirley, I think you need to use AlternateTokenisation at some point; check BJ1.8.1 Cookbook at http://www.biojava.org/wiki/BioJava:Cookbook:Sequence regards, George Quoting Shirley Hui : > Hi, > I am using DNATools to generate dna Sequences. > I noticed that the static methods in DNATools a(),c(),t(),g() map to lower > case characters. > I am using using DistributionLogo class to draw sequences logos for a set of > dna Sequences. > I think DistributionLogo is calling the static methods to map the > nucleotides which is lower case. > But I want the logo output the nucleotides in uppercase. How can I do this? > Thanks for your help > shirley > _______________________________________________ > Biojava-l mailing list - Biojava-l at lists.open-bio.org > http://lists.open-bio.org/mailman/listinfo/biojava-l > From shirleyh at gmail.com Fri May 27 12:53:46 2011 From: shirleyh at gmail.com (Shirley Hui) Date: Fri, 27 May 2011 12:53:46 -0400 Subject: [Biojava-l] DNATools lower case? In-Reply-To: <20110527111518.81163axdepe9fm04@gator1273.hostgator.com> References: <20110527111518.81163axdepe9fm04@gator1273.hostgator.com> Message-ID: Thanks George. It looks like using alternate tokenization works if you are "stringifying" a Sequence explicitly using the alphabet.getTokenization() method. But presumably this gets done within the DistributionLogo class or some other class down the line and I don't want to modify any Biojava classes unless I really have to. The way I am constructing the DNA sequences is like this: Sequences seq =DNATools.createDNASequence(sequence, name); The list sequences is used to make a SimpleWeightMatrix wm. Then the call to DistributionLogo is like this: Distribution dist = wm.getColumn(columnNumber); DistributionLogo dl = new DistributionLogo(); dl.setRenderingHints(hints); dl.setOpaque(false); dl.setDistribution(dist); dl.setPreferredSize(new Dimension((int) columnWidth, (int) columnHeight)); dl.setLogoPainter(new TextLogoPainter()); dl.setStyle(symbolColorStyle); There no way that I can tell right now in the DNATools API to make the DNATools use the alternate string tokenization via the call to createDNASequence() or another type of set method? shirley On Fri, May 27, 2011 at 12:15 PM, George Waldon wrote: > Hello Shirley, > > I think you need to use AlternateTokenisation at some point; check BJ1.8.1 > Cookbook at http://www.biojava.org/wiki/BioJava:Cookbook:Sequence > > regards, > > George > > > Quoting Shirley Hui : > > Hi, >> I am using DNATools to generate dna Sequences. >> I noticed that the static methods in DNATools a(),c(),t(),g() map to lower >> case characters. >> I am using using DistributionLogo class to draw sequences logos for a set >> of >> dna Sequences. >> I think DistributionLogo is calling the static methods to map the >> nucleotides which is lower case. >> But I want the logo output the nucleotides in uppercase. How can I do >> this? >> Thanks for your help >> shirley >> _______________________________________________ >> Biojava-l mailing list - Biojava-l at lists.open-bio.org >> http://lists.open-bio.org/mailman/listinfo/biojava-l >> >> > > > From gwaldon at geneinfinity.org Fri May 27 13:12:01 2011 From: gwaldon at geneinfinity.org (George Waldon) Date: Fri, 27 May 2011 12:12:01 -0500 Subject: [Biojava-l] DNATools lower case? In-Reply-To: References: <20110527111518.81163axdepe9fm04@gator1273.hostgator.com> Message-ID: <20110527121201.42723aw4e2egh86c@gator1273.hostgator.com> Hi Shirley, I am not really familiar with this code but I think AlternateTokenization was introduced after the Logo code and that is why you do not find it there. Can you fill a bug report? Also I'll be happy to add any patch you submit. Thank you. George Quoting Shirley Hui : > Thanks George. It looks like using alternate tokenization works if you are > "stringifying" a Sequence explicitly using the alphabet.getTokenization() > method. > > But presumably this gets done within the DistributionLogo class or some > other class down the line and I don't want to modify any Biojava classes > unless I really have to. > > The way I am constructing the DNA sequences is like this: > > Sequences seq =DNATools.createDNASequence(sequence, name); > > The list sequences is used to make a SimpleWeightMatrix wm. > Then the call to DistributionLogo is like this: > > Distribution dist = wm.getColumn(columnNumber); > DistributionLogo dl = new DistributionLogo(); > dl.setRenderingHints(hints); > dl.setOpaque(false); > dl.setDistribution(dist); > dl.setPreferredSize(new Dimension((int) columnWidth, (int) columnHeight)); > dl.setLogoPainter(new TextLogoPainter()); > dl.setStyle(symbolColorStyle); > > There no way that I can tell right now in the DNATools API to make the > DNATools use the alternate string tokenization via the call to > createDNASequence() > or another type of set method? > > shirley > > > On Fri, May 27, 2011 at 12:15 PM, George Waldon > wrote: > >> Hello Shirley, >> >> I think you need to use AlternateTokenisation at some point; check BJ1.8.1 >> Cookbook at http://www.biojava.org/wiki/BioJava:Cookbook:Sequence >> >> regards, >> >> George >> >> >> Quoting Shirley Hui : >> >> Hi, >>> I am using DNATools to generate dna Sequences. >>> I noticed that the static methods in DNATools a(),c(),t(),g() map to lower >>> case characters. >>> I am using using DistributionLogo class to draw sequences logos for a set >>> of >>> dna Sequences. >>> I think DistributionLogo is calling the static methods to map the >>> nucleotides which is lower case. >>> But I want the logo output the nucleotides in uppercase. How can I do >>> this? >>> Thanks for your help >>> shirley >>> _______________________________________________ >>> Biojava-l mailing list - Biojava-l at lists.open-bio.org >>> http://lists.open-bio.org/mailman/listinfo/biojava-l >>> >>> >> >> >> > From khalil.elmazouari at gmail.com Tue May 3 15:56:21 2011 From: khalil.elmazouari at gmail.com (Khalil El Mazouari) Date: Tue, 3 May 2011 17:56:21 +0200 Subject: [Biojava-l] Global Alignmeent: Needle vs Biojava3 Message-ID: <50F4DA36-7308-4DCF-9833-54469B00C879@gmail.com> Hi is it possible to set an End gap penalty to false for Global alignment in biojava3. As you can see, the T in biojava3 GA is wrong. Needle gives correct result. In case of end gap penalty=true => same biojava3 result. Thanks khalil Biojava3 query MGWSWIFLFLLSGTAGVLSEVQLQQSGPELVKPGASVRMSCKSSGYIFDDFYMNWVRQSHGKSLDYIGYISPYSGVTGYNQKFKGKATLTVDKSSSTAYMELRSLTSEDSAVYYCAGSSGNKWAMDYWGHGASVTVSS target -------------------QVQLQQPGAELVKPGASVKLSCKASGYTF-----------------------------------------------------------------------------------------T Needle (Emboss) : End gap penalty = false query 1 MGWSWIFLFLLSGTAGVLSEVQLQQSGPELVKPGASVRMSCKSSGYIFDD 50 :|||||.|.|||||||||::|||:|||.|. target 1 -------------------QVQLQQPGAELVKPGASVKLSCKASGYTFT- 30 query 51 FYMNWVRQSHGKSLDYIGYISPYSGVTGYNQKFKGKATLTVDKSSSTAYM 100 target 30 -------------------------------------------------- 30 query 101 ELRSLTSEDSAVYYCAGSSGNKWAMDYWGHGASVTVSS 138 target 30 -------------------------------------- 30 From andreas at sdsc.edu Fri May 6 00:34:11 2011 From: andreas at sdsc.edu (Andreas Prlic) Date: Thu, 5 May 2011 17:34:11 -0700 Subject: [Biojava-l] Global Alignmeent: Needle vs Biojava3 In-Reply-To: <50F4DA36-7308-4DCF-9833-54469B00C879@gmail.com> References: <50F4DA36-7308-4DCF-9833-54469B00C879@gmail.com> Message-ID: Hi Khalil, I don't think you can set end gap penalties, currently. Andreas On Tue, May 3, 2011 at 8:56 AM, Khalil El Mazouari wrote: > Hi > > is it possible to set an End gap penalty to false for Global alignment in biojava3. > > As you can see, the T in biojava3 GA is wrong. > > Needle gives correct result. In case of end gap penalty=true => same biojava3 result. > > Thanks > > khalil > > > > Biojava3 > query ? MGWSWIFLFLLSGTAGVLSEVQLQQSGPELVKPGASVRMSCKSSGYIFDDFYMNWVRQSHGKSLDYIGYISPYSGVTGYNQKFKGKATLTVDKSSSTAYMELRSLTSEDSAVYYCAGSSGNKWAMDYWGHGASVTVSS > target ?-------------------QVQLQQPGAELVKPGASVKLSCKASGYTF-----------------------------------------------------------------------------------------T > > > > Needle (Emboss) : End gap penalty = false > query ? ? ? ? ? ? ?1 MGWSWIFLFLLSGTAGVLSEVQLQQSGPELVKPGASVRMSCKSSGYIFDD ? ? 50 > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?:|||||.|.|||||||||::|||:|||.|. > target ? ? ? ? ? ? 1 -------------------QVQLQQPGAELVKPGASVKLSCKASGYTFT- ? ? 30 > > query ? ? ? ? ? ? 51 FYMNWVRQSHGKSLDYIGYISPYSGVTGYNQKFKGKATLTVDKSSSTAYM ? ?100 > > target ? ? ? ? ? ?30 -------------------------------------------------- ? ? 30 > > query ? ? ? ? ? ?101 ELRSLTSEDSAVYYCAGSSGNKWAMDYWGHGASVTVSS ? ?138 > > target ? ? ? ? ? ?30 -------------------------------------- ? ? 30 > > > _______________________________________________ > Biojava-l mailing list ?- ?Biojava-l at lists.open-bio.org > http://lists.open-bio.org/mailman/listinfo/biojava-l > From tariq_cp at hotmail.com Mon May 9 05:20:00 2011 From: tariq_cp at hotmail.com (Muhammad Tariq Pervez) Date: Mon, 9 May 2011 05:20:00 +0000 Subject: [Biojava-l] An exception is being thrown while using the code related to phylogeny from BioJava cookbook Message-ID: Dear concerns, I want to develop an application for phylogenetic analysis. To get started, I took some lines of code from BioJava cookbook, modified them as per my requirement and have been trying to get the results for a few days but in vain. The code is as follows. package biojavademo; import java.io.File; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map.Entry; import org.biojava3.alignment.template.Profile; import org.biojava3.alignment.Alignments; import org.biojava3.alignment.template.AlignedSequence; import org.biojava3.core.sequence.MultipleSequenceAlignment; import org.biojava3.core.sequence.ProteinSequence; import org.biojava3.core.sequence.compound.AminoAcidCompound; import org.biojava3.core.sequence.io.FastaReaderHelper; import org.biojava3.core.sequence.template.Compound; import org.biojava3.core.sequence.template.Sequence; import org.biojava3.core.util.ConcurrencyTools; import org.biojava3.phylo.ProgessListenerStub; import org.biojava3.phylo.TreeConstructionAlgorithm; import org.biojava3.phylo.TreeConstructor; import org.biojava3.phylo.TreeType; public class MSA { MSA(){ multipleSequenceAlignment = new MultipleSequenceAlignment (); } public void multipleSequenceAlignment(List ids) throws Exception { List lst = new ArrayList(); for (String id : ids) { lst.add(getSequenceForId(id)); } profile = Alignments.getMultipleSequenceAlignment(lst); System.out.println("Compound == "+ profile.getCompoundSet()); seq=new ProteinSequence(profile.toString(),profile.getCompoundSet()); multipleSequenceAlignment.addAlignedSequence(seq); TreeConstructor treeConstructor = new TreeConstructor(multipleSequenceAlignment, TreeType.NJ, TreeConstructionAlgorithm.PID, new ProgessListenerStub()); treeConstructor.process(); String newick = treeConstructor.getNewickString(true, true); System.out.println("Clustalw:\n Multisequence Alignment\n"+ profile.toString(Profile.StringFormat.CLUSTALW)); System.out.println("Tree === "+ newick); ConcurrencyTools.shutdown(); } private static ProteinSequence getSequenceForId(String fileName) throws Exception { LinkedHashMap a = FastaReaderHelper.readFastaProteinSequence(new File(fileName)); String seqStr; ProteinSequence seq=null; for ( Entry entry : a.entrySet() ) { seqStr=entry.getValue().getSequenceAsString(); seq=new ProteinSequence(seqStr);//entry.getValue(); } return seq; } public Profile getMSAProfile(){ return profile; } Profile profile; MultipleSequenceAlignment multipleSequenceAlignment; ProteinSequence seq=null; } When I run this code the following exception is thrown Exception in thread "AWT-EventQueue-0" org.biojava3.core.exceptions.CompoundNotFoundError: Compound not found for: Cannot find compound for: at org.biojava3.core.sequence.storage.ArrayListSequenceReader.setContents(ArrayListSequenceReader.java:196) at org.biojava3.core.sequence.template.AbstractSequence.(AbstractSequence.java:88) at org.biojava3.core.sequence.ProteinSequence.(ProteinSequence.java:52) at biojavademo.MSA.multipleSequenceAlignment(MSA.java:41) at biojavademo.MSAJFrame.jButton2ActionPerformed(MSAJFrame.java:160) at biojavademo.MSAJFrame.access$100(MSAJFrame.java:27) at biojavademo.MSAJFrame$2.actionPerformed(MSAJFrame.java:72) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236) at java.awt.Component.processMouseEvent(Component.java:6038) at javax.swing.JComponent.processMouseEvent(JComponent.java:3265) at java.awt.Component.processEvent(Component.java:5803) at java.awt.Container.processEvent(Container.java:2058) at java.awt.Component.dispatchEventImpl(Component.java:4410) at java.awt.Container.dispatchEventImpl(Container.java:2116) at java.awt.Component.dispatchEvent(Component.java:4240) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916) at java.awt.Container.dispatchEventImpl(Container.java:2102) at java.awt.Window.dispatchEventImpl(Window.java:2429) at java.awt.Component.dispatchEvent(Component.java:4240) at java.awt.EventQueue.dispatchEvent(EventQueue.java:599) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160) at java.awt.EventDispatchThread.run(EventDispatchThread.java:121) Actually I don't know how to construct the multiple sequence alignment object which is given as a parameter while constructing the 'TreeConstructor' object. Kindly guide/help me to resolve this issue. Muhammad Tariq Pervez Ph.D (Scholar) - Bioinformatics, University of Veterinary and Animal Science, Lahore, Pakistan From andreas at sdsc.edu Tue May 10 00:13:01 2011 From: andreas at sdsc.edu (Andreas Prlic) Date: Mon, 9 May 2011 17:13:01 -0700 Subject: [Biojava-l] An exception is being thrown while using the code related to phylogeny from BioJava cookbook In-Reply-To: References: Message-ID: Hi Muhammad, did you see the Cookbook pages? Best to start with a simple example like http://biojava.org/wiki/BioJava:CookBook3:MSA I suspect there is something going wrong with your input file. Try to get the file parsing right first. E.g.: http://biojava.org/wiki/BioJava:CookBook:Core:FastaReadWrite Andreas On Sun, May 8, 2011 at 10:20 PM, Muhammad Tariq Pervez wrote: > Dear concerns, > I want to develop an application for phylogenetic analysis. To get started, > I took some lines of code from BioJava cookbook, modified them as per my > requirement and have been trying to get the results for a few days but in > vain. The code is as follows. > > > package biojavademo; > > > import java.io.File; > import java.util.ArrayList; > import java.util.LinkedHashMap; > import java.util.List; > import java.util.Map.Entry; > > import org.biojava3.alignment.template.Profile; > import org.biojava3.alignment.Alignments; > import org.biojava3.alignment.template.AlignedSequence; > import org.biojava3.core.sequence.MultipleSequenceAlignment; > import org.biojava3.core.sequence.ProteinSequence; > import org.biojava3.core.sequence.compound.AminoAcidCompound; > import org.biojava3.core.sequence.io.FastaReaderHelper; > import org.biojava3.core.sequence.template.Compound; > import org.biojava3.core.sequence.template.Sequence; > import org.biojava3.core.util.ConcurrencyTools; > import org.biojava3.phylo.ProgessListenerStub; > import org.biojava3.phylo.TreeConstructionAlgorithm; > import org.biojava3.phylo.TreeConstructor; > import org.biojava3.phylo.TreeType; > > public class MSA { > > > MSA(){ > multipleSequenceAlignment = new MultipleSequenceAlignment > (); > } > public void multipleSequenceAlignment(List ids) throws > Exception { > List lst = new ArrayList(); > > for (String id : ids) { > lst.add(getSequenceForId(id)); > > } > > profile = Alignments.getMultipleSequenceAlignment(lst); > System.out.println("Compound == "+ profile.getCompoundSet()); > seq=new > ProteinSequence(profile.toString(),profile.getCompoundSet()); > multipleSequenceAlignment.addAlignedSequence(seq); > TreeConstructor treeConstructor > = new TreeConstructor AminoAcidCompound>(multipleSequenceAlignment, TreeType.NJ, > TreeConstructionAlgorithm.PID, new ProgessListenerStub()); > treeConstructor.process(); > String newick = treeConstructor.getNewickString(true, true); > System.out.println("Clustalw:\n Multisequence Alignment\n"+ > profile.toString(Profile.StringFormat.CLUSTALW)); > System.out.println("Tree === "+ newick); > ConcurrencyTools.shutdown(); > } > > private static ProteinSequence getSequenceForId(String fileName) > throws Exception { > > LinkedHashMap a = > FastaReaderHelper.readFastaProteinSequence(new File(fileName)); > > String seqStr; > ProteinSequence seq=null; > for ( Entry entry : a.entrySet() ) { > seqStr=entry.getValue().getSequenceAsString(); > seq=new ProteinSequence(seqStr);//entry.getValue(); > > } > return seq; > } > public Profile getMSAProfile(){ > return profile; > } > > Profile profile; > MultipleSequenceAlignment > multipleSequenceAlignment; > ProteinSequence seq=null; > } > > When I run this code the following exception is thrown > > Exception in thread "AWT-EventQueue-0" > org.biojava3.core.exceptions.CompoundNotFoundError: Compound not found for: > Cannot find compound for: > at > org.biojava3.core.sequence.storage.ArrayListSequenceReader.setContents(ArrayListSequenceReader.java:196) > at > org.biojava3.core.sequence.template.AbstractSequence.(AbstractSequence.java:88) > at > org.biojava3.core.sequence.ProteinSequence.(ProteinSequence.java:52) > at biojavademo.MSA.multipleSequenceAlignment(MSA.java:41) > at > biojavademo.MSAJFrame.jButton2ActionPerformed(MSAJFrame.java:160) > at biojavademo.MSAJFrame.access$100(MSAJFrame.java:27) > at biojavademo.MSAJFrame$2.actionPerformed(MSAJFrame.java:72) > at > javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995) > at > javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318) > at > javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387) > at > javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242) > at > javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236) > at java.awt.Component.processMouseEvent(Component.java:6038) > at javax.swing.JComponent.processMouseEvent(JComponent.java:3265) > at java.awt.Component.processEvent(Component.java:5803) > at java.awt.Container.processEvent(Container.java:2058) > at java.awt.Component.dispatchEventImpl(Component.java:4410) > at java.awt.Container.dispatchEventImpl(Container.java:2116) > at java.awt.Component.dispatchEvent(Component.java:4240) > at > java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322) > at > java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986) > at > java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916) > at java.awt.Container.dispatchEventImpl(Container.java:2102) > at java.awt.Window.dispatchEventImpl(Window.java:2429) > at java.awt.Component.dispatchEvent(Component.java:4240) > at java.awt.EventQueue.dispatchEvent(EventQueue.java:599) > at > java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273) > at > java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183) > at > java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173) > at > java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168) > at > java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160) > at java.awt.EventDispatchThread.run(EventDispatchThread.java:121) > > Actually I don't know how to construct the multiple sequence alignment > object which is given as a parameter while constructing the > 'TreeConstructor' object. > > Kindly guide/help me to resolve this issue. > > > Muhammad Tariq Pervez > Ph.D (Scholar) - Bioinformatics, > University of Veterinary and Animal Science, Lahore, Pakistan > > > > > From tariq_cp at hotmail.com Wed May 11 06:00:24 2011 From: tariq_cp at hotmail.com (Muhammad Tariq Pervez) Date: Wed, 11 May 2011 06:00:24 +0000 Subject: [Biojava-l] Biojava-l Digest, Vol 100, Issue 4 In-Reply-To: References: Message-ID: Dear Andreas, now I took code from BioJavaCookbook as it is and tried again to create the tree but in vain. Problem is not with http://biojava.org/wiki/BioJava:CookBook3:MSA and http://biojava.org/wiki/BioJava:CookBook:Core:FastaReadWrite. Files are read and MSA is performed successfully but problem is faced when the code to build the tree is reached. Problem is how to get MultipleSequenceAlignment object to be used in the phylo module from the Profile object used in the alignment module. Kindly help me. The following exception is thrown and code is given below of this exception. Best Regards. Exception in thread "AWT-EventQueue-0" org.biojava3.core.exceptions.CompoundNotFoundError: Compound not found for: Cannot find compound for: at org.biojava3.core.sequence.storage.ArrayListSequenceReader.setContents(ArrayListSequenceReader.java:196) at org.biojava3.core.sequence.template.AbstractSequence.(AbstractSequence.java:88) at org.biojava3.core.sequence.ProteinSequence.(ProteinSequence.java:52) at biojavademo.MSA.multipleSequenceAlignment(MSA.java:41) at biojavademo.MSAJFrame.jButton2ActionPerformed(MSAJFrame.java:160) at biojavademo.MSAJFrame.access$100(MSAJFrame.java:27) at biojavademo.MSAJFrame$2.actionPerformed(MSAJFrame.java:72) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236) at java.awt.Component.processMouseEvent(Component.java:6038) at javax.swing.JComponent.processMouseEvent(JComponent.java:3265) at java.awt.Component.processEvent(Component.java:5803) at java.awt.Container.processEvent(Container.java:2058) at java.awt.Component.dispatchEventImpl(Component.java:4410) at java.awt.Container.dispatchEventImpl(Container.java:2116) at java.awt.Component.dispatchEvent(Component.java:4240) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916) at java.awt.Container.dispatchEventImpl(Container.java:2102) at java.awt.Window.dispatchEventImpl(Window.java:2429) at java.awt.Component.dispatchEvent(Component.java:4240) at java.awt.EventQueue.dispatchEvent(EventQueue.java:599) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160) at java.awt.EventDispatchThread.run(EventDispatchThread.java:121) package biojavademo; import java.net.URL; import java.util.ArrayList; import java.util.List; import org.biojava3.alignment.template.Profile; import org.biojava3.alignment.Alignments; import org.biojava3.core.sequence.MultipleSequenceAlignment; import org.biojava3.core.sequence.ProteinSequence; import org.biojava3.core.sequence.compound.AminoAcidCompound; import org.biojava3.core.sequence.io.FastaReaderHelper; import org.biojava3.core.util.ConcurrencyTools; import org.biojava3.phylo.ProgessListenerStub; import org.biojava3.phylo.TreeConstructionAlgorithm; import org.biojava3.phylo.TreeConstructor; import org.biojava3.phylo.TreeType; public class MSA { MSA(){ multipleSequenceAlignment = new MultipleSequenceAlignment (); } public void multipleSequenceAlignment() throws Exception { String[] ids = new String[] {"Q21691", "Q21495", "O48771"}; try { multipleSequenceAlignment(ids); } catch (Exception e){ e.printStackTrace(); } } private void multipleSequenceAlignment(String[] ids) throws Exception { List lst = new ArrayList(); for (String id : ids) { lst.add(getSequenceForId(id)); } Profile profile = Alignments.getMultipleSequenceAlignment(lst); System.out.printf("Clustalw:%n%s%n", profile); ProteinSequence seq=new ProteinSequence(profile.toString()); multipleSequenceAlignment.addAlignedSequence(seq); TreeConstructor treeConstructor = new TreeConstructor(multipleSequenceAlignment, TreeType.NJ, TreeConstructionAlgorithm.PID, new ProgessListenerStub()); treeConstructor.process(); String newick = treeConstructor.getNewickString(true, true); ConcurrencyTools.shutdown(); } private static ProteinSequence getSequenceForId(String uniProtId) throws Exception { URL uniprotFasta = new URL(String.format("http://www.uniprot.org/uniprot/%s.fasta", uniProtId)); ProteinSequence seq = FastaReaderHelper.readFastaProteinSequence(uniprotFasta.openStream()).get(uniProtId); System.out.printf("id : %s %s%n%s%n", uniProtId, seq, seq.getOriginalHeader()); return seq; } Muhammad Tariq Pervez Ph.D (Scholar) - Bioinformatics, University of Veterinary and Animal Science, Lahore, Pakistan > From: biojava-l-request at lists.open-bio.org > Subject: Biojava-l Digest, Vol 100, Issue 4 > To: biojava-l at lists.open-bio.org > Date: Tue, 10 May 2011 12:00:04 -0400 > > Send Biojava-l mailing list submissions to > biojava-l at lists.open-bio.org > > To subscribe or unsubscribe via the World Wide Web, visit > http://lists.open-bio.org/mailman/listinfo/biojava-l > or, via email, send a message with subject or body 'help' to > biojava-l-request at lists.open-bio.org > > You can reach the person managing the list at > biojava-l-owner at lists.open-bio.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Biojava-l digest..." > > > Today's Topics: > > 1. Re: An exception is being thrown while using the code related > to phylogeny from BioJava cookbook (Andreas Prlic) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Mon, 9 May 2011 17:13:01 -0700 > From: Andreas Prlic > Subject: Re: [Biojava-l] An exception is being thrown while using the > code related to phylogeny from BioJava cookbook > To: Muhammad Tariq Pervez > Cc: biojava-l at lists.open-bio.org > Message-ID: > Content-Type: text/plain; charset=ISO-8859-1 > > Hi Muhammad, > > did you see the Cookbook pages? > > Best to start with a simple example like > http://biojava.org/wiki/BioJava:CookBook3:MSA > > I suspect there is something going wrong with your input file. Try to get > the file parsing right first. E.g.: > http://biojava.org/wiki/BioJava:CookBook:Core:FastaReadWrite > > Andreas > > > On Sun, May 8, 2011 at 10:20 PM, Muhammad Tariq Pervez > wrote: > > > Dear concerns, > > I want to develop an application for phylogenetic analysis. To get started, > > I took some lines of code from BioJava cookbook, modified them as per my > > requirement and have been trying to get the results for a few days but in > > vain. The code is as follows. > > > > > > package biojavademo; > > > > > > import java.io.File; > > import java.util.ArrayList; > > import java.util.LinkedHashMap; > > import java.util.List; > > import java.util.Map.Entry; > > > > import org.biojava3.alignment.template.Profile; > > import org.biojava3.alignment.Alignments; > > import org.biojava3.alignment.template.AlignedSequence; > > import org.biojava3.core.sequence.MultipleSequenceAlignment; > > import org.biojava3.core.sequence.ProteinSequence; > > import org.biojava3.core.sequence.compound.AminoAcidCompound; > > import org.biojava3.core.sequence.io.FastaReaderHelper; > > import org.biojava3.core.sequence.template.Compound; > > import org.biojava3.core.sequence.template.Sequence; > > import org.biojava3.core.util.ConcurrencyTools; > > import org.biojava3.phylo.ProgessListenerStub; > > import org.biojava3.phylo.TreeConstructionAlgorithm; > > import org.biojava3.phylo.TreeConstructor; > > import org.biojava3.phylo.TreeType; > > > > public class MSA { > > > > > > MSA(){ > > multipleSequenceAlignment = new MultipleSequenceAlignment > > (); > > } > > public void multipleSequenceAlignment(List ids) throws > > Exception { > > List lst = new ArrayList(); > > > > for (String id : ids) { > > lst.add(getSequenceForId(id)); > > > > } > > > > profile = Alignments.getMultipleSequenceAlignment(lst); > > System.out.println("Compound == "+ profile.getCompoundSet()); > > seq=new > > ProteinSequence(profile.toString(),profile.getCompoundSet()); > > multipleSequenceAlignment.addAlignedSequence(seq); > > TreeConstructor treeConstructor > > = new TreeConstructor > AminoAcidCompound>(multipleSequenceAlignment, TreeType.NJ, > > TreeConstructionAlgorithm.PID, new ProgessListenerStub()); > > treeConstructor.process(); > > String newick = treeConstructor.getNewickString(true, true); > > System.out.println("Clustalw:\n Multisequence Alignment\n"+ > > profile.toString(Profile.StringFormat.CLUSTALW)); > > System.out.println("Tree === "+ newick); > > ConcurrencyTools.shutdown(); > > } > > > > private static ProteinSequence getSequenceForId(String fileName) > > throws Exception { > > > > LinkedHashMap a = > > FastaReaderHelper.readFastaProteinSequence(new File(fileName)); > > > > String seqStr; > > ProteinSequence seq=null; > > for ( Entry entry : a.entrySet() ) { > > seqStr=entry.getValue().getSequenceAsString(); > > seq=new ProteinSequence(seqStr);//entry.getValue(); > > > > } > > return seq; > > } > > public Profile getMSAProfile(){ > > return profile; > > } > > > > Profile profile; > > MultipleSequenceAlignment > > multipleSequenceAlignment; > > ProteinSequence seq=null; > > } > > > > When I run this code the following exception is thrown > > > > Exception in thread "AWT-EventQueue-0" > > org.biojava3.core.exceptions.CompoundNotFoundError: Compound not found for: > > Cannot find compound for: > > at > > org.biojava3.core.sequence.storage.ArrayListSequenceReader.setContents(ArrayListSequenceReader.java:196) > > at > > org.biojava3.core.sequence.template.AbstractSequence.(AbstractSequence.java:88) > > at > > org.biojava3.core.sequence.ProteinSequence.(ProteinSequence.java:52) > > at biojavademo.MSA.multipleSequenceAlignment(MSA.java:41) > > at > > biojavademo.MSAJFrame.jButton2ActionPerformed(MSAJFrame.java:160) > > at biojavademo.MSAJFrame.access$100(MSAJFrame.java:27) > > at biojavademo.MSAJFrame$2.actionPerformed(MSAJFrame.java:72) > > at > > javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995) > > at > > javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318) > > at > > javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387) > > at > > javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242) > > at > > javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236) > > at java.awt.Component.processMouseEvent(Component.java:6038) > > at javax.swing.JComponent.processMouseEvent(JComponent.java:3265) > > at java.awt.Component.processEvent(Component.java:5803) > > at java.awt.Container.processEvent(Container.java:2058) > > at java.awt.Component.dispatchEventImpl(Component.java:4410) > > at java.awt.Container.dispatchEventImpl(Container.java:2116) > > at java.awt.Component.dispatchEvent(Component.java:4240) > > at > > java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322) > > at > > java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986) > > at > > java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916) > > at java.awt.Container.dispatchEventImpl(Container.java:2102) > > at java.awt.Window.dispatchEventImpl(Window.java:2429) > > at java.awt.Component.dispatchEvent(Component.java:4240) > > at java.awt.EventQueue.dispatchEvent(EventQueue.java:599) > > at > > java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273) > > at > > java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183) > > at > > java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173) > > at > > java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168) > > at > > java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160) > > at java.awt.EventDispatchThread.run(EventDispatchThread.java:121) > > > > Actually I don't know how to construct the multiple sequence alignment > > object which is given as a parameter while constructing the > > 'TreeConstructor' object. > > > > Kindly guide/help me to resolve this issue. > > > > > > Muhammad Tariq Pervez > > Ph.D (Scholar) - Bioinformatics, > > University of Veterinary and Animal Science, Lahore, Pakistan > > > > > > > > > > > > > ------------------------------ > > _______________________________________________ > Biojava-l mailing list - Biojava-l at lists.open-bio.org > http://lists.open-bio.org/mailman/listinfo/biojava-l > > > End of Biojava-l Digest, Vol 100, Issue 4 > ***************************************** From jayunit100 at gmail.com Wed May 11 21:42:15 2011 From: jayunit100 at gmail.com (Jay Vyas) Date: Wed, 11 May 2011 17:42:15 -0400 Subject: [Biojava-l] Group to AminoAcid ? Message-ID: Hi Everyone : Im trying to convert a "Group" to an "AminoAcid" in biojava, so that I can use the "getPhi()" "getPsi()" on my protein. My input is just a Chain of Groups (typical pdb structure). I figured maybe I could make one using the AminoAcid constructor, so I tried //Group g new AminoAcidImpl(g) but of course, this isnt in the api. Any ideas ? From andreas at sdsc.edu Wed May 11 23:23:46 2011 From: andreas at sdsc.edu (Andreas Prlic) Date: Wed, 11 May 2011 16:23:46 -0700 Subject: [Biojava-l] Group to AminoAcid ? In-Reply-To: References: Message-ID: Hi Jay, you could do this: if ( group instanceof AminoAcid ) { AminoAcid aa = (AminoAcid) group; } A On Wed, May 11, 2011 at 2:42 PM, Jay Vyas wrote: > Hi Everyone : Im trying to convert a "Group" to an "AminoAcid" in biojava, > so that I can use the "getPhi()" "getPsi()" on my protein. My input is > just > a Chain of Groups (typical pdb structure). > > I figured maybe I could make one using the AminoAcid constructor, so I > tried > > //Group g > new AminoAcidImpl(g) > > but of course, this isnt in the api. > > Any ideas ? > _______________________________________________ > Biojava-l mailing list - Biojava-l at lists.open-bio.org > http://lists.open-bio.org/mailman/listinfo/biojava-l > From andreas at sdsc.edu Thu May 12 03:09:35 2011 From: andreas at sdsc.edu (Andreas Prlic) Date: Wed, 11 May 2011 20:09:35 -0700 Subject: [Biojava-l] Biojava-l Digest, Vol 100, Issue 4 In-Reply-To: References: Message-ID: Hi Muhammad, I am not sure how to convert a profile from the alignment module into a sequence alignment that can be used in the phylo module. Perhaps Andy, Scooter, or Mark have a suggestion on that? It would be good if there was a convenience method for that. Looking at your code it seems you are doing a profile.toString() when creating the ProteinSequence. This seems wrong, since you would dump the whole alignment representation into a single sequence object. I suspect a better approach would be to get an aligned sequence from the profile and use that instead, however I have never tried that myself... Perhaps one of the over developers has a better suggestion here? Andreas On Tue, May 10, 2011 at 11:00 PM, Muhammad Tariq Pervez < tariq_cp at hotmail.com> wrote: > > > > Dear Andreas, now I took code from BioJavaCookbook as it is and tried again > to create the tree but in vain. Problem is not with > http://biojava.org/wiki/BioJava:CookBook3:MSA and > http://biojava.org/wiki/BioJava:CookBook:Core:FastaReadWrite. Files are > read and MSA is performed successfully but problem is faced when the code to > build the tree is reached. > > Problem is how to get MultipleSequenceAlignment object to be used in the > phylo module from the Profile object used in the alignment module. > > > > > > > Kindly help me. > > The following exception is thrown and code is given below of this > exception. > > Best Regards. > > > Exception in thread "AWT-EventQueue-0" > org.biojava3.core.exceptions.CompoundNotFoundError: Compound not found > for: Cannot find compound for: > > at > org.biojava3.core.sequence.storage.ArrayListSequenceReader.setContents(ArrayListSequenceReader.java:196) > at > org.biojava3.core.sequence.template.AbstractSequence.(AbstractSequence.java:88) > > > > > at > org.biojava3.core.sequence.ProteinSequence.(ProteinSequence.java:52) > at biojavademo.MSA.multipleSequenceAlignment(MSA.java:41) > at biojavademo.MSAJFrame.jButton2ActionPerformed(MSAJFrame.java:160) > > > > > at biojavademo.MSAJFrame.access$100(MSAJFrame.java:27) > at biojavademo.MSAJFrame$2.actionPerformed(MSAJFrame.java:72) > at > javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995) > > > > > at > javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318) > at > javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387) > at > javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242) > > > > > at > javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236) > at java.awt.Component.processMouseEvent(Component.java:6038) > at javax.swing.JComponent.processMouseEvent(JComponent.java:3265) > > > > > at java.awt.Component.processEvent(Component.java:5803) > at java.awt.Container.processEvent(Container.java:2058) > at java.awt.Component.dispatchEventImpl(Component.java:4410) > at java.awt.Container.dispatchEventImpl(Container.java:2116) > > > > > at java.awt.Component.dispatchEvent(Component.java:4240) > at > java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322) > at > java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986) > > > > > at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916) > at java.awt.Container.dispatchEventImpl(Container.java:2102) > at java.awt.Window.dispatchEventImpl(Window.java:2429) > at java.awt.Component.dispatchEvent(Component.java:4240) > > > > > at java.awt.EventQueue.dispatchEvent(EventQueue.java:599) > at > java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273) > at > java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183) > > > > > at > java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173) > at > java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168) > at > java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160) > > > > > at java.awt.EventDispatchThread.run(EventDispatchThread.java:121) > > > package biojavademo; > > > import java.net.URL; > import java.util.ArrayList; > import java.util.List; > > > import org.biojava3.alignment.template.Profile; > import org.biojava3.alignment.Alignments; > import org.biojava3.core.sequence.MultipleSequenceAlignment; > import org.biojava3.core.sequence.ProteinSequence; > > > > import org.biojava3.core.sequence.compound.AminoAcidCompound; > import org.biojava3.core.sequence.io.FastaReaderHelper; > import org.biojava3.core.util.ConcurrencyTools; > import org.biojava3.phylo.ProgessListenerStub; > > > > import org.biojava3.phylo.TreeConstructionAlgorithm; > import org.biojava3.phylo.TreeConstructor; > import org.biojava3.phylo.TreeType; > > public class MSA { > > > MSA(){ > multipleSequenceAlignment = new MultipleSequenceAlignment > (); > > > > } > public void multipleSequenceAlignment() throws Exception { > String[] ids = new String[] {"Q21691", "Q21495", "O48771"}; > try { > multipleSequenceAlignment(ids); > > > > } catch (Exception e){ > e.printStackTrace(); > } > } > > private void multipleSequenceAlignment(String[] ids) throws Exception { > List lst = new ArrayList(); > > > > for (String id : ids) { > lst.add(getSequenceForId(id)); > } > Profile profile = > Alignments.getMultipleSequenceAlignment(lst); > System.out.printf("Clustalw:%n%s%n", profile); > > > > > ProteinSequence seq=new ProteinSequence(profile.toString()); > multipleSequenceAlignment.addAlignedSequence(seq); > > TreeConstructor > treeConstructor = new TreeConstructor AminoAcidCompound>(multipleSequenceAlignment, TreeType.NJ, > TreeConstructionAlgorithm.PID, new ProgessListenerStub()); > > > > treeConstructor.process(); > String newick = treeConstructor.getNewickString(true, true); > ConcurrencyTools.shutdown(); > } > > private static ProteinSequence getSequenceForId(String uniProtId) throws > Exception { > > > > URL uniprotFasta = new URL(String.format(" > http://www.uniprot.org/uniprot/%s.fasta", uniProtId)); > ProteinSequence seq = > FastaReaderHelper.readFastaProteinSequence(uniprotFasta.openStream()).get(uniProtId); > > > > System.out.printf("id : %s %s%n%s%n", uniProtId, seq, > seq.getOriginalHeader()); > return seq; > } > > Muhammad Tariq Pervez > > Ph.D (Scholar) - Bioinformatics, > University of Veterinary and Animal Science, Lahore, Pakistan > > > > > > From: biojava-l-request at lists.open-bio.org > > Subject: Biojava-l Digest, Vol 100, Issue 4 > > To: biojava-l at lists.open-bio.org > > Date: Tue, 10 May 2011 12:00:04 -0400 > > > > Send Biojava-l mailing list submissions to > > biojava-l at lists.open-bio.org > > > > To subscribe or unsubscribe via the World Wide Web, visit > > http://lists.open-bio.org/mailman/listinfo/biojava-l > > or, via email, send a message with subject or body 'help' to > > biojava-l-request at lists.open-bio.org > > > > You can reach the person managing the list at > > biojava-l-owner at lists.open-bio.org > > > > When replying, please edit your Subject line so it is more specific > > than "Re: Contents of Biojava-l digest..." > > > > > > Today's Topics: > > > > 1. Re: An exception is being thrown while using the code related > > to phylogeny from BioJava cookbook (Andreas Prlic) > > > > > > ---------------------------------------------------------------------- > > > > Message: 1 > > Date: Mon, 9 May 2011 17:13:01 -0700 > > From: Andreas Prlic > > Subject: Re: [Biojava-l] An exception is being thrown while using the > > code related to phylogeny from BioJava cookbook > > To: Muhammad Tariq Pervez > > Cc: biojava-l at lists.open-bio.org > > Message-ID: > > Content-Type: text/plain; charset=ISO-8859-1 > > > > Hi Muhammad, > > > > did you see the Cookbook pages? > > > > Best to start with a simple example like > > http://biojava.org/wiki/BioJava:CookBook3:MSA > > > > I suspect there is something going wrong with your input file. Try to > get > > the file parsing right first. E.g.: > > http://biojava.org/wiki/BioJava:CookBook:Core:FastaReadWrite > > > > Andreas > > > > > > On Sun, May 8, 2011 at 10:20 PM, Muhammad Tariq Pervez < > tariq_cp at hotmail.com > > > wrote: > > > > > Dear concerns, > > > I want to develop an application for phylogenetic analysis. To get > started, > > > I took some lines of code from BioJava cookbook, modified them as per > my > > > requirement and have been trying to get the results for a few days but > in > > > vain. The code is as follows. > > > > > > > > > package biojavademo; > > > > > > > > > import java.io.File; > > > import java.util.ArrayList; > > > import java.util.LinkedHashMap; > > > import java.util.List; > > > import java.util.Map.Entry; > > > > > > import org.biojava3.alignment.template.Profile; > > > import org.biojava3.alignment.Alignments; > > > import org.biojava3.alignment.template.AlignedSequence; > > > import org.biojava3.core.sequence.MultipleSequenceAlignment; > > > import org.biojava3.core.sequence.ProteinSequence; > > > import org.biojava3.core.sequence.compound.AminoAcidCompound; > > > import org.biojava3.core.sequence.io.FastaReaderHelper; > > > import org.biojava3.core.sequence.template.Compound; > > > import org.biojava3.core.sequence.template.Sequence; > > > import org.biojava3.core.util.ConcurrencyTools; > > > import org.biojava3.phylo.ProgessListenerStub; > > > import org.biojava3.phylo.TreeConstructionAlgorithm; > > > import org.biojava3.phylo.TreeConstructor; > > > import org.biojava3.phylo.TreeType; > > > > > > public class MSA { > > > > > > > > > MSA(){ > > > multipleSequenceAlignment = new MultipleSequenceAlignment > > > (); > > > } > > > public void multipleSequenceAlignment(List ids) throws > > > Exception { > > > List lst = new ArrayList(); > > > > > > for (String id : ids) { > > > lst.add(getSequenceForId(id)); > > > > > > } > > > > > > profile = Alignments.getMultipleSequenceAlignment(lst); > > > System.out.println("Compound == "+ profile.getCompoundSet()); > > > seq=new > > > ProteinSequence(profile.toString(),profile.getCompoundSet()); > > > multipleSequenceAlignment.addAlignedSequence(seq); > > > TreeConstructor > treeConstructor > > > = new TreeConstructor > > AminoAcidCompound>(multipleSequenceAlignment, TreeType.NJ, > > > TreeConstructionAlgorithm.PID, new ProgessListenerStub()); > > > treeConstructor.process(); > > > String newick = treeConstructor.getNewickString(true, true); > > > System.out.println("Clustalw:\n Multisequence Alignment\n"+ > > > profile.toString(Profile.StringFormat.CLUSTALW)); > > > System.out.println("Tree === "+ newick); > > > ConcurrencyTools.shutdown(); > > > } > > > > > > private static ProteinSequence getSequenceForId(String fileName) > > > throws Exception { > > > > > > LinkedHashMap a = > > > FastaReaderHelper.readFastaProteinSequence(new File(fileName)); > > > > > > String seqStr; > > > ProteinSequence seq=null; > > > for ( Entry entry : a.entrySet() ) { > > > seqStr=entry.getValue().getSequenceAsString(); > > > seq=new > ProteinSequence(seqStr);//entry.getValue(); > > > > > > } > > > return seq; > > > } > > > public Profile getMSAProfile(){ > > > return profile; > > > } > > > > > > Profile profile; > > > MultipleSequenceAlignment > > > multipleSequenceAlignment; > > > ProteinSequence seq=null; > > > } > > > > > > When I run this code the following exception is thrown > > > > > > Exception in thread "AWT-EventQueue-0" > > > org.biojava3.core.exceptions.CompoundNotFoundError: Compound not found > for: > > > Cannot find compound for: > > > at > > > > org.biojava3.core.sequence.storage.ArrayListSequenceReader.setContents(ArrayListSequenceReader.java:196) > > > at > > > > org.biojava3.core.sequence.template.AbstractSequence.(AbstractSequence.java:88) > > > at > > > > org.biojava3.core.sequence.ProteinSequence.(ProteinSequence.java:52) > > > at biojavademo.MSA.multipleSequenceAlignment(MSA.java:41) > > > at > > > biojavademo.MSAJFrame.jButton2ActionPerformed(MSAJFrame.java:160) > > > at biojavademo.MSAJFrame.access$100(MSAJFrame.java:27) > > > at biojavademo.MSAJFrame$2.actionPerformed(MSAJFrame.java:72) > > > at > > > > javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995) > > > at > > > > javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318) > > > at > > > > javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387) > > > at > > > javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242) > > > at > > > > javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236) > > > at java.awt.Component.processMouseEvent(Component.java:6038) > > > at > javax.swing.JComponent.processMouseEvent(JComponent.java:3265) > > > at java.awt.Component.processEvent(Component.java:5803) > > > at java.awt.Container.processEvent(Container.java:2058) > > > at java.awt.Component.dispatchEventImpl(Component.java:4410) > > > at java.awt.Container.dispatchEventImpl(Container.java:2116) > > > at java.awt.Component.dispatchEvent(Component.java:4240) > > > at > > > java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322) > > > at > > > java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986) > > > at > > > java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916) > > > at java.awt.Container.dispatchEventImpl(Container.java:2102) > > > at java.awt.Window.dispatchEventImpl(Window.java:2429) > > > at java.awt.Component.dispatchEvent(Component.java:4240) > > > at java.awt.EventQueue.dispatchEvent(EventQueue.java:599) > > > at > > > > java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273) > > > at > > > > java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183) > > > at > > > > java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173) > > > at > > > java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168) > > > at > > > java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160) > > > at > java.awt.EventDispatchThread.run(EventDispatchThread.java:121) > > > > > > Actually I don't know how to construct the multiple sequence alignment > > > object which is given as a parameter while constructing the > > > 'TreeConstructor' object. > > > > > > Kindly guide/help me to resolve this issue. > > > > > > > > > Muhammad Tariq Pervez > > > Ph.D (Scholar) - Bioinformatics, > > > University of Veterinary and Animal Science, Lahore, Pakistan > > > > > > > > > > > > > > > > > > > > > ------------------------------ > > > > _______________________________________________ > > Biojava-l mailing list - Biojava-l at lists.open-bio.org > > http://lists.open-bio.org/mailman/listinfo/biojava-l > > > > > > End of Biojava-l Digest, Vol 100, Issue 4 > > ***************************************** > > _______________________________________________ > Biojava-l mailing list - Biojava-l at lists.open-bio.org > http://lists.open-bio.org/mailman/listinfo/biojava-l > From benjamin.pavie at gmail.com Wed May 18 22:30:18 2011 From: benjamin.pavie at gmail.com (Benjamin Pavie) Date: Wed, 18 May 2011 17:30:18 -0500 Subject: [Biojava-l] Reading the abi format using Biojava 3.x Message-ID: Hi Everybody, I tried to find an answer on the wiki but I couldn't find it. Is there a way to read the abi file format (like in this example http://www.biojava.org/wiki/BioJava:Cookbook:SeqIO:ABItoSequence ) but using the version 3.x of Biojava? I couldn't find the class ABITrace anymore in this API. And if it exist, in which module would it be (biojava3-core, biojava3-alignment, biojava3-genome, biojava3-structure, biojava3-structure-gui, biojava3-phylo, biojava3-protmod or biojava3-ws) ? And if the API change is it possible to have a example on how to do the same things as the example provided in http://www.biojava.org/wiki/BioJava:Cookbook:SeqIO:ABItoSequence ? Benjamin From andreas at sdsc.edu Thu May 19 00:29:19 2011 From: andreas at sdsc.edu (Andreas Prlic) Date: Wed, 18 May 2011 17:29:19 -0700 Subject: [Biojava-l] Reading the abi format using Biojava 3.x In-Reply-To: References: Message-ID: Hi Benjamin, I tried to find an answer on the wiki but I couldn't find it. Is there a way to read the abi file format (like in this example > http://www.biojava.org/wiki/BioJava:Cookbook:SeqIO:ABItoSequence ) but > using > the version 3.x of Biojava? > you need to use BioJava 1.8 for this. Andreas I couldn't find the class ABITrace anymore in this API. And if it exist, in > which module would it be > (biojava3-core, biojava3-alignment, biojava3-genome, > biojava3-structure, biojava3-structure-gui, biojava3-phylo, > biojava3-protmod > or biojava3-ws) ? > And if the API change is it possible to have a example on how to do the > same > things as the example provided in > http://www.biojava.org/wiki/BioJava:Cookbook:SeqIO:ABItoSequence ? > > Benjamin > _______________________________________________ > Biojava-l mailing list - Biojava-l at lists.open-bio.org > http://lists.open-bio.org/mailman/listinfo/biojava-l > From shirleyh at gmail.com Fri May 27 15:53:23 2011 From: shirleyh at gmail.com (Shirley Hui) Date: Fri, 27 May 2011 11:53:23 -0400 Subject: [Biojava-l] DNATools lower case? Message-ID: Hi, I am using DNATools to generate dna Sequences. I noticed that the static methods in DNATools a(),c(),t(),g() map to lower case characters. I am using using DistributionLogo class to draw sequences logos for a set of dna Sequences. I think DistributionLogo is calling the static methods to map the nucleotides which is lower case. But I want the logo output the nucleotides in uppercase. How can I do this? Thanks for your help shirley From gwaldon at geneinfinity.org Fri May 27 16:15:18 2011 From: gwaldon at geneinfinity.org (George Waldon) Date: Fri, 27 May 2011 11:15:18 -0500 Subject: [Biojava-l] DNATools lower case? In-Reply-To: References: Message-ID: <20110527111518.81163axdepe9fm04@gator1273.hostgator.com> Hello Shirley, I think you need to use AlternateTokenisation at some point; check BJ1.8.1 Cookbook at http://www.biojava.org/wiki/BioJava:Cookbook:Sequence regards, George Quoting Shirley Hui : > Hi, > I am using DNATools to generate dna Sequences. > I noticed that the static methods in DNATools a(),c(),t(),g() map to lower > case characters. > I am using using DistributionLogo class to draw sequences logos for a set of > dna Sequences. > I think DistributionLogo is calling the static methods to map the > nucleotides which is lower case. > But I want the logo output the nucleotides in uppercase. How can I do this? > Thanks for your help > shirley > _______________________________________________ > Biojava-l mailing list - Biojava-l at lists.open-bio.org > http://lists.open-bio.org/mailman/listinfo/biojava-l > From shirleyh at gmail.com Fri May 27 16:53:46 2011 From: shirleyh at gmail.com (Shirley Hui) Date: Fri, 27 May 2011 12:53:46 -0400 Subject: [Biojava-l] DNATools lower case? In-Reply-To: <20110527111518.81163axdepe9fm04@gator1273.hostgator.com> References: <20110527111518.81163axdepe9fm04@gator1273.hostgator.com> Message-ID: Thanks George. It looks like using alternate tokenization works if you are "stringifying" a Sequence explicitly using the alphabet.getTokenization() method. But presumably this gets done within the DistributionLogo class or some other class down the line and I don't want to modify any Biojava classes unless I really have to. The way I am constructing the DNA sequences is like this: Sequences seq =DNATools.createDNASequence(sequence, name); The list sequences is used to make a SimpleWeightMatrix wm. Then the call to DistributionLogo is like this: Distribution dist = wm.getColumn(columnNumber); DistributionLogo dl = new DistributionLogo(); dl.setRenderingHints(hints); dl.setOpaque(false); dl.setDistribution(dist); dl.setPreferredSize(new Dimension((int) columnWidth, (int) columnHeight)); dl.setLogoPainter(new TextLogoPainter()); dl.setStyle(symbolColorStyle); There no way that I can tell right now in the DNATools API to make the DNATools use the alternate string tokenization via the call to createDNASequence() or another type of set method? shirley On Fri, May 27, 2011 at 12:15 PM, George Waldon wrote: > Hello Shirley, > > I think you need to use AlternateTokenisation at some point; check BJ1.8.1 > Cookbook at http://www.biojava.org/wiki/BioJava:Cookbook:Sequence > > regards, > > George > > > Quoting Shirley Hui : > > Hi, >> I am using DNATools to generate dna Sequences. >> I noticed that the static methods in DNATools a(),c(),t(),g() map to lower >> case characters. >> I am using using DistributionLogo class to draw sequences logos for a set >> of >> dna Sequences. >> I think DistributionLogo is calling the static methods to map the >> nucleotides which is lower case. >> But I want the logo output the nucleotides in uppercase. How can I do >> this? >> Thanks for your help >> shirley >> _______________________________________________ >> Biojava-l mailing list - Biojava-l at lists.open-bio.org >> http://lists.open-bio.org/mailman/listinfo/biojava-l >> >> > > > From gwaldon at geneinfinity.org Fri May 27 17:12:01 2011 From: gwaldon at geneinfinity.org (George Waldon) Date: Fri, 27 May 2011 12:12:01 -0500 Subject: [Biojava-l] DNATools lower case? In-Reply-To: References: <20110527111518.81163axdepe9fm04@gator1273.hostgator.com> Message-ID: <20110527121201.42723aw4e2egh86c@gator1273.hostgator.com> Hi Shirley, I am not really familiar with this code but I think AlternateTokenization was introduced after the Logo code and that is why you do not find it there. Can you fill a bug report? Also I'll be happy to add any patch you submit. Thank you. George Quoting Shirley Hui : > Thanks George. It looks like using alternate tokenization works if you are > "stringifying" a Sequence explicitly using the alphabet.getTokenization() > method. > > But presumably this gets done within the DistributionLogo class or some > other class down the line and I don't want to modify any Biojava classes > unless I really have to. > > The way I am constructing the DNA sequences is like this: > > Sequences seq =DNATools.createDNASequence(sequence, name); > > The list sequences is used to make a SimpleWeightMatrix wm. > Then the call to DistributionLogo is like this: > > Distribution dist = wm.getColumn(columnNumber); > DistributionLogo dl = new DistributionLogo(); > dl.setRenderingHints(hints); > dl.setOpaque(false); > dl.setDistribution(dist); > dl.setPreferredSize(new Dimension((int) columnWidth, (int) columnHeight)); > dl.setLogoPainter(new TextLogoPainter()); > dl.setStyle(symbolColorStyle); > > There no way that I can tell right now in the DNATools API to make the > DNATools use the alternate string tokenization via the call to > createDNASequence() > or another type of set method? > > shirley > > > On Fri, May 27, 2011 at 12:15 PM, George Waldon > wrote: > >> Hello Shirley, >> >> I think you need to use AlternateTokenisation at some point; check BJ1.8.1 >> Cookbook at http://www.biojava.org/wiki/BioJava:Cookbook:Sequence >> >> regards, >> >> George >> >> >> Quoting Shirley Hui : >> >> Hi, >>> I am using DNATools to generate dna Sequences. >>> I noticed that the static methods in DNATools a(),c(),t(),g() map to lower >>> case characters. >>> I am using using DistributionLogo class to draw sequences logos for a set >>> of >>> dna Sequences. >>> I think DistributionLogo is calling the static methods to map the >>> nucleotides which is lower case. >>> But I want the logo output the nucleotides in uppercase. How can I do >>> this? >>> Thanks for your help >>> shirley >>> _______________________________________________ >>> Biojava-l mailing list - Biojava-l at lists.open-bio.org >>> http://lists.open-bio.org/mailman/listinfo/biojava-l >>> >>> >> >> >> >