sALenght=len(SerieA)

 

# Loop the series and use all functions at once for [n,m) bases similarity

def allCompCheck (SerieA,sALenght,SerieTagsA):

    for i in range (n,m):

       print '------ ',i,' bases similarity ------'

       for j in range (0,sALenght):

           sequenceA=SerieA[j]  #appoint 1st sequence and avoid self and overlapped checking

           SerieTagA=SerieTagsA[j] #assign the oligo tags

           nextSequenceA=j+1

           for k in range (nextSequenceA,sALenght):

               sequenceB=SerieA[k]  #appoint 2nd sequence

               SerieTagB=SerieTagsA[k] #assign the oligo tags

               if 1>0:

                    compLetters={'a':'A', 't':'T', 'c':'C', 'g':'G','A':'A','T':'T'}

                    rightSequenceB=''

                    for letter in sequenceB:

                        if letter in compLetters:

                           rightSequenceB=rightSequenceB+compLetters[letter]  #reverse complementary of the 2nd sequence

                    checkNumber=0

                   rightSequenceBLenght=len(rightSequenceB)

                    CompFound=0

                    while checkNumber<=(rightSequenceBLenght-i): #break the sequence

                       rightSequenceBPart=rightSequenceB[checkNumber:checkNumber+i]

                       hitNumber=sequenceA.find(rightSequenceBPart) #find the complementarity

                        if hitNumber>=0:

                            CompFound=1

                            #print "There is complementarity in",hitNumber+1,"places"

                        checkNumber+=1

                    if CompFound==1:

                        #print sequenceA,'has complementary part in ',sequenceB

                       print SerieTagA,'has similarity with ',SerieTagB

                    #else:

                        #    print sequenceA,'has no complementary part in ',sequenceB