Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## calhoun.seq
Class FastaWriter

    java.lang.Object
      calhoun.seq.FastaWriter

    public class FastaWriter

extends java.lang.Object

Used for writing fasta files. Formats sequences to a specific line length. Allows multiple sequences to be to the same file.

Field Summary
`static int` | `DEFAULT_LINE_LENGTH`

Constructor Summary
`FastaWriter(java.io.File file, boolean append)` Opens a fasta file for writing.
`FastaWriter(java.io.File file, boolean append, int lineLength)` Opens a fasta file for writing.
`FastaWriter(java.lang.String file, boolean append)` Opens a fasta file for writing.
`FastaWriter(java.lang.String file, boolean append, int lineLength)` Opens a fasta file for writing.
`FastaWriter(java.io.Writer w, int lineLength)`

Method Summary
`void` | `close()` Closes the file.
`java.lang.String` | `getFilename()`
`void` | `writeSeq(FastaSequence seq)` Writes a sequence to the file, which may have been previously read from a different file.
`void` | `writeSeq(java.lang.String header, java.lang.String content)` Writes a sequence to the file.
`void` | `writeSeq(java.lang.String header, java.lang.String string, java.lang.Integer start, java.lang.Integer stop)` Writes a portion of the sequence to the file.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DEFAULT_LINE_LENGTH

    public static final int DEFAULT_LINE_LENGTH

See Also:
  Constant Field Values

Constructor Detail

### FastaWriter

    public FastaWriter(java.lang.String file,
                       boolean append)

  Opens a fasta file for writing. Uses the default line length.

  Parameters:
    `file` - Filename of the file to open
    `append` - true if sequences should be appended to this file, false if it should be replaced.

### FastaWriter

    public FastaWriter(java.lang.String file,
                       boolean append,
                       int lineLength)

  Opens a fasta file for writing.

  Parameters:
    `file` - Filename of the file to open
    `append` - true if sequences should be appended to this file, false if it should be replaced.
    `lineLength` - Allows the length of a sequence line to be set.

### FastaWriter

    public FastaWriter(java.io.File file,
                       boolean append)

  Opens a fasta file for writing. Uses the default line length

  Parameters:
    `file` - Filename of the file to open
    `append` - true if sequences should be appended to this file, false if it should be replaced.

### FastaWriter

    public FastaWriter(java.io.File file,
                       boolean append,
                       int lineLength)

  Opens a fasta file for writing.

  Parameters:
    `file` - Filename of the file to open
    `append` - true if sequences should be appended to this file, false if it should be replaced.
    `lineLength` - Allows the length of a sequence line to be set.

### FastaWriter

    public FastaWriter(java.io.Writer w,
                       int lineLength)

Method Detail

### writeSeq

    public void writeSeq(java.lang.String header,
                         java.lang.String content)

  Writes a sequence to the file.

  Parameters:
    `header` - The fasta header for the sequence. Should not include '>'.
    `content` - The actual sequence. It will be broken up into lines based on linelength as it is written out.

### writeSeq

    public void writeSeq(java.lang.String header,
                         java.lang.String string,
                         java.lang.Integer start,
                         java.lang.Integer stop)

  Writes a portion of the sequence to the file.

  Parameters:
    `header` - The fasta header for the sequence. Should not include '>'.
    `content` - The actual sequence. It will be broken up into lines based on linelength as it is written out.
    `start` - 1-based index of the first base to write. If null, writing will start from the beginning of the sequence.
    `stop` - 1-based index of the last base to write. If null, writing will continue until the end of the sequence.

### writeSeq

    public void writeSeq(FastaSequence seq)

  Writes a sequence to the file, which may have been previously read from a different file.

### close

    public void close()

  Closes the file. Once it is closed, no more sequences may be written. Open a new FastaWriter to append more sequences into the file.

### getFilename

    public java.lang.String getFilename()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD