gde_linux/SUPPORT/Zuk_to_gen.c

89 lines
1.7 KiB
C
Raw Normal View History

2023-04-12 03:39:54 +08:00
#include <stdio.h>
2023-04-12 03:41:11 +08:00
#include <string.h>
2023-04-12 03:39:54 +08:00
2023-04-12 03:41:11 +08:00
typedef struct Sequence {
int len;
char name[80];
char type[8];
char *nuc;
2023-04-12 03:39:54 +08:00
} Sequence;
main()
{
2023-04-12 03:41:11 +08:00
char a[5000], b[5000], cinline[132];
int pos1, pos2, pos3, i, j, k, FLAG;
2023-04-12 03:39:54 +08:00
Sequence pair[2];
2023-04-12 03:41:11 +08:00
for (j = 0; j < 5000; j++) b[j] = '-';
FLAG = (int)gets(cinline);
for (j = 0; FLAG; j++) {
FLAG = (int)gets(cinline);
sscanf(cinline, "%d", &pos1);
if ((sscanf(cinline, "%*6c %c %d %d %d", &(a[j]), &k, &pos2,
&pos3) == 4) &&
(FLAG)) {
if (pos3 != 0) {
if (pos1 < pos3) {
b[pos1 - 1] = '[';
b[pos3 - 1] = ']';
}
else {
b[pos3 - 1] = '[';
b[pos1 - 1] = ']';
2023-04-12 03:39:54 +08:00
}
}
}
2023-04-12 03:41:11 +08:00
else {
2023-04-12 03:39:54 +08:00
pair[0].len = j;
2023-04-12 03:41:11 +08:00
strcpy(pair[0].name, "HELIX");
strcpy(pair[0].type, "TEXT");
2023-04-12 03:39:54 +08:00
pair[1].len = j;
2023-04-12 03:41:11 +08:00
/*
sscanf(cinline,"%*24c
%s",pair[1].name);
*/
strcpy(pair[1].name, "Sequence");
strcpy(pair[1].type, "RNA");
2023-04-12 03:39:54 +08:00
pair[0].nuc = b;
pair[1].nuc = a;
2023-04-12 03:41:11 +08:00
WriteGen(pair, stdout, 2);
for (j = 0; j < 5000; j++) b[j] = '-';
2023-04-12 03:39:54 +08:00
j = -1;
}
}
exit(0);
}
2023-04-12 03:41:11 +08:00
WriteGen(seq, file, numseq) Sequence *seq;
2023-04-12 03:39:54 +08:00
FILE *file;
int numseq;
{
2023-04-12 03:41:11 +08:00
register i, j;
char temp[14];
for (j = 0; j < numseq; j++) fprintf(file, "%-.12s\n", seq[j].name);
2023-04-12 03:39:54 +08:00
2023-04-12 03:41:11 +08:00
fprintf(file, "ZZZZZZZZZZ\n");
2023-04-12 03:39:54 +08:00
2023-04-12 03:41:11 +08:00
for (j = 0; j < numseq; j++) {
strcpy(temp, seq[j].name);
for (i = strlen(temp); i < 13; i++) temp[i] = ' ';
temp[i] = '\0';
fprintf(file, "LOCUS %-.12s %s %d BP\n", temp,
seq[j].type, seq[j].len);
2023-04-12 03:39:54 +08:00
2023-04-12 03:41:11 +08:00
fprintf(file, "ORIGIN");
for (i = 0; i < seq[j].len; i++) {
if (i % 60 == 0) fprintf(file, "\n%9d", i + 1);
if (i % 10 == 0) fprintf(file, " ");
fprintf(file, "%c", seq[j].nuc[i]);
}
fprintf(file, "\n//\n");
}
return;
2023-04-12 03:39:54 +08:00
}