Skip to content

Commit

Permalink
patching errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
wolski committed May 28, 2018
1 parent 2de9d02 commit 0449157
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
12 changes: 8 additions & 4 deletions R/annotatePeptides.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ annotatePeptides <- function(pepinfo,
#' file = file.path(path.package("prozor"),"extdata/shortfasta.fasta.gz" )
#' fasta = readPeptideFasta(file = file)
#' #res = annotateVec(pepprot[1:20,"peptideSeq"],fasta)
#' system.time(res2 <- annotateAHO(pepprot[1:20,"peptideSeq"],fasta))
#'
#' system.time( res2 <- annotateAHO( pepprot[1:20,"peptideSeq"], fasta))
#' colnames(res2)
#' @export
annotateAHO <- function(pepseq,fasta){
Expand All @@ -71,11 +72,14 @@ annotateAHO <- function(pepseq,fasta){
fasta <- stringr::str_trim(unlist(fasta))
names(fasta) <- proteinIDS

system.time(res <- AhoCorasickSearch(unique(pepseq) , unlist(fasta), alphabet = "aminoacid"))

res <- AhoCorasickSearch(unique(pepseq) , unlist(fasta), alphabet = "aminoacid")
if(length(res) == 0)
{
return(NULL)
}
simplifyAhoCorasickResult <- function(x, name){t <- as.data.frame(do.call("rbind",(x))); t$proteinID <- name; return(t)}
tmp <- mapply(simplifyAhoCorasickResult, res, names(res), SIMPLIFY=FALSE)

print(length(tmp))
xx <- plyr::rbind.fill(tmp)
colnames(xx)[colnames(xx)=="Keyword"]<-"peptideSeq"
xx$peptideSeq <- as.character(xx$peptideSeq)
Expand Down
Binary file added inst/extdata/shortfasta.fasta.gz
Binary file not shown.
3 changes: 2 additions & 1 deletion man/annotateAHO.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions prozor.Rproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ StripTrailingWhitespace: Yes
BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
PackageRoxygenize: rd,collate,namespace

0 comments on commit 0449157

Please sign in to comment.