[Bioc-devel] Biostring

Martin Morgan mtmorgan at fredhutch.org
Sun Apr 26 19:32:21 CEST 2015


On 04/26/2015 04:52 AM, Kinga via Bioc-devel wrote:
> library(Biostrings)
> S_seq = "acgtggattagcgta";
> Q_seq = "acgtcgta";
> xq = DNAString(Q_seq);
> xs = DNAString(S_seq);
>
> m = length(xq);
> n = length(xs);
> score_matrix = matrix(data=0, nrow = m+1, ncol = n+1, byrow = TRUE)
> best=0;
> optloc=c(0,0);
>
>
> for (i in 2:(m+1)){
>    for (j in 2:(n+1)){
>      if ((xs[i-1]) == (xq[j-1])) {score.match = 3}

for j = 10, xq[j - 1] tries to access the 9th letter of Q_seq. But Q_seq only 
has 8 letters. Did you mean

     xs[j-1] == xq[i-1]

?

This question probably belongs on https://support.bioconductor.org

Martin

>      else {score.match = -4}
>      score_matrix[i,j]=max(score_matrix[i,j-1]-7,
>                                score_matrix[i-1,j]-7,
>                                score_matrix[i-1,j-1] + score.match);
>      if (score_matrix[i,j]>= best) {
>        best = score_matrix[i,j];
>        optloc = c(i,j);
>      }
>    }
> }
> Error in NSBS(i, x, exact = exact, upperBoundIsStrict = !allow.append) :
>    subscript contains NAs or out-of-bounds indices
>
> Can somebody help me with this error. What does it mean? I updated all the packages I used and I'm a newbie to this so I would really appreciate some help.
>
> Here is my sessionInfo:R version 3.1.3 (2015-03-09)
> Platform: x86_64-w64-mingw32/x64 (64-bit)
> Running under: Windows 8 x64 (build 9200)
>
> locale:
> [1] LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United Kingdom.1252
> [3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C
> [5] LC_TIME=English_United Kingdom.1252
>
> attached base packages:
> [1] stats4    parallel  stats     graphics  grDevices utils     datasets  methods
> [9] base
>
> other attached packages:
> [1] Biostrings_2.34.1   XVector_0.6.0       IRanges_2.0.1       S4Vectors_0.4.0
> [5] BiocGenerics_0.12.1
>
> loaded via a namespace (and not attached):
> [1] tools_3.1.3     zlibbioc_1.10.0
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> Bioc-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel
>


-- 
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793



More information about the Bioc-devel mailing list