I have an R script I am trying to run through in a bash script but im not sure how to make the two compatible my R script(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
}
while my bash script is
ls *.ab1 | while read line
do
cd ../../sanger_analysis | Rscript seq_trimming.R $line >../../sanger_analysis/trim_$line
done
my goal is to be able to take a group of ab1 files in a folder and put them through this script and get the trimmed sequences out