ajseqwrite.c

Datatypes: AjPSeqout AjPStr


Datatype: AjPSeqout

Sequence output

Sections: Sequence Output Constructors destructors


Section: Sequence Output Constructors

All constructors return a new sequence output object by pointer. It is the responsibility of the user to first destroy any previous sequence output object. The target pointer does not need to be initialised to NULL, but it is good programming practice to do so anyway.

Functions: ajSeqoutNew ajSeqoutNewFile ajSeqoutNewFormatC ajSeqoutNewFormatS


Function ajSeqoutNew

Creates a new sequence output object.

Synopsis

Prototype
AjPSeqout ajSeqoutNew (
      void
);

TypeNameRead/WriteDescription
AjPSeqout RETURNNew sequence output object.

Returns
AjPSeqout:New sequence output object.

Description

Creates a new sequence output object.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSeqoutNewFile

Creates a new sequence output object using a pre-opened file.

Synopsis

Prototype
AjPSeqout ajSeqoutNewFile (
      AjPFile file
);

TypeNameRead/WriteDescription
AjPFilefileModifyOpen file object
AjPSeqout RETURNNew sequence output object.

Input & Output
file:(Modify)Open file object
Returns
AjPSeqout:New sequence output object.

Description

Creates a new sequence output object using a pre-opened file.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSeqoutNewFormatC

Creates a new sequence output object with a specified format.

Synopsis

Prototype
AjPSeqout ajSeqoutNewFormatC (
      const char* txt
);

TypeNameRead/WriteDescription
const char*txtInputOutput sequence format
AjPSeqout RETURNNew sequence output object.

Input
txt:(Input)Output sequence format
Returns
AjPSeqout:New sequence output object.

Description

Creates a new sequence output object with a specified format.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSeqoutNewFormatS

Creates a new sequence output object with a specified format.

Synopsis

Prototype
AjPSeqout ajSeqoutNewFormatS (
      const AjPStr str
);

TypeNameRead/WriteDescription
const AjPStrstrInputOutput sequence format
AjPSeqout RETURNNew sequence output object.

Input
str:(Input)Output sequence format
Returns
AjPSeqout:New sequence output object.

Description

Creates a new sequence output object with a specified format.

See Also

See other functions in this section

Availability

In release 6.4.0

Section: destructors

Destruction destroys all internal data structures and frees the memory allocated for the sequence output object.

Functions: ajSeqoutDel


Function ajSeqoutDel

Destructor for AjPSeqout objects

Synopsis

Prototype
void ajSeqoutDel (
      AjPSeqout* Pseqout
);

TypeNameRead/WriteDescription
AjPSeqout*PseqoutDeleteSequence output object
void RETURN

Output
Pseqout:(Delete)Sequence output object
Returns
void:No return value

Description

Destructor for AjPSeqout objects

See Also

See other functions in this section

Availability

In release 6.4.0

Section: Sequence Stream output

These functions output the contents of a sequence stream object. As the input is a stream they expect to be called again.

Functions: ajSeqoutWriteSeq ajSeqoutWriteSet


Function ajSeqoutWriteSeq

Write next sequence out - continue until done.

Synopsis

Prototype
AjBool ajSeqoutWriteSeq (
      AjPSeqout outseq,
      const AjPSeq seq
);

TypeNameRead/WriteDescription
AjPSeqoutoutseqModifySequence output.
const AjPSeqseqInputSequence.
AjBool RETURNTrue if sequence was successfully written. Note if the save flag is true this means it was saved to be written later when the output is closed.

Input
seq:(Input)Sequence.
Input & Output
outseq:(Modify)Sequence output.
Returns
AjBool:True if sequence was successfully written. Note if the save flag is true this means it was saved to be written later when the output is closed.

Description

Write next sequence out - continue until done.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSeqoutWriteSet

Write a set of sequences out.

Synopsis

Prototype
AjBool ajSeqoutWriteSet (
      AjPSeqout outseq,
      const AjPSeqset seq
);

TypeNameRead/WriteDescription
AjPSeqoutoutseqModifySequence output.
const AjPSeqsetseqInputSequence set.
AjBool RETURNTrue on success

Input
seq:(Input)Sequence set.
Input & Output
outseq:(Modify)Sequence output.
Returns
AjBool:True on success

Description

Write a set of sequences out.

See Also

See other functions in this section

Availability

In release 6.4.0

Section: non-standard output

Writes a sequence string in SWISSPROT format with a user-defined line code

Functions: ajSeqoutDumpSwisslike


Function ajSeqoutDumpSwisslike

Writes a sequence in SWISSPROT format with a user-defined line code

Synopsis

Prototype
void ajSeqoutDumpSwisslike (
      AjPSeqout outseq,
      const AjPStr seq,
      const char* prefix
);

