| Bioinformatics Toolbox | ![]() |
Write to file with FASTA format
fastawrite('File', Data)
fastawrite('File', Header, Sequence)
File | Enter either a filename or a path and filename supported by your operating system. (ASCII text file). |
Data | Enter a character string with a FASTA format, a sequence object, a structure containing the fields Sequence and Header, or a GenBank/GenPept structure. |
Header | Information about the sequence. |
Sequence | Nucleotide or amino acid sequence using the standard IUB/IUPAC codes. For a list of valid characters, see and Mapping Nucleotide Letters to Integers. |
fastawrite('File', Data) writes the contents of Data to a file with a FASTA format.
fastawrite('File', Header, Sequence) writes header and sequence information to a file with a FASTA format.
%get the sequence for the human p53 gene from GenBank.
seq = getgenbank('NM_000546')
%find the CDS line in the FEATURES information.
cdsline = strmatch('CDS',seq.Features)
%read the coordinates of the coding region.
[start,stop] = strread(seq.Features(cdsline,:),'%*s%d..%d')
%extract the coding region.
codingSeq = seq.Sequence(start:stop)
%write just the coding region to a FASTA file.
fastawrite('p53coding.txt','Coding region for p53',codingSeq);
Save multiple sequences.
data(1).Sequence = 'ACACAGGAAA'
data(1).Header = 'First sequence'
data(2).Sequence = 'ACGTCAGGTC'
data(2).Header = 'Second sequence'
fastawrite('my_sequences.txt', data)
type('my_sequences.txt')
>First sequence
ACACAGGAAA
>Second sequence
ACGTCAGGTC
Bioinformatics Toolbox function fastaread
| fastaread | galread | ![]() |
© 1994-2005 The MathWorks, Inc.