2021年1月20日星期三

Finding a particular line in a large matrix

Hellow every one,

I have a sequence:
s= BCCDDDCDCDDDDCDDABCDABCABDBACBDCAADDCBCABACBCCABCACBCCCCCBDBACABBBCBCBACCACADAACCCBABADBCCAAABBCCBB
It has 99 characters. Now I have a large matrix where it shows the coupling between two characters in the above sequence. The matric has 99C2 (99 Combination of 2 = 4851) Now I like to have a script where I can give the positions and I can print the coupling from the large matrix.

This is what I'm trying:

s="BCCDDDCDCDDDDCDDABCDABCABDBACBDCAADDCBCABACBCCABCACBCCCCCBDBACABBBCBCBACCACADAACCCBABADBCCAAABBCCBB"   cc=np.loadtxt('coupling.txt')  a=len(s)-1  position1=84/2  position2=90/2  for x, line in enumerate(cc):       ...:     if x==a*position1+position2:       ...:         print(line)  

I like to find the coupling between two positions (let's say positions 84 and 90). But there is some problem with my code. How do I make a general code which will work for any two positions

https://stackoverflow.com/questions/65819738/finding-a-particular-line-in-a-large-matrix January 21, 2021 at 08:51AM

没有评论:

发表评论