473,574 Members | 2,457 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Plz help..urgent!

111 New Member
I have a code here which is finding a log vaue.
its input will be a sequence file and another matrix file..it reads both and computes the results.there seems to be some problem .. and it gives an indendation error as a problem and i dont think that could be..
my input files examples
Expand|Select|Wrap|Line Numbers
  1. matrix file:
  2. PO         A          C          G          T       
  3. 01         0.00       3.67       0.00       0.00    
  4. 02         0.00       0.00       3.67       0.00    
  5. 03         0.00       0.00       0.00       3.67    
  6. 04         0.00       3.67       0.00       0.00    
  7. 05         3.67       0.00       0.00       0.00    
  8. 06         3.46       0.00       0.22       0.00    
  9. 07         0.00       0.00       3.67       0.00    
  10. 08         0.00       0.00       0.00       3.67    
  11. 09         0.00       0.00       0.00       3.67    
  12. 10         0.00       3.67       0.00       0.00    
  13. 11         3.67       0.00       0.00       0.00    
  14. 12         3.67       0.00       0.00       0.00    
  15. 13         0.00       0.00       3.67       0.00    
  16. 14         0.00       0.00       0.00       3.67    
  17. 15         0.00       0.00       3.67       0.00    
  18. 16         0.00       3.67       0.00       0.00    
  19. sequence file:
  20. >Scer_YAL001C SGDID:S0000001 5' untranslated region, Chr I 151168 - 152167 (revcom), 1000 bp
  21. ACTTGTAAATATATCTTTTATTTTCCGAGAGGAAAAAGTTTCAAAAAAAAAAAAAAAAAAAGAAGAAAAATAACTTTCTCATGTAATAAAAGGTAACTAATGTAGACAAAAAAGTATACATTTAGCTTTTCTTTTTTTGATGATTTTTGAGTTTCATGTTACTAATCAGAACAATTAACGACACCTTCATTATGAAAAAATTAATTAGCTATAAGTCTTCGAAGTAGAACATGATATTTGGCAATCACTCGAATAACTATCTTAATTTACCTGCTGAAATAATTTGAAAAAACACCCGAGGCAGCAGACGAAAGGTGTTTTTGCTAAACAATGATTGATTTCTGGCGCCATTTCTACATTCTGAACAGTTCATCTCATTTCAGTAACAGTACTTCAATGGAATATTTATTAAAGAAAGTGCTTAAAAAAGTATTATAAAACGATACATGGACTGACTCAAGATTGAGCTAATAAGGTCCACCGCCTAGTGCTTAAGAGTTCTGTACCACTATAATAATTTATCTTGATCGTATTATGTGTAAAAAAAAGGCGCTTGAAATGAAAGCTCCGAAAATTAAAATACTTTGACTGCTTCGGAAAACAAAAACATATAAATAAATTTAAAAAATAAACTGTAAAATATTTAAAAACTATTAAAAATATTTTATATTTTTAAAATTATTTATTATTATGTCATGTGACAAGACTTAAATCATTACATAAAAGGTTTTGAAGTTCAATGTCAAAGTCAATATAATAAGCATACTAAGGCACACTTATGCAAATCGAGTTATTGAAGCTGGTAAAATTATAAGATTTTTATTTTTATTTCTTTTATTTCTGCAAATCTGCATTTTCAAATACCGCTTGGTTTTTTGCATCATAAAGGGCGGCGCTTTCAGTCGCGAAAGTGAAATAAACAACCAGTCACACATATAACTTTCTTCTTGCCATAAGAGAGAAGAGGACGTTTGGTTGAAGCCAACTAGCCACAAGAAAA
  22. >Spar YAL001C c218:24375..25375
  23. TCAAGAGGGTTATTATATACCGATATTTGAATCCACACATGATCGAACTAATATAATTCACTACTTAGCTGCTTAACCATTCTTTGCCATTATAATAAATGTATCTCGATCGAATGCTGCATAGAGAAAAGCGCTTAAAAAAGTGTTCCGAAATATAACATATTTTAAACGTTTCGGAAACCAAAAACATATATTTATTATCTTAAAGTAATCTAAAAAATGAAAGAAACTTTGATATATTTAAAACATAATATAATTATTTTATAAAAGTAACATGTGATTAAACTCACAAAGCCTAAAAATGTTTTTAATCATTATGTTAAGCTGAATATAGTATATCTAATAATTGTTTATTTAAGCAGATTGAACTGTGAATGCTAGTAAATTTTTAAGGGTTTTTTGTTGTTCTGCTTTTCTCTAGTTTTGTAGTGTCAAATACAACTAACTGGATTTTTTGCATCAGAAGGGGCGCTTTAACTCGCGAAAGTAAAAATAAACAATTAATCACACATATCTTTTCCTCTTGCAGAAGCAAAGAAGAGGACGGTTGATTGAAGCAAACCAGCCACAGAAAATATGGCGTTGACAATTTATCCTGATGAACTGGTTAAAATAGTGTCTGATGAAATTGCATCAAATAAAGGAAGTATGTATATGCCTCATTCTTCTATTCCATGTTCTTTTCAGGTGAGAAACGTGATATATTGTAAGATTATTTACTAACGACTTATTAAAGAAATTACGTTAAATCAGCTTTGGGATATATCTCGTAAATATTTTGATTTGTCTGACGAGAAAGTTAAACAATTTGTGCTTTCATGCGTGATGTTGAAAAAGGACATCGAGGTGTACTGTGATAGCGTTATAACAACTAAAAACGTGACAAATATTATAGACGACACTAGTCATTCATACTCAGTAGGGATTACTGAGGACAGCCTGTGGACGTTATTAACTGGATACACAAAGAAGGAGTCAACTATCGGGAATTCAGCATTTGA
  24.  well my code is here
  25.     Expand|Select|Wrap|Line Numbers
  •  
  •     
  •  
  • from math import *
  • import random
  • f=open("half.txt","r")
  • line=f.next()
  • while not line.startswith('PO'):
  •     line=f.next()
  •  
  • headerlist=line.strip().split()[1:]
  • linelist=[]
  •  
  •  
  • line=f.next().strip()
  • while not line.startswith('/'):
  •     if line !='':
  •         linelist.append(line.strip().split())
  •     line=f.next().strip()
  •  
  • keys=[i[0] for i in linelist]
  • values=[[float(s) for s in item] for item in [j[1:] for j in linelist]]
  •  
  • array={}
  • linedict=dict(zip(keys,values))
  • keys=linedict.keys()
  • keys.sort()
  • for key in keys:
  •     array=[key,linedict[key]]
  •  
  • datadict={}
  • datadict1={}
  • for i,item in enumerate(headerlist):
  •     datadict[item]={}
  •     for key_ in linedict:
  •         datadict[item][key_]=linedict[key_][i]
  •  
  •  
  • for keymain in datadict:
  •     for keysub in datadict[keymain]:
  •         datadict[keymain][keysub]+=1.0
  •  
  • datadict1=datadict.copy()
  • for keysub in datadict:
  •     for keysub in datadict[keymain]:
  •         #print "::::::::::::::::"
  • datadict1[keymain][keysub]=datadict[keymain][keysub]/(sum(values[int(keysub)-1])+4)
  •  
  •  
  • def readfasta():
  •     file1=open("YAL001C.txt",'r')
  •     file_content=file1.readlines()
  •     first=1
  •     list1=""
  •     for line in file_content:
  •         if line[0]==">":
  •             if first==0:
  •                 print "***************"
  •                 list1+=sequence
  •                 print "***********"
  •             else:
  •                 first=0
  •                 sequence=""
  •                 seq=""
  •                 for i in range(0,len(line)-1):
  •                     seq+=line[i]
  •         else:
  •                for i in range(0,len(line)-1):
  •             sequence+=line[i]
  •     list1+=sequence
  •     return list1
  • p=readfasta()
  • res=1
  • part=""
  • q=len(p)
  • seqq=""
  •  
  • value={"A"=0.3,"T":0.3,"C":0.2,"G":0.2}
  • for i in range(q-16):
  •     part=p[i:i+16]
  •     seqq=part
  •     res=1
  •     score=1
  •     for j in range(16):
  •         key=seqq[j]
  •         res=res*datadict1[key]["%02d"%(j+1)]
  •     for key in seqq:
  •         score=score*value[key]
  •     log_ratio=log10(res/score)
  •     print i,log_ratio
  •  
  •  
  •     
  •  
  •  
  • can you see the problem?
    plz help!!
    Dec 9 '07 #1
    0 976

    Sign in to post your reply or Sign up for a free account.

    Similar topics

    8
    1817
    by: Tim::.. | last post by:
    Can someone please tell me why I keep getting the following error for some of my web application users but not others??? Even though the application runs from a central webserver??? Thanks for any help... Error: -----
    7
    7230
    by: zeyais | last post by:
    Here is my HTML: <style> ..leftcolumn{float:left;width:300px;border: 1px solid #ccc} ..rtcolumn{float:left;width:600px;border: 1px solid #ccc} </style> <body> <div class="leftcolumn" id="d_links"> multiple <a href="hello.aspx?q=something">something</a><a href="hello.aspx?q=something1">something1</a><a
    17
    2272
    by: Saps | last post by:
    Hi all. Can anyone help me here. I have loads of .sql files and i need a way to call these from my asp page so the user can run them from the browser. Meaning i have a page with a list of all scripts. each when clicked i am able to run the script. so HOW and what do i do to call and run the .sql Thanks
    3
    6448
    by: N. Spiker | last post by:
    I am attempting to receive a single TCP packet with some text ending with carriage return and line feed characters. When the text is send and the packet has the urgent flag set, the text read from the socket is missing the last character (line feed). When the same text is sent without the urgent flag set, all of the characters are read. ...
    1
    2102
    by: psantosh12 | last post by:
    Hello Frnds Please need help to resolve error.......... it is very very urgent........ The error is Runtime Error Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could,...
    0
    7815
    marktang
    by: marktang | last post by:
    ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
    0
    8079
    Oralloy
    by: Oralloy | last post by:
    Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
    1
    7833
    by: Hystou | last post by:
    Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
    0
    6481
    agi2029
    by: agi2029 | last post by:
    Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
    0
    3756
    by: TSSRALBI | last post by:
    Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
    0
    3770
    by: adsilva | last post by:
    A Windows Forms form does not have the event Unload, like VB6. What one acts like?
    1
    2254
    by: 6302768590 | last post by:
    Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
    1
    1359
    muto222
    by: muto222 | last post by:
    How can i add a mobile payment intergratation into php mysql website.
    0
    1081
    bsmnconsultancy
    by: bsmnconsultancy | last post by:
    In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

    By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

    To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.