[med-svn] r280 - in trunk/packages/seaview/trunk: . debian
Charles Plessy
charles-guest at alioth.debian.org
Sun Apr 29 13:48:46 UTC 2007
Author: charles-guest
Date: 2007-04-29 13:48:45 +0000 (Sun, 29 Apr 2007)
New Revision: 280
Modified:
trunk/packages/seaview/trunk/debian/changelog
trunk/packages/seaview/trunk/use_mase_files.cxx
Log:
New usptream release
Modified: trunk/packages/seaview/trunk/debian/changelog
===================================================================
--- trunk/packages/seaview/trunk/debian/changelog 2007-04-29 13:42:49 UTC (rev 279)
+++ trunk/packages/seaview/trunk/debian/changelog 2007-04-29 13:48:45 UTC (rev 280)
@@ -1,3 +1,9 @@
+seaview (20070417-1) UNRELEASED; urgency=low
+
+ * New upstream release adding processing of comments in FASTA format.
+
+ -- Charles Plessy <charles-debian-nospam at plessy.org> Sun, 29 Apr 2007 22:46:26 +0900
+
seaview (20070215-1) unstable; urgency=low
* New upstream release, adding a new "Edit sequence" option in the Edit menu.
Modified: trunk/packages/seaview/trunk/use_mase_files.cxx
===================================================================
--- trunk/packages/seaview/trunk/use_mase_files.cxx 2007-04-29 13:42:49 UTC (rev 279)
+++ trunk/packages/seaview/trunk/use_mase_files.cxx 2007-04-29 13:48:45 UTC (rev 280)
@@ -15,7 +15,7 @@
int read_msf_align(const char *fname, char ***pseq, char ***pseqname,
char ***pcomments, char **pheader, char **err_message);
int is_a_protein_seq(char *seq);
-int save_fasta_file(const char *fname, char **seq,
+int save_fasta_file(const char *fname, char **seq, char **comments,
char **seqname, int totseqs, int *eachlength, region *region_used,
int *sel_seqs, int tot_sel_seqs);
int save_phylip_file(const char *fname, char **seq,
@@ -249,7 +249,7 @@
{
FILE *in;
int totseqs, lseq, l2, l, lenseqs;
-char line[200], *p, *i, *provseq = NULL;
+char line[300], *p, *i, *provseq = NULL, c, *q;
static char ret_message[200];
char **seq, **seqname, **comments;
@@ -282,17 +282,33 @@
totseqs = -1; goto fini;
}
while( i != NULL ){
+ /* finish reading very long title line */
+ c = line[strlen(line) - 1];
+ while(c != '\n' && c != '\r' && c != EOF) c = getc(in);
+ q = line + strlen(line) - 1;
+ while(q > line + 1 && (*q == '\n' || *q == '\r')) *(q--) = 0;
totseqs++;
- comments[totseqs] = NULL;
p = line + 1; while(*p != ' ' && *p != '\n') p++;
l = p - line - 1;
if( (seqname[totseqs] = (char *)malloc(l+1)) == NULL)goto nomem;
memcpy(seqname[totseqs], line + 1, l); seqname[totseqs][l] = 0;
+ /* use rest of title line, if any, as comment */
+ while(*p == ' ') p++;
+ l = q - p + 1;
+ if( l > 0) {
+ comments[totseqs] = (char *)malloc(l + 3);
+ if(comments[totseqs] != NULL) {
+ strcpy(comments[totseqs], ";");
+ strcpy(comments[totseqs] + 1, p);
+ strcpy(comments[totseqs] + l + 1, "\n");
+ }
+ }
+ else comments[totseqs] = NULL;
seq[totseqs] = (char *)malloc(lenseqs+1);
if(seq[totseqs] == NULL) goto nomem;
lseq = 0;
while( (i=fgets(line, sizeof(line), in))!= NULL && *i != '>' ) {
- l2 = strlen(line);
+ l2 = strlen(line);
if( line[l2 - 1] == '\n' ) l2--;
while(l2>0 && line[l2-1]==' ')l2--;
if(lseq + l2 > lenseqs) {
@@ -872,7 +888,7 @@
}
-int save_fasta_file(const char *fname, char **seq,
+int save_fasta_file(const char *fname, char **seq, char **comments,
char **seqname, int totseqs, int *eachlength, region *region_used,
int *sel_seqs, int tot_sel_seqs)
/* sauver des sequences ou des regions au format fasta
@@ -886,6 +902,7 @@
int num, retval = 1, current, ecrit;
list_segments *psegment, all_sequence;
region maregion;
+char *p;
if(totseqs == 0) return 0;
if( (out = fopen(fname,"w")) == NULL) return 1;
@@ -904,7 +921,13 @@
if( tot_sel_seqs != 0 && ! sel_seqs[num] ) continue;
current = 0; psegment = region_used->list;
all_sequence.fin = eachlength[num];
- fprintf(out,">%s\n",seqname[num]);
+ fprintf(out,">%s", seqname[num]);
+ if(comments[num] != NULL) {
+ putc(' ', out);
+ p = comments[num] + 1;
+ while(*p != '\n' && *p != 0) putc(*(p++), out);
+ }
+ putc('\n', out);
if(ferror(out)) goto fin;
do {
ecrit = output_next_res_from_region(seq[num], eachlength[num],
@@ -1163,7 +1186,7 @@
seqname, totseqs, eachlength, region_used, protein,
sel_seqs, tot_sel_seqs);
else if(format == FASTA_FORMAT)
- err = save_fasta_file(fname, seq,
+ err = save_fasta_file(fname, seq, comments,
seqname, totseqs, eachlength, region_used,
sel_seqs, tot_sel_seqs);
if(err == 0)
More information about the debian-med-commit
mailing list