~ubuntu-branches/ubuntu/intrepid/ncbi-tools6/intrepid

« back to all changes in this revision

Viewing changes to util/creaders/alnread.c

  • Committer: Bazaar Package Importer
  • Author(s): Aaron M. Ucko
  • Date: 2008-03-19 19:42:00 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20080319194200-7t0o0fgni3pijh1x
Tags: 6.1.20080302-1
* New upstream release
* debian/lib{ncbi6,vibrant6a}.symbols: update and clean up.
* debian/lib{ncbi,vibrant}6-dev.install: ship new headers.
* debian/ncbi-tools-bin.docs, doc/man/tbl2asn.1: belatedly ship
  tbl2asn.txt, and restore tbl2asn.1's reference thereto.
* doc/man/*.1: correct usage of ' and -.
* doc/man/{blast,cleanasn,nps2gps,tbl2asn}.1: resync with help output.
* debian/control: tighten dependencies between binary packages.
* debian/{control,rules}: require cdbs 0.4.51; drop workaround for #462130.
* debian/{control,rules,*.override}: rename Lintian overrides to
  $pkg.lintian-overrides and employ dh_lintian from debhelper (>= 6.0.7)
  in lieu of custom logic.
* debian/*.doc-base*: modernize (and correct) section assignments per
  doc-base 0.8.10: science -> Science/Biology, net -> System/Administration.
* debian/makemenu: drop obsolete Encoding key from generated .desktop files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * $Id: alnread.c,v 1.31 2007/01/10 18:20:14 ucko Exp $
 
2
 * $Id: alnread.c,v 1.32 2007/12/29 18:25:42 kazimird Exp $
3
3
 *
4
4
 * ===========================================================================
5
5
 *
345
345
 
346
346
    eip->category = eAlnErr_BadData;
347
347
    if (list->string == NULL) {
348
 
        eip->message = malloc (strlen (err_null_format)
349
 
                               + kMaxPrintedIntLen + 1);
 
348
        eip->message = (char*)malloc (strlen (err_null_format)
 
349
                                      + kMaxPrintedIntLen + 1);
350
350
        if (eip->message != NULL) {
351
351
            sprintf (eip->message, err_null_format, list->num_appearances);
352
352
        }
353
353
    } else {
354
 
        eip->message = malloc (strlen (err_format)
355
 
                               + strlen (list->string)
356
 
                               + kMaxPrintedIntLen + 1);
 
354
        eip->message = (char*)malloc (strlen (err_format)
 
355
                                      + strlen (list->string)
 
356
                                      + kMaxPrintedIntLen + 1);
357
357
        if (eip->message != NULL) {
358
358
            sprintf (eip->message, err_format, list->string,
359
359
                     list->num_appearances);
432
432
    eip->category = eAlnErr_BadFormat;
433
433
    eip->id = strdup (id);
434
434
    eip->line_num = line_num;
435
 
    eip->message = malloc (strlen (err_format) + 2 * kMaxPrintedIntLen + 1);
 
435
    eip->message = (char *)malloc (strlen (err_format) + 2 * kMaxPrintedIntLen + 1);
436
436
    if (eip->message != NULL) {
437
437
      sprintf (eip->message, err_format, expected_num, actual_num);
438
438
    }
518
518
    }
519
519
    eip->category = eAlnErr_BadFormat;
520
520
    eip->id = strdup (id);
521
 
    eip->message = malloc (strlen (format_str) + 50);
 
521
    eip->message = (char *)malloc (strlen (format_str) + 50);
522
522
    if (eip->message != NULL) {
523
523
        sprintf (eip->message, format_str, expected_length, actual_length);
524
524
    }
614
614
    if (id != NULL ) {
615
615
        eip->id = strdup (id);
616
616
    }
617
 
    eip->message = malloc (strlen (err_format) + strlen (org_name)
 
617
    eip->message = (char *)malloc (strlen (err_format) + strlen (org_name)
618
618
                           + kMaxPrintedIntLen + 1);
619
619
    if (eip->message != NULL) {
620
620
        sprintf (eip->message, err_format, org_name, second_line_num);
2411
2411
        {
2412
2412
          free (str);
2413
2413
        }
2414
 
        str = malloc (2 * sizeof (char));
 
2414
        str = (char *)malloc (2 * sizeof (char));
2415
2415
        if (str != NULL)
2416
2416
        {
2417
2417
          str [0] = c;
2837
2837
        return NULL;
2838
2838
    }
2839
2839
 
2840
 
    ordered_org_name = malloc (org_clp->end - org_clp->start + 2);
 
2840
    ordered_org_name = (char *)malloc (org_clp->end - org_clp->start + 2);
2841
2841
    if (ordered_org_name == NULL) {
2842
2842
        return NULL;
2843
2843
    }
5349
5349
    if (len == 0) {
5350
5350
        return NULL;
5351
5351
    }
5352
 
    id = malloc (len + 1);
 
5352
    id = (char *)malloc (len + 1);
5353
5353
    if (id == NULL) {
5354
5354
        return NULL;
5355
5355
    }
6025
6025
    return ReadAlignmentFileEx (readfunc, fileuserdata, errfunc, erroruserdata,
6026
6026
                                sequence_info, eFalse);
6027
6027
}
6028
 
 
6029
 
 
6030
 
/*
6031
 
 * ===========================================================================
6032
 
 * $Log: alnread.c,v $
6033
 
 * Revision 1.31  2007/01/10 18:20:14  ucko
6034
 
 * Drop s_AddPatternRepeat (obsolete as of R1.30, as s_ReadAlignFileRaw
6035
 
 * now contains an internal version reworked to be more efficient).
6036
 
 *
6037
 
 * Revision 1.30  2006/12/27 13:38:46  bollin
6038
 
 * Fixed bug in alignment reader and improved performance for large alignments.
6039
 
 *
6040
 
 * Revision 1.29  2006/09/14 13:32:29  bollin
6041
 
 * do not free alphabet in sequence info struct
6042
 
 *
6043
 
 * Revision 1.28  2006/09/13 18:34:59  bollin
6044
 
 * added flag to indicate whether alignment formatting clues were found
6045
 
 *
6046
 
 * Revision 1.27  2005/12/12 13:35:30  bollin
6047
 
 * changed alignment reader code to handle PHYLIP IDs when there are no spaces
6048
 
 * between the IDs and the sequence.  Note - if there are spaces in the sequence
6049
 
 * this will not work - the first part of the sequence will be assumed to be part
6050
 
 * of the sequence ID.
6051
 
 *
6052
 
 * Revision 1.26  2005/10/21 15:19:13  bollin
6053
 
 * added a function to allow the missing, match, and gap characters to be
6054
 
 * specified in a NEXUS comment for an alignment file
6055
 
 *
6056
 
 * Revision 1.25  2005/10/12 20:12:28  bollin
6057
 
 * when reading an interleaved block alignment, generate errors if duplicate IDs
6058
 
 * are found.
6059
 
 *
6060
 
 * Revision 1.24  2005/06/20 14:59:17  bollin
6061
 
 * when creating an ordered organism name, stop when the next organism comment
6062
 
 * is found
6063
 
 *
6064
 
 * Revision 1.23  2005/06/06 15:31:34  lavr
6065
 
 * Explicit (unsigned char) casts in ctype routines
6066
 
 *
6067
 
 * Revision 1.22  2005/06/03 17:03:57  lavr
6068
 
 * Explicit (unsigned char) casts in ctype routines
6069
 
 *
6070
 
 * Revision 1.21  2005/05/12 17:41:01  bollin
6071
 
 * changed cast for ctype classification macros
6072
 
 *
6073
 
 * Revision 1.19  2005/05/06 14:24:01  bollin
6074
 
 * when adding a definition line that follows an organism comment, make sure
6075
 
 * that the new definition line has the same list position as the organism
6076
 
 * name
6077
 
 *
6078
 
 * Revision 1.18  2005/05/04 18:54:42  bollin
6079
 
 * removed Linux warnings
6080
 
 *
6081
 
 * Revision 1.17  2005/01/13 14:56:42  bollin
6082
 
 * be sure to skip over segment brackets when reading segments for alignment of
6083
 
 * segmented sets
6084
 
 *
6085
 
 * Revision 1.16  2005/01/10 19:31:09  bollin
6086
 
 * limit how hard we will try to read a badly formatted alignment
6087
 
 *
6088
 
 * Revision 1.15  2004/12/21 15:13:44  bollin
6089
 
 * handle blocks of organism definition lines in NEXUS files that do not
6090
 
 * separate the definition lines from the sequence data
6091
 
 *
6092
 
 * Revision 1.14  2004/12/02 17:12:18  bollin
6093
 
 * allow reading of an interleaved alignment with only one block
6094
 
 *
6095
 
 * Revision 1.13  2004/12/01 14:14:35  bollin
6096
 
 * improved detection of consensus lines in Clustal files
6097
 
 *
6098
 
 * Revision 1.12  2004/09/17 12:21:48  bollin
6099
 
 * allow all-gap segments in segmented alignments
6100
 
 *
6101
 
 * Revision 1.11  2004/08/11 15:23:07  vakatov
6102
 
 * Compilation warning fix (unused static func)
6103
 
 *
6104
 
 * Revision 1.10  2004/05/20 19:40:24  bollin
6105
 
 * Made chnages to allow reading of alignments of segmented sets.
6106
 
 * Also added warnings for when organism lines may be present but improperly
6107
 
 * formatted.
6108
 
 *
6109
 
 * Revision 1.9  2004/03/16 21:05:15  bollin
6110
 
 * Added some improvements to the portion of the alignment reader that deals
6111
 
 * with contiguous alignments that do not have a '>' at the beginning of each
6112
 
 * ID.
6113
 
 *
6114
 
 * Revision 1.8  2004/03/16 16:25:38  bollin
6115
 
 * Added function to recognize a file as ASN.1 and reject immediately
6116
 
 *
6117
 
 * Revision 1.7  2004/03/09 21:27:39  bollin
6118
 
 * in s_InsertNewOffsets, if the list ends while searching for the next pattern, exit immediately (prevents NULL pointer access)
6119
 
 *
6120
 
 * Revision 1.6  2004/03/04 19:15:07  bollin
6121
 
 * file reading now skips over multi-line bracketed comments
6122
 
 *
6123
 
 * Revision 1.5  2004/03/04 16:29:32  bollin
6124
 
 * added skip of taxa comment for PAUP format alignment files
6125
 
 *
6126
 
 * Revision 1.4  2004/02/10 16:15:13  bollin
6127
 
 * now checks for unused lines when finding interleaved blocks, will reject and try other methods if unused lines found after first block found.
6128
 
 *
6129
 
 * Revision 1.3  2004/02/05 16:29:32  bollin
6130
 
 * smarter function for skipping NEXUS comment lines
6131
 
 *
6132
 
 * Revision 1.2  2004/02/04 19:49:11  bollin
6133
 
 * fixed infinite loop condition in s_AugmentOffsetList, properly skip over first non-space column when looking for interleaved block patterns in s_ReadAlignFileRaw
6134
 
 *
6135
 
 * Revision 1.1  2004/02/03 16:47:02  ucko
6136
 
 * Add Colleen Bollin's Toolkit-independent alignment reader.
6137
 
 *
6138
 
 * Revision 1.38  2004/01/30 22:46:08  bollin
6139
 
 * renamed defined variable, fixed typo in comment
6140
 
 *
6141
 
 * Revision 1.37  2004/01/30 21:48:14  bollin
6142
 
 * changes for compatibility with Windows
6143
 
 *
6144
 
 * Revision 1.36  2004/01/30 21:33:41  bollin
6145
 
 * replaced strncasecmp and strncase function calls
6146
 
 *
6147
 
 * Revision 1.35  2004/01/29 19:16:27  bollin
6148
 
 * use EBool for boolean values
6149
 
 *
6150
 
 * Revision 1.34  2004/01/29 17:58:11  bollin
6151
 
 * aligned assignment blocks in New functions
6152
 
 *
6153
 
 * Revision 1.33  2004/01/29 17:43:40  bollin
6154
 
 * added directory specification to alnread.h include line
6155
 
 *
6156
 
 * Revision 1.32  2004/01/29 17:41:29  bollin
6157
 
 * added comment block, id tags, log
6158
 
 * 
6159
 
 * ===========================================================================
6160
 
 */