TypeNameRead/WriteDescription
AjPSeqoutoutseqOutputSequence output object
const AjPStrseqInputsequence
const char*prefixInputline prefix code - should be 2 characters
void RETURN

Input
seq:(Input)sequence
prefix:(Input)line prefix code - should be 2 characters
Output
outseq:(Output)Sequence output object
Returns
void:No return value

Description

Writes a sequence in SWISSPROT format with a user-defined line code

See Also

See other functions in this section

Availability

In release 6.4.0

Section: sequence output opening

These functions use the contents of a sequence output object and update them.

Functions: ajSeqoutClear ajSeqoutClearUsa ajSeqoutClose ajSeqoutFlush ajSeqoutOpen ajSeqoutOpenFilename ajSeqoutReset


Function ajSeqoutClear

Clears a Sequence output object back to "as new" condition

Synopsis

Prototype
void ajSeqoutClear (
      AjPSeqout seqout
);

TypeNameRead/WriteDescription
AjPSeqoutseqoutModifySequence output object
void RETURN

Input & Output
seqout:(Modify)Sequence output object
Returns
void:No return value

Description

Clears a Sequence output object back to "as new" condition

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSeqoutClearUsa

Creates or resets a sequence output object using a new Universal Sequence Address

Synopsis

Prototype
void ajSeqoutClearUsa (
      AjPSeqout seqout,
      const AjPStr usa
);

TypeNameRead/WriteDescription
AjPSeqoutseqoutModifySequence output object.
const AjPStrusaInputUSA
void RETURN

Input
usa:(Input)USA
Input & Output
seqout:(Modify)Sequence output object.
Returns
void:No return value

Description

Creates or resets a sequence output object using a new Universal Sequence Address

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSeqoutClose

Close a sequence output file. For formats that save everything up and write at the end, call the Write function first.

Synopsis

Prototype
void ajSeqoutClose (
      AjPSeqout seqout
);

TypeNameRead/WriteDescription
AjPSeqoutseqoutModifySequence output
void RETURN

Input & Output
seqout:(Modify)Sequence output
Returns
void:No return value

Description

Close a sequence output file. For formats that save everything up and write at the end, call the Write function first.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSeqoutFlush

Flush output to a sequence output file. For formats that save everything up and write at the end, call the Write function first.

Do not close the file. It can be reused for more output

Synopsis

Prototype
void ajSeqoutFlush (
      AjPSeqout seqout
);

TypeNameRead/WriteDescription
AjPSeqoutseqoutModifySequence output
void RETURN

Input & Output
seqout:(Modify)Sequence output
Returns
void:No return value

Description

Flush output to a sequence output file. For formats that save everything up and write at the end, call the Write function first.

Do not close the file. It can be reused for more output

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSeqoutOpen

If the file is not yet open, calls seqoutUsaProcess to convert the USA into an open output file stream.

Returns the results in the AjPSeqout object.

Synopsis

Prototype
AjBool ajSeqoutOpen (
      AjPSeqout seqout
);

TypeNameRead/WriteDescription
AjPSeqoutseqoutOutputSequence output object.
AjBool RETURNajTrue on success.

Output
seqout:(Output)Sequence output object.
Returns
AjBool:ajTrue on success.

Description

If the file is not yet open, calls seqoutUsaProcess to convert the USA into an open output file stream.

Returns the results in the AjPSeqout object.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSeqoutOpenFilename

Opens an output file for sequence writing. 'stdout' and 'stderr' are special cases using standard output and standard error respectively.

Synopsis

Prototype
AjBool ajSeqoutOpenFilename (
      AjPSeqout seqout,
      const AjPStr name
);

TypeNameRead/WriteDescription
AjPSeqoutseqoutModifySequence output object.
const AjPStrnameInputOutput filename.
AjBool RETURNajTrue on success.

Input
name:(Input)Output filename.
Input & Output
seqout:(Modify)Sequence output object.
Returns
AjBool:ajTrue on success.

Description

Opens an output file for sequence writing. 'stdout' and 'stderr' are special cases using standard output and standard error respectively.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSeqoutReset

Clears a Sequence output object ready to accept further sequences

Synopsis

Prototype
void ajSeqoutReset (
      AjPSeqout seqout
);

TypeNameRead/WriteDescription
AjPSeqoutseqoutModifySequence output object
void RETURN

Input & Output
seqout:(Modify)Sequence output object
Returns
void:No return value

Description

Clears a Sequence output object ready to accept further sequences

See Also

See other functions in this section

Availability

In release 6.4.0

Section: set

Functions: ajSeqoutSetFormatC ajSeqoutSetFormatS ajSeqoutSetNameDefaultC ajSeqoutSetNameDefaultS


