[Biococoa-dev] first non-whitespace character

Alexander Griekspoor mek at mekentosj.com
Mon Nov 29 08:12:43 EST 2004


Hi Koen,

I believe NSString's rangeOfCharacterFromSet: should get you there 
(there are more other options if needed in two extended methods). Use 
[NSCharacterSet alphanumericCharacterSet] as the set, and I believe you 
should get the range of the first character that it will meet. Check 
out the other "default sets" for sets that might proove a better or 
faster (smaller) option.
Alex

Op 29-nov-04 om 1:04 heeft Koen van der Drift het volgende geschreven:

> Hi,
>
> Anyone knows how to get the location in a string where the first 
> non-whitespace character is at? I am trying to parse a clustal file 
> (turn on monospaced font):
>
>
> ACT1_FUGRU      
> -----------------------MEDEIAALVVDNGSGMCKAGFAGDDAPRAVFPSIVGR
> ACT2_FUGRU      
> -----------------------MDDEIAALVVDNGSGMCKAGFAGDDAPRAVFPSIVGR
> ACT3_FUGRU      
> -----------------------MEDEVASLVVDNGSGMCKAGFAGDDAPRAVFPSIVGR
> 5H1A_FUGRU      
> MDLRATSSNDSNATSGYSDTAAVDWDEGENATGSGSLPDPELSYQIITSLFLGALILCSI
> 5H1B_FUGRU      
> -------MEGTNNTTGWT-----HFDSTSNRTSKSFDEEVKLSYQVVTSFLLGALILCSI
> 5H1D_FUGRU      
> -------MELDNNSLDYFSSN--FTDIPSNTTVAHWTEATLLGLQISVSVVLAIVTLATM
>                                          *     .          .     :      
>  :
>
> The first 6 lines are easy to parse. However, the last line which 
> contains the alignment, starts at the same location as the other 
> lines, not at the asterisk. So, I need to figure out where the first 
> character after the name starts in the first lines. Once I have that 
> number, all subsequent lines start at the same number. Unfortunately 
> that number can vary for different clustal files. I already commited a 
> readClustal method earlier today, so you can see what I have sofar.
>
>
> cheers,
>
> - Koen.
>
> _______________________________________________
> Biococoa-dev mailing list
> Biococoa-dev at bioinformatics.org
> https://bioinformatics.org/mailman/listinfo/biococoa-dev
>
>
*********************************************************
                       ** 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

           LabAssistant - Get your life organized!
           http://www.mekentosj.com/labassistant

*********************************************************




More information about the Biococoa-dev mailing list