view commons/tools/tests/Test_F_GFF3Maker.py @ 31:0ab839023fe4

Uploaded
author m-zytnicki
date Tue, 30 Apr 2013 14:33:21 -0400
parents 94ab73e8a190
children
line wrap: on
line source

import unittest
import os
from commons.core.utils.FileUtils import FileUtils
from commons.core.sql.DbMySql import DbMySql
from commons.tools.GFF3Maker import GFF3Maker

class Test_F_GFF3Maker(unittest.TestCase):

    def setUp(self):
        self._projectName = "projectName"
        self._iDb = DbMySql()
        self._tablesFileName = "annotation_tables.txt"
        self._fastaFileName = "%s_chr.fa" % self._projectName
        self._fastaTableName = "%s_chr_seq" % self._projectName
        self._writeFastaFile(self._fastaFileName)
        self._iDb.createTable(self._fastaTableName, "seq", self._fastaFileName, True)
        self._inputFileName = "%s_chr_allTEs_nr_noSSR_join.pathOrSet" % self._projectName
        self._expGFFFileName = "explm_SuperContig_29_v2.gff3"
        self._obsGFFFileName = "lm_SuperContig_29_v2.gff3"
        self._obsGFFEmptyFileName = "lm_SuperContig_30_v2.gff3"
        
    def tearDown(self):
        self._iDb.dropTable(self._fastaTableName)
        self._iDb.dropTable(self._inputTableName)
        self._iDb.close()
        os.remove(self._obsGFFFileName)
        os.remove(self._expGFFFileName)
        os.remove(self._fastaFileName)
        os.remove(self._tablesFileName)
        os.remove(self._inputFileName)
        
    def test_run_as_script_path_with_seq_withAllFiles(self):
        self._writeTablesFile("path")
        self._writePathFile(self._inputFileName)
        self._inputTableName = "%s_chr_allTEs_nr_noSSR_join_path" % self._projectName
        self._iDb.createTable(self._inputTableName, "path", self._inputFileName, True)
        self._writeExpPathGFFFile(self._expGFFFileName)
        expGFFEmptyFileName = "explm_SuperContig_30_v2.gff3"
        self._writeExpEmptyPathGFFFileWithSeq(expGFFEmptyFileName)
        
        cmd = "GFF3Maker.py -t %s -f %s -w -a -p"% (self._tablesFileName, self._fastaTableName) 
        os.system(cmd)
        
        self.assertTrue(FileUtils.are2FilesIdentical(self._expGFFFileName, self._obsGFFFileName))
        self.assertTrue(FileUtils.are2FilesIdentical(expGFFEmptyFileName, self._obsGFFEmptyFileName))
        
        os.remove(expGFFEmptyFileName)
        os.remove(self._obsGFFEmptyFileName)
       
    def test_run_as_script_path_without_seq_withAllFiles(self):
        self._writeTablesFile("path")
        self._writePathFile(self._inputFileName)
        self._inputTableName = "%s_chr_allTEs_nr_noSSR_join_path" % self._projectName
        self._iDb.createTable(self._inputTableName, "path", self._inputFileName, True)
        self._writeExpPathGFFFile_without_seq(self._expGFFFileName)
        expGFFEmptyFileName = "explm_SuperContig_30_v2.gff3"
        self._writeExpEmptyPathGFFFile(expGFFEmptyFileName)
        
        cmd = "GFF3Maker.py -t %s -f %s -a -p" % (self._tablesFileName, self._fastaTableName)
        os.system(cmd)
        
        self.assertTrue(FileUtils.are2FilesIdentical(self._expGFFFileName, self._obsGFFFileName))
        self.assertTrue(FileUtils.are2FilesIdentical(expGFFEmptyFileName, self._obsGFFEmptyFileName))
        
        os.remove(expGFFEmptyFileName)
        os.remove(self._obsGFFEmptyFileName)
   
    def test_run_without_seq(self):
        self._writeTablesFile("path")
        self._writePathFile(self._inputFileName)
        self._inputTableName = "%s_chr_allTEs_nr_noSSR_join_path" % self._projectName
        self._iDb.createTable(self._inputTableName, "path", self._inputFileName, True)
        self._writeExpPathGFFFile_without_seq(self._expGFFFileName)
        
        iGFF3Maker = GFF3Maker()
        iGFF3Maker.setTablesFileName(self._tablesFileName)
        iGFF3Maker.setInFastaName(self._fastaTableName)
        iGFF3Maker.setAreMatchPartCompulsory(True)
        iGFF3Maker.run()
        
        self.assertTrue(FileUtils.are2FilesIdentical(self._expGFFFileName, self._obsGFFFileName))
        self.assertFalse(FileUtils.isRessourceExists(self._obsGFFEmptyFileName))
   
    def test_run_without_seq_and_match_part_not_compulsory(self):
        self._writeTablesFile("path")
        self._writePathFile(self._inputFileName)
        self._inputTableName = "%s_chr_allTEs_nr_noSSR_join_path" % self._projectName
        self._iDb.createTable(self._inputTableName, "path", self._inputFileName, True)
        self._writeExpPathGFFFile_without_seq_and_match_part_not_comulsory(self._expGFFFileName)
        
        iGFF3Maker = GFF3Maker()
        iGFF3Maker.setTablesFileName(self._tablesFileName)
        iGFF3Maker.setInFastaName(self._fastaTableName)
        iGFF3Maker.run()
        
        self.assertTrue(FileUtils.are2FilesIdentical(self._expGFFFileName, self._obsGFFFileName))
        self.assertFalse(FileUtils.isRessourceExists(self._obsGFFEmptyFileName))

    def test_run_as_script_pathReversed(self):
        self._writeTablesFile("path")
        self._writePathFileReverse(self._inputFileName)
        self._inputTableName = "%s_chr_allTEs_nr_noSSR_join_path" % self._projectName
        self._iDb.createTable(self._inputTableName, "path", self._inputFileName, True)
        self._writeExpPathGFFFileReversed(self._expGFFFileName)
        
        cmd = "GFF3Maker.py -t %s -f %s -w -p" % (self._tablesFileName, self._fastaTableName)
        os.system(cmd)
        
        self.assertTrue(FileUtils.are2FilesIdentical(self._expGFFFileName, self._obsGFFFileName))
        self.assertFalse(FileUtils.isRessourceExists(self._obsGFFEmptyFileName))
      
    def test_run_as_script_set(self):
        self._writeTablesFile("set")
        self._writeSetFile(self._inputFileName)
        self._inputTableName = "%s_chr_allTEs_nr_noSSR_join_set" % self._projectName
        self._iDb.createTable(self._inputTableName, "set", self._inputFileName, True)
        self._writeExpSetGFFFile(self._expGFFFileName)
        
        cmd = "GFF3Maker.py -t %s -f %s -w -p " % (self._tablesFileName, self._fastaTableName)
        os.system(cmd)
        
        self.assertTrue(FileUtils.are2FilesIdentical(self._expGFFFileName, self._obsGFFFileName))
        self.assertFalse(FileUtils.isRessourceExists(self._obsGFFEmptyFileName))
        
    def test_run_as_script_setReversed(self):
        self._writeTablesFile("set")
        self._writeSetFileReverse(self._inputFileName)
        self._inputTableName = "%s_chr_allTEs_nr_noSSR_join_set" % self._projectName
        self._iDb.createTable(self._inputTableName, "set", self._inputFileName, True)
        self._writeExpSetGFFFileReversed(self._expGFFFileName)
        
        cmd = "GFF3Maker.py -t %s -f %s -w -p " % (self._tablesFileName, self._fastaTableName)
        os.system(cmd)
        
        self.assertTrue(FileUtils.are2FilesIdentical(self._expGFFFileName, self._obsGFFFileName))
        self.assertFalse(FileUtils.isRessourceExists(self._obsGFFEmptyFileName))
       
    def test_run_as_script_path_without_seq_withAllFilesWithClassif_headers_TEdenovo_step6_and_step8(self):
        self._writeTablesFile("path")
        self._writePathFile_withClassif(self._inputFileName)
        self._inputTableName = "%s_chr_allTEs_nr_noSSR_join_path" % self._projectName
        self._iDb.createTable(self._inputTableName, "path", self._inputFileName, True)
        
        self._writeClassifFile("input.classif")
        inputClassifTableName = "%s_classif" % self._projectName
        self._iDb.createTable(inputClassifTableName, "classif", "input.classif", True)
        
        self._expGFFFileName = "explm_SuperContig_30_v2.gff3"
        self._obsGFFFileName = "lm_SuperContig_30_v2.gff3"
        self._writeExpPathGFFFile_without_seq_withClassif(self._expGFFFileName)
        
        cmd = "GFF3Maker.py -t %s -f %s -i %s -p" % (self._tablesFileName, self._fastaTableName, inputClassifTableName)
        os.system(cmd)
        
        self.assertTrue(FileUtils.are2FilesIdentical(self._expGFFFileName, self._obsGFFFileName))
        
        os.remove("input.classif")
        os.remove("lm_SuperContig_29_v2.gff3")
        self._iDb.dropTable(inputClassifTableName)

    def test_run_as_script_path_without_seq_withAllFilesWithTargetLength(self):
        fastaFileName = "genome.fa"
        self._writeFastaFileExtended(fastaFileName)
        self._iDb.createTable(self._fastaTableName, "seq", fastaFileName, True)
        os.remove(fastaFileName)
        
        self._writeTablesFile_withTESeqTables("path")
        
        self._writePathFile(self._inputFileName)
        self._inputTableName = "%s_chr_allTEs_nr_noSSR_join_path" % self._projectName
        self._iDb.createTable(self._inputTableName, "path", self._inputFileName, True)
        
        inFileName2 = "%s_chr_bankBLRtx.path" % self._projectName
        self._writePathFile2(inFileName2)
        bankPathTableName = "%s_chr_bankBLRtx_path" % self._projectName
        self._iDb.createTable(bankPathTableName, "path", inFileName2, True)
        os.remove(inFileName2)
        
        refTEsFastaFileName = "%s_refTEs.fa" % self._projectName
        self._writeRefTEsSeqFile(refTEsFastaFileName)
        refTESeqTableName = "%s_refTEs_seq" % self._projectName
        self._iDb.createTable(refTESeqTableName, "seq", refTEsFastaFileName, True) 
        os.remove(refTEsFastaFileName)     
          
        bankBLRtxFastaFileName = "dummyRepbase.fa"
        self._writeBankBLRtxSeqFile(bankBLRtxFastaFileName)
        bankBLRtxTableName = "%s_bankBLRtx_nt_seq" % self._projectName
        self._iDb.createTable(bankBLRtxTableName, "seq", bankBLRtxFastaFileName, True)
        os.remove(bankBLRtxFastaFileName)
        
        self._expGFFFileName = "explm_SuperContig_29_v2.gff3"
        expSeq2GFFFileName = "expChr1.gff3"
        self._obsGFFFileName = "lm_SuperContig_29_v2.gff3"
        obsSeq2GFFFileName = "chr1.gff3"
        self._writeExpPathGFFFile_without_seq_withTargetLength_seq1(self._expGFFFileName)
        self._writeExpPathGFFFile_without_seq_withTargetLength_seq2(expSeq2GFFFileName)
        
        cmd = "GFF3Maker.py -t %s -f %s -p" % (self._tablesFileName, self._fastaTableName)
        os.system(cmd)
        
        self.assertTrue(FileUtils.are2FilesIdentical(self._expGFFFileName, self._obsGFFFileName))
        self.assertTrue(FileUtils.are2FilesIdentical(expSeq2GFFFileName, obsSeq2GFFFileName))
        
        os.remove(expSeq2GFFFileName)
        os.remove(obsSeq2GFFFileName)
        self._iDb.dropTable(refTESeqTableName)
        self._iDb.dropTable(bankBLRtxTableName)
        self._iDb.dropTable(bankPathTableName)
        
    def test_run_as_script_split_file_by_annotation_method(self):
        fastaFileName = "dummyDmelChr4.fa"
        self._writeFastaFile_DmelChr4(fastaFileName)
        self._iDb.createTable(self._fastaTableName, "seq", fastaFileName, True)
        os.remove(fastaFileName)
        
        self._writeTablesFile_withTESeqTables("path")
        
        self._writePathFile_refTEs_annotation(self._inputFileName)
        self._inputTableName = "%s_chr_allTEs_nr_noSSR_join_path" % self._projectName
        self._iDb.createTable(self._inputTableName, "path", self._inputFileName, True)
        
        inFileName2 = "%s_chr_bankBLRtx.path" % self._projectName
        self._writePathFile_bankBLRtx_annotation(inFileName2)
        bankPathTableName = "%s_chr_bankBLRtx_path" % self._projectName
        self._iDb.createTable(bankPathTableName, "path", inFileName2, True)
        os.remove(inFileName2)
        
        refTEsFastaFileName = "%s_refTEs.fa" % self._projectName
        self._writeRefTEsSeqFile(refTEsFastaFileName)
        refTESeqTableName = "%s_refTEs_seq" % self._projectName
        self._iDb.createTable(refTESeqTableName, "seq", refTEsFastaFileName, True) 
        os.remove(refTEsFastaFileName)     
          
        bankBLRtxFastaFileName = "dummyRepbase.fa"
        self._writeBankBLRtxSeqFile(bankBLRtxFastaFileName)
        bankBLRtxTableName = "%s_bankBLRtx_nt_seq" % self._projectName
        self._iDb.createTable(bankBLRtxTableName, "seq", bankBLRtxFastaFileName, True)
        os.remove(bankBLRtxFastaFileName)
        
        self._expGFFFileName = "expdmel_chr4_Annot1.gff3"
        expGFFFileName2 = "expdmel_chr1_Annot1.gff3"
        expGFFFileName3 = "expdmel_chr4_Annot2.gff3"
        self._obsGFFFileName = "dmel_chr4_Annot1.gff3"
        obsGFFFileName2 = "dmel_chr1_Annot1.gff3"
        obsGFFFileName3 = "dmel_chr4_Annot2.gff3"
        self._writeExpPathGFFFile_split_file1(self._expGFFFileName)
        self._writeExpPathGFFFile_split_file2(expGFFFileName2)
        self._writeExpPathGFFFile_split_file3(expGFFFileName3)
        
        cmd = "GFF3Maker.py -t %s -f %s -s -p" % (self._tablesFileName, self._fastaTableName)
        os.system(cmd)
        
        self.assertTrue(FileUtils.are2FilesIdentical(self._expGFFFileName, self._obsGFFFileName))
        self.assertTrue(FileUtils.are2FilesIdentical(expGFFFileName2, obsGFFFileName2))
        self.assertTrue(FileUtils.are2FilesIdentical(expGFFFileName3, obsGFFFileName3))
        
        os.remove(expGFFFileName2)
        os.remove(expGFFFileName3)
        os.remove(obsGFFFileName2)
        os.remove(obsGFFFileName3)
        self._iDb.dropTable(refTESeqTableName)
        self._iDb.dropTable(bankBLRtxTableName)
        self._iDb.dropTable(bankPathTableName)
        
    def test_run_path_without_seq_withAllFilesWithClassif_headers_TEdenovo_step6_and_step8_withIdenticalMatches(self):
        self._writeTablesFile("path")
        self._writePathFile_withClassif_withIdenticalMatches(self._inputFileName)
        self._inputTableName = "%s_chr_allTEs_nr_noSSR_join_path" % self._projectName
        self._iDb.createTable(self._inputTableName, "path", self._inputFileName, True)
        
        self._writeClassifFile("input.classif")
        inputClassifTableName = "%s_classif" % self._projectName
        self._iDb.createTable(inputClassifTableName, "classif", "input.classif", True)
        
        self._expGFFFileName = "explm_SuperContig_30_v2.gff3"
        self._obsGFFFileName = "lm_SuperContig_30_v2.gff3"
        self._writeExpPathGFFFile_without_seq_withClassif_withIdenticalMatches(self._expGFFFileName)
        
        iGFF3Maker = GFF3Maker()
        iGFF3Maker.setTablesFileName(self._tablesFileName)
        iGFF3Maker.setInFastaName(self._fastaTableName)
        iGFF3Maker.setClassifTable(inputClassifTableName)
        iGFF3Maker.setDoMergeIdenticalMatches(True)
        iGFF3Maker.setAreMatchPartCompulsory(True)
        iGFF3Maker.run()
        
        self.assertTrue(FileUtils.are2FilesIdentical(self._expGFFFileName, self._obsGFFFileName))
        
        os.remove("input.classif")
        os.remove("lm_SuperContig_29_v2.gff3")
        self._iDb.dropTable(inputClassifTableName) 
        
    def test_run_as_script_path_without_seq_withAllFilesWithClassif_headers_TEdenovo_step6_and_step8_withIdenticalMatches(self):
        self._writeTablesFile("path")
        self._writePathFile_withClassif_withIdenticalMatches(self._inputFileName)
        self._inputTableName = "%s_chr_allTEs_nr_noSSR_join_path" % self._projectName
        self._iDb.createTable(self._inputTableName, "path", self._inputFileName, True)
        
        self._writeClassifFile("input.classif")
        inputClassifTableName = "%s_classif" % self._projectName
        self._iDb.createTable(inputClassifTableName, "classif", "input.classif", True)
        
        self._expGFFFileName = "explm_SuperContig_30_v2.gff3"
        self._obsGFFFileName = "lm_SuperContig_30_v2.gff3"
        self._writeExpPathGFFFile_without_seq_withClassif_withIdenticalMatches(self._expGFFFileName)
        
        cmd = "GFF3Maker.py -t %s -f %s -i %s -m -p" % (self._tablesFileName, self._fastaTableName, inputClassifTableName)
        os.system(cmd)
        
        self.assertTrue(FileUtils.are2FilesIdentical(self._expGFFFileName, self._obsGFFFileName))
        
        os.remove("input.classif")
        os.remove("lm_SuperContig_29_v2.gff3")
        self._iDb.dropTable(inputClassifTableName)
        
    def _writeRefTEsSeqFile(self, inFileName):
        with open(inFileName, "w") as f:
            f.write(">DTX-incomp_DmelChr4-L-B1-Map3\n")
            f.write("ATCGATCGTT\n")
            f.write(">DTX-incomp_DmelChr4-B-P0.0-Map3\n")
            f.write("GCTAGCTA\n")
        
    def _writeBankBLRtxSeqFile(self, inFileName):
        with open(inFileName, "w") as f:
            f.write(">PROTOP_B:classII:TIR\n")
            f.write("ATCGATCGTT\n")
            f.write(">DMRT1C:classI:?\n")
            f.write("GCTAGCTA\n")
            f.write(">BATUMI_I:classI:LTR_retrotransposon\n")
            f.write("GCTAATGGCATA\n")
            
    def _writeExpPathGFFFile_without_seq_withTargetLength_seq1(self, inFileName):
        with open(inFileName, "w") as f:
            f.write("##gff-version 3\n")
            f.write("##sequence-region lm_SuperContig_29_v2 1 120\n")
            f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch\t193781\t194212\t0.0\t-\t.\tID=ms1_lm_SuperContig_29_v2_DTX-incomp_DmelChr4-L-B1-Map3;Target=DTX-incomp_DmelChr4-L-B1-Map3 85 228;TargetLength=10;Identity=30.56\n")
            f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch_part\t193781\t194212\t1e-40\t-\t.\tID=mp1-1_lm_SuperContig_29_v2_DTX-incomp_DmelChr4-L-B1-Map3;Parent=ms1_lm_SuperContig_29_v2_DTX-incomp_DmelChr4-L-B1-Map3;Target=DTX-incomp_DmelChr4-L-B1-Map3 85 228;Identity=30.56\n")
            f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch\t192832\t193704\t0.0\t-\t.\tID=ms2_lm_SuperContig_29_v2_DTX-incomp_DmelChr4-L-B1-Map3;Target=DTX-incomp_DmelChr4-L-B1-Map3 229 522;TargetLength=10;Identity=23.99\n")
            f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch_part\t192832\t193704\t1e-40\t-\t.\tID=mp2-1_lm_SuperContig_29_v2_DTX-incomp_DmelChr4-L-B1-Map3;Parent=ms2_lm_SuperContig_29_v2_DTX-incomp_DmelChr4-L-B1-Map3;Target=DTX-incomp_DmelChr4-L-B1-Map3 229 522;Identity=23.99\n")
            f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch\t78031\t78588\t0.0\t+\t.\tID=ms3_lm_SuperContig_29_v2_DTX-incomp_DmelChr4-B-P0.0-Map3;Target=DTX-incomp_DmelChr4-B-P0.0-Map3 19 209;TargetLength=8\n")
            f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch_part\t78031\t78080\t3e-21\t+\t.\tID=mp3-1_lm_SuperContig_29_v2_DTX-incomp_DmelChr4-B-P0.0-Map3;Parent=ms3_lm_SuperContig_29_v2_DTX-incomp_DmelChr4-B-P0.0-Map3;Target=DTX-incomp_DmelChr4-B-P0.0-Map3 19 209;Identity=30.89\n")
            f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch_part\t78081\t78588\t3e-21\t+\t.\tID=mp3-2_lm_SuperContig_29_v2_DTX-incomp_DmelChr4-B-P0.0-Map3;Parent=ms3_lm_SuperContig_29_v2_DTX-incomp_DmelChr4-B-P0.0-Map3;Target=DTX-incomp_DmelChr4-B-P0.0-Map3 19 209;Identity=30.89\n")
        
    def _writeExpPathGFFFile_without_seq_withTargetLength_seq2(self, inFileName):
        with open(inFileName, "w") as f:
            f.write("##gff-version 3\n")
            f.write("##sequence-region chr1 1 18\n")
            f.write("chr1\tprojectName_REPET_TEs\tmatch\t1\t100\t0.0\t-\t.\tID=ms1_chr1_PROTOP_B:classII:TIR;Target=PROTOP_B:classII:TIR 85 228;TargetLength=10;Identity=30.56\n")
            f.write("chr1\tprojectName_REPET_TEs\tmatch_part\t1\t100\t1e-20\t-\t.\tID=mp1-1_chr1_PROTOP_B:classII:TIR;Parent=ms1_chr1_PROTOP_B:classII:TIR;Target=PROTOP_B:classII:TIR 85 228;Identity=30.56\n")
            f.write("chr1\tprojectName_REPET_TEs\tmatch\t100\t1000\t0.0\t-\t.\tID=ms2_chr1_DMRT1C:classI:?;Target=DMRT1C:classI:? 85 228;TargetLength=8;Identity=30.56\n")
            f.write("chr1\tprojectName_REPET_TEs\tmatch_part\t100\t1000\t1e-30\t-\t.\tID=mp2-1_chr1_DMRT1C:classI:?;Parent=ms2_chr1_DMRT1C:classI:?;Target=DMRT1C:classI:? 85 228;Identity=30.56\n")
        
    def _writeExpPathGFFFile_split_file1(self, inFileName):
        with open(inFileName, 'w') as f:
            f.write("##gff-version 3\n")
            f.write("##sequence-region dmel_chr4 1 18\n")
            f.write("dmel_chr4\t%s_REPET_TEs\tmatch\t4630\t4889\t0.0\t+\t.\tID=ms21_dmel_chr4_DTX-incomp_DmelChr4-B-P0.0-Map3;Target=DTX-incomp_DmelChr4-B-P0.0-Map3 232 512;TargetLength=8\n" % self._projectName)
            f.write("dmel_chr4\t%s_REPET_TEs\tmatch_part\t4630\t4704\t0.0\t+\t.\tID=mp21-1_dmel_chr4_DTX-incomp_DmelChr4-B-P0.0-Map3;Parent=ms21_dmel_chr4_DTX-incomp_DmelChr4-B-P0.0-Map3;Target=DTX-incomp_DmelChr4-B-P0.0-Map3 232 312;Identity=84.4417\n" % self._projectName)
            f.write("dmel_chr4\t%s_REPET_TEs\tmatch_part\t4837\t4889\t0.0\t+\t.\tID=mp21-2_dmel_chr4_DTX-incomp_DmelChr4-B-P0.0-Map3;Parent=ms21_dmel_chr4_DTX-incomp_DmelChr4-B-P0.0-Map3;Target=DTX-incomp_DmelChr4-B-P0.0-Map3 456 512;Identity=84.4417\n" % self._projectName)
            f.write("dmel_chr4\t%s_REPET_TEs\tmatch\t4364\t4611\t0.0\t+\t.\tID=ms6_dmel_chr4_DTX-incomp_DmelChr4-L-B1-Map3;Target=DTX-incomp_DmelChr4-L-B1-Map3 854 1150;TargetLength=10;Identity=91.24\n" % self._projectName)
            f.write("dmel_chr4\t%s_REPET_TEs\tmatch_part\t4364\t4611\t0.0\t+\t.\tID=mp6-1_dmel_chr4_DTX-incomp_DmelChr4-L-B1-Map3;Parent=ms6_dmel_chr4_DTX-incomp_DmelChr4-L-B1-Map3;Target=DTX-incomp_DmelChr4-L-B1-Map3 854 1150;Identity=91.24\n" % self._projectName)

    def _writeExpPathGFFFile_split_file2(self, inFileName):
        with open(inFileName, 'w') as f:
            f.write("##gff-version 3\n")
            f.write("##sequence-region dmel_chr1 1 25\n")
            f.write("dmel_chr1\t%s_REPET_TEs\tmatch\t4364\t4611\t0.0\t+\t.\tID=ms35_dmel_chr1_DTX-incomp_DmelChr4-L-B1-Map3;Target=DTX-incomp_DmelChr4-L-B1-Map3 854 1150;TargetLength=10;Identity=91.24\n" % self._projectName)
            f.write("dmel_chr1\t%s_REPET_TEs\tmatch_part\t4364\t4611\t0.0\t+\t.\tID=mp35-1_dmel_chr1_DTX-incomp_DmelChr4-L-B1-Map3;Parent=ms35_dmel_chr1_DTX-incomp_DmelChr4-L-B1-Map3;Target=DTX-incomp_DmelChr4-L-B1-Map3 854 1150;Identity=91.24\n" % self._projectName)

    def _writeExpPathGFFFile_split_file3(self, inFileName):
        with open(inFileName, 'w') as f:
            f.write("##gff-version 3\n")
            f.write("##sequence-region dmel_chr4 1 18\n")
            f.write("dmel_chr4\t%s_REPET_TEs\tmatch\t3143\t4364\t0.0\t-\t.\tID=ms66_dmel_chr4_DMRT1C:classI:?;Target=DMRT1C:classI:? 24 2206;TargetLength=8\n" % self._projectName)
            f.write("dmel_chr4\t%s_REPET_TEs\tmatch_part\t3143\t3361\t0.0\t-\t.\tID=mp66-1_dmel_chr4_DMRT1C:classI:?;Parent=ms66_dmel_chr4_DMRT1C:classI:?;Target=DMRT1C:classI:? 1988 2206;Identity=89.7202\n" % self._projectName)
            f.write("dmel_chr4\t%s_REPET_TEs\tmatch_part\t3345\t3410\t0.0\t-\t.\tID=mp66-2_dmel_chr4_DMRT1C:classI:?;Parent=ms66_dmel_chr4_DMRT1C:classI:?;Target=DMRT1C:classI:? 1654 1719;Identity=54.55\n" % self._projectName)
            f.write("dmel_chr4\t%s_REPET_TEs\tmatch_part\t3448\t3572\t0.0\t-\t.\tID=mp66-3_dmel_chr4_DMRT1C:classI:?;Parent=ms66_dmel_chr4_DMRT1C:classI:?;Target=DMRT1C:classI:? 1495 1619;Identity=77.3433\n" % self._projectName)
            f.write("dmel_chr4\t%s_REPET_TEs\tmatch_part\t3564\t3693\t0.0\t-\t.\tID=mp66-4_dmel_chr4_DMRT1C:classI:?;Parent=ms66_dmel_chr4_DMRT1C:classI:?;Target=DMRT1C:classI:? 1380 1509;Identity=83.7306\n" % self._projectName)
            f.write("dmel_chr4\t%s_REPET_TEs\tmatch_part\t3705\t3857\t0.0\t-\t.\tID=mp66-5_dmel_chr4_DMRT1C:classI:?;Parent=ms66_dmel_chr4_DMRT1C:classI:?;Target=DMRT1C:classI:? 539 691;Identity=84.5762\n" % self._projectName)
            f.write("dmel_chr4\t%s_REPET_TEs\tmatch_part\t3861\t3992\t0.0\t-\t.\tID=mp66-6_dmel_chr4_DMRT1C:classI:?;Parent=ms66_dmel_chr4_DMRT1C:classI:?;Target=DMRT1C:classI:? 403 534;Identity=67.1422\n" % self._projectName)
            f.write("dmel_chr4\t%s_REPET_TEs\tmatch_part\t3985\t4106\t0.0\t-\t.\tID=mp66-7_dmel_chr4_DMRT1C:classI:?;Parent=ms66_dmel_chr4_DMRT1C:classI:?;Target=DMRT1C:classI:? 290 411;Identity=76.612\n" % self._projectName)
            f.write("dmel_chr4\t%s_REPET_TEs\tmatch_part\t4102\t4248\t0.0\t-\t.\tID=mp66-8_dmel_chr4_DMRT1C:classI:?;Parent=ms66_dmel_chr4_DMRT1C:classI:?;Target=DMRT1C:classI:? 139 285;Identity=75.3027\n" % self._projectName)
            f.write("dmel_chr4\t%s_REPET_TEs\tmatch_part\t4236\t4364\t0.0\t-\t.\tID=mp66-9_dmel_chr4_DMRT1C:classI:?;Parent=ms66_dmel_chr4_DMRT1C:classI:?;Target=DMRT1C:classI:? 24 152;Identity=66.6657\n" % self._projectName)
            f.write("dmel_chr4\t%s_REPET_TEs\tmatch\t4412\t4889\t0.0\t-\t.\tID=ms27_dmel_chr4_PROTOP_B:classII:TIR;Target=PROTOP_B:classII:TIR 553 1082;TargetLength=10\n" % self._projectName)
            f.write("dmel_chr4\t%s_REPET_TEs\tmatch_part\t4412\t4501\t5e-108\t-\t.\tID=mp27-1_dmel_chr4_PROTOP_B:classII:TIR;Parent=ms27_dmel_chr4_PROTOP_B:classII:TIR;Target=PROTOP_B:classII:TIR 993 1082;Identity=91.3066\n" % self._projectName)
            f.write("dmel_chr4\t%s_REPET_TEs\tmatch_part\t4483\t4652\t9e-146\t-\t.\tID=mp27-2_dmel_chr4_PROTOP_B:classII:TIR;Parent=ms27_dmel_chr4_PROTOP_B:classII:TIR;Target=PROTOP_B:classII:TIR 821 990;Identity=86.5572\n" % self._projectName)
            f.write("dmel_chr4\t%s_REPET_TEs\tmatch_part\t4672\t4775\t9e-146\t-\t.\tID=mp27-3_dmel_chr4_PROTOP_B:classII:TIR;Parent=ms27_dmel_chr4_PROTOP_B:classII:TIR;Target=PROTOP_B:classII:TIR 684 787;Identity=88.8013\n" % self._projectName)
            f.write("dmel_chr4\t%s_REPET_TEs\tmatch_part\t4782\t4889\t9e-141\t-\t.\tID=mp27-4_dmel_chr4_PROTOP_B:classII:TIR;Parent=ms27_dmel_chr4_PROTOP_B:classII:TIR;Target=PROTOP_B:classII:TIR 553 661;Identity=53.7067\n" % self._projectName)
            f.write("dmel_chr4\t%s_REPET_TEs\tmatch\t4917\t5195\t0.0\t+\t.\tID=ms141_dmel_chr4_BATUMI_I:classI:LTR_retrotransposon;Target=BATUMI_I:classI:LTR_retrotransposon 7030 7303;TargetLength=12\n" % self._projectName)
            f.write("dmel_chr4\t%s_REPET_TEs\tmatch_part\t4917\t5007\t2e-144\t+\t.\tID=mp141-1_dmel_chr4_BATUMI_I:classI:LTR_retrotransposon;Parent=ms141_dmel_chr4_BATUMI_I:classI:LTR_retrotransposon;Target=BATUMI_I:classI:LTR_retrotransposon 7030 7120;Identity=94.1756\n" % self._projectName)
            f.write("dmel_chr4\t%s_REPET_TEs\tmatch_part\t4976\t5195\t2e-144\t+\t.\tID=mp141-2_dmel_chr4_BATUMI_I:classI:LTR_retrotransposon;Parent=ms141_dmel_chr4_BATUMI_I:classI:LTR_retrotransposon;Target=BATUMI_I:classI:LTR_retrotransposon 7087 7303;Identity=82.2343\n" % self._projectName)
        
    def _writeClassifFile(self, inputFileName):
        f = open(inputFileName, "w")
        f.write("PotentialHostGene-chim_fTest05105818-B-G11-Map20\t1240\t+\tPotentialChimeric\tNA\tPotentialHostGene\tNA\tCI=100; coding=(HG_BLRn: FBtr0089196_Dmel_r4.3: 95.65%); other=(TE_BLRtx: PROTOP:classII:TIR: 12.03%, PROTOP_A:classII:TIR: 49.14%; TermRepeats: termTIR: 49; SSRCoverage=0.25<0.75)\n")
        f.write("DTX-comp-chim_fTest05105818-B-G7-Map3_reversed\t1944\t-\tPotentialChimeric\tII\tTIR\tcomplete\tCI=33; coding=(TE_BLRtx: PROTOP:classII:TIR: 12.77%, PROTOP_A:classII:TIR: 25.16%, PROTOP_A:classII:TIR: 100.00%); struct=(TElength: <700bps; TermRepeats: termTIR: 844); other=(HG_BLRn: FBtr0089196_Dmel_r4.3: 29.48%; SSRCoverage=0.24<0.75)\n")
        f.write("DTX-incomp_fTest05105818-B-G9-Map3_reversed\t1590\t-\tok\tII\tTIR\tincomplete\tCI=33; coding=(TE_BLRtx: PROTOP:classII:TIR: 10.92%, PROTOP:classII:TIR: 11.03%, PROTOP_A:classII:TIR: 55.20%); struct=(TElength: >700bps); other=(HG_BLRn: FBtr0089196_Dmel_r4.3: 35.60%; SSRCoverage=0.21<0.75)\n")
        f.write("DTX-incomp_fTest05105818-B-P0.0-Map3\t1042\t.\tok\tII\tTIR\tincomplete\tCI=50; coding=(TE_BLRtx: PROTOP:classII:TIR: 17.39%, PROTOP_A:classII:TIR: 22.17%); struct=(TElength: >700bps; TermRepeats: termTIR: 50); other=(HG_BLRn: FBtr0089196_Dmel_r4.3: 47.22%; SSRCoverage=0.25<0.75)\n")
        f.write("DTX-comp_fTest05105818-B-P1.0-Map9_reversed\t1137\t-\tok\tII\tTIR\tcomplete\tCI=50; coding=(TE_BLRtx: PROTOP:classII:TIR: 6.70%, PROTOP_A:classII:TIR: 66.43%, PROTOP_B:classII:TIR: 6.42%); struct=(TElength: >700bps; TermRepeats: termTIR: 52); other=(HG_BLRn: FBtr0089196_Dmel_r4.3: 51.19%; SSRCoverage=0.22<0.75)\n")
        f.write("RLX-incomp_fTest05105818-B-R12-Map3_reversed\t2284\t-\tok\tI\tLTR\tincomplete\tCI=28; coding=(TE_BLRtx: ROOA_I:classI:LTR_retrotransposon: 27.57%, ROOA_LTR:classI:LTR_retrotransposon: 94.56%; TE_BLRx: BEL11_AGp:classI:LTR_retrotransposon: 19.47%, BEL2-I_Dmoj_1p:classI:LTR_retrotransposon: 11.49%); struct=(TElength: >700bps); other=(SSRCoverage=0.07<0.75)\n")
        f.write("DTX-incomp_fTest05105818-B-R19-Map4\t705\t+\tok\tII\tTIR\tincomplete\tCI=66; coding=(TE_BLRtx: TC1-2_DM:classII:TIR: 42.70%; TE_BLRx: TC1-2_DMp:classII:TIR: 41.18%); struct=(TElength: >700bps); other=(SSRCoverage=0.14<0.75)\n")
        f.write("DHX-incomp_fTest05105818-B-R1-Map4\t2367\t.\tok\tII\tHelitron\tincomplete\tCI=20; coding=(TE_BLRtx: DNAREP1_DM:classII:Helitron: 17.00%, DNAREP1_DYak:classII:Helitron: 9.08%); struct=(TElength: >700bps); other=(HG_BLRn: FBtr0089179_Dmel_r4.3: 13.52%; SSRCoverage=0.18<0.75)\n")
        f.write("noCat_fTest05105818-B-R2-Map6\t4638\t.\tok\tnoCat\tnoCat\tNA\tCI=NA; coding=(HG_BLRn: FBtr0089179_Dmel_r4.3: 73.65%); struct=(SSRCoverage=0.05<0.75)\n")
        f.write("PotentialHostGene-chim_fTest05105818-B-R4-Map5_reversed\t1067\t-\tPotentialChimeric\tNA\tPotentialHostGene\tNA\tCI=100; coding=(HG_BLRn: FBtr0089196_Dmel_r4.3: 99.91%); other=(TE_BLRtx: PROTOP:classII:TIR: 13.06%, PROTOP_A:classII:TIR: 37.47%; SSRCoverage=0.27<0.75)\n")
        f.write("DTX-incomp_fTest05105818-B-R9-Map3_reversed\t714\t-\tok\tII\tTIR\tincomplete\tCI=66; coding=(TE_BLRtx: TC1_DM:classII:TIR: 40.88%; TE_BLRx: Tc1-1_TCa_1p:classII:TIR: 30.18%, Tc1-3_FR_1p:classII:TIR: 9.97%); struct=(TElength: >700bps); other=(SSRCoverage=0.08<0.75)\n")        
        f.close()
        
    def _writePathFile_withClassif(self,inFileName):
        f = open(inFileName,'w')
        f.write('1\tlm_SuperContig_29_v2\t193781\t194212\t1nc550_030\t228\t85\t1e-40\t84\t30.56\n')
        f.write('2\tlm_SuperContig_29_v2\t192832\t193704\t1nc550_030\t522\t229\t1e-40\t106\t23.99\n')
        f.write('3\tlm_SuperContig_30_v2\t78081\t78088\tDHX-incomp_Blc1_fTest05105818-B-R1-Map4\t19\t209\t3e-21\t101\t30.89\n')
        f.write('3\tlm_SuperContig_30_v2\t78089\t78588\tDHX-incomp_Blc1_fTest05105818-B-R1-Map4\t150\t350\t3e-22\t101\t35.89\n')
        f.write('4\tlm_SuperContig_30_v2\t88031\t88080\tDTX-incomp_fTest05105818-B-G1-Map3\t370\t420\t3e-23\t101\t31.89\n')
        f.write('5\tlm_SuperContig_30_v2\t108588\t108081\tDTX-incomp_fTest05105818-B-G9-Map3_reversed\t590\t820\t3e-24\t101\t32.89\n')
        f.write('6\tlm_SuperContig_30_v2\t118081\t118588\tPotentialHostGene-chim_Blc6_fTest05105818-B-R4-Map5_reversed\t154\t289\t3e-25\t101\t33.89\n')
        f.write('7\tlm_SuperContig_30_v2\t288031\t288080\tnoCat_Blc22_fTest05105818-B-R2-Map6\t1900\t2090\t3e-26\t101\t34.89\n')
        f.close() 
        
    def _writeExpPathGFFFile_without_seq_withClassif(self, inFileName):
        f = open(inFileName, 'w')
        f.write("##gff-version 3\n")
        f.write("##sequence-region lm_SuperContig_30_v2 1 120\n")
        f.write("lm_SuperContig_30_v2\tprojectName_REPET_TEs\tmatch\t78081\t78588\t0.0\t+\t.\tID=ms3_lm_SuperContig_30_v2_DHX-incomp_Blc1_fTest05105818-B-R1-Map4;Target=DHX-incomp_Blc1_fTest05105818-B-R1-Map4 19 350;TargetDescription=CI:20 coding:(TE_BLRtx: DNAREP1_DM:classII:Helitron: 17.00% | DNAREP1_DYak:classII:Helitron: 9.08%) struct:(TElength: >700bps) other:(HG_BLRn: FBtr0089179_Dmel_r4.3: 13.52% SSRCoverage:0.18<0.75)\n")
        f.write("lm_SuperContig_30_v2\tprojectName_REPET_TEs\tmatch_part\t78081\t78088\t3e-21\t+\t.\tID=mp3-1_lm_SuperContig_30_v2_DHX-incomp_Blc1_fTest05105818-B-R1-Map4;Parent=ms3_lm_SuperContig_30_v2_DHX-incomp_Blc1_fTest05105818-B-R1-Map4;Target=DHX-incomp_Blc1_fTest05105818-B-R1-Map4 19 209;Identity=30.89\n")
        f.write("lm_SuperContig_30_v2\tprojectName_REPET_TEs\tmatch_part\t78089\t78588\t3e-22\t+\t.\tID=mp3-2_lm_SuperContig_30_v2_DHX-incomp_Blc1_fTest05105818-B-R1-Map4;Parent=ms3_lm_SuperContig_30_v2_DHX-incomp_Blc1_fTest05105818-B-R1-Map4;Target=DHX-incomp_Blc1_fTest05105818-B-R1-Map4 150 350;Identity=35.89\n")
        
        f.write("lm_SuperContig_30_v2\tprojectName_REPET_TEs\tmatch\t88031\t88080\t0.0\t+\t.\tID=ms4_lm_SuperContig_30_v2_DTX-incomp_fTest05105818-B-G1-Map3;Target=DTX-incomp_fTest05105818-B-G1-Map3 370 420;Identity=31.89\n")
        f.write("lm_SuperContig_30_v2\tprojectName_REPET_TEs\tmatch_part\t88031\t88080\t3e-23\t+\t.\tID=mp4-1_lm_SuperContig_30_v2_DTX-incomp_fTest05105818-B-G1-Map3;Parent=ms4_lm_SuperContig_30_v2_DTX-incomp_fTest05105818-B-G1-Map3;Target=DTX-incomp_fTest05105818-B-G1-Map3 370 420;Identity=31.89\n")
        
        f.write("lm_SuperContig_30_v2\tprojectName_REPET_TEs\tmatch\t108081\t108588\t0.0\t-\t.\tID=ms5_lm_SuperContig_30_v2_DTX-incomp_fTest05105818-B-G9-Map3_reversed;Target=DTX-incomp_fTest05105818-B-G9-Map3_reversed 590 820;TargetDescription=CI:33 coding:(TE_BLRtx: PROTOP:classII:TIR: 10.92% | PROTOP:classII:TIR: 11.03% | PROTOP_A:classII:TIR: 55.20%) struct:(TElength: >700bps) other:(HG_BLRn: FBtr0089196_Dmel_r4.3: 35.60% SSRCoverage:0.21<0.75);Identity=32.89\n")
        f.write("lm_SuperContig_30_v2\tprojectName_REPET_TEs\tmatch_part\t108081\t108588\t3e-24\t-\t.\tID=mp5-1_lm_SuperContig_30_v2_DTX-incomp_fTest05105818-B-G9-Map3_reversed;Parent=ms5_lm_SuperContig_30_v2_DTX-incomp_fTest05105818-B-G9-Map3_reversed;Target=DTX-incomp_fTest05105818-B-G9-Map3_reversed 590 820;Identity=32.89\n")
        
        f.write("lm_SuperContig_30_v2\tprojectName_REPET_TEs\tmatch\t118081\t118588\t0.0\t+\t.\tID=ms6_lm_SuperContig_30_v2_PotentialHostGene-chim_Blc6_fTest05105818-B-R4-Map5_reversed;Target=PotentialHostGene-chim_Blc6_fTest05105818-B-R4-Map5_reversed 154 289;TargetDescription=CI:100 coding:(HG_BLRn: FBtr0089196_Dmel_r4.3: 99.91%) other:(TE_BLRtx: PROTOP:classII:TIR: 13.06% | PROTOP_A:classII:TIR: 37.47% SSRCoverage:0.27<0.75);Identity=33.89\n")
        f.write("lm_SuperContig_30_v2\tprojectName_REPET_TEs\tmatch_part\t118081\t118588\t3e-25\t+\t.\tID=mp6-1_lm_SuperContig_30_v2_PotentialHostGene-chim_Blc6_fTest05105818-B-R4-Map5_reversed;Parent=ms6_lm_SuperContig_30_v2_PotentialHostGene-chim_Blc6_fTest05105818-B-R4-Map5_reversed;Target=PotentialHostGene-chim_Blc6_fTest05105818-B-R4-Map5_reversed 154 289;Identity=33.89\n")
        
        f.write("lm_SuperContig_30_v2\tprojectName_REPET_TEs\tmatch\t288031\t288080\t0.0\t+\t.\tID=ms7_lm_SuperContig_30_v2_noCat_Blc22_fTest05105818-B-R2-Map6;Target=noCat_Blc22_fTest05105818-B-R2-Map6 1900 2090;TargetDescription=CI:NA coding:(HG_BLRn: FBtr0089179_Dmel_r4.3: 73.65%) struct:(SSRCoverage:0.05<0.75);Identity=34.89\n")
        f.write("lm_SuperContig_30_v2\tprojectName_REPET_TEs\tmatch_part\t288031\t288080\t3e-26\t+\t.\tID=mp7-1_lm_SuperContig_30_v2_noCat_Blc22_fTest05105818-B-R2-Map6;Parent=ms7_lm_SuperContig_30_v2_noCat_Blc22_fTest05105818-B-R2-Map6;Target=noCat_Blc22_fTest05105818-B-R2-Map6 1900 2090;Identity=34.89\n")
       
        f.close()

    def _writePathFile_withClassif_withIdenticalMatches(self,inFileName):
        f = open(inFileName,'w')
        f.write('1\tlm_SuperContig_29_v2\t193781\t194212\t1nc550_030\t228\t85\t1e-40\t84\t30.56\n')
        f.write('2\tlm_SuperContig_29_v2\t192832\t193704\t1nc550_030\t522\t229\t1e-40\t106\t23.99\n')
        f.write('3\tlm_SuperContig_30_v2\t78081\t78088\tDHX-incomp_Blc1_fTest05105818-B-R1-Map4\t19\t209\t3e-21\t101\t30.89\n')
        f.write('3\tlm_SuperContig_30_v2\t78089\t78588\tDHX-incomp_Blc1_fTest05105818-B-R1-Map4\t150\t350\t3e-22\t101\t35.89\n')
        f.write('4\tlm_SuperContig_30_v2\t88031\t88080\tDTX-incomp_fTest05105818-B-G1-Map3\t370\t420\t3e-23\t101\t31.89\n')
        f.write('5\tlm_SuperContig_30_v2\t108588\t108081\tDTX-incomp_fTest05105818-B-G9-Map3_reversed\t590\t820\t3e-24\t101\t32.89\n')
        f.write('6\tlm_SuperContig_30_v2\t118081\t118588\tPotentialHostGene-chim_Blc6_fTest05105818-B-R4-Map5_reversed\t154\t289\t3e-25\t101\t33.89\n')

        f.write('7\tlm_SuperContig_30_v2\t288031\t288080\tnoCat_Blc22_fTest05105818-B-R2-Map6\t1900\t2090\t3e-26\t101\t34.89\n')
        f.write('8\tlm_SuperContig_30_v2\t288031\t288080\tDTX-incomp_fTest05105818-B-P0.0-Map3\t100\t190\t3e-26\t101\t39.89\n')
        f.write('9\tlm_SuperContig_30_v2\t288031\t288080\tRLX-incomp_fTest05105818-B-R12-Map3_reversed\t1100\t1290\t3e-26\t101\t40.89\n')
        f.write('10\tlm_SuperContig_30_v2\t288031\t288080\tPotentialHostGene-chim_fTest05105818-B-G11-Map20\t990\t1890\t3e-26\t101\t38.09\n')

        f.write('11\tlm_SuperContig_30_v2\t288031\t288080\tDTX-incomp_fTest05105818-B-G1-Map3\t990\t1890\t3e-26\t301\t38.09\n')
        
        f.write('12\tlm_SuperContig_30_v2\t388031\t388080\tDHX-incomp_Blc1_fTest05105818-B-R1-Map4\t19\t209\t3e-21\t101\t30.89\n')
        f.write('12\tlm_SuperContig_30_v2\t388081\t388380\tDHX-incomp_Blc1_fTest05105818-B-R1-Map4\t150\t350\t3e-22\t101\t35.89\n')
        
        f.write('13\tlm_SuperContig_30_v2\t388031\t388080\tDTX-incomp_fTest05105818-B-P0.0-Map3\t119\t309\t3e-21\t101\t30.89\n')
        f.write('13\tlm_SuperContig_30_v2\t388081\t388380\tDTX-incomp_fTest05105818-B-P0.0-Map3\t250\t450\t3e-22\t101\t35.89\n')
        f.close() 

    def _writeExpPathGFFFile_without_seq_withClassif_withIdenticalMatches(self, inFileName):
        f = open(inFileName, 'w')
        f.write("##gff-version 3\n")
        f.write("##sequence-region lm_SuperContig_30_v2 1 120\n")
        f.write("lm_SuperContig_30_v2\tprojectName_REPET_TEs\tmatch\t78081\t78588\t0.0\t+\t.\tID=ms3_lm_SuperContig_30_v2_DHX-incomp_Blc1_fTest05105818-B-R1-Map4;Target=DHX-incomp_Blc1_fTest05105818-B-R1-Map4 19 350;TargetDescription=CI:20 coding:(TE_BLRtx: DNAREP1_DM:classII:Helitron: 17.00% | DNAREP1_DYak:classII:Helitron: 9.08%) struct:(TElength: >700bps) other:(HG_BLRn: FBtr0089179_Dmel_r4.3: 13.52% SSRCoverage:0.18<0.75)\n")
        f.write("lm_SuperContig_30_v2\tprojectName_REPET_TEs\tmatch_part\t78081\t78088\t3e-21\t+\t.\tID=mp3-1_lm_SuperContig_30_v2_DHX-incomp_Blc1_fTest05105818-B-R1-Map4;Parent=ms3_lm_SuperContig_30_v2_DHX-incomp_Blc1_fTest05105818-B-R1-Map4;Target=DHX-incomp_Blc1_fTest05105818-B-R1-Map4 19 209;Identity=30.89\n")
        f.write("lm_SuperContig_30_v2\tprojectName_REPET_TEs\tmatch_part\t78089\t78588\t3e-22\t+\t.\tID=mp3-2_lm_SuperContig_30_v2_DHX-incomp_Blc1_fTest05105818-B-R1-Map4;Parent=ms3_lm_SuperContig_30_v2_DHX-incomp_Blc1_fTest05105818-B-R1-Map4;Target=DHX-incomp_Blc1_fTest05105818-B-R1-Map4 150 350;Identity=35.89\n")
        
        f.write("lm_SuperContig_30_v2\tprojectName_REPET_TEs\tmatch\t88031\t88080\t0.0\t+\t.\tID=ms4_lm_SuperContig_30_v2_DTX-incomp_fTest05105818-B-G1-Map3;Target=DTX-incomp_fTest05105818-B-G1-Map3 370 420;Identity=31.89\n")
        f.write("lm_SuperContig_30_v2\tprojectName_REPET_TEs\tmatch_part\t88031\t88080\t3e-23\t+\t.\tID=mp4-1_lm_SuperContig_30_v2_DTX-incomp_fTest05105818-B-G1-Map3;Parent=ms4_lm_SuperContig_30_v2_DTX-incomp_fTest05105818-B-G1-Map3;Target=DTX-incomp_fTest05105818-B-G1-Map3 370 420;Identity=31.89\n")
       
        f.write("lm_SuperContig_30_v2\tprojectName_REPET_TEs\tmatch\t108081\t108588\t0.0\t-\t.\tID=ms5_lm_SuperContig_30_v2_DTX-incomp_fTest05105818-B-G9-Map3_reversed;Target=DTX-incomp_fTest05105818-B-G9-Map3_reversed 590 820;TargetDescription=CI:33 coding:(TE_BLRtx: PROTOP:classII:TIR: 10.92% | PROTOP:classII:TIR: 11.03% | PROTOP_A:classII:TIR: 55.20%) struct:(TElength: >700bps) other:(HG_BLRn: FBtr0089196_Dmel_r4.3: 35.60% SSRCoverage:0.21<0.75);Identity=32.89\n")
        f.write("lm_SuperContig_30_v2\tprojectName_REPET_TEs\tmatch_part\t108081\t108588\t3e-24\t-\t.\tID=mp5-1_lm_SuperContig_30_v2_DTX-incomp_fTest05105818-B-G9-Map3_reversed;Parent=ms5_lm_SuperContig_30_v2_DTX-incomp_fTest05105818-B-G9-Map3_reversed;Target=DTX-incomp_fTest05105818-B-G9-Map3_reversed 590 820;Identity=32.89\n")
        
        f.write("lm_SuperContig_30_v2\tprojectName_REPET_TEs\tmatch\t118081\t118588\t0.0\t+\t.\tID=ms6_lm_SuperContig_30_v2_PotentialHostGene-chim_Blc6_fTest05105818-B-R4-Map5_reversed;Target=PotentialHostGene-chim_Blc6_fTest05105818-B-R4-Map5_reversed 154 289;TargetDescription=CI:100 coding:(HG_BLRn: FBtr0089196_Dmel_r4.3: 99.91%) other:(TE_BLRtx: PROTOP:classII:TIR: 13.06% | PROTOP_A:classII:TIR: 37.47% SSRCoverage:0.27<0.75);Identity=33.89\n")
        f.write("lm_SuperContig_30_v2\tprojectName_REPET_TEs\tmatch_part\t118081\t118588\t3e-25\t+\t.\tID=mp6-1_lm_SuperContig_30_v2_PotentialHostGene-chim_Blc6_fTest05105818-B-R4-Map5_reversed;Parent=ms6_lm_SuperContig_30_v2_PotentialHostGene-chim_Blc6_fTest05105818-B-R4-Map5_reversed;Target=PotentialHostGene-chim_Blc6_fTest05105818-B-R4-Map5_reversed 154 289;Identity=33.89\n")
        
        f.write("lm_SuperContig_30_v2\tprojectName_REPET_TEs\tmatch\t288031\t288080\t0.0\t+\t.\tID=ms10_lm_SuperContig_30_v2_PotentialHostGene-chim_fTest05105818-B-G11-Map20;Target=PotentialHostGene-chim_fTest05105818-B-G11-Map20 990 1890;OtherTargets=RLX-incomp_fTest05105818-B-R12-Map3_reversed 1100 1290, DTX-incomp_fTest05105818-B-P0.0-Map3 100 190, noCat_Blc22_fTest05105818-B-R2-Map6 1900 2090\n")
        f.write("lm_SuperContig_30_v2\tprojectName_REPET_TEs\tmatch_part\t288031\t288080\t3e-26\t+\t.\tID=mp10-1_lm_SuperContig_30_v2_PotentialHostGene-chim_fTest05105818-B-G11-Map20;Parent=ms10_lm_SuperContig_30_v2_PotentialHostGene-chim_fTest05105818-B-G11-Map20;Target=PotentialHostGene-chim_fTest05105818-B-G11-Map20 990 1890\n")

        f.write("lm_SuperContig_30_v2\tprojectName_REPET_TEs\tmatch\t288031\t288080\t0.0\t+\t.\tID=ms11_lm_SuperContig_30_v2_DTX-incomp_fTest05105818-B-G1-Map3;Target=DTX-incomp_fTest05105818-B-G1-Map3 990 1890;Identity=38.09\n")
        f.write("lm_SuperContig_30_v2\tprojectName_REPET_TEs\tmatch_part\t288031\t288080\t3e-26\t+\t.\tID=mp11-1_lm_SuperContig_30_v2_DTX-incomp_fTest05105818-B-G1-Map3;Parent=ms11_lm_SuperContig_30_v2_DTX-incomp_fTest05105818-B-G1-Map3;Target=DTX-incomp_fTest05105818-B-G1-Map3 990 1890;Identity=38.09\n")

        #TODO:
        #Should this case really occur : If merging multiple match-parts, the current behaviour needs to be fixed to get correct subject start/end coordinates 
        f.write("lm_SuperContig_30_v2\tprojectName_REPET_TEs\tmatch\t388031\t388380\t0.0\t+\t.\tID=ms12_lm_SuperContig_30_v2_DHX-incomp_Blc1_fTest05105818-B-R1-Map4;Target=DHX-incomp_Blc1_fTest05105818-B-R1-Map4 19 350;OtherTargets=DTX-incomp_fTest05105818-B-P0.0-Map3 119 309\n")
        f.write("lm_SuperContig_30_v2\tprojectName_REPET_TEs\tmatch_part\t388031\t388080\t3e-21\t+\t.\tID=mp12-1_lm_SuperContig_30_v2_DHX-incomp_Blc1_fTest05105818-B-R1-Map4;Parent=ms12_lm_SuperContig_30_v2_DHX-incomp_Blc1_fTest05105818-B-R1-Map4;Target=DHX-incomp_Blc1_fTest05105818-B-R1-Map4 19 209\n")
        f.write("lm_SuperContig_30_v2\tprojectName_REPET_TEs\tmatch_part\t388081\t388380\t3e-22\t+\t.\tID=mp12-2_lm_SuperContig_30_v2_DHX-incomp_Blc1_fTest05105818-B-R1-Map4;Parent=ms12_lm_SuperContig_30_v2_DHX-incomp_Blc1_fTest05105818-B-R1-Map4;Target=DHX-incomp_Blc1_fTest05105818-B-R1-Map4 150 350\n")
        f.close()

    def _writeTablesFile_withTESeqTables(self, tableType):
        tableFile = open( self._tablesFileName, "w" )
        string = "%s_REPET_TEs\t%s\t%s_chr_allTEs_nr_noSSR_join_%s\t%s_refTEs_seq\n" % (self._projectName, tableType, self._projectName, tableType, self._projectName)
        tableFile.write(string)
        string = "%s_REPET_TEs\t%s\t%s_chr_bankBLRtx_%s\t%s_bankBLRtx_nt_seq\n" % (self._projectName, tableType, self._projectName, tableType, self._projectName)
        tableFile.write(string)
        tableFile.close()
        
    def _writeTablesFile(self, tableType):
        tableFile = open( self._tablesFileName, "w" )
        string = "%s_REPET_TEs\t%s\t%s_chr_allTEs_nr_noSSR_join_%s\n" % (self._projectName, tableType, self._projectName, tableType)
        tableFile.write(string)
        tableFile.close()
        
    def _writePathFile(self,inFileName):
        f = open(inFileName,'w')
        f.write('1\tlm_SuperContig_29_v2\t193781\t194212\tDTX-incomp_DmelChr4-L-B1-Map3\t228\t85\t1e-40\t84\t30.56\n')
        f.write('2\tlm_SuperContig_29_v2\t192832\t193704\tDTX-incomp_DmelChr4-L-B1-Map3\t522\t229\t1e-40\t106\t23.99\n')
        f.write('3\tlm_SuperContig_29_v2\t78031\t78080\tDTX-incomp_DmelChr4-B-P0.0-Map3\t19\t209\t3e-21\t101\t30.89\n')
        f.write('3\tlm_SuperContig_29_v2\t78081\t78588\tDTX-incomp_DmelChr4-B-P0.0-Map3\t19\t209\t3e-21\t101\t30.89\n')
        f.close() 
        
    def _writePathFile2(self,inFileName):
        f = open(inFileName,'w')
        f.write('1\tchr1\t1\t100\tPROTOP_B:classII:TIR\t228\t85\t1e-20\t84\t30.56\n')
        f.write('2\tchr1\t100\t1000\tDMRT1C:classI:?\t228\t85\t1e-30\t84\t30.56\n')
        f.close() 
        
    def _writePathFile_refTEs_annotation(self,inFileName):
        f = open(inFileName,'w')
        f.write('6\tdmel_chr4\t4364\t4611\tDTX-incomp_DmelChr4-L-B1-Map3\t854\t1150\t0\t1475\t91.24\n')
        f.write('21\tdmel_chr4\t4630\t4704\tDTX-incomp_DmelChr4-B-P0.0-Map3\t232\t312\t0\t65\t84.4417\n')
        f.write('21\tdmel_chr4\t4837\t4889\tDTX-incomp_DmelChr4-B-P0.0-Map3\t456\t512\t0\t46\t84.4417\n')
        f.write('35\tdmel_chr1\t4364\t4611\tDTX-incomp_DmelChr4-L-B1-Map3\t854\t1150\t0\t1475\t91.24\n')
        f.close()
        
    def _writePathFile_bankBLRtx_annotation(self,inFileName):
        f = open(inFileName, 'w')
        f.write('27\tdmel_chr4\t4412\t4501\tPROTOP_B:classII:TIR\t1082\t993\t5e-108\t702\t91.3066\n')
        f.write('27\tdmel_chr4\t4483\t4652\tPROTOP_B:classII:TIR\t990\t821\t9e-146\t707\t86.5572\n')
        f.write('27\tdmel_chr4\t4672\t4775\tPROTOP_B:classII:TIR\t787\t684\t9e-146\t707\t88.8013\n')
        f.write('27\tdmel_chr4\t4782\t4889\tPROTOP_B:classII:TIR\t661\t553\t9e-141\t356\t53.7067\n')
        f.write('66\tdmel_chr4\t3143\t3361\tDMRT1C:classI:?\t2206\t1988\t0\t1878\t89.7202\n')
        f.write('66\tdmel_chr4\t3345\t3410\tDMRT1C:classI:?\t1719\t1654\t0\t313\t54.55\n')
        f.write('66\tdmel_chr4\t3448\t3572\tDMRT1C:classI:?\t1619\t1495\t0\t1252\t77.3433\n')
        f.write('66\tdmel_chr4\t3564\t3693\tDMRT1C:classI:?\t1509\t1380\t0\t1565\t83.7306\n')
        f.write('66\tdmel_chr4\t3705\t3857\tDMRT1C:classI:?\t691\t539\t0\t1252\t84.5762\n')
        f.write('66\tdmel_chr4\t3861\t3992\tDMRT1C:classI:?\t534\t403\t0\t1565\t67.1422\n')
        f.write('66\tdmel_chr4\t3985\t4106\tDMRT1C:classI:?\t411\t290\t0\t1252\t76.612\n')
        f.write('66\tdmel_chr4\t4102\t4248\tDMRT1C:classI:?\t285\t139\t0\t1565\t75.3027\n')
        f.write('66\tdmel_chr4\t4236\t4364\tDMRT1C:classI:?\t152\t24\t0\t1565\t66.6657\n')
        f.write('141\tdmel_chr4\t4917\t5007\tBATUMI_I:classI:LTR_retrotransposon\t7030\t7120\t2e-144\t984\t94.1756\n')
        f.write('141\tdmel_chr4\t4976\t5195\tBATUMI_I:classI:LTR_retrotransposon\t7087\t7303\t2e-144\t2098\t82.2343\n')
        f.close() 
        
    def _writePathFileReverse(self,inFileName):
        f = open(inFileName,'w')
        f.write('1\tlm_SuperContig_29_v2\t193781\t194212\t1nc550_030 related to putative multidrug transporter Mfs1.1 (major facilitator family protein)\t228\t85\t1e-40\t84\t30.56\n')
        f.write('2\tlm_SuperContig_29_v2\t192832\t193704\t1nc550_030 related to putative multidrug transporter Mfs1.1 (major facilitator family protein)\t522\t229\t1e-40\t106\t23.99\n')
        f.write('3\tlm_SuperContig_29_v2\t78080\t78031\txnc164_090 related to multidrug resistance protein\t19\t209\t3e-21\t101\t30.89\n')
        f.write('3\tlm_SuperContig_29_v2\t78588\t78081\txnc164_090 related to multidrug resistance protein\t19\t209\t3e-21\t101\t30.89\n')
        f.close() 
        
    def _writeSetFile(self,inFileName):
        f = open(inFileName,'w')
        f.write('1\tset1\tlm_SuperContig_29_v2\t193781\t194212\n')
        f.write('2\tset2\tlm_SuperContig_29_v2\t192832\t193704\n')
        f.write('3\tset3\tlm_SuperContig_29_v2\t78031\t78080\n')
        f.write('3\tset3\tlm_SuperContig_29_v2\t78081\t78588\n')
        f.close() 
        
    def _writeSetFileReverse(self,inFileName):
        f = open(inFileName,'w')
        f.write('1\tset1\tlm_SuperContig_29_v2\t193781\t194212\n')
        f.write('2\tset2\tlm_SuperContig_29_v2\t192832\t193704\n')
        f.write('3\tset3\tlm_SuperContig_29_v2\t78080\t78031\n')
        f.write('3\tset3\tlm_SuperContig_29_v2\t78588\t78081\n')
        f.close() 
    
    def _writeExpEmptyPathGFFFile(self, inFileName):
        f = open(inFileName, 'w')
        f.write("##gff-version 3\n")
        f.write("##sequence-region lm_SuperContig_30_v2 1 120\n")
        f.close()
    
    def _writeExpPathGFFFile(self, inFileName):
        f = open(inFileName, 'w')
        f.write("##gff-version 3\n")
        f.write("##sequence-region lm_SuperContig_29_v2 1 120\n")
        f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch\t193781\t194212\t0.0\t-\t.\tID=ms1_lm_SuperContig_29_v2_DTX-incomp_DmelChr4-L-B1-Map3;Target=DTX-incomp_DmelChr4-L-B1-Map3 85 228;Identity=30.56\n")
        f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch_part\t193781\t194212\t1e-40\t-\t.\tID=mp1-1_lm_SuperContig_29_v2_DTX-incomp_DmelChr4-L-B1-Map3;Parent=ms1_lm_SuperContig_29_v2_DTX-incomp_DmelChr4-L-B1-Map3;Target=DTX-incomp_DmelChr4-L-B1-Map3 85 228;Identity=30.56\n")
        f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch\t192832\t193704\t0.0\t-\t.\tID=ms2_lm_SuperContig_29_v2_DTX-incomp_DmelChr4-L-B1-Map3;Target=DTX-incomp_DmelChr4-L-B1-Map3 229 522;Identity=23.99\n")
        f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch_part\t192832\t193704\t1e-40\t-\t.\tID=mp2-1_lm_SuperContig_29_v2_DTX-incomp_DmelChr4-L-B1-Map3;Parent=ms2_lm_SuperContig_29_v2_DTX-incomp_DmelChr4-L-B1-Map3;Target=DTX-incomp_DmelChr4-L-B1-Map3 229 522;Identity=23.99\n")
        f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch\t78031\t78588\t0.0\t+\t.\tID=ms3_lm_SuperContig_29_v2_DTX-incomp_DmelChr4-B-P0.0-Map3;Target=DTX-incomp_DmelChr4-B-P0.0-Map3 19 209\n")
        f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch_part\t78031\t78080\t3e-21\t+\t.\tID=mp3-1_lm_SuperContig_29_v2_DTX-incomp_DmelChr4-B-P0.0-Map3;Parent=ms3_lm_SuperContig_29_v2_DTX-incomp_DmelChr4-B-P0.0-Map3;Target=DTX-incomp_DmelChr4-B-P0.0-Map3 19 209;Identity=30.89\n")
        f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch_part\t78081\t78588\t3e-21\t+\t.\tID=mp3-2_lm_SuperContig_29_v2_DTX-incomp_DmelChr4-B-P0.0-Map3;Parent=ms3_lm_SuperContig_29_v2_DTX-incomp_DmelChr4-B-P0.0-Map3;Target=DTX-incomp_DmelChr4-B-P0.0-Map3 19 209;Identity=30.89\n")
        f.write("##FASTA\n")
        self._writeSeq1(f)
        f.close()
    
    def _writeExpEmptyPathGFFFileWithSeq(self, inFileName):
        f = open(inFileName, 'w')
        f.write("##gff-version 3\n")
        f.write("##sequence-region lm_SuperContig_30_v2 1 120\n")
        f.write("##FASTA\n")
        self._writeSeq2(f)
        f.close()
    
    def _writeExpPathGFFFile_without_seq(self, inFileName):
        f = open(inFileName, 'w')
        f.write("##gff-version 3\n")
        f.write("##sequence-region lm_SuperContig_29_v2 1 120\n")
        f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch\t193781\t194212\t0.0\t-\t.\tID=ms1_lm_SuperContig_29_v2_DTX-incomp_DmelChr4-L-B1-Map3;Target=DTX-incomp_DmelChr4-L-B1-Map3 85 228;Identity=30.56\n")
        f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch_part\t193781\t194212\t1e-40\t-\t.\tID=mp1-1_lm_SuperContig_29_v2_DTX-incomp_DmelChr4-L-B1-Map3;Parent=ms1_lm_SuperContig_29_v2_DTX-incomp_DmelChr4-L-B1-Map3;Target=DTX-incomp_DmelChr4-L-B1-Map3 85 228;Identity=30.56\n")
        f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch\t192832\t193704\t0.0\t-\t.\tID=ms2_lm_SuperContig_29_v2_DTX-incomp_DmelChr4-L-B1-Map3;Target=DTX-incomp_DmelChr4-L-B1-Map3 229 522;Identity=23.99\n")
        f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch_part\t192832\t193704\t1e-40\t-\t.\tID=mp2-1_lm_SuperContig_29_v2_DTX-incomp_DmelChr4-L-B1-Map3;Parent=ms2_lm_SuperContig_29_v2_DTX-incomp_DmelChr4-L-B1-Map3;Target=DTX-incomp_DmelChr4-L-B1-Map3 229 522;Identity=23.99\n")
        f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch\t78031\t78588\t0.0\t+\t.\tID=ms3_lm_SuperContig_29_v2_DTX-incomp_DmelChr4-B-P0.0-Map3;Target=DTX-incomp_DmelChr4-B-P0.0-Map3 19 209\n")
        f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch_part\t78031\t78080\t3e-21\t+\t.\tID=mp3-1_lm_SuperContig_29_v2_DTX-incomp_DmelChr4-B-P0.0-Map3;Parent=ms3_lm_SuperContig_29_v2_DTX-incomp_DmelChr4-B-P0.0-Map3;Target=DTX-incomp_DmelChr4-B-P0.0-Map3 19 209;Identity=30.89\n")
        f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch_part\t78081\t78588\t3e-21\t+\t.\tID=mp3-2_lm_SuperContig_29_v2_DTX-incomp_DmelChr4-B-P0.0-Map3;Parent=ms3_lm_SuperContig_29_v2_DTX-incomp_DmelChr4-B-P0.0-Map3;Target=DTX-incomp_DmelChr4-B-P0.0-Map3 19 209;Identity=30.89\n")
        f.close()
    
    def _writeExpPathGFFFile_without_seq_and_match_part_not_comulsory(self, inFileName):
        f = open(inFileName, 'w')
        f.write("##gff-version 3\n")
        f.write("##sequence-region lm_SuperContig_29_v2 1 120\n")
        f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch\t193781\t194212\t0.0\t-\t.\tID=ms1_lm_SuperContig_29_v2_DTX-incomp_DmelChr4-L-B1-Map3;Target=DTX-incomp_DmelChr4-L-B1-Map3 85 228;Identity=30.56\n")
        f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch\t192832\t193704\t0.0\t-\t.\tID=ms2_lm_SuperContig_29_v2_DTX-incomp_DmelChr4-L-B1-Map3;Target=DTX-incomp_DmelChr4-L-B1-Map3 229 522;Identity=23.99\n")
        f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch\t78031\t78588\t0.0\t+\t.\tID=ms3_lm_SuperContig_29_v2_DTX-incomp_DmelChr4-B-P0.0-Map3;Target=DTX-incomp_DmelChr4-B-P0.0-Map3 19 209\n")
        f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch_part\t78031\t78080\t3e-21\t+\t.\tID=mp3-1_lm_SuperContig_29_v2_DTX-incomp_DmelChr4-B-P0.0-Map3;Parent=ms3_lm_SuperContig_29_v2_DTX-incomp_DmelChr4-B-P0.0-Map3;Target=DTX-incomp_DmelChr4-B-P0.0-Map3 19 209;Identity=30.89\n")
        f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch_part\t78081\t78588\t3e-21\t+\t.\tID=mp3-2_lm_SuperContig_29_v2_DTX-incomp_DmelChr4-B-P0.0-Map3;Parent=ms3_lm_SuperContig_29_v2_DTX-incomp_DmelChr4-B-P0.0-Map3;Target=DTX-incomp_DmelChr4-B-P0.0-Map3 19 209;Identity=30.89\n")
        f.close()
        
    def _writeExpPathGFFFileReversed(self, inFileName):
        f = open(inFileName, 'w')
        f.write("##gff-version 3\n")
        f.write("##sequence-region lm_SuperContig_29_v2 1 120\n")
        f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch\t193781\t194212\t0.0\t-\t.\tID=ms1_lm_SuperContig_29_v2_1nc550_030 related to putative multidrug transporter Mfs1.1 (major facilitator family protein);Target=1nc550_030 related to putative multidrug transporter Mfs1.1 (major facilitator family protein) 85 228;Identity=30.56\n")
        f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch_part\t193781\t194212\t1e-40\t-\t.\tID=mp1-1_lm_SuperContig_29_v2_1nc550_030 related to putative multidrug transporter Mfs1.1 (major facilitator family protein);Parent=ms1_lm_SuperContig_29_v2_1nc550_030 related to putative multidrug transporter Mfs1.1 (major facilitator family protein);Target=1nc550_030 related to putative multidrug transporter Mfs1.1 (major facilitator family protein) 85 228;Identity=30.56\n")
        f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch\t192832\t193704\t0.0\t-\t.\tID=ms2_lm_SuperContig_29_v2_1nc550_030 related to putative multidrug transporter Mfs1.1 (major facilitator family protein);Target=1nc550_030 related to putative multidrug transporter Mfs1.1 (major facilitator family protein) 229 522;Identity=23.99\n")
        f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch_part\t192832\t193704\t1e-40\t-\t.\tID=mp2-1_lm_SuperContig_29_v2_1nc550_030 related to putative multidrug transporter Mfs1.1 (major facilitator family protein);Parent=ms2_lm_SuperContig_29_v2_1nc550_030 related to putative multidrug transporter Mfs1.1 (major facilitator family protein);Target=1nc550_030 related to putative multidrug transporter Mfs1.1 (major facilitator family protein) 229 522;Identity=23.99\n")
        f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch\t78031\t78588\t0.0\t-\t.\tID=ms3_lm_SuperContig_29_v2_xnc164_090 related to multidrug resistance protein;Target=xnc164_090 related to multidrug resistance protein 19 209\n")
        f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch_part\t78031\t78080\t3e-21\t-\t.\tID=mp3-1_lm_SuperContig_29_v2_xnc164_090 related to multidrug resistance protein;Parent=ms3_lm_SuperContig_29_v2_xnc164_090 related to multidrug resistance protein;Target=xnc164_090 related to multidrug resistance protein 19 209;Identity=30.89\n")
        f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch_part\t78081\t78588\t3e-21\t-\t.\tID=mp3-2_lm_SuperContig_29_v2_xnc164_090 related to multidrug resistance protein;Parent=ms3_lm_SuperContig_29_v2_xnc164_090 related to multidrug resistance protein;Target=xnc164_090 related to multidrug resistance protein 19 209;Identity=30.89\n")
        f.write("##FASTA\n")
        self._writeSeq1(f)
        f.close()
        
    def _writeExpSetGFFFile(self, inFileName):
        f = open(inFileName, 'w')
        f.write("##gff-version 3\n")
        f.write("##sequence-region lm_SuperContig_29_v2 1 120\n")
        f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch\t193781\t194212\t0.0\t+\t.\tID=ms1_lm_SuperContig_29_v2_set1;Target=set1 1 432\n")
        f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch_part\t193781\t194212\t0.0\t+\t.\tID=mp1-1_lm_SuperContig_29_v2_set1;Parent=ms1_lm_SuperContig_29_v2_set1;Target=set1 1 432\n")
        f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch\t192832\t193704\t0.0\t+\t.\tID=ms2_lm_SuperContig_29_v2_set2;Target=set2 1 873\n")
        f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch_part\t192832\t193704\t0.0\t+\t.\tID=mp2-1_lm_SuperContig_29_v2_set2;Parent=ms2_lm_SuperContig_29_v2_set2;Target=set2 1 873\n")
        f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch\t78031\t78588\t0.0\t+\t.\tID=ms3_lm_SuperContig_29_v2_set3;Target=set3 1 558\n")
        f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch_part\t78031\t78080\t0.0\t+\t.\tID=mp3-1_lm_SuperContig_29_v2_set3;Parent=ms3_lm_SuperContig_29_v2_set3;Target=set3 1 50\n")
        f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch_part\t78081\t78588\t0.0\t+\t.\tID=mp3-2_lm_SuperContig_29_v2_set3;Parent=ms3_lm_SuperContig_29_v2_set3;Target=set3 1 508\n")
        f.write("##FASTA\n")
        self._writeSeq1(f)
        f.close()
        
    def _writeExpSetGFFFileReversed(self, inFileName):
        f = open(inFileName, 'w')
        f.write("##gff-version 3\n")
        f.write("##sequence-region lm_SuperContig_29_v2 1 120\n")
        f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch\t193781\t194212\t0.0\t+\t.\tID=ms1_lm_SuperContig_29_v2_set1;Target=set1 1 432\n")
        f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch_part\t193781\t194212\t0.0\t+\t.\tID=mp1-1_lm_SuperContig_29_v2_set1;Parent=ms1_lm_SuperContig_29_v2_set1;Target=set1 1 432\n")
        f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch\t192832\t193704\t0.0\t+\t.\tID=ms2_lm_SuperContig_29_v2_set2;Target=set2 1 873\n")
        f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch_part\t192832\t193704\t0.0\t+\t.\tID=mp2-1_lm_SuperContig_29_v2_set2;Parent=ms2_lm_SuperContig_29_v2_set2;Target=set2 1 873\n")
        f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch\t78031\t78588\t0.0\t-\t.\tID=ms3_lm_SuperContig_29_v2_set3;Target=set3 1 558\n")
        f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch_part\t78031\t78080\t0.0\t-\t.\tID=mp3-1_lm_SuperContig_29_v2_set3;Parent=ms3_lm_SuperContig_29_v2_set3;Target=set3 1 50\n")
        f.write("lm_SuperContig_29_v2\tprojectName_REPET_TEs\tmatch_part\t78081\t78588\t0.0\t-\t.\tID=mp3-2_lm_SuperContig_29_v2_set3;Parent=ms3_lm_SuperContig_29_v2_set3;Target=set3 1 508\n")
        f.write("##FASTA\n")
        self._writeSeq1(f)
        f.close()
    
    def _writeFastaFile(self, inFileName):
        f = open(inFileName,'w')
        self._writeSeq2(f)
        self._writeSeq1(f)
        f.close()
        
    def _writeFastaFileExtended(self, inFileName):
        f = open(inFileName,'w')
        self._writeSeq2(f)
        self._writeSeq1(f)
        f.write(">chr1\n")
        f.write("CTAAGCTGCGCTATGTAG\n")
        f.close()
    
    def _writeSeq1(self, f):
        f.write('>lm_SuperContig_29_v2\n')
        f.write('CCTAGACAATTAATTATAATAATTAATAAACTATTAGGCTAGTAGTAGGTAATAATAAAA\n')
        f.write('GGATTACTACTAAGCTGCGCTATGTAGATATTTAAAACATGTGGCTTAGGCAAGAGTATA\n')

    def _writeSeq2(self, f):
        f.write('>lm_SuperContig_30_v2\n')
        f.write('TGTTCATATTCATAGGATGGAGCTAGTAAGCGATGTCGGCTTAGCTCATCCACATGAATG\n')
        f.write('CAGGAATCATGAAGGGTACGACTGTTCGTCGATTAAAGAGCTACACGAGCTGGGTTAAAT\n')
        
    def _writeFastaFile_DmelChr4(self, inFileName):
        f = open(inFileName,'w')
        f.write(">dmel_chr4\n")
        f.write("CTAAGCTGCGCTATGTAG\n")
        f.write(">dmel_chr1\n")
        f.write("CGTAACGCTAGCGCTTATAGTGAGC\n")
        f.close()


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