i worte a program to automatically dectect the scoring system in fastq file
and if pred+64, it should be changed into pred+33

please help me make sure it is right

rm(list=ls())
fastqfile="1.fastq";
working_dir="d:/working_dir"
setwd(working_dir)
library(ShortRead);
reads <- readFastq(fastqfile);
seqs <- sread(reads);
score_sys = data.class(quality(reads));
cat("the quality score system
(SFastqQuality=Phred+64,FastqQuality=Phred+33) is",score_sys,"\n")
raw_len <- max(width(reads));

qual <- quality(quality(reads));
myqual_16L <- charToRaw(as.character(unlist(qual)));
if(score_sys =="FastqQuality")
{
 myqual_10L <- strtoi(myqual_16L,16L)-33;   # this is for other use
}

if(score_sys =="SFastqQuality")
{
 myqual_10L <- strtoi(myqual_16L,16L)-64;
 qual_temp <- PhredQuality (as.integer(myqual_10L));
 qual <- BStringSet(unlist(qual_temp), start= seq(from = 1, to =
raw_len*(length(reads)-1)+1, by = raw_len), width=raw_len);

}
reads <- ShortReadQ(sread=seqs, quality=qual ) );

-- 
shan gao
Room 231(Dr.Fei lab)
Boyce Thompson Institute for Plant Research
Cornell University
Tower Road, Ithaca, NY 14853-1801
Office phone: 1-607-254-1267(day)
Official email:sg839@cornell.edu
Facebook:http://www.facebook.com/profile.php?id=100001986532253

	[[alternative HTML version deleted]]

