# Path: SDDetector/Utils/EffectPredictor.py
# class EffectPredictor(object):
# 
#     effects = []
# 
#     def __init__(self):
#         """Constructor"""
#         pass
# 
# 
#     def run(self):
#         pass
# 
# 
#     def extractVariantFromAlignment(self,seq1,seq2):
#         """def
# 
#             Sequence analyzed only on CDS part.
#             If gene splitting, the CDS part is analyzed in 
#             case of a symetric CDS
#         """
# 
#         nbSNPs = 0
#         nbInDels = 0
#         seq1PreviousNt = None
#         seq2PreviousNt = None
#         for i in range(0, len(seq1)):
#             if seq1[i] != seq2[i] and seq1[i] != '.' and seq2[i] != '.':
#                 nbSNPs += 1
#             if seq1[i] == '.' and seq1PreviousNt != '.':
#                 nbInDels += 1
#             if seq2[i] == '.' and seq2PreviousNt != '.':
#                 nbInDels += 1
#             seq1PreviousNt = seq1[i]
#             seq2PreviousNt = seq2[i]
# 
#         return (nbSNPs,nbInDels)
# 
# 
# 
# 
#     def basicStructureAnalysis(self,gene1,gene2):
#         """ exons structure
# 
#             possible return value: 
#             - None : no effect, same structure nb exon/ size
#             - SIZE : At least one exon as not the same size, the number of exon is the same
#             - EXON : The number of exons is different, and possibly the size
#         """
# 
#         lGene1CDSSizes = []
#         lGene2CDSSizes = [] 
#         for CDS in gene1.lTranscripts[0].lCDS:
#             lGene1CDSSizes.append(CDS.end-CDS.start)
#         for CDS in gene2.lTranscripts[0].lCDS:
#             lGene2CDSSizes.append(CDS.end-CDS.start)
#         if gene1.lTranscripts[0].strand == -1:
#             lGene1CDSSizes.reverse()
#         if gene2.lTranscripts[0].strand == -1:
#             lGene2CDSSizes.reverse()
#         
#         if len(lGene1CDSSizes) == len(lGene2CDSSizes):
#             if sum(lGene1CDSSizes) != sum(lGene2CDSSizes):
#                 return 'SIZE'
#             else:
#                 return None
#         else:
#             return 'EXON'
# 
# Path: SDDetector/Entities/Gene.py
# class Gene(object):
# 
# 
#     def __init__(self, id, seqid, start, end, strand, lTranscripts=[]):
#         """Gene constructor"""
# 
#         self.id = id
#         self.seqid = seqid
#         self.start = start
#         self.end = end
#         self.strand = strand
#         self.lTranscripts = lTranscripts
# 
#     def __eq__(self, other):
#         """Equality on all args"""
#       
#         return ((self.id,self.seqid,self.start,self.end,self.strand, self.lTranscripts) == (other.id, other.seqid, other.start, other.end, other.strand, other.lTranscripts))
# 
#     def __repr__(self):
#         """Gene representation"""
# 
#         return 'Gene: {}-{}-{}-{}-{}-{}'.format(self.id,self.seqid,self.start,self.end,self.strand, self.lTranscripts)
# 
# Path: SDDetector/Entities/Transcript.py
# class Transcript(object):
# 
# 
#     def __init__(self, id, seqid, start, end, strand, gene_id, lCDS=[]):
#         """Transcript constructor"""
# 
#         self.id = id
#         self.seqid = seqid
#         self.start = start
#         self.end = end
#         self.strand = strand
#         self.gene_id = gene_id
#         self.lCDS = lCDS
# 
#     def __eq__(self, other):
#         """Equality on all args"""
#       
#         return ((self.id,self.seqid,self.start,self.end,self.strand,self.lCDS, self.gene_id) == (other.id, other.seqid, other.start, other.end, other.strand, other.lCDS, other.gene_id))
# 
#     def __repr__(self):
#         """Transcript representation"""
# 
#         return 'Transcript: {}-{}-{}-{}-{}-{}-{}'.format(self.id,self.seqid,self.start,self.end,self.strand,self.lCDS, self.gene_id)
# 
# Path: SDDetector/Entities/CDS.py
# class CDS(object):
# 
# 
#     def __init__(self,cds_id, seqid, start, end, strand, transcript_id):
#         """Transcript constructor"""
# 
#         self.cds_id = cds_id
#         self.seqid = seqid
#         self.start = start
#         self.end = end
#         self.strand = strand
#         self.transcript_id = transcript_id
# 
#     def __eq__(self, other):
#         """Equality on all args"""
#       
#         return ((self.cds_id,self.seqid,self.start,self.end,self.strand,self.transcript_id) == (other.cds_id,other.seqid, other.start, other.end, other.strand, other.transcript_id))
# 
#     def __repr__(self):
#         """CDS representation"""
# 
#         return 'CDS: {}'.format(self.cds_id)


import unittest
from SDDetector.Utils.EffectPredictor import EffectPredictor
from SDDetector.Entities.Gene import Gene
from SDDetector.Entities.Transcript import Transcript
from SDDetector.Entities.CDS import CDS
#!/usr/bin/env python



class TestEffectPredictor(unittest.TestCase):

    def setUp(self):
        pass

    def tearDown(self):
        pass

    def test_basicStructureAnalysis(self):
        """ test """

        EP = EffectPredictor()

