write_reading(3)

πŸ’– write_reading(3) β€” the Staden Package's little "save ur Read" era πŸ’–

okay bestie, gather round, because this one is literally about writing a Read structure into a trace file, and it's giving "underrated utility function that deserves main character energy" ✨


✨ SYNOPSIS ✨

#include <Read.h>

int write_reading(
     char *filename,
     Read *read,
     int format);

int fwrite_reading(
     FILE *fp,
     Read *read,
     int format);

like. two functions. one job. iconic behavior tbh πŸŽ€


🌸 DESCRIPTION 🌸

So these functions write a Read structure into a trace file. that's the whole vibe. that's what we're doing here.

The principle format support is the SCF format. no cap, that's the one everybody actually uses. Now β€” reading? reading is supported for ABI and ALF. but writing? NOT supported. so if you came here hoping to write out an ABI or an ALF file, bestie, i'm so sorry, it's not happening 😭

Additionally, it is possible to write using the plain (old) staden format files, or as Experiment files. and in both of those cases, only the sequence component of the trace file will be written. just the sequence. that's it. that's all you get. πŸ’…

When writing as an experiment file, the QL, QR and SQ fields are generated from the Read structure. And here's the tea: if we previously created the Read structure from reading an experiment file, then the original experiment file data is also written. Otherwise, EN, ID, LN and LT lines are also generated. so like, it depends on where your Read came from. iykyk πŸ¦‹

Now for the two sisters:

  • write_reading() β€” writes a Read structure to the specified filename in the specified format. Formats available are TT_SCF, TT_PLN and TT_EXP. and listen, if you specify format TT_ANY, it will be treated as TT_SCF. so don't be out here thinking TT_ANY means "any", it means SCF, periodt.
  • fwrite_reading() β€” writes a Read structure to the specified FILE pointer in the specified format. Apart from writing to a FILE pointer instead of a filename, the function is identical to write_reading(). same energy, different destination. πŸ’–

πŸ”₯ RETURN VALUES πŸ”₯

On successful completion, the write_reading() and fwrite_reading() functions return 0. Otherwise these functions return -1.

so like, 0 = slay, -1 = something went off and you should probably check urself before you wreck urself πŸ™ˆ


πŸ‘‘ SEE ALSO πŸ‘‘

go read those too, they're the rest of the lore ⭐


and that's the whole page, bestie!! this one came straight out of the Staden Package β€” the write_reading(3) manual, no date on the lil footer but it's still serving. stay hydrated, close your FILE pointers, and go write some trace files πŸ’…βœ¨πŸ«Ά