Beispiel #1
0
def getseqbyfeaturetuple(sequence, gfftuple):
    """ """
    seqpart = sequence[int(gfftuple[3]) - 1:int(gfftuple[4])]
    if gfftuple[5] == '-':
        return _reversecomplement(seqpart)
    else:
        return seqpart
Beispiel #2
0
def getseqbyfeaturetuple(sequence,gfftuple):
    """ """
    seqpart = sequence[int(gfftuple[3])-1:int(gfftuple[4])]
    if gfftuple[5] == '-':
        return _reversecomplement(seqpart)
    else:
        return seqpart
Beispiel #3
0
def _get_reverse_strand_coords_and_seqs(dnaseq, start, end):
    """
    TODO ....

    @type  dnaseq: string
    @param dnaseq: DNA sequence string

    @type  start: integer
    @param start:

    @type  end: integer
    @param end:

    @rtype:  tuple
    @return: (start,end,dnarevseq,protseq)
    """
    # obtain position of the exterior stop codons on the other strand
    # take care with EOF sequence; after while loop +3; so stop at -6 end
    if end >= len(dnaseq) - 6:
        # end offset already in the danger zone of reaching EOF sequence
        # shift untill in reach (3nt offset) of EOF sequence
        while end >= len(dnaseq) - 3:
            end -= 3
    else:
        while end < len(dnaseq) - 6:
            if dnaseq[end:end + 3].upper() in REV_STOP_CODONS: break
            end += 3
    # take care with EOF sequence; after while loop -3; so stop at +6 end
    if start < 6:
        # start offset already in the danger zone of reaching EOF sequence
        # shift untill in reach (3nt offset) of EOF sequence
        while start < 3:
            start += 3
    else:
        while start >= 6:
            if dnaseq[start - 3:start].upper() in REV_STOP_CODONS: break
            start -= 3
    # get DNA & Protein sequences on the reverse strand
    start -= 3
    end += 3
    dnarevseq = _reversecomplement(dnaseq[start:end])
    protseq = dna2protein(dnarevseq)
    # return coords & sequences
    return (start, end, dnarevseq, protseq)
Beispiel #4
0
def _get_reverse_strand_coords_and_seqs(dnaseq,start,end):
    """
    TODO ....

    @type  dnaseq: string
    @param dnaseq: DNA sequence string

    @type  start: integer
    @param start:

    @type  end: integer
    @param end:

    @rtype:  tuple
    @return: (start,end,dnarevseq,protseq)
    """
    # obtain position of the exterior stop codons on the other strand
    # take care with EOF sequence; after while loop +3; so stop at -6 end
    if end >= len(dnaseq)-6:
        # end offset already in the danger zone of reaching EOF sequence
        # shift untill in reach (3nt offset) of EOF sequence
        while end >= len(dnaseq)-3: end-=3
    else:
        while end < len(dnaseq)-6:
            if dnaseq[end:end+3].upper() in REV_STOP_CODONS: break
            end += 3
    # take care with EOF sequence; after while loop -3; so stop at +6 end
    if start < 6:
        # start offset already in the danger zone of reaching EOF sequence
        # shift untill in reach (3nt offset) of EOF sequence
        while start < 3: start += 3
    else:
        while start >= 6:
            if dnaseq[start-3:start].upper() in REV_STOP_CODONS: break
            start -= 3
    # get DNA & Protein sequences on the reverse strand
    start-=3
    end+=3
    dnarevseq = _reversecomplement(dnaseq[start:end])
    protseq   = dna2protein(dnarevseq)
    # return coords & sequences
    return (start,end,dnarevseq,protseq)