0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

NCBI SRA (Short Read Archive) 形式から fastq 形式に変換する Makefile

Posted at

結論

下記に載せるようなMakefileを書いて,データファイルと同じディレクトリに配置し,
make SRA=SRR0000000.sraなどとコマンドを実行すれば良い。
ただし,SRR0000000.sraはダウンロードしてきたsraファイルの名前とする。

ファイル中で,somewhereとなっている部分は,SRA Toolkit をインストール先にあわせて適宜変えてください。

paired-end のデータの場合のFasta ファイル

## commands
FASTQ-DUMP = /somewhere/fastq-dump

## files
FASTQ1 = $(SRA:%.sra=%_1.fastq)
FASTQ2 = $(SRA:%.sra=%_2.fastq)

all: $(FASTQ1) $(FASTQ2)

# obtain the paired-end fastq files from a given sra file
$(FASTQ1) $(FASTQ2): $(SRA)
	$(FASTQ-DUMP) --qual-filter --split-files $<

paired-end でない場合のFasta ファイル

## commands
FASTQ-DUMP = /somewhere/fastq-dump

## files
FASTQ = $(SRA:%.sra=%.fastq)

all: $(FASTQ)

# obtain the fastq file from a given sra file
$(FASTQ): $(SRA)
	$(FASTQ-DUMP) --qual-filter $<

背景

NCBI SRAと.sra形式

次世代シーケンサーで得られた生データは,NCBI の SRA (short read archive) というデータベースに登録されています
http://www.ncbi.nlm.nih.gov/sra
http://trace.ddbj.nig.ac.jp/dra/index.html

ここに登録されているデータは,実験一セット(1 run)を単位として.sra形式にまとめられてます。
http://trace.ddbj.nig.ac.jp/dra/faq.html#data_files_sra

このため,データを利用する場合は,NCBIが提供しているSRA Toolkitを用いて,データ形式を変換する必要があります。
http://trace.ncbi.nlm.nih.gov/Traces/sra/sra.cgi?view=toolkit_doc

今回は,fastq-dumpというツールを用いて,fasta 形式に変換することにします。
http://www.ncbi.nlm.nih.gov/Traces/sra/sra.cgi?view=toolkit_doc&f=fastq-dump

Makefile

あるファイルXから別のファイルYを生成するというような依存関係があるとき,
Makefileを書いて,依存関係をプログラムに管理してもらうと楽です。

今回は,sra形式のファイルからfasta形式のファイルを作るMakefileを書きました。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?