Re: [R] counting sequence mismatches

2008-02-23 Thread joseph
it is pretty enough for me. Thanks - Original Message From: Martin Morgan <[EMAIL PROTECTED]> To: joseph <[EMAIL PROTECTED]> Cc: r-help@r-project.org Sent: Friday, February 22, 2008 6:41:41 PM Subject: Re: [R] counting sequence mismatches One kind of ugly soluti

Re: [R] counting sequence mismatches

2008-02-22 Thread Martin Morgan
One kind of ugly solution > d.f=data.frame(seq1, seq2, stringsAsFactors=FALSE) > d.f[["nMismatch"]] <- with(d.f, { + m <- mapply("!=", strsplit(seq1, ""), strsplit(seq2, "")) + colSums(m) + }) Check out the Bioconductor Biostrings package, especially the version available with the developm

[R] counting sequence mismatches

2008-02-22 Thread joseph
Hello I have 2 columns of short sequences that I would like to compare and count the number of mismatches and record the number of mismatches in a new column. The sequences are part of a data frame that looks like this: seq1=c("CGGTGTAGAGGAAAGGAAACAGGAGTTC","CGGTGGTCAGTCTGGGACCTGGGCAGCAGGCT