Function ajSeqoutSetFormatC

Sets the output format. Currently hard coded but will be replaced in future by a variable.

Synopsis

Prototype
AjBool ajSeqoutSetFormatC (
      AjPSeqout seqout,
      const char* txt
);

TypeNameRead/WriteDescription
AjPSeqoutseqoutModifySequence output object.
const char*txtInputOutput format.
AjBool RETURNajTrue on success.

Input
txt:(Input)Output format.
Input & Output
seqout:(Modify)Sequence output object.
Returns
AjBool:ajTrue on success.

Description

Sets the output format. Currently hard coded but will be replaced in future by a variable.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSeqoutSetFormatS

Sets the output format. Currently hard coded but will be replaced in future by a variable.

Synopsis

Prototype
AjBool ajSeqoutSetFormatS (
      AjPSeqout seqout,
      const AjPStr str
);

TypeNameRead/WriteDescription
AjPSeqoutseqoutModifySequence output object.
const AjPStrstrInputOutput format.
AjBool RETURNajTrue on success.

Input
str:(Input)Output format.
Input & Output
seqout:(Modify)Sequence output object.
Returns
AjBool:ajTrue on success.

Description

Sets the output format. Currently hard coded but will be replaced in future by a variable.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSeqoutSetNameDefaultC

Provides a unique (for this program run) name for a sequence.

Synopsis

Prototype
AjBool ajSeqoutSetNameDefaultC (
      AjPSeqout seqout,
      AjBool multi,
      const char* txt
);

TypeNameRead/WriteDescription
AjPSeqoutseqoutOutputSequence output object
AjBoolmultiInputIf true, appends a number to the name.
const char*txtInputName set by caller
AjBool RETURNTrue on success

Input
multi:(Input)If true, appends a number to the name.
txt:(Input)Name set by caller
Output
seqout:(Output)Sequence output object
Returns
AjBool:True on success

Description

Provides a unique (for this program run) name for a sequence.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSeqoutSetNameDefaultS

Provides a unique (for this program run) name for a sequence.

Synopsis

Prototype
AjBool ajSeqoutSetNameDefaultS (
      AjPSeqout seqout,
      AjBool multi,
      const AjPStr str
);

TypeNameRead/WriteDescription
AjPSeqoutseqoutOutputSequence output object
AjBoolmultiInputIf true, appends a number to the name.
const AjPStrstrInputName set by caller
AjBool RETURNTrue on success

Input
multi:(Input)If true, appends a number to the name.
str:(Input)Name set by caller
Output
seqout:(Output)Sequence output object
Returns
AjBool:True on success

Description

Provides a unique (for this program run) name for a sequence.

See Also

See other functions in this section

Availability

In release 6.4.0

Section: print

Functions: ajSeqoutPrintFormat ajSeqoutPrintbookFormat ajSeqoutPrinthtmlFormat ajSeqoutPrintwikiFormat


Function ajSeqoutPrintFormat

Reports the internal data structures

Synopsis

Prototype
void ajSeqoutPrintFormat (
      AjPFile outf,
      AjBool full
);

TypeNameRead/WriteDescription
AjPFileoutfModifyOutput file
AjBoolfullInputFull report (usually ajFalse)
void RETURN

Input
full:(Input)Full report (usually ajFalse)
Input & Output
outf:(Modify)Output file
Returns
void:No return value

Description

Reports the internal data structures

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSeqoutPrintbookFormat

Reports the internal data structures as EMBOSS book format

Synopsis

Prototype
void ajSeqoutPrintbookFormat (
      AjPFile outf
);

TypeNameRead/WriteDescription
AjPFileoutfModifyOutput file
void RETURN

Input & Output
outf:(Modify)Output file
Returns
void:No return value

Description

Reports the internal data structures as EMBOSS book format

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSeqoutPrinthtmlFormat

Reports the internal data structures as wikitext

Synopsis

Prototype
void ajSeqoutPrinthtmlFormat (
      AjPFile outf
);

TypeNameRead/WriteDescription
AjPFileoutfModifyOutput file
void RETURN

Input & Output
outf:(Modify)Output file
Returns
void:No return value

Description

Reports the internal data structures as wikitext

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSeqoutPrintwikiFormat

Reports the internal data structures as wikitext

Synopsis

Prototype
void ajSeqoutPrintwikiFormat (
      AjPFile outf
);

TypeNameRead/WriteDescription
AjPFileoutfModifyOutput file
void RETURN

Input & Output
outf:(Modify)Output file
Returns
void:No return value

Description

Reports the internal data structures as wikitext

See Also

See other functions in this section

Availability

In release 6.4.0

Section: Sequence Output Casts

Functions: ajSeqoutGetBasecount ajSeqoutGetCheckgcg ajSeqoutGetFilename


