import unittest
from should_dsl import *
from PirSequence import *

class SequenceTest(unittest.TestCase):
	def setUp(self):
		pir_sequence_test_str =""">P1;7mdh
structureX:7mdh.pdb:  23 :A:+858 :B:MOL_ID  1; MOLECULE  PROTEIN (MALATE DEHYDROGENASE); CHAIN  A,B; EC  1.1.1.82; ENGINEERED  YES; MUTATION  YES:MOL_ID  1; ORGANISM_SCIENTIFIC  SORGHUM BICOLOR; ORGANISM_COMMON  SORGHUM; ORGANISM_TAXID  4558; TISSUE  LEAF; ORGANELLE  CHLOROPLAST; EXPRESSION_SYSTEM  ESCHERICHIA COLI BL21(DE3); EXPRESSION_SYSTEM_TAXID  469008; EXPRESSION_SYSTEM_STRAIN  BL21(DE3); EXPRESSION_SYSTEM_PLASMID  PET: 2.40: 0.22
DCFGVFCTWKKLVNIAVSGAAGMISNHLLFKLASGEVFGQDQPIALKLLGSERSFQALEGVAMELEDSLYPLLRE
VSIGIDPYEVFEDVDWALLIGAKPRGPGMERAALLDINGQIFADQGKALNAVASKNVKVLVVGNPCNTNALICLK
NAPDIPAKNFHALTRLDENRAKCQLALKAGVFYDKVSNVTIWGNHSTTQVPDFLNAKIDGRPVKEVIKRTKWLEE
EFTITVQKRGGALIQKWGRSSAASTAVSIADAIKSLVTPTPEGDWFSTGVYTTGNPYGIAEDIVFSMPCRSKGDG
DYELATDVSNDDFLWERIKKSEAELLAEKKCVAHLTGEGNAYCDVPEDTMLzzzzwwwwwwwwwwwwwwwwwwww
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww/RKDCFGVFCTTYDLKSWKKLVNIAVSGAAGMIS
NHLLFKLASGEVFGQDQPIALKLLGSERSFQALEGVAMELEDSLYPLLREVSIGIDPYEVFEDVDWALLIGAKPR
GPGMERAALLDINGQIFADQGKALNAVASK-NVKVLVVGNPCNTNALICLKNAPDIPAKNFHALTRLDENRAKCQ
LALKAGVFYDKVSNVTIWGNHSTTQVPDFLNAKI--DGRPVKEV-IKRTKWLEEEFTITVQKRGGALIQKWGRSS
AASTAVSIADAIKSLVTPTPEGDWFSTGVYTT-GNPYGIAEDIVFSMPCRSKGDGDYELATDVSNDDFLWERIKK
SEAELLAEKKCVAHLTGEGNAYCDVPEDTMLPzzzzz3wwwwwwwwwwwwwwwwwwww&wwwwwwwwwwwwwwww
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww*"""
		self.__test_pir_sequence__ = PirSequence(pir_sequence_test_str)


	def test_if_show_the_number_of_chains(self):
		self.__test_pir_sequence__.number_of_chains() |should| equal_to(2)

	def test_if_show_sequence(self):
		test_sequence = """DCFGVFCTWKKLVNIAVSGAAGMISNHLLFKLASGEVFGQDQPIALKLLGSERSFQALEGVAMELEDSLYPLLRE
VSIGIDPYEVFEDVDWALLIGAKPRGPGMERAALLDINGQIFADQGKALNAVASKNVKVLVVGNPCNTNALICLK
NAPDIPAKNFHALTRLDENRAKCQLALKAGVFYDKVSNVTIWGNHSTTQVPDFLNAKIDGRPVKEVIKRTKWLEE
EFTITVQKRGGALIQKWGRSSAASTAVSIADAIKSLVTPTPEGDWFSTGVYTTGNPYGIAEDIVFSMPCRSKGDG
DYELATDVSNDDFLWERIKKSEAELLAEKKCVAHLTGEGNAYCDVPEDTMLzzzzwwwwwwwwwwwwwwwwwwww
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww/RKDCFGVFCTTYDLKSWKKLVNIAVSGAAGMIS
NHLLFKLASGEVFGQDQPIALKLLGSERSFQALEGVAMELEDSLYPLLREVSIGIDPYEVFEDVDWALLIGAKPR
GPGMERAALLDINGQIFADQGKALNAVASK-NVKVLVVGNPCNTNALICLKNAPDIPAKNFHALTRLDENRAKCQ
LALKAGVFYDKVSNVTIWGNHSTTQVPDFLNAKI--DGRPVKEV-IKRTKWLEEEFTITVQKRGGALIQKWGRSS
AASTAVSIADAIKSLVTPTPEGDWFSTGVYTT-GNPYGIAEDIVFSMPCRSKGDGDYELATDVSNDDFLWERIKK
SEAELLAEKKCVAHLTGEGNAYCDVPEDTMLPzzzzz3wwwwwwwwwwwwwwwwwwww&wwwwwwwwwwwwwwww
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww*"""

		self.__test_pir_sequence__.sequence() |should| equal_to(test_sequence)

	def test_if_show_a_choosed_chain(self):
		first_sequence = """DCFGVFCTWKKLVNIAVSGAAGMISNHLLFKLASGEVFGQDQPIALKLLGSERSFQALEGVAMELEDSLYPLLRE
VSIGIDPYEVFEDVDWALLIGAKPRGPGMERAALLDINGQIFADQGKALNAVASKNVKVLVVGNPCNTNALICLK
NAPDIPAKNFHALTRLDENRAKCQLALKAGVFYDKVSNVTIWGNHSTTQVPDFLNAKIDGRPVKEVIKRTKWLEE
EFTITVQKRGGALIQKWGRSSAASTAVSIADAIKSLVTPTPEGDWFSTGVYTTGNPYGIAEDIVFSMPCRSKGDG
DYELATDVSNDDFLWERIKKSEAELLAEKKCVAHLTGEGNAYCDVPEDTMLzzzzwwwwwwwwwwwwwwwwwwww
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww"""
		
		self.__test_pir_sequence__.chain(1) |should| equal_to(first_sequence)


	def test_if_show_last_sequence(self):
		last_sequence = """RKDCFGVFCTTYDLKSWKKLVNIAVSGAAGMIS
NHLLFKLASGEVFGQDQPIALKLLGSERSFQALEGVAMELEDSLYPLLREVSIGIDPYEVFEDVDWALLIGAKPR
GPGMERAALLDINGQIFADQGKALNAVASK-NVKVLVVGNPCNTNALICLKNAPDIPAKNFHALTRLDENRAKCQ
LALKAGVFYDKVSNVTIWGNHSTTQVPDFLNAKI--DGRPVKEV-IKRTKWLEEEFTITVQKRGGALIQKWGRSS
AASTAVSIADAIKSLVTPTPEGDWFSTGVYTT-GNPYGIAEDIVFSMPCRSKGDGDYELATDVSNDDFLWERIKK
SEAELLAEKKCVAHLTGEGNAYCDVPEDTMLPzzzzz3wwwwwwwwwwwwwwwwwwww&wwwwwwwwwwwwwwww
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww"""
			
		self.__test_pir_sequence__.chain(2) |should| equal_to(last_sequence)

	def test_if_show_heteroatoms(self):
		heteroatoms = ["z", "w"]
		self.__test_pir_sequence__.list_heteroatoms(1) |should| equal_to(heteroatoms)

	def test_if_show_heteroatoms_in_last_line_without_asterisk_with_number_and_symbol(self):
		heteroatoms = ['z', '3', 'w', '&']
		self.__test_pir_sequence__.list_heteroatoms(2) |should| equal_to(heteroatoms)

	def test_if_sequence_has_a_header(self):
		header = """>P1;7mdh
structureX:7mdh.pdb:  23 :A:+858 :B:MOL_ID  1; MOLECULE  PROTEIN (MALATE DEHYDROGENASE); CHAIN  A,B; EC  1.1.1.82; ENGINEERED  YES; MUTATION  YES:MOL_ID  1; ORGANISM_SCIENTIFIC  SORGHUM BICOLOR; ORGANISM_COMMON  SORGHUM; ORGANISM_TAXID  4558; TISSUE  LEAF; ORGANELLE  CHLOROPLAST; EXPRESSION_SYSTEM  ESCHERICHIA COLI BL21(DE3); EXPRESSION_SYSTEM_TAXID  469008; EXPRESSION_SYSTEM_STRAIN  BL21(DE3); EXPRESSION_SYSTEM_PLASMID  PET: 2.40: 0.22"""

		self.__test_pir_sequence__.header() |should| equal_to(header)

	def test_if_change_heteroatom(self):
		heteroatoms = ["z", "i"]
		self.__test_pir_sequence__.change_heteroatom(1,"w","i")
		self.__test_pir_sequence__.list_heteroatoms(1) |should| equal_to(heteroatoms)

	def test_if_change_the_sequence_when_change_heteroatom(self):
		pir_sequence_test_str ="""DCFGVFCTWKKLVNIAVSGAAGMISNHLLFKLASGEVFGQDQPIALKLLGSERSFQALEGVAMELEDSLYPLLRE
VSIGIDPYEVFEDVDWALLIGAKPRGPGMERAALLDINGQIFADQGKALNAVASKNVKVLVVGNPCNTNALICLK
NAPDIPAKNFHALTRLDENRAKCQLALKAGVFYDKVSNVTIWGNHSTTQVPDFLNAKIDGRPVKEVIKRTKWLEE
EFTITVQKRGGALIQKWGRSSAASTAVSIADAIKSLVTPTPEGDWFSTGVYTTGNPYGIAEDIVFSMPCRSKGDG
DYELATDVSNDDFLWERIKKSEAELLAEKKCVAHLTGEGNAYCDVPEDTMLzzzzwwwwwwwwwwwwwwwwwwww
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww/RKDCFGVFCTTYDLKSWKKLVNIAVSGAAGMIS
NHLLFKLASGEVFGQDQPIALKLLGSERSFQALEGVAMELEDSLYPLLREVSIGIDPYEVFEDVDWALLIGAKPR
GPGMERAALLDINGQIFADQGKALNAVASK-NVKVLVVGNPCNTNALICLKNAPDIPAKNFHALTRLDENRAKCQ
LALKAGVFYDKVSNVTIWGNHSTTQVPDFLNAKI--DGRPVKEV-IKRTKWLEEEFTITVQKRGGALIQKWGRSS
AASTAVSIADAIKSLVTPTPEGDWFSTGVYTT-GNPYGIAEDIVFSMPCRSKGDGDYELATDVSNDDFLWERIKK
SEAELLAEKKCVAHLTGEGNAYCDVPEDTMLPiiiii3wwwwwwwwwwwwwwwwwwww&wwwwwwwwwwwwwwww
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww*"""
		self.__test_pir_sequence__.change_heteroatom(2,"z","i")
		self.__test_pir_sequence__.sequence() |should| equal_to(pir_sequence_test_str)


	def test_if_show_chain_with_heteroatm_changed(self):
		chain_sequence_test = """RKDCFGVFCTTYDLKSWKKLVNIAVSGAAGMIS
NHLLFKLASGEVFGQDQPIALKLLGSERSFQALEGVAMELEDSLYPLLREVSIGIDPYEVFEDVDWALLIGAKPR
GPGMERAALLDINGQIFADQGKALNAVASK-NVKVLVVGNPCNTNALICLKNAPDIPAKNFHALTRLDENRAKCQ
LALKAGVFYDKVSNVTIWGNHSTTQVPDFLNAKI--DGRPVKEV-IKRTKWLEEEFTITVQKRGGALIQKWGRSS
AASTAVSIADAIKSLVTPTPEGDWFSTGVYTT-GNPYGIAEDIVFSMPCRSKGDGDYELATDVSNDDFLWERIKK
SEAELLAEKKCVAHLTGEGNAYCDVPEDTMLPiiiii3wwwwwwwwwwwwwwwwwwww&wwwwwwwwwwwwwwww
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww"""
		self.__test_pir_sequence__.__show_chain_with_new_heteroatoms__(2,"z","i") |should| equal_to(chain_sequence_test)

	def test_if_add_heteroatom_in_gap_in_position(self):
		pir_sequence_test_str =""">P1;7mdh
structureX:7mdh.pdb:  23 :A:+858 :B:MOL_ID  1; MOLECULE  PROTEIN (MALATE DEHYDROGENASE); CHAIN  A,B; EC  1.1.1.82; ENGINEERED  YES; MUTATION  YES:MOL_ID  1; ORGANISM_SCIENTIFIC  SORGHUM BICOLOR; ORGANISM_COMMON  SORGHUM; ORGANISM_TAXID  4558; TISSUE  LEAF; ORGANELLE  CHLOROPLAST; EXPRESSION_SYSTEM  ESCHERICHIA COLI BL21(DE3); EXPRESSION_SYSTEM_TAXID  469008; EXPRESSION_SYSTEM_STRAIN  BL21(DE3); EXPRESSION_SYSTEM_PLASMID  PET: 2.40: 0.22
DCFGVFCTWKKLVNIAVSGAAGMISNHLLFKLASGEVFGQDQPIALKLLGSERSFQALEGVAMELEDSLYPLLRE
VSIGIDPYEVFEDVDWALLIGAKPRGPGMERAALLDINGQIFADQGKALNAVASKNVKVLVVGNPCNTNALICLK
NAPDIPAKNFHALTRLDENRAKCQLALKAGVFYDKVSNVTIWGNHSTTQVPDFLNAKIDGRPVKEVIKRTKWLEE
EFTITVQKRGGALIQKWGRSSAASTAVSIADAIKSLVTPTPEGDWFSTGVYTTGNPYGIAEDIVFSMPCRSKGDG
DYELATDVSNDDFLWERIKKSEAELLAEKKCVAHLTGEGNAYCDVPEDTML----wwwwwwwwwwwwwwwwwwww
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww*"""
		pir_sequence_test_str_modified = """DCFGVFCTWKKLVNIAVSGAAGMISNHLLFKLASGEVFGQDQPIALKLLGSERSFQALEGVAMELEDSLYPLLRE
VSIGIDPYEVFEDVDWALLIGAKPRGPGMERAALLDINGQIFADQGKALNAVASKNVKVLVVGNPCNTNALICLK
NAPDIPAKNFHALTRLDENRAKCQLALKAGVFYDKVSNVTIWGNHSTTQVPDFLNAKIDGRPVKEVIKRTKWLEE
EFTITVQKRGGALIQKWGRSSAASTAVSIADAIKSLVTPTPEGDWFSTGVYTTGNPYGIAEDIVFSMPCRSKGDG
DYELATDVSNDDFLWERIKKSEAELLAEKKCVAHLTGEGNAYCDVPEDTMLh---wwwwwwwwwwwwwwwwwwww
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww*"""
		pir_sequence_test = PirSequence(pir_sequence_test_str)
		pir_sequence_test.change_het_in_position("h",360)
		pir_sequence_test.sequence() |should| equal_to(pir_sequence_test_str_modified)

	def test_if_change_heteroatom_in_position(self):
		pir_sequence_test_str =""">P1;7mdh
structureX:7mdh.pdb:  23 :A:+858 :B:MOL_ID  1; MOLECULE  PROTEIN (MALATE DEHYDROGENASE); CHAIN  A,B; EC  1.1.1.82; ENGINEERED  YES; MUTATION  YES:MOL_ID  1; ORGANISM_SCIENTIFIC  SORGHUM BICOLOR; ORGANISM_COMMON  SORGHUM; ORGANISM_TAXID  4558; TISSUE  LEAF; ORGANELLE  CHLOROPLAST; EXPRESSION_SYSTEM  ESCHERICHIA COLI BL21(DE3); EXPRESSION_SYSTEM_TAXID  469008; EXPRESSION_SYSTEM_STRAIN  BL21(DE3); EXPRESSION_SYSTEM_PLASMID  PET: 2.40: 0.22
DCFGVFCTWKKLVNIAVSGAAGMISNHLLFKLASGEVFGQDQPIALKLLGSERSFQALEGVAMELEDSLYPLLRE
VSIGIDPYEVFEDVDWALLIGAKPRGPGMERAALLDINGQIFADQGKALNAVASKNVKVLVVGNPCNTNALICLK
NAPDIPAKNFHALTRLDENRAKCQLALKAGVFYDKVSNVTIWGNHSTTQVPDFLNAKIDGRPVKEVIKRTKWLEE
EFTITVQKRGGALIQKWGRSSAASTAVSIADAIKSLVTPTPEGDWFSTGVYTTGNPYGIAEDIVFSMPCRSKGDG
DYELATDVSNDDFLWERIKKSEAELLAEKKCVAHLTGEGNAYCDVPEDTML----wwwwwwwwwwwwwwwwwwww
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww*"""
		pir_sequence_test_str_modified = """DCFGVFCTWKKLVNIAVSGAAGMISNHLLFKLASGEVFGQDQPIALKLLGSERSFQALEGVAMELEDSLYPLLRE
VSIGIDPYEVFEDVDWALLIGAKPRGPGMERAALLDINGQIFADQGKALNAVASKNVKVLVVGNPCNTNALICLK
NAPDIPAKNFHALTRLDENRAKCQLALKAGVFYDKVSNVTIWGNHSTTQVPDFLNAKIDGRPVKEVIKRTKWLEE
EFTITVQKRGGALIQKWGRSSAASTAVSIADAIKSLVTPTPEGDWFSTGVYTTGNPYGIAEDIVFSMPCRSKGDG
DYELATDVSNDDFLWERIKKSEAELLAEKKCVAHLTGEGNAYCDVPEDTML----hwwwwwwwwwwwwwwwwwww
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww*"""
		pir_sequence_test = PirSequence(pir_sequence_test_str)
		pir_sequence_test.change_het_in_position("h",364)
		pir_sequence_test.sequence() |should| equal_to(pir_sequence_test_str_modified)

	def test_if_change_heteroatom_next_to_return(self):
		pir_sequence_test_str =""">P1;7mdh
structureX:7mdh.pdb:  23 :A:+858 :B:MOL_ID  1; MOLECULE  PROTEIN (MALATE DEHYDROGENASE); CHAIN  A,B; EC  1.1.1.82; ENGINEERED  YES; MUTATION  YES:MOL_ID  1; ORGANISM_SCIENTIFIC  SORGHUM BICOLOR; ORGANISM_COMMON  SORGHUM; ORGANISM_TAXID  4558; TISSUE  LEAF; ORGANELLE  CHLOROPLAST; EXPRESSION_SYSTEM  ESCHERICHIA COLI BL21(DE3); EXPRESSION_SYSTEM_TAXID  469008; EXPRESSION_SYSTEM_STRAIN  BL21(DE3); EXPRESSION_SYSTEM_PLASMID  PET: 2.40: 0.22
DCFGVFCTWKKLVNIAVSGAAGMISNHLLFKLASGEVFGQDQPIALKLLGSERSFQALEGVAMELEDSLYPLLRE
VSIGIDPYEVFEDVDWALLIGAKPRGPGMERAALLDINGQIFADQGKALNAVASKNVKVLVVGNPCNTNALICLK
NAPDIPAKNFHALTRLDENRAKCQLALKAGVFYDKVSNVTIWGNHSTTQVPDFLNAKIDGRPVKEVIKRTKWLEE
EFTITVQKRGGALIQKWGRSSAASTAVSIADAIKSLVTPTPEGDWFSTGVYTTGNPYGIAEDIVFSMPCRSKGDG
DYELATDVSNDDFLWERIKKSEAELLAEKKCVAHLTGEGNAYCDVPEDTML----wwwwwwwwwwwwwwwwwwww
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww*"""
		pir_sequence_test_str_modified = """DCFGVFCTWKKLVNIAVSGAAGMISNHLLFKLASGEVFGQDQPIALKLLGSERSFQALEGVAMELEDSLYPLLRE
VSIGIDPYEVFEDVDWALLIGAKPRGPGMERAALLDINGQIFADQGKALNAVASKNVKVLVVGNPCNTNALICLK
NAPDIPAKNFHALTRLDENRAKCQLALKAGVFYDKVSNVTIWGNHSTTQVPDFLNAKIDGRPVKEVIKRTKWLEE
EFTITVQKRGGALIQKWGRSSAASTAVSIADAIKSLVTPTPEGDWFSTGVYTTGNPYGIAEDIVFSMPCRSKGDG
DYELATDVSNDDFLWERIKKSEAELLAEKKCVAHLTGEGNAYCDVPEDTML----wwwwwwwwwwwwwwwwwwwh
hwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww*"""
		pir_sequence_test = PirSequence(pir_sequence_test_str)
		pir_sequence_test.change_het_in_position("h",384)
		pir_sequence_test.change_het_in_position("h",386)
		pir_sequence_test.sequence() |should| equal_to(pir_sequence_test_str_modified)

	def test_if_change_heteroatom_after_to_return(self):
		pir_sequence_test_str =""">P1;7mdh
structureX:7mdh.pdb:  23 :A:+858 :B:MOL_ID  1; MOLECULE  PROTEIN (MALATE DEHYDROGENASE); CHAIN  A,B; EC  1.1.1.82; ENGINEERED  YES; MUTATION  YES:MOL_ID  1; ORGANISM_SCIENTIFIC  SORGHUM BICOLOR; ORGANISM_COMMON  SORGHUM; ORGANISM_TAXID  4558; TISSUE  LEAF; ORGANELLE  CHLOROPLAST; EXPRESSION_SYSTEM  ESCHERICHIA COLI BL21(DE3); EXPRESSION_SYSTEM_TAXID  469008; EXPRESSION_SYSTEM_STRAIN  BL21(DE3); EXPRESSION_SYSTEM_PLASMID  PET: 2.40: 0.22
DCFGVFCTWKKLVNIAVSGAAGMISNHLLFKLASGEVFGQDQPIALKLLGSERSFQALEGVAMELEDSLYPLLRE
VSIGIDPYEVFEDVDWALLIGAKPRGPGMERAALLDINGQIFADQGKALNAVASKNVKVLVVGNPCNTNALICLK
NAPDIPAKNFHALTRLDENRAKCQLALKAGVFYDKVSNVTIWGNHSTTQVPDFLNAKIDGRPVKEVIKRTKWLEE
EFTITVQKRGGALIQKWGRSSAASTAVSIADAIKSLVTPTPEGDWFSTGVYTTGNPYGIAEDIVFSMPCRSKGDG
DYELATDVSNDDFLWERIKKSEAELLAEKKCVAHLTGEGNAYCDVPEDTML----wwwwwwwwwwwwwwwwwwww
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww*"""
		pir_sequence_test_str_modified = """DCFGVFCTWKKLVNIAVSGAAGMISNHLLFKLASGEVFGQDQPIALKLLGSERSFQALEGVAMELEDSLYPLLRE
VSIGIDPYEVFEDVDWALLIGAKPRGPGMERAALLDINGQIFADQGKALNAVASKNVKVLVVGNPCNTNALICLK
NAPDIPAKNFHALTRLDENRAKCQLALKAGVFYDKVSNVTIWGNHSTTQVPDFLNAKIDGRPVKEVIKRTKWLEE
EFTITVQKRGGALIQKWGRSSAASTAVSIADAIKSLVTPTPEGDWFSTGVYTTGNPYGIAEDIVFSMPCRSKGDG
DYELATDVSNDDFLWERIKKSEAELLAEKKCVAHLTGEGNAYCDVPEDTML----wwwwwwwwwwwwwwwwwwww
hwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww*"""
		pir_sequence_test = PirSequence(pir_sequence_test_str)
		pir_sequence_test.change_het_in_position("h",386)
		pir_sequence_test.sequence() |should| equal_to(pir_sequence_test_str_modified)


	def test_if_not_try_change_heteroatom_in_residue(self):
		pir_sequence_test_str =""">P1;7mdh
structureX:7mdh.pdb:  23 :A:+858 :B:MOL_ID  1; MOLECULE  PROTEIN (MALATE DEHYDROGENASE); CHAIN  A,B; EC  1.1.1.82; ENGINEERED  YES; MUTATION  YES:MOL_ID  1; ORGANISM_SCIENTIFIC  SORGHUM BICOLOR; ORGANISM_COMMON  SORGHUM; ORGANISM_TAXID  4558; TISSUE  LEAF; ORGANELLE  CHLOROPLAST; EXPRESSION_SYSTEM  ESCHERICHIA COLI BL21(DE3); EXPRESSION_SYSTEM_TAXID  469008; EXPRESSION_SYSTEM_STRAIN  BL21(DE3); EXPRESSION_SYSTEM_PLASMID  PET: 2.40: 0.22
DCFGVFCTWKKLVNIAVSGAAGMISNHLLFKLASGEVFGQDQPIALKLLGSERSFQALEGVAMELEDSLYPLLRE
VSIGIDPYEVFEDVDWALLIGAKPRGPGMERAALLDINGQIFADQGKALNAVASKNVKVLVVGNPCNTNALICLK
NAPDIPAKNFHALTRLDENRAKCQLALKAGVFYDKVSNVTIWGNHSTTQVPDFLNAKIDGRPVKEVIKRTKWLEE
EFTITVQKRGGALIQKWGRSSAASTAVSIADAIKSLVTPTPEGDWFSTGVYTTGNPYGIAEDIVFSMPCRSKGDG
DYELATDVSNDDFLWERIKKSEAELLAEKKCVAHLTGEGNAYCDVPEDTML----wwwwwwwwwwwwwwwwwwww
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww*"""
		pir_sequence_test_str_modified = """DCFGVFCTWKKLVNIAVSGAAGMISNHLLFKLASGEVFGQDQPIALKLLGSERSFQALEGVAMELEDSLYPLLRE
VSIGIDPYEVFEDVDWALLIGAKPRGPGMERAALLDINGQIFADQGKALNAVASKNVKVLVVGNPCNTNALICLK
NAPDIPAKNFHALTRLDENRAKCQLALKAGVFYDKVSNVTIWGNHSTTQVPDFLNAKIDGRPVKEVIKRTKWLEE
EFTITVQKRGGALIQKWGRSSAASTAVSIADAIKSLVTPTPEGDWFSTGVYTTGNPYGIAEDIVFSMPCRSKGDG
DYELATDVSNDDFLWERIKKSEAELLAEKKCVAHLTGEGNAYCDVPhDTML----wwwwwwwwwwwwwwwwwwww
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww*"""
		pir_sequence_test = PirSequence(pir_sequence_test_str)
		pir_sequence_test.change_het_in_position("h",355)
		pir_sequence_test.sequence() |should| equal_to(pir_sequence_test_str_modified)


	def test_if_change_heteroatom_that_is_a_symbol(self):
		pir_sequence_test_str =""">P1;7mdh
structureX:7mdh.pdb:  23 :A:+858 :B:MOL_ID  1; MOLECULE  PROTEIN (MALATE DEHYDROGENASE); CHAIN  A,B; EC  1.1.1.82; ENGINEERED  YES; MUTATION  YES:MOL_ID  1; ORGANISM_SCIENTIFIC  SORGHUM BICOLOR; ORGANISM_COMMON  SORGHUM; ORGANISM_TAXID  4558; TISSUE  LEAF; ORGANELLE  CHLOROPLAST; EXPRESSION_SYSTEM  ESCHERICHIA COLI BL21(DE3); EXPRESSION_SYSTEM_TAXID  469008; EXPRESSION_SYSTEM_STRAIN  BL21(DE3); EXPRESSION_SYSTEM_PLASMID  PET: 2.40: 0.22
DCFGVFCTWKKLVNIAVSGAAGMISNHLLFKLASGEVFGQDQPIALKLLGSERSFQALEGVAMELEDSLYPLLRE
VSIGIDPYEVFEDVDWALLIGAKPRGPGMERAALLDINGQIFADQGKALNAVASKNVKVLVVGNPCNTNALICLK
NAPDIPAKNFHALTRLDENRAKCQLALKAGVFYDKVSNVTIWGNHSTTQVPDFLNAKIDGRPVKEVIKRTKWLEE
EFTITVQKRGGALIQKWGRSSAASTAVSIADAIKSLVTPTPEGDWFSTGVYTTGNPYGIAEDIVFSMPCRSKGDG
DYELATDVSNDDFLWERIKKSEAELLAEKKCVAHLTGEGNAYCDVPEDTML----wwwwwwwwwwwwwwwwwwww
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww*"""
		pir_sequence_test_str_modified = """DCFGVFCTWKKLVNIAVSGAAGMISNHLLFKLASGEVFGQDQPIALKLLGSERSFQALEGVAMELEDSLYPLLRE
VSIGIDPYEVFEDVDWALLIGAKPRGPGMERAALLDINGQIFADQGKALNAVASKNVKVLVVGNPCNTNALICLK
NAPDIPAKNFHALTRLDENRAKCQLALKAGVFYDKVSNVTIWGNHSTTQVPDFLNAKIDGRPVKEVIKRTKWLEE
EFTITVQKRGGALIQKWGRSSAASTAVSIADAIKSLVTPTPEGDWFSTGVYTTGNPYGIAEDIVFSMPCRSKGDG
DYELATDVSNDDFLWERIKKSEAELLAEKKCVAHLTGEGNAYCDVP$DTML----wwwwwwwwwwwwwwwwwwww
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww*"""
		pir_sequence_test = PirSequence(pir_sequence_test_str)
		pir_sequence_test.change_het_in_position("$",355)
		pir_sequence_test.sequence() |should| equal_to(pir_sequence_test_str_modified)

	def test_if_change_heteroatom_that_is_a_symbol(self):
		pir_sequence_test_str =""">P1;7mdh
structureX:7mdh.pdb:  23 :A:+858 :B:MOL_ID  1; MOLECULE  PROTEIN (MALATE DEHYDROGENASE); CHAIN  A,B; EC  1.1.1.82; ENGINEERED  YES; MUTATION  YES:MOL_ID  1; ORGANISM_SCIENTIFIC  SORGHUM BICOLOR; ORGANISM_COMMON  SORGHUM; ORGANISM_TAXID  4558; TISSUE  LEAF; ORGANELLE  CHLOROPLAST; EXPRESSION_SYSTEM  ESCHERICHIA COLI BL21(DE3); EXPRESSION_SYSTEM_TAXID  469008; EXPRESSION_SYSTEM_STRAIN  BL21(DE3); EXPRESSION_SYSTEM_PLASMID  PET: 2.40: 0.22
DCFGVFCTWKKLVNIAVSGAAGMISNHLLFKLASGEVFGQDQPIALKLLGSERSFQALEGVAMELEDSLYPLLRE
VSIGIDPYEVFEDVDWALLIGAKPRGPGMERAALLDINGQIFADQGKALNAVASKNVKVLVVGNPCNTNALICLK
NAPDIPAKNFHALTRLDENRAKCQLALKAGVFYDKVSNVTIWGNHSTTQVPDFLNAKIDGRPVKEVIKRTKWLEE
EFTITVQKRGGALIQKWGRSSAASTAVSIADAIKSLVTPTPEGDWFSTGVYTTGNPYGIAEDIVFSMPCRSKGDG
DYELATDVSNDDFLWERIKKSEAELLAEKKCVAHLTGEGNAYCDVPEDTML----wwwwwwwwwwwwwwwwwwww
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww*"""
		pir_sequence_test_str_modified = """DCFGVFCTWKKLVNIAVSGAAGMISNHLLFKLASGEVFGQDQPIALKLLGSERSFQALEGVAMELEDSLYPLLRE
VSIGIDPYEVFEDVDWALLIGAKPRGPGMERAALLDINGQIFADQGKALNAVASKNVKVLVVGNPCNTNALICLK
NAPDIPAKNFHALTRLDENRAKCQLALKAGVFYDKVSNVTIWGNHSTTQVPDFLNAKIDGRPVKEVIKRTKWLEE
EFTITVQKRGGALIQKWGRSSAASTAVSIADAIKSLVTPTPEGDWFSTGVYTTGNPYGIAEDIVFSMPCRSKGDG
DYELATDVSNDDFLWERIKKSEAELLAEKKCVAHLTGEGNAYCDVP$DTML----wwwwwwwwwwwwwwwwwwww
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww*"""
		pir_sequence_test = PirSequence(pir_sequence_test_str)
		pir_sequence_test.change_het_in_position("$",355)
		pir_sequence_test.sequence() |should| equal_to(pir_sequence_test_str_modified)

	def test_if_change_heteroatom_that_was_a_symbol(self):
		pir_sequence_test_str =""">P1;7mdh
structureX:7mdh.pdb:  23 :A:+858 :B:MOL_ID  1; MOLECULE  PROTEIN (MALATE DEHYDROGENASE); CHAIN  A,B; EC  1.1.1.82; ENGINEERED  YES; MUTATION  YES:MOL_ID  1; ORGANISM_SCIENTIFIC  SORGHUM BICOLOR; ORGANISM_COMMON  SORGHUM; ORGANISM_TAXID  4558; TISSUE  LEAF; ORGANELLE  CHLOROPLAST; EXPRESSION_SYSTEM  ESCHERICHIA COLI BL21(DE3); EXPRESSION_SYSTEM_TAXID  469008; EXPRESSION_SYSTEM_STRAIN  BL21(DE3); EXPRESSION_SYSTEM_PLASMID  PET: 2.40: 0.22
DCFGVFCTWKKLVNIAVSGAAGMISNHLLFKLASGEVFGQDQPIALKLLGSERSFQALEGVAMELEDSLYPLLRE
VSIGIDPYEVFEDVDWALLIGAKPRGPGMERAALLDINGQIFADQGKALNAVASKNVKVLVVGNPCNTNALICLK
NAPDIPAKNFHALTRLDENRAKCQLALKAGVFYDKVSNVTIWGNHSTTQVPDFLNAKIDGRPVKEVIKRTKWLEE
EFTITVQKRGGALIQKWGRSSAASTAVSIADAIKSLVTPTPEGDWFSTGVYTTGNPYGIAEDIVFSMPCRSKGDG
DYELATDVSNDDFLWERIKKSEAELLAEKKCVAHLTGEGNAYCDVP#DTML----wwwwwwwwwwwwwwwwwwww
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww*"""
		pir_sequence_test_str_modified = """DCFGVFCTWKKLVNIAVSGAAGMISNHLLFKLASGEVFGQDQPIALKLLGSERSFQALEGVAMELEDSLYPLLRE
VSIGIDPYEVFEDVDWALLIGAKPRGPGMERAALLDINGQIFADQGKALNAVASKNVKVLVVGNPCNTNALICLK
NAPDIPAKNFHALTRLDENRAKCQLALKAGVFYDKVSNVTIWGNHSTTQVPDFLNAKIDGRPVKEVIKRTKWLEE
EFTITVQKRGGALIQKWGRSSAASTAVSIADAIKSLVTPTPEGDWFSTGVYTTGNPYGIAEDIVFSMPCRSKGDG
DYELATDVSNDDFLWERIKKSEAELLAEKKCVAHLTGEGNAYCDVPwDTML----wwwwwwwwwwwwwwwwwwww
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww*"""
		pir_sequence_test = PirSequence(pir_sequence_test_str)
		pir_sequence_test.change_het_in_position("w",355)
		pir_sequence_test.sequence() |should| equal_to(pir_sequence_test_str_modified)

if __name__ == '__main__':
	unittest.main()
