write
Write contents of BioRead or BioMap object to file
Description
write(
uses additional options specified by one or more name-value pair arguments. For
example, object
,fName
,Name,Value
)write(object,'data','Format','FASTQ')
saves the contents
of the object in the FASTQ-formatted file data.fastq
.
Examples
Save NGS Data to a File
Create a BioRead
object from an FASTQ
file.
BRObj = BioRead('SRR005164_1_50.fastq');
Extract the first 10 elements from BRObj
and store them in a new object.
subsetBRObj = getSubset(BRObj, [1:10]);
Write the contents of the subset data to a file named
subsetData.fastq
in the local C
drive. By default, the file is FASTQ-formatted because the object contains
the quality data.
write(subsetBRObj, 'C:\subsetData');
Input Arguments
fName
— Name of file
character vector | string
Name of the file where the contents of object
are
written, specified as a character vector or string.
The function adds the file extension automatically depending on the type of data the object contains. If you provide the extension, the function checks for consistency between the extension and the data format of the object. The file name can be prefixed by a file path. If the path is missing, the function writes the file to the same folder where the source file is located or to the current folder if the data is in memory.
Example: 'output'
Data Types: char
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Before R2021a, use commas to separate each name and value, and enclose
Name
in quotes.
Example: write(object,'data','Format','FASTQ')
saves the
contents of the object in the FASTQ-formatted file
data.fastq
.
Format
— File format
'FASTQ'
| 'FASTA'
| 'SAM'
| 'BAM'
File format, specified as a comma-separated pair consisting of
'Format'
and a character vector or string.
For BioRead
objects, available formats are
'FASTA'
and 'FASTQ'
. The
default format is 'FASTA'
if the object does not
contain qualities, that is, the Quality
property is
empty. Otherwise, the default format is
'FASTQ'
.
For BioMap
objects, available formats are
'FASTA'
, 'FASTQ'
,
'SAM'
, and 'BAM'
(default).
Example: 'Format','FASTA'
Data Types: char
Overwrite
— Boolean indicator to overwrite existing file
false
(default) | true
Boolean indicator to overwrite an existing file, specified as a
comma-separated pair consisting of 'Overwrite'
and
true
or false
. If
true
, the function overwrites the file and
deletes any respective index file
(*.idx,*.bai,*.linearindex
) or ordered file
(*.ordered.bam, *.ordered.sam
) that is no longer
needed.
Example: 'Overwrite',true
Data Types: logical
Version History
Introduced in R2010a
Comando de MATLAB
Ha hecho clic en un enlace que corresponde a este comando de MATLAB:
Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de 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)