Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(1)  |  Call(1)  |  Derive(0)  |  Import(0)
Function: write_CT_file()

Purpose:  Use list of base pairs derived from dot-bracket notation
          to create CT file.
          
Input:    Desired file name, sequence and structure given as list of base pairs. 

Return:   Create CT file.

        def write_CT_file(sequence, base_pairs, output_ct):
    """ Function: write_CT_file()

        Purpose:  Use list of base pairs derived from dot-bracket notation
                  to create CT file.
                  
        Input:    Desired file name, sequence and structure given as list of base pairs. 
        
        Return:   Create CT file.
    """  
    output = file(output_ct,'w')

    output.write(str(len(sequence)))
    output.write('\n')    
        
    for index, base in enumerate(sequence):

        found = False
        
        for (b1, b2) in base_pairs:
            if b1 == index + 1:
                line = (index + 1, base, index, index + 2, b2, index + 1)
                found = True
                
        if not found:
            line = (index + 1, base, index, index + 2, 0, index + 1)

        for element in line:
            output.write(str(element))
            output.write(' ')
        output.write('\n')
        

    output.close()

    return
        


src/r/n/RNArobo-HEAD/foldfilter/dotknot/dotknot.py   RNArobo(Download)
        base_pairs = BPs_to_CT.db_to_ct_brackets(predicted_global_structure)
        output_ct = FILE_ID + '.ct'
        BPs_to_CT.write_CT_file(seq, base_pairs, output_ct)
 
    #---------------------------------------------------------------------------------------------------------