Question: (Closed) nrow,ncol name,matrix name
0
gravatar for gizemtatar
4.6 years ago by
gizemtatar0
Turkey
gizemtatar0 wrote:

My input;

seq1="GCATGCU"

seq2="GATTACA"

n=length(s1string) #seq1

m=length(s2string) #seq2

This matrix

D <- matrix(0,nrow=m+1, ncol=n+1)

seq1 and seq2 length = 7 but I must create matrix 8x8:

       [,1]  [,2] [,3] [,4] [,5] [,6] [,7] [,8]
[1,]    0   -1   -2   -3   -4   -5   -6   -7
[2,]   -1    1    0   -1   -2   -3   -4   -5
[3,]   -2    0    0    1    0   -1   -2   -3
[4,]   -3   -1   -1    0    2    1    0   -1
[5,]   -4   -2   -2   -1    1    1    0   -1
[6,]   -5   -3   -3   -1    0    0    0   -1
[7,]   -6   -4   -2   -2   -1   -1    1    0
[8,]   -7   -5   -3   -1   -2   -2    0    0

  I want to define matrix ncol with s1string, nrow= s2string but start colname and rowname [2, ], [,2].  for example, [,2]="G" [,3]="C" [,4]="A" [,5]="T" [,6]="G" [,7]="C" [,8]="T" . I don't want define in this [1,1].  Can you help me for this topic?

sequence • 1.6k views
ADD COMMENTlink written 4.6 years ago by gizemtatar0

Please explain why you posted the same question again, you have gotten an answer already.

ADD REPLYlink written 4.6 years ago by Michael Dondrup47k

Hello gizemtatar!

Questions similar to yours can already be found at:

We have closed your question to allow us to keep similar content in the same thread.

If you disagree with this please tell us why in a reply below. We'll be happy to talk about it.

Cheers!

ADD REPLYlink written 4.6 years ago by Michael Dondrup47k

Because my question don't answer. 

 

ı try it but programme give error :

Error in dimnames(x) <- dn : 
  length of 'dimnames' [2] not equal to array extent

ADD REPLYlink written 4.6 years ago by gizemtatar0

For sure it won't work, because dimnames must have same length as the matrix dimensions, why do you want to assign 7 dimnames to an 8x8 matrix. Your matrix looks like a scoring matrix. So the solution is obvious: define proper dimension names of length 8. So what's in the additional column? 
 

ADD REPLYlink modified 4.6 years ago • written 4.6 years ago by Michael Dondrup47k

Also, if your original question is not answered correctly, please attend the original question instead of posting again.

ADD REPLYlink written 4.6 years ago by Michael Dondrup47k

Yes, I know. I create scoring matrix but this matrix Needleman-Wunsch global alignment matrix. And I need this matrix. 

ADD REPLYlink written 4.6 years ago by gizemtatar0

I have answered your initial question.

ADD REPLYlink written 4.6 years ago by Michael Dondrup47k
Please log in to add an answer.
The thread is closed. No new answers may be added.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1037 users visited in the last hour