Function ajSeqoutGetBasecount

Counts the numbers of A, C, G and T in a nucleotide sequence.

Synopsis

Prototype
void ajSeqoutGetBasecount (
      const AjPSeqout seqout,
      ajuint* bases
);

TypeNameRead/WriteDescription
const AjPSeqoutseqoutInputSequence output object
ajuint*basesOutputInteger array, minimum size 5, to hold the results.
void RETURN

Input
seqout:(Input)Sequence output object
Output
bases:(Output)Integer array, minimum size 5, to hold the results.
Returns
void:No return value

Description

Counts the numbers of A, C, G and T in a nucleotide sequence.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSeqoutGetCheckgcg

Calculates a GCG checksum for an output sequence.

Synopsis

Prototype
ajint ajSeqoutGetCheckgcg (
      const AjPSeqout seqout
);

TypeNameRead/WriteDescription
const AjPSeqoutseqoutInputOutput sequence.
ajint RETURNGCG checksum.

Input
seqout:(Input)Output sequence.
Returns
ajint:GCG checksum.

Description

Calculates a GCG checksum for an output sequence.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSeqoutGetFilename

Returns the filename for a sequence output object

Synopsis

Prototype
const AjPStr ajSeqoutGetFilename (
      const AjPSeqout seqout
);

TypeNameRead/WriteDescription
const AjPSeqoutseqoutInputSequence output object
const AjPStr RETURNFilename

Input
seqout:(Input)Sequence output object
Returns
const AjPStr:Filename

Description

Returns the filename for a sequence output object

See Also

See other functions in this section

Availability

In release 6.4.0

Section: debugging

Functions for reporting of a string object.

Functions: ajSeqoutTrace


Function ajSeqoutTrace

Debug calls to trace the data in a sequence object.

Synopsis

Prototype
void ajSeqoutTrace (
      const AjPSeqout seqout
);

TypeNameRead/WriteDescription
const AjPSeqoutseqoutInputSequence output object.
void RETURN

Input
seqout:(Input)Sequence output object.
Returns
void:No return value

Description

Debug calls to trace the data in a sequence object.

See Also

See other functions in this section

Availability

In release 6.4.0

Section: exit

Functions called on exit

Functions: ajSeqoutExit


Function ajSeqoutExit

Cleans up sequence output processing internal memory

Synopsis

Prototype
void ajSeqoutExit (
      void
);

TypeNameRead/WriteDescription
void RETURN

Returns
void:No return value

Description

Cleans up sequence output processing internal memory

See Also

See other functions in this section

Availability

In release 6.4.0

Datatype: AjPStr

Sequence output strings

Sections: other


Section: other

Functions: ajSeqoutstrGetFormatDefault ajSeqoutstrIsFormatExists ajSeqoutstrIsFormatSingle


Function ajSeqoutstrGetFormatDefault

Sets the default output format. Checks the _OUTFORMAT variable, and uses FASTA if no other definition is found.

Synopsis

Prototype
AjBool ajSeqoutstrGetFormatDefault (
      AjPStr* Pformat
);

TypeNameRead/WriteDescription
AjPStr*PformatOutputDefault output format.
AjBool RETURNajTrue on success.

Output
Pformat:(Output)Default output format.
Returns
AjBool:ajTrue on success.

Description

Sets the default output format. Checks the _OUTFORMAT variable, and uses FASTA if no other definition is found.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSeqoutstrIsFormatExists

Checks whether an output format name exists.

Synopsis

Prototype
AjBool ajSeqoutstrIsFormatExists (
      const AjPStr format
);

TypeNameRead/WriteDescription
const AjPStrformatInputOutput format required.
AjBool RETURNajTrue if format is known.

Input
format:(Input)Output format required.
Returns
AjBool:ajTrue if format is known.

Description

Checks whether an output format name exists.

See Also

See other functions in this section

Availability

In release 6.4.0

Function ajSeqoutstrIsFormatSingle

Checks whether an output format should go to single files, rather than all sequences being written to one file. Some formats do not work when more than one sequence is written to a file. Obvious examples are plain text and GCG formats.

Synopsis

Prototype
AjBool ajSeqoutstrIsFormatSingle (
      const AjPStr format
);

TypeNameRead/WriteDescription
const AjPStrformatInputOutput format required.
AjBool RETURNajTrue if separate file is needed for each sequence.

Input
format:(Input)Output format required.
Returns
AjBool:ajTrue if separate file is needed for each sequence.

Description

Checks whether an output format should go to single files, rather than all sequences being written to one file. Some formats do not work when more than one sequence is written to a file. Obvious examples are plain text and GCG formats.

See Also

See other functions in this section

Availability

In release 6.4.0