2022-03-08 04:43:05 +08:00
|
|
|
#include <malloc.h>
|
2023-04-09 02:17:32 +08:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include <time.h>
|
2022-03-08 04:43:05 +08:00
|
|
|
#include <xview/panel.h>
|
2023-04-09 02:17:32 +08:00
|
|
|
#include <xview/xview.h>
|
2022-03-08 04:43:05 +08:00
|
|
|
|
2023-04-09 02:17:32 +08:00
|
|
|
#include "defines.h"
|
|
|
|
#include "menudefs.h"
|
2022-03-08 04:43:05 +08:00
|
|
|
/*
|
|
|
|
|
|
|
|
Copyright (c) 1990,1991,1992 Steven Smith at the Harvard Genome Laboratory.
|
|
|
|
All rights reserved.
|
|
|
|
*/
|
2023-04-09 02:17:32 +08:00
|
|
|
ReadGDE(filename, dataset, type) char *filename;
|
2022-03-08 04:43:05 +08:00
|
|
|
NA_Alignment *dataset;
|
|
|
|
int type;
|
|
|
|
{
|
2023-04-09 02:17:32 +08:00
|
|
|
register int done = FALSE, len = 0, j = 0;
|
|
|
|
int success, count, temp = 0;
|
|
|
|
char Inline[GBUFSIZ], c;
|
|
|
|
char *buffer, *line, *gencomments = NULL, fields[8][GBUFSIZ];
|
|
|
|
int buflen = GBUFSIZ, genclen = 0, curelem = 0, n = 0, flag = 0;
|
|
|
|
NA_Sequence *this_elem = NULL, temp_elem;
|
2022-03-08 04:43:05 +08:00
|
|
|
FILE *file;
|
|
|
|
extern int Default_DNA_Trans[], Default_RNA_Trans[];
|
2023-04-09 02:17:32 +08:00
|
|
|
extern int OVERWRITE, Default_NA_RTrans[], Default_PROColor_LKUP[];
|
2022-03-08 04:43:05 +08:00
|
|
|
|
2023-04-09 02:17:32 +08:00
|
|
|
ErrorOut("No such file", file = fopen(filename, "r"));
|
2022-03-08 04:43:05 +08:00
|
|
|
|
2023-04-09 02:17:32 +08:00
|
|
|
for (; fgets(Inline, GBUFSIZ, file) != 0;) {
|
|
|
|
for (line = Inline; line[0] == ' ' || line[0] == '\t'; line++)
|
|
|
|
;
|
2022-03-08 04:43:05 +08:00
|
|
|
|
2023-04-09 02:17:32 +08:00
|
|
|
if (Find2(line, "{") == 0) {
|
2022-03-08 04:43:05 +08:00
|
|
|
this_elem = &temp_elem;
|
2023-04-09 02:17:32 +08:00
|
|
|
InitNASeq(this_elem, DNA);
|
2022-03-08 04:43:05 +08:00
|
|
|
this_elem->offset = -(dataset->rel_offset);
|
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
else if (Find2(line, "type") == 0) {
|
|
|
|
if (Find(line, "DNA")) {
|
2022-03-08 04:43:05 +08:00
|
|
|
this_elem->elementtype = DNA;
|
|
|
|
this_elem->tmatrix = Default_DNA_Trans;
|
|
|
|
this_elem->rmatrix = Default_NA_RTrans;
|
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
else if (Find(line, "RNA")) {
|
2022-03-08 04:43:05 +08:00
|
|
|
this_elem->elementtype = RNA;
|
|
|
|
this_elem->tmatrix = Default_RNA_Trans;
|
|
|
|
this_elem->rmatrix = Default_NA_RTrans;
|
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
else if (Find(line, "MASK")) {
|
2022-03-08 04:43:05 +08:00
|
|
|
this_elem->elementtype = MASK;
|
|
|
|
this_elem->rmatrix = NULL;
|
|
|
|
this_elem->tmatrix = NULL;
|
|
|
|
this_elem->col_lut = NULL;
|
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
else if (Find(line, "TEXT")) {
|
2022-03-08 04:43:05 +08:00
|
|
|
this_elem->elementtype = TEXT;
|
|
|
|
this_elem->rmatrix = NULL;
|
|
|
|
this_elem->tmatrix = NULL;
|
|
|
|
this_elem->col_lut = NULL;
|
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
else if (Find(line, "PROT")) {
|
2022-03-08 04:43:05 +08:00
|
|
|
this_elem->elementtype = PROTEIN;
|
|
|
|
this_elem->rmatrix = NULL;
|
|
|
|
this_elem->tmatrix = NULL;
|
|
|
|
this_elem->col_lut = Default_PROColor_LKUP;
|
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
/*
|
|
|
|
this_elem->attr =
|
|
|
|
DEFAULT_X_ATTR;
|
|
|
|
*/
|
2022-03-08 04:43:05 +08:00
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
else if (Find2(line, "circular") == 0) {
|
|
|
|
sscanf(line, "%*s %d", &temp);
|
|
|
|
if (temp == 1) {
|
2022-03-08 04:43:05 +08:00
|
|
|
this_elem->attr |= IS_CIRCULAR;
|
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
else {
|
2022-03-08 04:43:05 +08:00
|
|
|
this_elem->attr &= ~IS_CIRCULAR;
|
|
|
|
}
|
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
else if (Find2(line, "orig_direction") == 0) {
|
|
|
|
sscanf(line, "%*s %d", &temp);
|
|
|
|
if (temp == 1) {
|
2022-03-08 04:43:05 +08:00
|
|
|
this_elem->attr |= IS_ORIG_5_TO_3;
|
|
|
|
this_elem->attr &= ~IS_ORIG_3_TO_5;
|
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
else {
|
2022-03-08 04:43:05 +08:00
|
|
|
this_elem->attr |= IS_ORIG_3_TO_5;
|
|
|
|
this_elem->attr &= ~IS_ORIG_5_TO_3;
|
|
|
|
}
|
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
else if (Find2(line, "direction") == 0) {
|
|
|
|
sscanf(line, "%*s %d", &temp);
|
|
|
|
if (temp == 1) {
|
2022-03-08 04:43:05 +08:00
|
|
|
this_elem->attr |= IS_5_TO_3;
|
|
|
|
this_elem->attr &= ~IS_3_TO_5;
|
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
else {
|
2022-03-08 04:43:05 +08:00
|
|
|
this_elem->attr |= IS_3_TO_5;
|
|
|
|
this_elem->attr &= ~IS_5_TO_3;
|
|
|
|
}
|
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
else if (Find2(line, "orig_strand") == 0) {
|
|
|
|
sscanf(line, "%*s %d", &temp);
|
|
|
|
if (temp == 1) {
|
2022-03-08 04:43:05 +08:00
|
|
|
this_elem->attr |= IS_ORIG_PRIMARY;
|
|
|
|
this_elem->attr &= ~IS_ORIG_SECONDARY;
|
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
else {
|
2022-03-08 04:43:05 +08:00
|
|
|
this_elem->attr |= IS_ORIG_SECONDARY;
|
|
|
|
this_elem->attr &= ~IS_ORIG_PRIMARY;
|
|
|
|
}
|
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
else if (Find2(line, "strandedness") == 0) {
|
|
|
|
sscanf(line, "%*s %d", &temp);
|
|
|
|
if (temp == 1) {
|
2022-03-08 04:43:05 +08:00
|
|
|
this_elem->attr |= IS_PRIMARY;
|
|
|
|
this_elem->attr &= ~IS_SECONDARY;
|
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
else {
|
2022-03-08 04:43:05 +08:00
|
|
|
this_elem->attr |= IS_SECONDARY;
|
|
|
|
this_elem->attr &= ~IS_PRIMARY;
|
|
|
|
}
|
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
else if (Find2(line, "creator") == 0) {
|
|
|
|
sscanf(line, "%*s %[^\n]", this_elem->authority);
|
2022-03-08 04:43:05 +08:00
|
|
|
RemoveQuotes(this_elem->authority);
|
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
else if (Find2(line, "longname") == 0) {
|
|
|
|
sscanf(line, "%*s %[^\n]", this_elem->seq_name);
|
2022-03-08 04:43:05 +08:00
|
|
|
RemoveQuotes(this_elem->seq_name);
|
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
else if (Find2(line, "descrip") == 0) {
|
|
|
|
sscanf(line, "%*s %[^\n]", this_elem->description);
|
2022-03-08 04:43:05 +08:00
|
|
|
RemoveQuotes(this_elem->description);
|
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
else if (Find2(line, "name") == 0) {
|
|
|
|
sscanf(line, "%*s %[^\n]", this_elem->short_name);
|
2022-03-08 04:43:05 +08:00
|
|
|
RemoveQuotes(this_elem->short_name);
|
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
else if (Find2(line, "group-ID") == 0) {
|
|
|
|
sscanf(line, "%*s %d", &(this_elem->groupid));
|
2022-03-08 04:43:05 +08:00
|
|
|
dataset->numgroups =
|
|
|
|
MAX(this_elem->groupid, dataset->numgroups);
|
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
else if (Find2(line, "sequence-ID") == 0) {
|
|
|
|
sscanf(line, "%*s %[^\n]", this_elem->id);
|
2022-03-08 04:43:05 +08:00
|
|
|
RemoveQuotes(this_elem->id);
|
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
else if (Find2(line, "barcode") == 0) {
|
|
|
|
sscanf(line, "%*s %[^\n]", this_elem->barcode);
|
2022-03-08 04:43:05 +08:00
|
|
|
RemoveQuotes(this_elem->barcode);
|
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
else if (Find2(line, "membrane") == 0) {
|
|
|
|
sscanf(line, "%*s %[^\n]", this_elem->membrane);
|
2022-03-08 04:43:05 +08:00
|
|
|
RemoveQuotes(this_elem->membrane);
|
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
else if (Find2(line, "contig") == 0) {
|
|
|
|
sscanf(line, "%*s %[^\n]", this_elem->contig);
|
2022-03-08 04:43:05 +08:00
|
|
|
RemoveQuotes(this_elem->contig);
|
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
else if (Find2(line, "creation-date") == 0) {
|
|
|
|
sscanf(line, "%*s %2d%*c%2d%*c%2d%*c%2d%*c%2d%*c%2d\n",
|
|
|
|
&(this_elem->t_stamp.origin.mm),
|
|
|
|
&(this_elem->t_stamp.origin.dd),
|
|
|
|
&(this_elem->t_stamp.origin.yy),
|
|
|
|
&(this_elem->t_stamp.origin.hr),
|
|
|
|
&(this_elem->t_stamp.origin.mn),
|
|
|
|
&(this_elem->t_stamp.origin.sc));
|
2022-03-08 04:43:05 +08:00
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
else if (Find2(line, "offset") == 0) {
|
|
|
|
sscanf(line, "%*s %d", &(this_elem->offset));
|
2022-03-08 04:43:05 +08:00
|
|
|
this_elem->offset -= dataset->rel_offset;
|
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
else if (Find2(line, "comments") == 0) {
|
|
|
|
if (this_elem->comments_maxlen == 0)
|
2022-03-08 04:43:05 +08:00
|
|
|
buflen = 2048;
|
|
|
|
else
|
|
|
|
buflen = this_elem->comments_maxlen;
|
|
|
|
|
|
|
|
done = FALSE;
|
|
|
|
len = this_elem->comments_len;
|
|
|
|
|
2023-04-09 02:17:32 +08:00
|
|
|
for (; line[0] != '"'; line++)
|
|
|
|
if (line[0] == '\0')
|
|
|
|
ErrorOut(0, "Error in input file");
|
2022-03-08 04:43:05 +08:00
|
|
|
line++;
|
2023-04-09 02:17:32 +08:00
|
|
|
buffer = Calloc(buflen, sizeof(char));
|
|
|
|
for (; !done;) {
|
|
|
|
for (j = 0; j < strlen(line); j++) {
|
|
|
|
if (len + strlen(line) >= buflen) {
|
|
|
|
buflen *= 2;
|
|
|
|
buffer = Realloc(
|
|
|
|
buffer,
|
|
|
|
buflen * sizeof(char));
|
2022-03-08 04:43:05 +08:00
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
if (line[j] == '"')
|
|
|
|
done = TRUE;
|
2022-03-08 04:43:05 +08:00
|
|
|
|
2023-04-09 02:17:32 +08:00
|
|
|
else
|
2022-03-08 04:43:05 +08:00
|
|
|
buffer[len++] = line[j];
|
|
|
|
}
|
|
|
|
/*
|
2023-04-09 02:17:32 +08:00
|
|
|
* Check pad with null
|
|
|
|
*/
|
2022-03-08 04:43:05 +08:00
|
|
|
buffer[len] = '\0';
|
2023-04-09 02:17:32 +08:00
|
|
|
if (!done) {
|
|
|
|
if (fgets(Inline, GBUFSIZ, file) == 0)
|
2022-03-08 04:43:05 +08:00
|
|
|
done = TRUE;
|
|
|
|
line = Inline;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this_elem->comments = buffer;
|
|
|
|
this_elem->comments_len = strlen(buffer);
|
|
|
|
this_elem->comments_maxlen = buflen;
|
|
|
|
RemoveQuotes(this_elem->comments);
|
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
else if (Find2(line, "sequence") == 0) {
|
2022-03-08 04:43:05 +08:00
|
|
|
buflen = GBUFSIZ;
|
|
|
|
done = FALSE;
|
|
|
|
len = 0;
|
|
|
|
|
2023-04-09 02:17:32 +08:00
|
|
|
buffer = Calloc(buflen, sizeof(char));
|
|
|
|
for (; line[0] != '"'; line++)
|
|
|
|
if (line[0] == '\0')
|
|
|
|
ErrorOut(0, "Error in input file");
|
2022-03-08 04:43:05 +08:00
|
|
|
|
|
|
|
line++;
|
2023-04-09 02:17:32 +08:00
|
|
|
for (; !done;) {
|
|
|
|
for (j = 0; j < strlen(line); j++) {
|
|
|
|
if (len + strlen(line) >= buflen) {
|
|
|
|
buflen *= 2;
|
|
|
|
buffer = Realloc(
|
|
|
|
buffer,
|
|
|
|
buflen * sizeof(char));
|
2022-03-08 04:43:05 +08:00
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
if (line[j] == '"')
|
|
|
|
done = TRUE;
|
2022-03-08 04:43:05 +08:00
|
|
|
|
2023-04-09 02:17:32 +08:00
|
|
|
else {
|
2022-03-08 04:43:05 +08:00
|
|
|
/*
|
2023-04-09 02:17:32 +08:00
|
|
|
* If not
|
|
|
|
*text, ignore spaces...
|
|
|
|
*/
|
|
|
|
if (this_elem->elementtype !=
|
|
|
|
TEXT) {
|
|
|
|
if (line[j] != ' ' &&
|
|
|
|
line[j] != '\t' &&
|
|
|
|
line[j] != '\n')
|
|
|
|
buffer[len++] =
|
|
|
|
line[j];
|
2022-03-08 04:43:05 +08:00
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
else if (line[j] != '\t' &&
|
|
|
|
line[j] != '\n')
|
|
|
|
buffer[len++] = line[j];
|
2022-03-08 04:43:05 +08:00
|
|
|
}
|
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
if (!done) {
|
|
|
|
if (fgets(Inline, GBUFSIZ, file) == 0)
|
2022-03-08 04:43:05 +08:00
|
|
|
done = TRUE;
|
|
|
|
line = Inline;
|
|
|
|
}
|
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
if (this_elem->rmatrix)
|
|
|
|
for (j = 0; j < len; j++)
|
|
|
|
buffer[j] =
|
|
|
|
this_elem->rmatrix[buffer[j]];
|
|
|
|
this_elem->sequence = (NA_Base *)buffer;
|
2022-03-08 04:43:05 +08:00
|
|
|
this_elem->seqlen = len;
|
|
|
|
this_elem->seqmaxlen = buflen;
|
|
|
|
}
|
|
|
|
|
2023-04-09 02:17:32 +08:00
|
|
|
else if (Find2(line, "}") == 0) {
|
|
|
|
if (this_elem->id[0] == '\0')
|
|
|
|
strncpy(this_elem->id, uniqueID(), 79);
|
|
|
|
if (this_elem->short_name[0] == '\0')
|
|
|
|
strncpy(this_elem->short_name, this_elem->id,
|
|
|
|
79);
|
|
|
|
if (this_elem->seqlen == 0)
|
|
|
|
this_elem->protect =
|
|
|
|
PROT_BASE_CHANGES + PROT_GREY_SPACE +
|
|
|
|
PROT_WHITE_SPACE + PROT_TRANSLATION;
|
2022-03-08 04:43:05 +08:00
|
|
|
genclen = 0;
|
2023-04-09 02:17:32 +08:00
|
|
|
/*
|
|
|
|
* Make a new sequence entry...
|
|
|
|
*/
|
2022-03-08 04:43:05 +08:00
|
|
|
|
|
|
|
success = -1;
|
2023-04-09 02:17:32 +08:00
|
|
|
if (OVERWRITE) success = OverWrite(this_elem, dataset);
|
2022-03-08 04:43:05 +08:00
|
|
|
|
2023-04-09 02:17:32 +08:00
|
|
|
if (success == -1) {
|
2022-03-08 04:43:05 +08:00
|
|
|
curelem = dataset->numelements++;
|
2023-04-09 02:17:32 +08:00
|
|
|
if (curelem == 0) {
|
|
|
|
dataset->element =
|
|
|
|
(NA_Sequence *)Calloc(
|
|
|
|
5, sizeof(NA_Sequence));
|
2022-03-08 04:43:05 +08:00
|
|
|
dataset->maxnumelements = 5;
|
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
else if (curelem == dataset->maxnumelements) {
|
2022-03-08 04:43:05 +08:00
|
|
|
(dataset->maxnumelements) *= 2;
|
2023-04-09 02:17:32 +08:00
|
|
|
dataset->element =
|
|
|
|
(NA_Sequence *)Realloc(
|
|
|
|
dataset->element,
|
|
|
|
dataset->maxnumelements *
|
|
|
|
sizeof(NA_Sequence));
|
2022-03-08 04:43:05 +08:00
|
|
|
}
|
|
|
|
dataset->element[curelem] = *this_elem;
|
|
|
|
}
|
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
else if (this_elem != NULL) {
|
|
|
|
if (this_elem->baggage == NULL) {
|
2022-03-08 04:43:05 +08:00
|
|
|
this_elem->baggage = String(line);
|
|
|
|
this_elem->baggage_maxlen =
|
|
|
|
this_elem->baggage_len =
|
2023-04-09 02:17:32 +08:00
|
|
|
strlen(this_elem->baggage) + 1;
|
2022-03-08 04:43:05 +08:00
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
else {
|
|
|
|
this_elem->baggage_len += strlen(line) + 1;
|
2022-03-08 04:43:05 +08:00
|
|
|
this_elem->baggage = Realloc(
|
2023-04-09 02:17:32 +08:00
|
|
|
this_elem->baggage,
|
|
|
|
this_elem->baggage_len * sizeof(char));
|
2022-03-08 04:43:05 +08:00
|
|
|
this_elem->baggage_maxlen =
|
|
|
|
this_elem->baggage_len;
|
|
|
|
|
2023-04-09 02:17:32 +08:00
|
|
|
strncat(this_elem->baggage, line, GBUFSIZ);
|
2022-03-08 04:43:05 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fclose(file);
|
|
|
|
NormalizeOffset(dataset);
|
|
|
|
Regroup(dataset);
|
|
|
|
AdjustGroups(dataset);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-04-09 02:17:32 +08:00
|
|
|
WriteGDE(aln, filename, method, maskable) NA_Alignment *aln;
|
2022-03-08 04:43:05 +08:00
|
|
|
char *filename;
|
2023-04-09 02:17:32 +08:00
|
|
|
int method, maskable;
|
2022-03-08 04:43:05 +08:00
|
|
|
{
|
2023-04-09 02:17:32 +08:00
|
|
|
int i, j, k, mask = -1;
|
2022-03-08 04:43:05 +08:00
|
|
|
FILE *file;
|
|
|
|
NA_Sequence *this_elem;
|
|
|
|
extern char month[12][6];
|
|
|
|
|
2023-04-09 02:17:32 +08:00
|
|
|
if (aln == NULL) return;
|
|
|
|
if (aln->na_ddata == NULL) return;
|
2022-03-08 04:43:05 +08:00
|
|
|
|
2023-04-09 02:17:32 +08:00
|
|
|
file = fopen(filename, "w");
|
|
|
|
if (file == NULL) {
|
2022-03-08 04:43:05 +08:00
|
|
|
Warning("Cannot open file for output");
|
2023-04-09 02:17:32 +08:00
|
|
|
return (1);
|
2022-03-08 04:43:05 +08:00
|
|
|
}
|
|
|
|
|
2023-04-09 02:17:32 +08:00
|
|
|
if (maskable && method != SELECT_REGION)
|
|
|
|
for (j = 0; j < aln->numelements; j++)
|
|
|
|
if (aln->element[j].elementtype == MASK &&
|
2022-03-08 04:43:05 +08:00
|
|
|
aln->element[j].selected)
|
|
|
|
mask = j;
|
|
|
|
|
2023-04-09 02:17:32 +08:00
|
|
|
for (j = 0; j < aln->numelements; j++) {
|
|
|
|
if ((aln->element[j].selected && j != mask &&
|
|
|
|
method != SELECT_REGION) ||
|
|
|
|
(method == ALL) ||
|
|
|
|
(aln->element[j].subselected && method == SELECT_REGION)) {
|
2022-03-08 04:43:05 +08:00
|
|
|
this_elem = &(aln->element[j]);
|
|
|
|
SeqNorm(this_elem);
|
2023-04-09 02:17:32 +08:00
|
|
|
fprintf(file, "{\n");
|
|
|
|
if (this_elem->short_name[0])
|
|
|
|
fprintf(file, "name \"%s\"\n",
|
|
|
|
this_elem->short_name);
|
|
|
|
switch (this_elem->elementtype) {
|
|
|
|
case DNA:
|
|
|
|
fprintf(file,
|
|
|
|
"type \"DNA\"\n");
|
|
|
|
break;
|
|
|
|
case RNA:
|
|
|
|
fprintf(file,
|
|
|
|
"type \"RNA\"\n");
|
|
|
|
break;
|
|
|
|
case PROTEIN:
|
|
|
|
fprintf(file,
|
|
|
|
"type \"PROTEIN\"\n");
|
|
|
|
break;
|
|
|
|
case MASK:
|
|
|
|
fprintf(file,
|
|
|
|
"type \"MASK\"\n");
|
|
|
|
break;
|
|
|
|
case TEXT:
|
|
|
|
fprintf(file,
|
|
|
|
"type \"TEXT\"\n");
|
|
|
|
break;
|
2022-03-08 04:43:05 +08:00
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
if (this_elem->seq_name[0])
|
|
|
|
fprintf(file, "longname %s\n",
|
|
|
|
this_elem->seq_name);
|
2022-03-08 04:43:05 +08:00
|
|
|
|
2023-04-09 02:17:32 +08:00
|
|
|
if (this_elem->id[0])
|
|
|
|
fprintf(file, "sequence-ID \"%s\"\n",
|
|
|
|
this_elem->id);
|
2022-03-08 04:43:05 +08:00
|
|
|
RemoveQuotes(this_elem->barcode);
|
|
|
|
RemoveQuotes(this_elem->contig);
|
|
|
|
|
2023-04-09 02:17:32 +08:00
|
|
|
if (this_elem->barcode[0])
|
|
|
|
fprintf(file, "barcode \"%s\"\n",
|
|
|
|
this_elem->barcode);
|
|
|
|
if (this_elem->membrane[0])
|
|
|
|
fprintf(file, "membrane \"%s\"\n",
|
|
|
|
this_elem->membrane);
|
|
|
|
if (this_elem->contig[0])
|
|
|
|
fprintf(file, "contig \"%s\"\n",
|
|
|
|
this_elem->contig);
|
|
|
|
if (this_elem->description[0])
|
|
|
|
fprintf(file, "descrip \"%s\"\n",
|
|
|
|
this_elem->description);
|
|
|
|
if (this_elem->authority[0])
|
|
|
|
fprintf(file, "creator \"%s\"\n",
|
|
|
|
this_elem->authority);
|
|
|
|
if (this_elem->groupid)
|
|
|
|
fprintf(file, "group-ID %d\n",
|
|
|
|
this_elem->groupid);
|
|
|
|
if (this_elem->offset + aln->rel_offset &&
|
|
|
|
method != SELECT_REGION)
|
|
|
|
fprintf(file, "offset %d\n",
|
|
|
|
this_elem->offset + aln->rel_offset);
|
|
|
|
if (method == SELECT_REGION) {
|
|
|
|
/*
|
|
|
|
* If selecting a region, the offset should
|
|
|
|
*be moved to the first non-'0' space in the
|
|
|
|
*mask.
|
|
|
|
*/
|
|
|
|
for (k = this_elem->offset;
|
|
|
|
k < aln->selection_mask_len &&
|
|
|
|
aln->selection_mask[k] == '0';
|
|
|
|
k++)
|
|
|
|
;
|
|
|
|
fprintf(file, "offset %d\n",
|
|
|
|
aln->rel_offset + k);
|
2022-03-08 04:43:05 +08:00
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
if (this_elem->t_stamp.origin.mm != 0)
|
|
|
|
fprintf(
|
|
|
|
file,
|
|
|
|
"creation-date %2d/%2d/%2d "
|
|
|
|
"%2d:%2d:%2d\n",
|
2022-03-08 04:43:05 +08:00
|
|
|
this_elem->t_stamp.origin.mm,
|
|
|
|
this_elem->t_stamp.origin.dd,
|
2023-04-09 02:17:32 +08:00
|
|
|
(this_elem->t_stamp.origin.yy) > 1900
|
|
|
|
? (this_elem->t_stamp.origin.yy - 1900)
|
|
|
|
: (this_elem->t_stamp.origin.yy),
|
2022-03-08 04:43:05 +08:00
|
|
|
this_elem->t_stamp.origin.hr,
|
|
|
|
this_elem->t_stamp.origin.mn,
|
|
|
|
this_elem->t_stamp.origin.sc);
|
2023-04-09 02:17:32 +08:00
|
|
|
if ((this_elem->attr & IS_ORIG_5_TO_3) &&
|
2022-03-08 04:43:05 +08:00
|
|
|
((this_elem->attr & IS_ORIG_3_TO_5) == 0))
|
2023-04-09 02:17:32 +08:00
|
|
|
fprintf(file, "orig_direction 1\n");
|
2022-03-08 04:43:05 +08:00
|
|
|
|
2023-04-09 02:17:32 +08:00
|
|
|
if ((this_elem->attr & IS_CIRCULAR))
|
|
|
|
fprintf(file, "circular 1\n");
|
2022-03-08 04:43:05 +08:00
|
|
|
|
2023-04-09 02:17:32 +08:00
|
|
|
if ((this_elem->attr & IS_5_TO_3) &&
|
2022-03-08 04:43:05 +08:00
|
|
|
((this_elem->attr & IS_3_TO_5) == 0))
|
2023-04-09 02:17:32 +08:00
|
|
|
fprintf(file, "direction 1\n");
|
2022-03-08 04:43:05 +08:00
|
|
|
|
2023-04-09 02:17:32 +08:00
|
|
|
if ((this_elem->attr & IS_ORIG_3_TO_5) &&
|
2022-03-08 04:43:05 +08:00
|
|
|
((this_elem->attr & IS_ORIG_5_TO_3) == 0))
|
2023-04-09 02:17:32 +08:00
|
|
|
fprintf(file, "orig_direction -1\n");
|
2022-03-08 04:43:05 +08:00
|
|
|
|
2023-04-09 02:17:32 +08:00
|
|
|
if ((this_elem->attr & IS_3_TO_5) &&
|
2022-03-08 04:43:05 +08:00
|
|
|
((this_elem->attr & IS_5_TO_3) == 0))
|
2023-04-09 02:17:32 +08:00
|
|
|
fprintf(file, "direction -1\n");
|
2022-03-08 04:43:05 +08:00
|
|
|
|
2023-04-09 02:17:32 +08:00
|
|
|
if ((this_elem->attr & IS_ORIG_PRIMARY) &&
|
2022-03-08 04:43:05 +08:00
|
|
|
((this_elem->attr & IS_ORIG_SECONDARY) == 0))
|
2023-04-09 02:17:32 +08:00
|
|
|
fprintf(file, "orig_strand 1\n");
|
2022-03-08 04:43:05 +08:00
|
|
|
|
2023-04-09 02:17:32 +08:00
|
|
|
if ((this_elem->attr & IS_PRIMARY) &&
|
2022-03-08 04:43:05 +08:00
|
|
|
((this_elem->attr & IS_SECONDARY) == 0))
|
2023-04-09 02:17:32 +08:00
|
|
|
fprintf(file, "strandedness 1\n");
|
2022-03-08 04:43:05 +08:00
|
|
|
|
2023-04-09 02:17:32 +08:00
|
|
|
if (((this_elem->attr & IS_ORIG_PRIMARY) == 0) &&
|
2022-03-08 04:43:05 +08:00
|
|
|
(this_elem->attr & IS_ORIG_SECONDARY))
|
2023-04-09 02:17:32 +08:00
|
|
|
fprintf(file, "orig_strand 2\n");
|
2022-03-08 04:43:05 +08:00
|
|
|
|
2023-04-09 02:17:32 +08:00
|
|
|
if (((this_elem->attr & IS_PRIMARY) == 0) &&
|
2022-03-08 04:43:05 +08:00
|
|
|
(this_elem->attr & IS_SECONDARY))
|
2023-04-09 02:17:32 +08:00
|
|
|
fprintf(file, "strandedness 2\n");
|
2022-03-08 04:43:05 +08:00
|
|
|
|
2023-04-09 02:17:32 +08:00
|
|
|
if (this_elem->comments != NULL) {
|
2022-03-08 04:43:05 +08:00
|
|
|
StripSpecial(this_elem->comments);
|
2023-04-09 02:17:32 +08:00
|
|
|
fprintf(file, "comments \"%s\"\n",
|
|
|
|
this_elem->comments);
|
2022-03-08 04:43:05 +08:00
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
if (this_elem->baggage != NULL) {
|
|
|
|
if (this_elem
|
|
|
|
->baggage[strlen(this_elem->baggage) -
|
|
|
|
1] == '\n')
|
|
|
|
fprintf(file, "%s", this_elem->baggage);
|
2022-03-08 04:43:05 +08:00
|
|
|
else
|
2023-04-09 02:17:32 +08:00
|
|
|
fprintf(file, "%s\n",
|
|
|
|
this_elem->baggage);
|
2022-03-08 04:43:05 +08:00
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
fprintf(file, "sequence \"");
|
|
|
|
if (this_elem->tmatrix) {
|
|
|
|
if (mask == -1) {
|
|
|
|
for (k = this_elem->offset;
|
|
|
|
k < this_elem->seqlen +
|
|
|
|
this_elem->offset;
|
|
|
|
k++) {
|
|
|
|
if (k % 60 == 0)
|
|
|
|
putc('\n', file);
|
|
|
|
if (method == SELECT_REGION) {
|
|
|
|
if (aln->selection_mask
|
|
|
|
[k] == '1')
|
|
|
|
putc(
|
|
|
|
this_elem->tmatrix
|
|
|
|
[getelem(
|
|
|
|
this_elem,
|
|
|
|
k)],
|
|
|
|
file);
|
2022-03-08 04:43:05 +08:00
|
|
|
}
|
|
|
|
else
|
2023-04-09 02:17:32 +08:00
|
|
|
putc(this_elem->tmatrix
|
|
|
|
[getelem(
|
|
|
|
this_elem,
|
|
|
|
k)],
|
|
|
|
file);
|
2022-03-08 04:43:05 +08:00
|
|
|
}
|
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
else {
|
|
|
|
for (i = 0, k = this_elem->offset;
|
|
|
|
k < this_elem->seqlen +
|
|
|
|
this_elem->offset;
|
|
|
|
k++)
|
|
|
|
if (aln->element[mask].seqlen +
|
|
|
|
this_elem->offset >
|
|
|
|
k)
|
|
|
|
if ((char)getelem(
|
|
|
|
&(aln->element
|
|
|
|
[mask]),
|
|
|
|
k) != '0' &&
|
|
|
|
((char)getelem(
|
|
|
|
&(aln->element
|
|
|
|
[mask]),
|
|
|
|
k) != '-')) {
|
|
|
|
if (i % 60 == 0)
|
|
|
|
putc(
|
|
|
|
'\n',
|
|
|
|
file);
|
|
|
|
putc(
|
|
|
|
this_elem->tmatrix
|
|
|
|
[getelem(
|
|
|
|
this_elem,
|
|
|
|
k)],
|
|
|
|
file);
|
|
|
|
i++;
|
|
|
|
}
|
2022-03-08 04:43:05 +08:00
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
fprintf(file, "\"\n");
|
2022-03-08 04:43:05 +08:00
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
else {
|
|
|
|
if (mask == -1) {
|
|
|
|
for (k = this_elem->offset;
|
|
|
|
k < this_elem->seqlen +
|
|
|
|
this_elem->offset;
|
|
|
|
k++) {
|
|
|
|
if (k % 60 == 0)
|
|
|
|
putc('\n', file);
|
|
|
|
if (method == SELECT_REGION) {
|
|
|
|
if (aln->selection_mask
|
|
|
|
[k] == '1')
|
|
|
|
putc(
|
|
|
|
getelem(
|
|
|
|
this_elem,
|
|
|
|
k),
|
|
|
|
file);
|
2022-03-08 04:43:05 +08:00
|
|
|
}
|
|
|
|
else
|
2023-04-09 02:17:32 +08:00
|
|
|
putc(getelem(this_elem,
|
|
|
|
k),
|
|
|
|
file);
|
2022-03-08 04:43:05 +08:00
|
|
|
}
|
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
else {
|
|
|
|
for (i = 0, k = this_elem->offset;
|
|
|
|
k < this_elem->seqlen +
|
|
|
|
this_elem->offset;
|
|
|
|
k++)
|
|
|
|
if (((aln->element[mask]
|
|
|
|
.seqlen) +
|
|
|
|
(aln->element[mask]
|
|
|
|
.offset)) > k)
|
|
|
|
if ((char)getelem(
|
|
|
|
&(aln->element
|
|
|
|
[mask]),
|
|
|
|
k) == '1') {
|
|
|
|
if (i % 60 == 0)
|
|
|
|
putc(
|
|
|
|
'\n',
|
|
|
|
file);
|
|
|
|
putc(
|
|
|
|
getelem(
|
|
|
|
this_elem,
|
|
|
|
k),
|
|
|
|
file);
|
2022-03-08 04:43:05 +08:00
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
fprintf(file, "\"\n");
|
2022-03-08 04:43:05 +08:00
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
fprintf(file, "}\n");
|
2022-03-08 04:43:05 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
fclose(file);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-04-09 02:17:32 +08:00
|
|
|
StripSpecial(string) char *string;
|
2022-03-08 04:43:05 +08:00
|
|
|
{
|
2023-04-09 02:17:32 +08:00
|
|
|
register int i, j, len;
|
2022-03-08 04:43:05 +08:00
|
|
|
|
|
|
|
len = strlen(string);
|
2023-04-09 02:17:32 +08:00
|
|
|
for (j = 0; j < len; j++) {
|
|
|
|
if (string[j] == '"')
|
2022-03-08 04:43:05 +08:00
|
|
|
string[j] = '`';
|
2023-04-09 02:17:32 +08:00
|
|
|
else if (string[j] == '{')
|
2022-03-08 04:43:05 +08:00
|
|
|
string[j] = '(';
|
2023-04-09 02:17:32 +08:00
|
|
|
else if (string[j] == '}')
|
2022-03-08 04:43:05 +08:00
|
|
|
string[j] = ')';
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-04-09 02:17:32 +08:00
|
|
|
RemoveQuotes(string) char *string;
|
2022-03-08 04:43:05 +08:00
|
|
|
{
|
2023-04-09 02:17:32 +08:00
|
|
|
register int i, j, len;
|
2022-03-08 04:43:05 +08:00
|
|
|
|
|
|
|
len = strlen(string);
|
2023-04-09 02:17:32 +08:00
|
|
|
for (j = 0; j < len; j++)
|
|
|
|
if (string[j] == '"') string[j] = ' ';
|
2022-03-08 04:43:05 +08:00
|
|
|
|
2023-04-09 02:17:32 +08:00
|
|
|
for (j = 0; string[j] == ' ' && j < strlen(string); j++)
|
|
|
|
;
|
2022-03-08 04:43:05 +08:00
|
|
|
|
|
|
|
len = strlen(string);
|
2023-04-09 02:17:32 +08:00
|
|
|
for (i = 0; i < len - j; i++) string[i] = string[i + j];
|
2022-03-08 04:43:05 +08:00
|
|
|
|
2023-04-09 02:17:32 +08:00
|
|
|
for (j = strlen(string) - 1;
|
|
|
|
j >= 0 && (string[j] == '\n' || string[j] == ' '); j--)
|
2022-03-08 04:43:05 +08:00
|
|
|
string[j] = '\0';
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2023-04-09 02:17:32 +08:00
|
|
|
* Normalize seq (remove leading indels in the sequence;
|
|
|
|
*/
|
|
|
|
void SeqNorm(seq) NA_Sequence *seq;
|
2022-03-08 04:43:05 +08:00
|
|
|
{
|
2023-04-09 02:17:32 +08:00
|
|
|
int len, j, shift_width, trailer;
|
2022-03-08 04:43:05 +08:00
|
|
|
char *sequence;
|
|
|
|
len = seq->seqlen;
|
|
|
|
|
2023-04-09 02:17:32 +08:00
|
|
|
sequence = (char *)seq->sequence;
|
2022-03-08 04:43:05 +08:00
|
|
|
|
2023-04-09 02:17:32 +08:00
|
|
|
if (len == 0) return;
|
2022-03-08 04:43:05 +08:00
|
|
|
|
2023-04-09 02:17:32 +08:00
|
|
|
if (seq->tmatrix)
|
|
|
|
for (shift_width = 0; (shift_width < len) &&
|
|
|
|
((sequence[shift_width] & 15) == '\0');
|
|
|
|
shift_width++)
|
|
|
|
;
|
2022-03-08 04:43:05 +08:00
|
|
|
else
|
2023-04-09 02:17:32 +08:00
|
|
|
for (shift_width = 0;
|
|
|
|
(shift_width < len) && (sequence[shift_width] == '-');
|
|
|
|
shift_width++)
|
|
|
|
;
|
2022-03-08 04:43:05 +08:00
|
|
|
|
2023-04-09 02:17:32 +08:00
|
|
|
for (j = 0; j < len - shift_width; j++)
|
|
|
|
sequence[j] = sequence[j + shift_width];
|
2022-03-08 04:43:05 +08:00
|
|
|
|
|
|
|
seq->seqlen -= shift_width;
|
|
|
|
seq->offset += shift_width;
|
2023-04-09 02:17:32 +08:00
|
|
|
for (trailer = seq->seqlen - 1;
|
|
|
|
(sequence[trailer] == '-' || sequence[trailer] == '\0') &&
|
|
|
|
trailer >= 0;
|
|
|
|
trailer--)
|
2022-03-08 04:43:05 +08:00
|
|
|
sequence[trailer] = '\0';
|
2023-04-09 02:17:32 +08:00
|
|
|
seq->seqlen = trailer + 1;
|
2022-03-08 04:43:05 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ALWAYS COPY the result from uniqueID() to a char[32],
|
|
|
|
* (strlen(hostname)+1+10). Memory is lost when the function
|
|
|
|
* is finished.
|
|
|
|
*/
|
|
|
|
char vname[32];
|
|
|
|
char *uniqueID()
|
|
|
|
{
|
|
|
|
char hname[32]; /* ,vname[32]; rtm 18.III.98 */
|
2023-04-09 02:17:32 +08:00
|
|
|
int hnamelen = 32;
|
2022-03-08 04:43:05 +08:00
|
|
|
time_t *tp;
|
|
|
|
static cnt = 0;
|
|
|
|
|
|
|
|
tp = (time_t *)Calloc(1, sizeof(time_t));
|
|
|
|
|
2023-04-09 02:17:32 +08:00
|
|
|
if (gethostname(hname, 10) == -1) {
|
2022-03-08 04:43:05 +08:00
|
|
|
fprintf(stderr, "UniqueID(): Failed to get host name.\n");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
time(tp);
|
|
|
|
sprintf(vname, "%s:%d:%ld", hname, cnt, *tp);
|
|
|
|
cnt++;
|
|
|
|
Cfree(tp);
|
2023-04-09 02:17:32 +08:00
|
|
|
return (vname);
|
2022-03-08 04:43:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2023-04-09 02:17:32 +08:00
|
|
|
* OverWrite(), overwrite all non-default data from a sequence entry
|
|
|
|
* onto any entry with the same ID or short name.
|
|
|
|
*/
|
|
|
|
OverWrite(this, aln) NA_Sequence *this;
|
2022-03-08 04:43:05 +08:00
|
|
|
NA_Alignment *aln;
|
|
|
|
{
|
2023-04-09 02:17:32 +08:00
|
|
|
int j, indx = -1;
|
2022-03-08 04:43:05 +08:00
|
|
|
NA_Sequence *that;
|
2023-04-09 02:17:32 +08:00
|
|
|
for (j = 0; j < aln->numelements; j++) {
|
|
|
|
if (Find2(this->id, aln->element[j].id) != -1)
|
|
|
|
if (Find2(aln->element[j].id, this->id) != -1) indx = j;
|
2022-03-08 04:43:05 +08:00
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
if (indx == -1)
|
|
|
|
for (j = 0; j < aln->numelements; j++) {
|
|
|
|
if (Find2(this->short_name,
|
|
|
|
aln->element[j].short_name) != -1)
|
|
|
|
if (Find2(aln->element[j].short_name,
|
|
|
|
this->short_name) != -1)
|
2022-03-08 04:43:05 +08:00
|
|
|
indx = j;
|
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
if (indx != -1) {
|
2022-03-08 04:43:05 +08:00
|
|
|
that = &(aln->element[indx]);
|
2023-04-09 02:17:32 +08:00
|
|
|
if (this->seq_name[0]) strcpy(that->seq_name, this->seq_name);
|
|
|
|
if (this->barcode[0]) strcpy(that->barcode, this->barcode);
|
|
|
|
if (this->contig[0]) strcpy(that->contig, this->contig);
|
|
|
|
if (this->membrane[0]) strcpy(that->membrane, this->membrane);
|
|
|
|
if (this->authority[0])
|
|
|
|
strcpy(that->authority, this->authority);
|
|
|
|
if (this->short_name[0])
|
|
|
|
strcpy(that->short_name, this->short_name);
|
|
|
|
if (this->description[0])
|
|
|
|
strcpy(that->description, this->description);
|
|
|
|
if (this->sequence) {
|
2023-04-11 23:34:31 +08:00
|
|
|
free(that->sequence);
|
2022-03-08 04:43:05 +08:00
|
|
|
that->sequence = this->sequence;
|
|
|
|
that->seqlen = this->seqlen;
|
|
|
|
that->seqmaxlen = this->seqmaxlen;
|
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
if (this->baggage) {
|
2022-03-08 04:43:05 +08:00
|
|
|
that->baggage_len += this->baggage_len;
|
|
|
|
that->baggage_maxlen += this->baggage_maxlen;
|
2023-04-09 02:17:32 +08:00
|
|
|
if (that->baggage)
|
|
|
|
that->baggage = Realloc(
|
|
|
|
that->baggage,
|
|
|
|
that->baggage_maxlen * sizeof(char));
|
2022-03-08 04:43:05 +08:00
|
|
|
else
|
2023-04-09 02:17:32 +08:00
|
|
|
that->baggage =
|
|
|
|
Calloc(that->baggage_maxlen, sizeof(char));
|
|
|
|
strncat(that->baggage, this->baggage,
|
|
|
|
that->baggage_maxlen);
|
2022-03-08 04:43:05 +08:00
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
if (this->comments) {
|
2022-03-08 04:43:05 +08:00
|
|
|
that->comments_len += this->comments_len;
|
|
|
|
that->comments_maxlen += this->comments_maxlen;
|
2023-04-09 02:17:32 +08:00
|
|
|
if (that->comments)
|
|
|
|
that->comments = Realloc(
|
|
|
|
that->comments,
|
|
|
|
that->comments_maxlen * sizeof(char));
|
2022-03-08 04:43:05 +08:00
|
|
|
else
|
2023-04-09 02:17:32 +08:00
|
|
|
that->comments =
|
|
|
|
Calloc(that->comments_maxlen, sizeof(char));
|
|
|
|
strncat(that->comments, this->comments,
|
|
|
|
that->comments_maxlen);
|
2022-03-08 04:43:05 +08:00
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
if (this->cmask) {
|
2023-04-11 23:34:31 +08:00
|
|
|
free(that->cmask);
|
2022-03-08 04:43:05 +08:00
|
|
|
that->cmask = this->cmask;
|
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
if (this->offset != that->offset) that->offset = this->offset;
|
|
|
|
if (this->attr != 0) that->attr = this->attr;
|
|
|
|
if (this->groupid != 0) {
|
2022-03-08 04:43:05 +08:00
|
|
|
that->groupid = this->groupid;
|
|
|
|
}
|
|
|
|
that->groupb = NULL;
|
|
|
|
that->groupf = NULL;
|
|
|
|
}
|
2023-04-09 02:17:32 +08:00
|
|
|
/*
|
|
|
|
NormalizeOffset(aln);
|
|
|
|
Regroup(aln);
|
|
|
|
AdjustGroups(aln);
|
|
|
|
*/
|
|
|
|
return (indx);
|
2022-03-08 04:43:05 +08:00
|
|
|
}
|