fastawrite
Write to file using FASTA format
Description
Examples
Write Coding Region to FASTA File
Retrieve the sequence for the human p53 gene from the GenBank database.
seq = getgenbank('NM_000546');
Read the coordinates of the coding region in the CDS line.
start = seq.CDS.indices(1)
start = 143
stop = seq.CDS.indices(2)
stop = 1324
Extract the coding region.
codingSeq = seq.Sequence(start:stop);
Write the coding region to a FASTA-formatted file, specifying Coding region for p53
for the Header in the file, and p53coding.txt
for the file name.
fastawrite("p53coding.txt","Coding region for p53",codingSeq);
Open the file to view the content.
open p53coding.txt
Save Multiple Sequences to FASTA File
Write two nucleotide sequences to a MATLAB structure containing the fields Header
and Sequence
.
data(1).Sequence = "ACACAGGAAA"; data(1).Header = "First Sequence"; data(2).Sequence = "ACGTCAGGTC"; data(2).Header = "Second Sequence";
Write the sequences to a FASTA-formatted file, specifying my_sequences.txt
for the file name.
fastawrite("my_sequences.txt",data)
Append a third sequence to the file. Also turn off the append warning message.
warnState = warning; %Save the current warning state warning('off','Bioinfo:fastawrite:AppendToFile'); fastawrite("my_sequences.txt","Third Sequence","TACTGACTTC")
Restore the warning to previous setttings.
warning(warnState)
Open the file.
open my_sequences.txt
Input Arguments
File
— File name or path
character vector | string scalar
File name or a path and file name for saving the FASTA-formatted data, specified as
a character vector or string scalar. If you specify only a file name,
fastawrite
saves the file to the MATLAB® Current Folder. If you specify an existing file,
fastawrite
appends the data to the file, instead of overwriting
the file.
Tip
To append FASTA-formatted data to an existing file, simply specify that file name.
fastawrite
adds the data to the end of the file.
If you are using fastawrite
in a script, you can disable the
append warning message by entering the following command lines before the
fastawrite
command:
warnState = warning %Save the current warning state warning('off','Bioinfo:fastawrite:AppendToFile');
fastawrite
command:warning(warnState) %Reset warning state to previous settings
Data Types: char
| string
Data
— Sequence data
character vector | string scalar | structure | character array
Sequence data to be written to File
, specified as one of the following.
Character vector or string scalar containing a sequence.
Structure containing the fields
Header
andSequence
.Structure containing sequence information from the GenBank® or GenPept database. The
genbankread
,getgenbank
,genpeptread
, orgetgenpept
functions return such structures.Character array, where each row is a sequence.
Data Types: char
| string
| structure
| array
Header
— Header information about the sequence
character vector | string scalar
Header information about the sequence, specified as a character vector or string scalar.
Data Types: char
| string
Sequence
— Amino acid or nucleotide sequence
character vector | string scalar
Amino acid or nucleotide sequence using the standard IUB/IUPAC letter or integer codes, specified as a character vector or string scalar. For a list of valid characters, see Amino Acid Lookup or Nucleotide Lookup.
Data Types: char
| string
Version History
Introduced before R2006a
See Also
fastainfo
| fastaread
| fastqinfo
| fastqread
| fastqwrite
| genbankread
| genpeptread
| getgenbank
| getgenpept
| multialignwrite
| saminfo
| samread
| seqviewer
| sffinfo
| sffread
Comando MATLAB
Hai fatto clic su un collegamento che corrisponde a questo comando MATLAB:
Esegui il comando inserendolo nella finestra di comando MATLAB. I browser web non supportano i comandi MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)