我有一个R脚本我试图在bash脚本中运行,但我不知道如何使两者兼容 我的R脚本(seq_trimming.R):
#!/usr/bin/Rscript
input <- file('stdin','r')
row <- readLines(input, n=1)
while (length(row)>0) {
#loading reads
#path needs to go to .ab1
seq.filepath = row
seq.abif = read.abif(seq.filepath)
seq.sanger = sangerseq(seq.abif)
#trimming low quality bases
#you can control the severity of the trim by usuing (seq.abif, 0.01) the higher the number the less amount of bases are trimmed
trims = trim.mott(seq.abif, 0.001)
trims
}
而我的bash脚本是
ls *.ab1 | while read line
do
cd ../../sanger_analysis | Rscript seq_trimming.R $line >../../sanger_analysis/trim_$line
done
我的目标是能够将一组ab1文件放在一个文件夹中并通过这个脚本放入并获取修剪过的序列