#!/usr/bin/env python3
# Above is the shebang line - which tells which program should interpret the rest of the file

# The libraries necessary for the exercises - use no other
import os, sys, re

####################################################################################
# You must fill the functions with code that does the job mentioned.               #
# All the functions must work together coherently for the exercise to be complete. #
# The main exercise function should call the other functions in it's group.        #
# You can add your own functions, but you still need to make the ones described.   #
# Any personal functions should follow the naming pattern demonstrated.            #
# You are expected the delete the "pass" statements as they are present only for   #
# syntax reasons. The template won't run without them.                             #
####################################################################################


########################################
### Add your fastaread function here ###
########################################


#########################################
### Add your fastawrite function here ###
#########################################



################################
### FUNCTIONS FOR EXERCISE 1 ###
################################

def exercise_1(numberstring:str) -> None:
    # Use RE to determine if numberstring is actually a number
    pass

################################
### FUNCTIONS FOR EXERCISE 2 ###
################################

def exercise_2(emailstring:str) -> None:
    # Use RE to determine if numberstring is actually an email address
    pass

################################
### FUNCTIONS FOR EXERCISE 3 ###
################################

def ex3_verify(seq:str) -> str:
    # Verifies a single sequence, returning "D" for DNA, "P" for protein or "U" for unknown
    pass

def exercise_3(filename:str) -> None:
    # Read a fasta file
    # Verify entries
    # print result
    pass

################################
### FUNCTIONS FOR EXERCISE 4 ###
################################

# Can you reuse function ex3_verify ????

def exercise_4(filenamein:str, filenameout:str) -> None:
    # Read a fasta file
    # Verify/discard entries
    # Save in output file
    pass

################################
### FUNCTIONS FOR EXERCISE 5 ###
################################

def exercise_5(filename:str) -> str:
    # Read fasta alignment
    # Compute consensus and return it
    pass

################################
### FUNCTIONS FOR EXERCISE 6 ###
################################

# You will likely make your own functions here - I won't decide for you

def exercise_6(filenamein:str, filenameout:str) -> None:
    # Open input SwissProt
    # Iterate through the lines, extraxt ID's and sequences
    # Save in output fasta
    pass

################################
### FUNCTIONS FOR EXERCISE 7 ###
################################

def exercise_7(filenamein:str, filenameout:str) -> None:
    # Open input fasta
    # Create epitope set
    # Save in output file
    pass

################################
### FUNCTIONS FOR EXERCISE 8 ###
################################

def ex8_hamming(seq1:str, seq2:str) -> int:
    # Compute hamming distance
    pass

def ex8_hobohm1(epitopes:list) -> list:
    # Eliminate similar epitopes and return new list
    pass

def exercise_8(filenamein:str, filenameout:str) -> None:
    # Open input epitope file
    # Iterate through the lines, extraxt ID's and sequences
    # Save in output epitope file
    pass



############################
# Main program starts here #
# Not necessary to change  #
############################

# Below if statement allows you to execute the main code when the file runs as a script,
# but not when it is imported as a module.
if __name__ == "__main__":

    # First exercise
    exercise_1('4')
    exercise_1('-7')
    exercise_1('0.656')
    exercise_1('-67.35555')
    exercise_1('5.')
    exercise_1('56F')
    exercise_1('.32')
    exercise_1('-.04')
    exercise_1('1+1')
    exercise_1('1-1')

    # Second exercise
    exercise_2('pwsa@dtu.dk')
    exercise_2('swe_we.232@22.dk')
    exercise_2('1234@dt-u.dk')
    exercise_2('pwsa.dtu.dk')
    exercise_2('pwsa.dtu@dk')

    # Third exercise
    exercise_3('dna7.fsa')
    exercise_3('dnanoise.fsa')

    # Fourth exercise
    exercise_4('dnanoise.fsa', 'fastaout.fsa')

    # Fifth exercise
    print(exercise_5('alignment.fsa'))

    # Sixth exercise
    exercise_6('HIVenvelope.txt', 'HIVenv.fsa')

    # Seventh exercise
    exercise_7('HIVenv.fsa', 'HIVepitopes.txt')

    # Eighth exercise
    exercise_8('HIVepitopes.txt', 'HIVepitopesML.txt')
