Write to file using FASTQ format
the contents of a MATLAB® structure or array of structures to
a FASTQ-formatted file. If you specify an existing FASTQ-formatted
fastqwrite appends the data to the file,
instead of overwriting the file.
header, sequence, and quality information to a FASTQ-formatted file.
To append FASTQ-formatted data to an existing file, simply specify
that file name.
fastqwrite adds the data to the
end of the file.
If you are using
fastqwrite in a script,
you can disable the append warning message by entering the following
command lines before the
warnState = warning %Save the current warning state warning('off','Bioinfo:fastqwrite:AppendToFile');
warning(warnState) %Reset warning state to previous settings
Character vector or string specifying either a file name or a path and file name for saving
the FASTQ-formatted data. If you specify only a file name,
MATLAB structure or array of structures containing the
Character vector or string containing header information about the nucleotide sequence. This
text appears in the header of the FASTQ-formatted file,
Character vector or string containing ASCII representation of per-base quality scores for a nucleotide sequence.
Write multiple sequences to a FASTQ file from an array of structures:
% Read the contents of a FASTQ-formatted file into % an array of structures reads = fastqread('SRR005164_1_50.fastq'); % Create another array of structures for the first five reads reads5 = reads(1:5); % Write the first five reads to a separate FASTQ-formatted file fastqwrite('fiveReads.fastq', reads5)
Write a single sequence to a FASTQ file from separate variables:
% Create separate variables for the header, sequence, and % quality information of a nucleotide sequence h = 'MYSEQ-000_1_1_1_953_493'; s = 'GTTACCATGATGTTATTTCTTCATTTGGAGGTAAAA'; q = ']]]]]]]]]]]]]]]]]]]]]]T]]]]RJRZTQLOA'; % Write the information to a FASTQ-formatted file fastqwrite('oneRead.fastq', h, s, q)
A FASTQ-formatted file contains nucleotide sequence and quality information on four lines:
Line 1 — Header information prefixed with an
Line 2 — Nucleotide sequence
Line 3 — Header information prefixed with a
Line 4 — ASCII representation of per-base quality scores for the nucleotide sequence using Phred or Solexa encoding