/workshop

Genome sequence comparison workshop

Primary LanguageR


Haruo Suzuki (haruo[at]g-language[dot]org)
Last Update: 2016-04-26


Microbial Genome Sequence Analysis

微生物ゲノム配列解析

Updates

2016-04-26

Pan-genome解析の演習

Rスクリプトscripts/test_gene_content.Rは、gene content(遺伝子の有無)データ行列を作成し、Pan-genome解析(共有遺伝子、ベン図、クラスター分析)を行なう。Rスクリプトの実行例は以下の通り:

Rscript --vanilla scripts/test_gene_content.R

http://www.ncbi.nlm.nih.gov/pmc/articles/PMC4765519/figure/F1/

Venn diagram plot that represents the three parts of the pan-genome. In gray: core genome; yellow: accessory or dispensable genome, and blue: species-specific or strain-specific genes. Adapted: Muzzi et al., 2007.

2016-04-19

微生物ゲノム解析の概要


References

https://en.wikipedia.org/wiki/Rarefaction_(ecology)


Scripts

The shell script scripts/run.sh automatically carries out the entire steps: creating subdirectories, downloading data files, and running the R scripts.

Let's run the driver script in the project's main directory mgsa/ with:

bash scripts/run.sh > log.txt 2>&1 &

Step

Created the project directory using mkdir -p ./{data,scripts,analysis}

mv Rplots.pdf table.csv analysis/

マイコプラズマ菌(Mycoplasma genitalium)のコンプリートゲノム配列の取得方法

プロジェクト・ディレクトリを作成し移動:

mkdir -p ~/projects/mgsa/data
cd ~/projects/mgsa/data

"Mycoplasma genitalium"のゲノム配列データのFTPディレクトリパス(URL)を記載したファイルをwgetでダウンロードする:

wget ftp://ftp.ncbi.nlm.nih.gov/genomes/genbank/bacteria/Mycoplasma_genitalium/assembly_summary.txt

または

wget ftp://ftp.ncbi.nlm.nih.gov/genomes/refseq/bacteria/Mycoplasma_genitalium/assembly_summary.txt

ゲノム配列解読の状況 Status (assembly_level) を確認:

head -n 1 assembly_summary.txt | cut -f12
grep -v '^#' assembly_summary.txt | cut -f12 | sort | uniq -c

出力例:

assembly_level
   5 Complete Genome
   1 Contig

"Complete Genome"のデータ最新版(version_status = latest)のURLを抽出する:

ftpdirpaths=($(awk -F "\t" '$12=="Complete Genome" && $11=="latest"{print $20}' assembly_summary.txt))

または

ftpdirpaths=($(grep "latest.*Complete Genome" assembly_summary.txt | cut -f20))

抽出されたURLの数を確認する:

echo ${#ftpdirpaths[@]}
echo ${ftpdirpaths[@]}

データの圧縮ファイル(.fna.gz,.faa.gz)をwgetでダウンロードする:

for URL in ${ftpdirpaths[@]}
do
  wget -nv $URL/{*.fna.gz,*.faa.gz}
done

gunzipコマンドで解凍:

gunzip *.gz

参考: https://github.com/haruosuz/mgen ケーススタディ https://dl.dropboxusercontent.com/u/33495171/introBI/CaseStudy.md.html NCBI assembly summary



Inspecting Data

cd data/
ls -lh
# Working with Gzipped Compressed Files using gzcat, zgrep, and zless
gzcat *.fna.gz | head -n 2
zgrep -c '^>' *.gz
zless *.faa.gz