[BioCocoa-dev] Peptides...

Alexander Griekspoor mek at mekentosj.com
Sat Mar 19 07:22:35 EST 2005


Hi everyone,

Someone in our institute asked me to create a little Cocoa app for a 
specific problem he had. Given a certain protein sequence and the 
weight for a peptide reported by the mass spec, which peptide would be 
the closest match?
Of course an ideal situation to use BioCocoa ;-)
I've used a modified version of our translation demo, which can be 
downloaded here:
http://www.mekentosj.com/temporary/Peptides.zip
Please check it out and perhaps we can add the example or parts of it 
to the framework.

Often using the framework is the best way to discover problems or come 
up with new ideas (so I guess I better start working on the demo app we 
plan to make), so here are a few suggestions/changes I'd like to feed 
back in the repository but not before you have agreed to do so...
1) In this case I have one sequence of which I want to calculate the 
mass of many peptides. So I wanted to cache the BCToolMassCalculator 
and ask it for the mass of a certain range. To avoid the overhead of 
having to create a subsequence first, instantiate a new 
BCToolMassCalculator from it and calculate the mass, I've added a 
simple method:
-(NSArray *)calculateMassForRange: (NSRange)aRange;
and changed the original calculateMass method to a convenience method:
--(NSArray *)calculateMass{
	return [self calculateMassForRange: NSMakeRange(0, [[self sequence] 
length])];
}
As BCToolMassCalculator uses BCToolSymbolCounter (very elegant Koen!) 
I've added the same method there as well:
- (NSCountedSet *)countSymbols;
- (NSCountedSet *)countSymbolsForRange: (NSRange)aRange;

2) I noticed that the BCSequenceView still needs a lot of works. For 
one, it can display line numbers (not so useful), but it wrongly 
displays symbol numbers. Also many things are not configurable yet 
(like the indent of the spacing). Also, none of the selection, marking 
etc methods take the spaces into account, so for a start I added an 
override of the setSelectedRange:  method:
- (void)setSelectedRange:(NSRange)charRange{
	int start = charRange.location;
	int end = charRange.location + charRange.length;
	start += start/10;
	end += end/10;
	[super setSelectedRange: NSMakeRange(start, end-start)];
}
Again, the 10 here should become configurable later.. I'd like to spend 
some time on this one further, and see what we can do... (it's also 
required for the demo app).

Finally, I think the program is acceptable fast for the purpose I made 
it for (it calculates the mass of approx. 1200 peptides a second on my 
1.5Ghz G4), but I'm sure it can be a lot faster if we optimize the 
symbolcounter where it spends most of its time (doing a lot of object 
messaging). But first I'll let the guy who asked me to help play with 
it, I challenged him to come up with something dramatically faster ;-)
Cheers,
Alex

*********************************************************
                     ** Alexander Griekspoor **
*********************************************************
               The Netherlands Cancer Institute
               Department of Tumorbiology (H4)
          Plesmanlaan 121, 1066 CX, Amsterdam
                    Tel:  + 31 20 - 512 2023
                   Fax:  + 31 20 - 512 2029
                   AIM: mekentosj at mac.com
                  E-mail: a.griekspoor at nki.nl
               Web: http://www.mekentosj.com

               4Peaks - For Peaks, Four Peaks.
        2004 Winner of the Apple Design Awards
                Best Mac OS X Student Product
              http://www.mekentosj.com/4peaks

*********************************************************
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 4085 bytes
Desc: not available
URL: <http://www.bioinformatics.org/pipermail/biococoa-dev/attachments/20050319/b60a5be7/attachment.bin>


More information about the Biococoa-dev mailing list