|
|
Choosing A Webhost: |
Re: Creating my own classes: msg#00040java.bio.general
An excellent book on OO and Java is Thinking in Java by Bruce Eckell. If you come from a C or Perl background it will change the way you think about programming. You can get online versions for free, most good bookstores have hardcopies as well. - Mark "Nathan S. Haigh" <n.haigh@xxxxxxxxxxxxxxx> Sent by: biojava-l-bounces@xxxxxxxxxxxxxxxxxx 04/28/2006 12:00 AM Please respond to n.haigh To: "'Richard Holland'" <richard.holland@xxxxxxxxx> cc: biojava-l@xxxxxxxxxxxxxxxxxx, (bcc: Mark Schreiber/GP/Novartis) Subject: Re: [Biojava-l] Creating my own classes Fantastic stuff - again, I'll look into this over the coming weeks (I actually have annual leave for a week, so my flurry of e-mail will have to stop for now. Thanks again! Nathan > -----Original Message----- > From: Richard Holland [mailto:richard.holland@xxxxxxxxx] > Sent: 27 April 2006 16:56 > To: n.haigh@xxxxxxxxxxxxxxx > Cc: biojava-l@xxxxxxxxxxxxxxxxxx > Subject: RE: [Biojava-l] Creating my own classes > > Given some existing Location object (let's called it 'loc'), and an > existing Alignment (hypothetically called 'algn'), you can do this: > > // Obtain the labels of all the sequences in the alignment. > Set labels = new HashSet(); > labels.addAll(algn.getLabels()); > // Obtain a sub-alignment including all the sequences in the > // original alignment. > Alignment subAlignment = algn.subAlignment(labels, loc); > > cheers, > Richard > > > On Thu, 2006-04-27 at 16:44 +0100, Nathan S. Haigh wrote: > > Thanks Richard, > > > > I'll think about this and try to do some deciphering. The only thing I'm > in > > need of help for is possibly some actual code that would take an > Alignment > > object and return a subalignment based on the positions specified in a > > Locations object - it's difficult to make sense of a new language until > you > > start to pick up some of the basics. > > > > Thanks > > Nathan > > > > > -----Original Message----- > > > From: Richard Holland [mailto:richard.holland@xxxxxxxxx] > > > Sent: 27 April 2006 16:37 > > > To: n.haigh@xxxxxxxxxxxxxxx > > > Cc: biojava-l@xxxxxxxxxxxxxxxxxx > > > Subject: Re: [Biojava-l] Creating my own classes > > > > > > On Thu, 2006-04-27 at 16:12 +0100, Nathan S. Haigh wrote: > > > > My application essentially defines sets of positions from an > alignment - > > > I > > > > call them CHARSETs as they are analogous to CHARSETs in the Nexus > file > > > > format. I believe in Biojava the Locations object/interface (sorry, > not > > > > familiar enough with correct terminology yet) is essentially the > same > > > sort > > > > of thing. In my app, the user can use several approaches to define a > > > CHARSET > > > > e.g. a CHARSET containing just invariable sites, or a CHARSET > containing > > > > sites above a given % identity. > > > > > > You'd be right there. A Location in BioJava represents a range of > > > positions. > > > > > > > My question is this, if I were to create a class called Charset, and > I > > > > create several subclasses called e.g. Invariable etc is this > reasonable? > > > Or > > > > should the class Charset contain many methods for creating a > different > > > type > > > > of CHARSET? > > > > > > My suggestion would be create an interface called Charset, which > defines > > > behaviour which you expect all types of Charset to exhibit. Then, > > > implement a number of classes which implement this interface, one for > > > each type of Charset you have, which each add their own methods or > > > special behaviour. If a lot of the behaviour is common, you can define > > > an abstract class called something like AbstractCharset which defines > > > this common behaviour, and have the others extend it. > > > > > > > In my app, a CHARSET needs to be associated with a particular > alignment, > > > and > > > > settings used to define the CHARSET, so my Charset class have > variables > > > such > > > > as an Alignment object, Locations objects etc. I'd like to write a > > > method > > > > that returns a subalignment based on the CHARSETs associated > alignment > > > > object and Locations object but I'm not sure how to do this. > > > > > > BioJava Alignment objects implement the SymbolList interface, which > > > means you can use all the methods from SymbolList to work with the > > > Alignment, including the subList() method. > > > > > > cheers, > > > Richard > > > > > > -- > > > Richard Holland (BioMart Team) > > > EMBL-EBI > > > Wellcome Trust Genome Campus > > > Hinxton > > > Cambridge CB10 1SD > > > UNITED KINGDOM > > > Tel: +44-(0)1223-494416 > > > > --- > > avast! Antivirus: Outbound message clean. > > Virus Database (VPS): 0615-2, 12/04/2006 > > Tested on: 27/04/2006 16:44:04 > > avast! - copyright (c) 1988-2006 ALWIL Software. > > http://www.avast.com > > > > > > > > > > > -- > Richard Holland (BioMart Team) > EMBL-EBI > Wellcome Trust Genome Campus > Hinxton > Cambridge CB10 1SD > UNITED KINGDOM > Tel: +44-(0)1223-494416 --- avast! Antivirus: Outbound message clean. Virus Database (VPS): 0615-2, 12/04/2006 Tested on: 27/04/2006 17:00:06 avast! - copyright (c) 1988-2006 ALWIL Software. http://www.avast.com _______________________________________________ Biojava-l mailing list - Biojava-l@xxxxxxxxxxxxxxxxxx http://lists.open-bio.org/mailman/listinfo/biojava-l _______________________________________________ Biojava-l mailing list - Biojava-l@xxxxxxxxxxxxxxxxxx http://lists.open-bio.org/mailman/listinfo/biojava-l
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | hibernate-xml mapping, David Scott |
|---|---|
| Next by Date: | Re: hibernate-xml mapping, mark . schreiber |
| Previous by Thread: | Re: Creating my own classes, Nathan S. Haigh |
| Next by Thread: | hibernate-xml mapping, David Scott |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |
Home
| advertise | OSDir is
an inevitable website.
|