Exemplo n.º 1
0
int convert(FILE *infp, FILE *outfp, char *infname, char *outfname,
	    struct opts *opts) {
    Read *r;

    if (NULL == (r = fread_reading(infp, infname, opts->in_format))) {
	fprintf(stderr, "failed to read file %s\n", infname);
	return 1;
    }

    if (opts->sub_background) { 
	/*
	trace_freq(r->traceA, r->NPoints);	
	trace_freq(r->traceC, r->NPoints);	
	trace_freq(r->traceG, r->NPoints);	
	trace_freq(r->traceT, r->NPoints);	
	*/
	subtract_background(r);
	/*
	separate_dyes(r, matrix);
	trace_freq(r->traceA, r->NPoints);	
	trace_freq(r->traceC, r->NPoints);	
	trace_freq(r->traceG, r->NPoints);	
	trace_freq(r->traceT, r->NPoints);
	*/
	reset_max_called_height(r);
    }

    if (opts->normalise) {
	rescale_heights(r);
    }

    if (opts->scale) {
	rescale_trace(r, opts->scale);
    }

    if (opts->name)
	r->ident = strdup(opts->name);
    else if (0 == strcmp(outfname, "(stdout)"))
	r->ident = strdup(infname);
    else
	r->ident = strdup(outfname);

    if (opts->compress_mode != -1)
	set_compression_method(opts->compress_mode);

    if (0 != (fwrite_reading(outfp, r, opts->out_format))) {
	fprintf(stderr, "failed to write file %s\n", outfname);
	read_deallocate(r);
	return 1;
    }

    read_deallocate(r);
    return 0;
}
Exemplo n.º 2
0
int fwrite_pln(FILE *fp, Read *read) {
    return fwrite_reading(fp, read, TT_PLN);
}
Exemplo n.º 3
0
int fwrite_ctf(FILE *fp, Read *read) {
    return fwrite_reading(fp, read, TT_CTF);
}
Exemplo n.º 4
0
int fwrite_alf(FILE *fp, Read *read) {
    return fwrite_reading(fp, read, TT_ALF);
}
Exemplo n.º 5
0
int fwrite_abi(FILE *fp, Read *read) {
    return fwrite_reading(fp, read, TT_ABI);
}