Commit 6c9d83a6 authored by Jordan Eckhoff's avatar Jordan Eckhoff

Experimenting with custom Error messages

parent 1cc7cc75
......@@ -8,16 +8,20 @@
# Contributor e-mails: N/A
#
# Creation Date: 10 Jul 2018
# Latest Version: 14 Jul 2018
# Latest Version: 31 Jul 2018
#
# Usage Instructions: When prompted, open a .fa FASTA file. This file will ???
import IS_Fasta_Sequence # Custom module for working with FASTA files
from tkinter import Tk #
from tkinter.filedialog import askopenfilename # Asks user to select a .fa FASTA file
Tk().withdraw() #
with open(askopenfilename(),'r') as FastaFile: # Opens the selected .fa file via its PATH
Sequences = IS_Fasta_Sequence.Sequence_Read(FastaFile.readlines()) # Creates a list of custom FASTA_Seq objects, each of which contains a single sequence from the FASTA file
# and its associated metadata as seperate properties, Seq and Meta respectively, as well as Code, a string
......@@ -51,4 +55,3 @@ Z = IS_Fasta_Sequence.Sequence_Translate(Sequences[3],1,'Protein')
print(Z.Meta + '\n',
Z.Seq + '\n',
Z.CodeType + '\n')
......@@ -8,12 +8,14 @@
# Contributor e-mails: N/A
#
# Creation Date: 10 Jul 2018
# Latest Version: 29 Jul 2018
# Latest Version: 31 Jul 2018
#
# Usage Instructions: N/A - User does not interface with this file
#
# Information: The classes/functions in this file are designed for reading and basic analysis of the sequences within FASTA-format files
from tkinter import messagebox
class FASTA_Seq():
# Has three properties:
# Meta - List of the metadata strings before the sequence strings, information within varies by FASTA standard
......@@ -152,5 +154,5 @@ def Sequence_Translate(Sequence,FrameNo=0,DesiredType='Protein'):
pass
if Sequence.CodeType == 'Indeterminable': # Error message if Sequence_Read was unable to determine if the original sequence was a Nucleotide or Protein sequence, will only happen in very rare/improbable cases
Sequence.Meta += ' ERROR, cannot translate sequence of indeterminable type' # This should be an actual error message when I learn how to do that
messagebox.showerror('Sequence Translation Error','Cannot translate sequence of indeterminable type')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment