def print_alignment_matrix(alignment_matrix, seq_x, seq_y):
    """
    Helper function that prints out the alignment_matrix
    """

    row_names = "0" + seq_x
    print "Alignment matrix where columns are: 0" + seq_y
    for index in range(len(seq_x)+1):
        print "For row", row_names[index], "=====>", alignment_matrix[index]
        

#####################################
# Code for answering question 1 of the application

# Read the HumanEyelessProtein and print the result
human_protein = rfs.read_protein(HUMAN_EYELESS_URL)
print "Human protein:"
print human_protein
print "Length human protein =", len(human_protein)
print
    
# Read the FruitflyEyelessProtein and print the result
fruitfly_protein = rfs.read_protein(FRUITFLY_EYELESS_URL)
print "Fruitfly protein:"
print fruitfly_protein
print "Length fruitfly protein =", len(fruitfly_protein)
print
    
# Read the PAM50 scoring matrix and print the result
scoring_matrix = rfs.read_scoring_matrix(PAM50_URL)
#print_scoring_matrix(scoring_matrix)
WORD_LIST_URL = "http://storage.googleapis.com/codeskulptor-assets/assets_scrabble_words3.txt"

# Resulting local alignments from question 1
HUMAN_LOCAL = "HSGVNQLGGVFVNGRPLPDSTRQKIVELAHSGARPCDISRILQVSNGCVSKILGRYYETGSIRPRAIGGSKPRVATPEVVSKIAQYKRECPSIFAWEIRDRLLSEGVCTNDNIPSVSSINRVLRNLASEK-QQ"
FRUITFLY_LOCAL = "HSGVNQLGGVFVGGRPLPDSTRQKIVELAHSGARPCDISRILQVSNGCVSKILGRYYETGSIRPRAIGGSKPRVATAEVVSKISQYKRECPSIFAWEIRDRLLQENVCTNDNIPSVSSINRVLRNLAAQKEQQ"

# Set timeout for CodeSkulptor (only if this code is run in Code Skulptor)
# import codeskulptor
# codeskulptor.set_timeout(20)


#####################################
# Code for answering question 2 of the application

# Read the ConsensusPAXDomain and print the result
consensus_pax = rfs.read_protein(CONSENSUS_PAX_URL)
print "Consensus PAX domain protein:"
print consensus_pax
print "Length consensus PAX domain protein =", len(consensus_pax)
print

# Read the PAM50 scoring matrix and print the result
scoring_matrix = rfs.read_scoring_matrix(PAM50_URL)

# Computations for the human protein sequence
# . remove all '-' from the sequence
lst_of_strings = HUMAN_LOCAL.split("-")
human_local = ""
for substring in lst_of_strings:
    human_local += substring
# . compute the alignment between this sequence and the ConsensusPAXDomain sequence