File: phylip.c

package info (click to toggle)
squizz 0.99d%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 6,772 kB
  • sloc: sh: 4,799; ansic: 2,640; lex: 1,992; yacc: 1,650; makefile: 123
file content (33 lines) | stat: -rw-r--r-- 611 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* phylip.c - PHYLIP common alignment functions */

#ifdef HAVE_CONFIG_H
# include <config.h>
#endif

#include <stdlib.h>
#include <string.h>

#include "align.h"
#include "align/phylip.h"


/* Fix sequence name */
char *phylip_fixnam(const char *nam) {
  char *p, *new;

  if (nam == NULL) { return NULL; }

  if ((new = strdup(nam)) == NULL) {
    return NULL; }

  /* Truncate names to 10 characters if needed */
  if (strlen(new) > 10) {
    p = new + 10; *p = '\0'; }

  /* Fix invalid characters */
  p = new;
  while (*p) {
    if (strchr("():;,[]", *p) != NULL) { *p = '_'; }
    p++; }

  return new; }