# Path: SDDetector/Utils/EffectPredictor.py
# class EffectPredictor(object):
# 
#     effects = []
# 
#     def __init__(self):
#         """Constructor"""
#         pass
# 
# 
#     def run(self):
#         pass
# 
# 
#     def extractVariantFromAlignment(self,seq1,seq2):
#         """def
# 
#             Sequence analyzed only on CDS part.
#             If gene splitting, the CDS part is analyzed in 
#             case of a symetric CDS
#         """
# 
#         nbSNPs = 0
#         nbInDels = 0
#         seq1PreviousNt = None
#         seq2PreviousNt = None
#         for i in range(0, len(seq1)):
#             if seq1[i] != seq2[i] and seq1[i] != '.' and seq2[i] != '.':
#                 nbSNPs += 1
#             if seq1[i] == '.' and seq1PreviousNt != '.':
#                 nbInDels += 1
#             if seq2[i] == '.' and seq2PreviousNt != '.':
#                 nbInDels += 1
#             seq1PreviousNt = seq1[i]
#             seq2PreviousNt = seq2[i]
# 
#         return (nbSNPs,nbInDels)
# 
# 
# 
# 
#     def basicStructureAnalysis(self,gene1,gene2):
#         """ exons structure
# 
#             possible return value: 
#             - None : no effect, same structure nb exon/ size
#             - SIZE : At least one exon as not the same size, the number of exon is the same
#             - EXON : The number of exons is different, and possibly the size
#         """
# 
#         lGene1CDSSizes = []
#         lGene2CDSSizes = [] 
#         for CDS in gene1.lTranscripts[0].lCDS:
#             lGene1CDSSizes.append(CDS.end-CDS.start)
#         for CDS in gene2.lTranscripts[0].lCDS:
#             lGene2CDSSizes.append(CDS.end-CDS.start)
#         if gene1.lTranscripts[0].strand == -1:
#             lGene1CDSSizes.reverse()
#         if gene2.lTranscripts[0].strand == -1:
#             lGene2CDSSizes.reverse()
#         
#         if len(lGene1CDSSizes) == len(lGene2CDSSizes):
#             if sum(lGene1CDSSizes) != sum(lGene2CDSSizes):
#                 return 'SIZE'
#             else:
#                 return None
#         else:
#             return 'EXON'
# 
# Path: SDDetector/Entities/Gene.py
# class Gene(object):
# 
# 
#     def __init__(self, id, seqid, start, end, strand, lTranscripts=[]):
#         """Gene constructor"""
# 
#         self.id = id
#         self.seqid = seqid
#         self.start = start
#         self.end = end
#         self.strand = strand
#         self.lTranscripts = lTranscripts
# 
#     def __eq__(self, other):
#         """Equality on all args"""
#       
#         return ((self.id,self.seqid,self.start,self.end,self.strand, self.lTranscripts) == (other.id, other.seqid, other.start, other.end, other.strand, other.lTranscripts))
# 
#     def __repr__(self):
#         """Gene representation"""
# 
#         return 'Gene: {}-{}-{}-{}-{}-{}'.format(self.id,self.seqid,self.start,self.end,self.strand, self.lTranscripts)
# 
# Path: SDDetector/Entities/Transcript.py
# class Transcript(object):
# 
# 
#     def __init__(self, id, seqid, start, end, strand, gene_id, lCDS=[]):
#         """Transcript constructor"""
# 
#         self.id = id
#         self.seqid = seqid
#         self.start = start
#         self.end = end
#         self.strand = strand
#         self.gene_id = gene_id
#         self.lCDS = lCDS
# 
#     def __eq__(self, other):
#         """Equality on all args"""
#       
#         return ((self.id,self.seqid,self.start,self.end,self.strand,self.lCDS, self.gene_id) == (other.id, other.seqid, other.start, other.end, other.strand, other.lCDS, other.gene_id))
# 
#     def __repr__(self):
#         """Transcript representation"""
# 
#         return 'Transcript: {}-{}-{}-{}-{}-{}-{}'.format(self.id,self.seqid,self.start,self.end,self.strand,self.lCDS, self.gene_id)
# 
# Path: SDDetector/Entities/CDS.py
# class CDS(object):
# 
# 
#     def __init__(self,cds_id, seqid, start, end, strand, transcript_id):
#         """Transcript constructor"""
# 
#         self.cds_id = cds_id
#         self.seqid = seqid
#         self.start = start
#         self.end = end
#         self.strand = strand
#         self.transcript_id = transcript_id
# 
#     def __eq__(self, other):
#         """Equality on all args"""
#       
#         return ((self.cds_id,self.seqid,self.start,self.end,self.strand,self.transcript_id) == (other.cds_id,other.seqid, other.start, other.end, other.strand, other.transcript_id))
# 
#     def __repr__(self):
#         """CDS representation"""
# 
#         return 'CDS: {}'.format(self.cds_id)


# Path: tests/test_EffectPredictor.py
import unittest
from SDDetector.Utils.EffectPredictor import EffectPredictor
from SDDetector.Entities.Gene import Gene
from SDDetector.Entities.Transcript import Transcript
from SDDetector.Entities.CDS import CDS

#!/usr/bin/env python



class TestEffectPredictor(unittest.TestCase):

    def setUp(self):
        pass

    def tearDown(self):
        pass

    def test_basicStructureAnalysis(self):
        """ test """

        EP = EffectPredictor()

        g1 = Gene('G00001','Chr1',23988,24919,-1,[Transcript('G00001.1','Chr1',23988,24919,-1,'G00001',[CDS('G00001.1_cds_1','Chr1',23988,24083, -1, 'G00001.1'),CDS('G00001.1_cds_1','Chr1',24274,24427,-1,'G00001.1'),CDS('G00001.1_cds_1','Chr1',24489,24919,-1,'G00001.1')])])