annotate srf2fastq/io_lib-1.12.2/io_lib/write_scf.c @ 0:d901c9f41a6a default tip

Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
author dawe
date Tue, 07 Jun 2011 17:48:05 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
1 /*
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
2 * Copyright (c) Medical Research Council 1994. All rights reserved.
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
3 *
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
4 * Permission to use, copy, modify and distribute this software and its
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
5 * documentation for any purpose is hereby granted without fee, provided that
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
6 * this copyright and notice appears in all copies.
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
7 *
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
8 * This file was written by James Bonfield, Simon Dear, Rodger Staden,
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
9 * as part of the Staden Package at the MRC Laboratory of Molecular
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
10 * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom.
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
11 *
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
12 * MRC disclaims all warranties with regard to this software.
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
13 */
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
14
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
15 /*
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
16 Title: write_scf.c
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
17
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
18 Purpose: Output of Standard Chromatogram Format sequences
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
19 Last update: August 18 1994
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
20
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
21 Change log:
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
22 4 Feb 1992, Now draft proposal version 2
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
23 23 Nov 92, SCF 2.0 + LaDeana's changes
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
24 11 Aug 93, Version 2.01 containing confidence values
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
25 18 Aug 1994 Renamed from writeSCF.c; now purely SCF IO (no Seq structs)
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
26
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
27 Oct 95 major rewrite to make files more easily compressed.
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
28 gzip now gets files to around 40% of original
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
29 Version raised to 3.00
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
30 * We store in order:
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
31 * Header
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
32 * Samples
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
33 * Bases
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
34 * Comments
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
35 * Private
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
36
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
37 Two main types of change:
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
38 1: write data in lane order instead of all lanes together
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
39 eg write Sample values for A, then Sample values for C, etc.
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
40
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
41 2: where appropriate write delta delta values instead of complete ones.
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
42 ie write the differences in the differences between successive values
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
43
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
44 */
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
45
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
46
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
47 static int scf_version = 3;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
48
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
49 /* ---- Imports ---- */
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
50
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
51
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
52 #include <ctype.h>
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
53 #include <stdio.h> /* IMPORT: fopen, fclose, fseek, ftell, fgetc,
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
54 EOF */
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
55 #include <string.h>
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
56 #include "io_lib/scf.h" /* IMPORT: scf structures */
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
57 #include "io_lib/mach-io.h" /* IMPORT: be_write_int_1, be_write_int_2, be_write_int_4 */
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
58 #include "io_lib/xalloc.h"
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
59
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
60 #include "io_lib/stdio_hack.h"
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
61
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
62 /* ---- Exports ---- */
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
63
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
64
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
65 int write_scf_header(FILE *fp, Header *h)
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
66 {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
67 int i;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
68
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
69 if (be_write_int_4(fp,&h->magic_number)==False) return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
70 if (be_write_int_4(fp,&h->samples)==False) return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
71 if (be_write_int_4(fp,&h->samples_offset)==False) return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
72 if (be_write_int_4(fp,&h->bases)==False) return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
73 if (be_write_int_4(fp,&h->bases_left_clip)==False) return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
74 if (be_write_int_4(fp,&h->bases_right_clip)==False) return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
75 if (be_write_int_4(fp,&h->bases_offset)==False) return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
76 if (be_write_int_4(fp,&h->comments_size)==False) return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
77 if (be_write_int_4(fp,&h->comments_offset)==False) return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
78 if (fwrite(h->version,sizeof(h->version),1,fp)!=1) return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
79 if (be_write_int_4(fp,&h->sample_size)==False) return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
80 if (be_write_int_4(fp,&h->code_set)==False) return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
81 if (be_write_int_4(fp,&h->private_size)==False) return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
82 if (be_write_int_4(fp,&h->private_offset)==False) return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
83 for (i=0;i<18;i++)
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
84 if (be_write_int_4(fp,&h->spare[i])==False) return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
85
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
86 return 0;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
87 }
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
88
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
89
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
90 int write_scf_sample1(FILE *fp, Samples1 *s)
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
91 {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
92 uint_1 buf[4];
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
93
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
94 buf[0] = s->sample_A;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
95 buf[1] = s->sample_C;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
96 buf[2] = s->sample_G;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
97 buf[3] = s->sample_T;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
98 if (4 != fwrite(buf, 1, 4, fp)) return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
99
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
100 return 0;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
101 }
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
102
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
103
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
104 int write_scf_sample2(FILE *fp, Samples2 *s)
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
105 {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
106 uint_2 buf[4];
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
107
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
108 buf[0] = be_int2(s->sample_A);
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
109 buf[1] = be_int2(s->sample_C);
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
110 buf[2] = be_int2(s->sample_G);
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
111 buf[3] = be_int2(s->sample_T);
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
112 if (4 != fwrite(buf, 2, 4, fp)) return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
113
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
114 return 0;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
115 }
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
116
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
117
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
118 int write_scf_samples1(FILE *fp, Samples1 *s, size_t num_samples) {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
119 size_t i;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
120
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
121 for (i = 0; i < num_samples; i++) {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
122 if (-1 == write_scf_sample1(fp, &(s[i])))
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
123 return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
124 }
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
125
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
126 return 0;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
127 }
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
128
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
129
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
130 int write_scf_samples2(FILE *fp, Samples2 *s, size_t num_samples) {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
131 size_t i;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
132
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
133 for (i = 0; i < num_samples; i++) {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
134 if (-1 == write_scf_sample2(fp, &(s[i])))
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
135 return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
136 }
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
137
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
138 return 0;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
139 }
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
140
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
141
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
142 int write_scf_samples31(FILE *fp, Samples1 *s, size_t num_samples) {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
143 size_t i;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
144 int1 *samples_out;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
145
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
146 if (!num_samples)
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
147 return 0;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
148
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
149 if ( ! (samples_out = (int1 *)xmalloc(num_samples *
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
150 sizeof(int1)))) {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
151 return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
152 }
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
153
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
154 for (i = 0; i < num_samples; i++) {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
155 samples_out[i] = (&s[i])->sample_A;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
156 }
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
157 scf_delta_samples1 ( samples_out, num_samples, 1);
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
158 if (num_samples != fwrite(samples_out, 1, num_samples, fp)) {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
159 xfree(samples_out);
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
160 return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
161 }
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
162
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
163 for (i = 0; i < num_samples; i++) {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
164 samples_out[i] = (&s[i])->sample_C;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
165 }
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
166 scf_delta_samples1 ( samples_out, num_samples, 1);
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
167 if (num_samples != fwrite(samples_out, 1, num_samples, fp)) {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
168 xfree(samples_out);
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
169 return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
170 }
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
171
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
172 for (i = 0; i < num_samples; i++) {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
173 samples_out[i] = (&s[i])->sample_G;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
174 }
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
175 scf_delta_samples1 ( samples_out, num_samples, 1);
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
176 if (num_samples != fwrite(samples_out, 1, num_samples, fp)) {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
177 xfree(samples_out);
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
178 return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
179 }
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
180
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
181 for (i = 0; i < num_samples; i++) {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
182 samples_out[i] = (&s[i])->sample_T;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
183 }
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
184 scf_delta_samples1 ( samples_out, num_samples, 1);
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
185 if (num_samples != fwrite(samples_out, 1, num_samples, fp)) {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
186 xfree(samples_out);
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
187 return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
188 }
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
189
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
190 xfree(samples_out);
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
191 return 0;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
192 }
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
193
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
194 int write_scf_samples32(FILE *fp, Samples2 *s, size_t num_samples) {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
195 size_t i;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
196 uint2 *samples_out;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
197
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
198 if (!num_samples)
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
199 return 0;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
200
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
201 if ( ! (samples_out = (uint2 *)xmalloc(num_samples * sizeof(uint2)))) {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
202 return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
203 }
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
204
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
205
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
206 for (i = 0; i < num_samples; i++) {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
207 samples_out[i] = (&s[i])->sample_A;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
208 }
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
209 scf_delta_samples2 ( samples_out, num_samples, 1);
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
210 #ifdef SP_LITTLE_ENDIAN
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
211 for (i = 0; i < num_samples; i++) {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
212 samples_out[i] = be_int2(samples_out[i]);
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
213 }
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
214 #endif
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
215 if (num_samples != fwrite(samples_out, 2, num_samples, fp)) return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
216
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
217
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
218 for (i = 0; i < num_samples; i++) {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
219 samples_out[i] = (&s[i])->sample_C;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
220 }
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
221 scf_delta_samples2 ( samples_out, num_samples, 1);
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
222 #ifdef SP_LITTLE_ENDIAN
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
223 for (i = 0; i < num_samples; i++) {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
224 samples_out[i] = be_int2(samples_out[i]);
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
225 }
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
226 #endif
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
227 if (num_samples != fwrite(samples_out, 2, num_samples, fp)) return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
228
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
229
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
230 for (i = 0; i < num_samples; i++) {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
231 samples_out[i] = (&s[i])->sample_G;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
232 }
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
233 scf_delta_samples2 ( samples_out, num_samples, 1);
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
234 #ifdef SP_LITTLE_ENDIAN
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
235 for (i = 0; i < num_samples; i++) {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
236 samples_out[i] = be_int2(samples_out[i]);
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
237 }
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
238 #endif
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
239 if (num_samples != fwrite(samples_out, 2, num_samples, fp)) return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
240
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
241
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
242 for (i = 0; i < num_samples; i++) {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
243 samples_out[i] = (&s[i])->sample_T;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
244 }
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
245 scf_delta_samples2 ( samples_out, num_samples, 1);
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
246 #ifdef SP_LITTLE_ENDIAN
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
247 for (i = 0; i < num_samples; i++) {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
248 samples_out[i] = be_int2(samples_out[i]);
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
249 }
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
250 #endif
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
251 if (num_samples != fwrite(samples_out, 2, num_samples, fp)) return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
252
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
253
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
254 xfree(samples_out);
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
255 return 0;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
256 }
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
257
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
258
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
259 int write_scf_base(FILE *fp, Bases *b)
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
260 {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
261 uint_1 buf[12];
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
262
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
263 ((uint_4 *)buf)[0] = be_int4(b->peak_index);
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
264 buf[4] = b->prob_A;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
265 buf[5] = b->prob_C;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
266 buf[6] = b->prob_G;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
267 buf[7] = b->prob_T;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
268 buf[8] = b->base;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
269 buf[9] = b->spare[0];
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
270 buf[10] = b->spare[1];
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
271 buf[11] = b->spare[2];
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
272
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
273 if (12 != fwrite(buf, 1, 12, fp)) return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
274
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
275 return 0;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
276 }
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
277
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
278
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
279 int write_scf_bases(FILE *fp, Bases *b, size_t num_bases)
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
280 {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
281 size_t i;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
282
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
283 for (i = 0; i < num_bases; i++) {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
284 if (-1 == write_scf_base(fp, &(b[i])))
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
285 return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
286 }
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
287
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
288 return 0;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
289 }
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
290
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
291 int write_scf_bases3(FILE *fp, Bases *b, size_t num_bases)
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
292 {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
293 size_t i;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
294 uint_4 *buf4;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
295 uint_1 *buf1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
296
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
297 if (NULL == (buf4 = (uint_4 *)xmalloc(1 + 4 * num_bases)))
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
298 return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
299
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
300 if (NULL == (buf1 = (uint_1 *)xmalloc(1 + 8 * num_bases))) {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
301 xfree(buf4);
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
302 return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
303 }
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
304
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
305 for (i = 0; i < num_bases; i++) {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
306 buf4[i] = be_int4((&b[i])->peak_index);
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
307 }
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
308 fwrite(buf4, 4, num_bases, fp);
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
309
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
310 for (i=0; i < num_bases; i++) {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
311 buf1[i ] = (&b[i])->prob_A;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
312 buf1[i+ num_bases] = (&b[i])->prob_C;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
313 buf1[i+2*num_bases] = (&b[i])->prob_G;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
314 buf1[i+3*num_bases] = (&b[i])->prob_T;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
315 buf1[i+4*num_bases] = (&b[i])->base;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
316 buf1[i+5*num_bases] = (&b[i])->spare[0];
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
317 buf1[i+6*num_bases] = (&b[i])->spare[1];
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
318 buf1[i+7*num_bases] = (&b[i])->spare[2];
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
319 }
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
320 if (8 * num_bases != (fwrite(buf1, 1, 8 * num_bases, fp))) {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
321 xfree(buf1);
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
322 xfree(buf4);
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
323 return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
324 }
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
325
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
326 xfree(buf1);
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
327 xfree(buf4);
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
328 return 0;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
329 }
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
330
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
331
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
332 int write_scf_comment(FILE *fp, Comments *c, size_t s)
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
333 {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
334 if (fwrite(c, 1, s, fp) != s) return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
335
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
336 return 0;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
337 }
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
338
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
339
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
340
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
341 /*
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
342 * Request which (major) version of scf to use when writing.
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
343 * Defaults to the latest. Currently suitable fields are
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
344 * 2 and 3.
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
345 *
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
346 * Returns 0 for success, -1 for failure.
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
347 */
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
348 int set_scf_version(int version) {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
349 if (version != 2 && version != 3)
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
350 return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
351
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
352 scf_version = version;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
353 return 0;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
354 }
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
355
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
356 /*
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
357 * Write Seq out as a .scf file to the 'fp' FILE *
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
358 */
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
359 int fwrite_scf(Scf *scf, FILE *fp) {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
360 uint_4 size;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
361 int err;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
362
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
363 /*
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
364 * Init header offsets.
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
365 *
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
366 * We store in order:
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
367 * Header
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
368 * Samples
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
369 * Bases
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
370 * Comments
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
371 * Private
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
372 */
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
373 scf->header.samples_offset = (uint_4)sizeof(Header);
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
374 size = scf->header.samples * (scf->header.sample_size == 1 ?
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
375 sizeof(Samples1) : sizeof(Samples2));
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
376 scf->header.bases_offset = (uint_4)(scf->header.samples_offset +
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
377 size);
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
378 size = scf->header.bases * sizeof(Bases);
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
379 scf->header.comments_offset = (uint_4)(scf->header.bases_offset + size);
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
380
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
381 size = scf->header.comments_size;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
382 scf->header.private_offset = (uint_4)(scf->header.comments_offset + size);
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
383
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
384 /* Init a few other things, such as the magic number */
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
385 scf->header.magic_number = SCF_MAGIC;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
386
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
387 if (scf_version == 3) {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
388 memcpy(scf->header.version, scf_version_float2str(SCF_VERSION), 4);
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
389 } else {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
390 memcpy(scf->header.version, scf_version_float2str(SCF_VERSION_OLD), 4);
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
391 }
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
392
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
393 /* Write header */
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
394 if (write_scf_header(fp, &scf->header) == -1)
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
395 return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
396
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
397 if (scf_version == 3) {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
398 /* Write Samples */
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
399 if (scf->header.sample_size == 1)
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
400 err = write_scf_samples31(fp, scf->samples.samples1,
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
401 scf->header.samples);
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
402 else
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
403 err = write_scf_samples32(fp, scf->samples.samples2,
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
404 scf->header.samples);
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
405 if (-1 == err)
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
406 return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
407
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
408 /* Write Bases */
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
409 if (-1 == write_scf_bases3(fp, scf->bases, scf->header.bases))
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
410 return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
411
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
412 } else {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
413 /* Write Samples */
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
414 if (scf->header.sample_size == 1)
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
415 err = write_scf_samples1(fp, scf->samples.samples1,
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
416 scf->header.samples);
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
417 else
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
418 err = write_scf_samples2(fp, scf->samples.samples2,
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
419 scf->header.samples);
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
420 if (-1 == err)
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
421 return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
422
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
423 /* Write Bases */
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
424 if (-1 == write_scf_bases(fp, scf->bases, scf->header.bases))
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
425 return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
426 }
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
427
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
428 /* Write Comments */
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
429 if (-1 == write_scf_comment(fp, scf->comments,
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
430 scf->header.comments_size))
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
431 return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
432
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
433 /* Write private data */
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
434 if (scf->header.private_size) {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
435 if (scf->header.private_size != fwrite(scf->private_data, 1,
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
436 scf->header.private_size, fp))
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
437 return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
438 }
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
439
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
440 return 0;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
441 }
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
442
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
443 /*
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
444 * Write Seq out as a .scf file to file 'fn'.
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
445 */
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
446 int write_scf(Scf *scf, char *fn)
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
447 {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
448 FILE *fp;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
449
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
450 /* Open for for write in binary mode */
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
451 if ((fp = fopen(fn,"wb")) == NULL)
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
452 return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
453
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
454 if (fwrite_scf(scf, fp)) {
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
455 fclose(fp);
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
456 return -1;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
457 }
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
458
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
459 fclose(fp);
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
460 return 0;
d901c9f41a6a Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
dawe
parents:
diff changeset
461 }