~ubuntu-branches/ubuntu/edgy/ncbi-tools6/edgy

« back to all changes in this revision

Viewing changes to util/creaders/alnread.c

  • Committer: Bazaar Package Importer
  • Author(s): Barry deFreese
  • Date: 2006-07-19 23:28:07 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20060719232807-et3cdmcjgmnyleyx
Tags: 6.1.20060507-3ubuntu1
Re-merge with Debian

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * $Id: alnread.c,v 1.26 2005/10/21 15:19:13 bollin Exp $
 
2
 * $Id: alnread.c,v 1.27 2005/12/12 13:35:30 bollin Exp $
3
3
 *
4
4
 * ===========================================================================
5
5
 *
3297
3297
        line_counter += llp->num_appearances;
3298
3298
    }
3299
3299
    if (line_counter - line_start == block_size) {
3300
 
        if (llp->next == NULL) {
3301
 
            return line_start;
3302
 
        }
3303
 
        llp = llp->next;
3304
 
        if (llp->lengthrepeats == NULL) {
 
3300
        /* we've found a combination of groups of similarly sized lines
 
3301
         * that add up to the desired block size - is the next line blank,
 
3302
         * or are there additional non-blank lines?
 
3303
         */
 
3304
        if (llp == NULL /* The block ended with the last line in the file */
 
3305
            || llp->lengthrepeats == NULL) { /* or the next line is blank */
3305
3306
            return line_start;
3306
3307
        }
3307
3308
    }
3798
3799
        cp = lip->data;
3799
3800
        if (has_ids) {
3800
3801
            len = strcspn (cp, " \t\r");
 
3802
            if (first_block && len == strlen (cp)) {
 
3803
                /* PHYLIP IDs are exactly 10 characters long
 
3804
                 * and may not have a space between the ID and
 
3805
                 * the sequence.
 
3806
                 */
 
3807
                len = 10;
 
3808
            }
3801
3809
            tmp_id = (char *) malloc ( (len + 1) * sizeof (char));
3802
3810
            if (tmp_id == NULL) {
3803
3811
                return eFalse;
3841
3849
        cp = lip->data;
3842
3850
        if (has_ids) {
3843
3851
            len = strcspn (cp, " \t\r");
 
3852
            if (first_block && len == strlen (cp)) {
 
3853
                /* PHYLIP IDs are exactly 10 characters long
 
3854
                 * and may not have a space between the ID and
 
3855
                 * the sequence.
 
3856
                 */
 
3857
                len = 10;
 
3858
            }        
3844
3859
            tmp_id = (char *) malloc ( (len + 1) * sizeof (char));
3845
3860
            if (tmp_id == NULL) {
3846
3861
                return eFalse;
3901
3916
            pos = 0;
3902
3917
            if (this_block_has_ids) {
3903
3918
                len = strcspn (linestring, " \t\r");
 
3919
                if (first_block && len == strlen (linestring)) {
 
3920
                    /* PHYLIP IDs are exactly ten characters long,
 
3921
                     * and may not have a space before the start of
 
3922
                     * the sequence data.
 
3923
                     */
 
3924
                    len = 10;
 
3925
                }
3904
3926
                this_id = (char *) malloc (len + 1);
3905
3927
                if (this_id == NULL) {
3906
3928
                    return;
3909
3931
                this_id [len] = 0;
3910
3932
                cp = linestring + len;
3911
3933
                pos += len;
3912
 
                len = strspn (linestring, " \t\r");
 
3934
                len = strspn (cp, " \t\r");
3913
3935
                cp += len;
3914
3936
                pos += len;
3915
3937
                /* Check for duplicate IDs in the first block */
5994
6016
/*
5995
6017
 * ===========================================================================
5996
6018
 * $Log: alnread.c,v $
 
6019
 * Revision 1.27  2005/12/12 13:35:30  bollin
 
6020
 * changed alignment reader code to handle PHYLIP IDs when there are no spaces
 
6021
 * between the IDs and the sequence.  Note - if there are spaces in the sequence
 
6022
 * this will not work - the first part of the sequence will be assumed to be part
 
6023
 * of the sequence ID.
 
6024
 *
5997
6025
 * Revision 1.26  2005/10/21 15:19:13  bollin
5998
6026
 * added a function to allow the missing, match, and gap characters to be
5999
6027
 * specified in a NEXUS comment for an alignment file