菌叢解析ソフトqiime2を用いた解析
q2cli version 2021.4.0を用いた。
realpathを用いた。coreutilsをインストールする必要がある。
brew install coreutilssudo apt install coreutils# ヘッダ行の書き出し
echo sample-id","absolute-filepath","direction > manifest.csv
# manifest.csvにサンプルID, fastqファイルパス,ストランドを追記する
fqs=(*_R1_001.fastq) # fastqファイル名の配列
wd=`pwd` # 現在いるディレクトリの絶対パス
for r1 in ${fqs[@]}
do
r2=${r1/_R1/_R2} # R2ファイル名
fqid=(${r1//_/ }) # サンプルID(fastqファイル名を_で分割して配列に入れた)
cpfq_r1=${wd}/${r1} # R1の絶対パス
cpfq_r2=${wd}/${r2} # R2の絶対パス
echo -e ${fqid}","${cpfq_r1}","forward >> manifest.csv # manifest.csvに追記
echo -e ${fqid}","${cpfq_r2}","reverse >> manifest.csv
done
# 一部表示
head -6 manifest.csv## sample-id,absolute-filepath,direction
## F3D0,/Users/shogo/pub/sampledata/MiSeq_SOP/F3D0_S188_L001_R1_001.fastq,forward
## F3D0,/Users/shogo/pub/sampledata/MiSeq_SOP/F3D0_S188_L001_R2_001.fastq,reverse
## F3D141,/Users/shogo/pub/sampledata/MiSeq_SOP/F3D141_S207_L001_R1_001.fastq,forward
## F3D141,/Users/shogo/pub/sampledata/MiSeq_SOP/F3D141_S207_L001_R2_001.fastq,reverse
## F3D142,/Users/shogo/pub/sampledata/MiSeq_SOP/F3D142_S208_L001_R1_001.fastq,forward
--type,--input-path--output-path## R version 4.0.3 (2020-10-10)
## Platform: x86_64-apple-darwin17.0 (64-bit)
## Running under: macOS Mojave 10.14.5
##
## Matrix products: default
## BLAS: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
##
## locale:
## [1] ja_JP.UTF-8/ja_JP.UTF-8/ja_JP.UTF-8/C/ja_JP.UTF-8/ja_JP.UTF-8
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## loaded via a namespace (and not attached):
## [1] digest_0.6.27 R6_2.5.0 jsonlite_1.7.2 magrittr_2.0.1
## [5] evaluate_0.14 rlang_0.4.11 stringi_1.6.2 jquerylib_0.1.4
## [9] bslib_0.2.5.1 rmarkdown_2.9 tools_4.0.3 stringr_1.4.0
## [13] xfun_0.24 yaml_2.2.1 compiler_4.0.3 htmltools_0.5.1.1
## [17] knitr_1.33 sass_0.4.0