def _tag_select(mode):
    tag = input('Input tag: ').strip()
    if tag == '' or tag == 'None':
        tag == 'None'
    else:
        if tag in tagset:
            pass  #Just a pass. Do not implement anything.
        elif tag.upper() in ('HIS6', 'HIS-TAG', 'HISTAG', 'POLYHISTIDINE'):
            tag = 'His6'
        else:
            print('Warning:invalid tag name...')
            yn = input('Wish to handle the input as sequence literal? (y/n): ')
            if yn == 'y':
                comset = mode_set(mode)
                temp_tag = ''
                for char in tag:
                    if char in comset:
                        temp_tag += char
                    else:
                        print(
                            'Warning:Character \'' + char +
                            '\' is not a valid character in current mode and was ignored.'
                        )
                tag = temp_tag
            else:
                tag = _tag_select(mode)
    return tag
Esempio n. 2
0
    def _tag_select(self, mode):
        tag = self.buttonGroup.checkedButton().text()[2:].strip()

        if tag == 'Other sequence:':
            tag = self.text_tag.toPlainText()
            comset = mode_set(mode)
            temp_tag = ''
            check_err = 0
            for char in tag:
                if char in comset:
                    temp_tag += char
                else:
                    check_err += 1

            err_tag = '    ' + str(check_err) + ' INVALID CHARACTER(s) WERE IGNORED'
            tag = temp_tag
            self.wrn_tag.setText(err_tag)

        return tag
Esempio n. 3
0
    def _dna_select(self, dna, mode):

        lines = dna.split('\n')
        comset = mode_set(mode)
        out = []
        started = False
        temp_header = ''
        temp_seq = []
        temp_seq_list = []

        for line in lines:
            line_lstrip = line.lstrip()
            if line_lstrip.strip() == '':
                continue
            elif line_lstrip[0] == '>':
                if started:
                    if temp_seq_list == []:
                        break
                    else:
                        temp_seq = ''.join(temp_seq_list)
                        out.append((temp_header, temp_seq))
                else:
                    started = True
                temp_header = line[1:].rstrip()
                temp_seq_list = []
            elif line_lstrip[0] == ';':
                continue
            else:
                l = line_lstrip.strip().upper()
                for i in range(len(l)):
                    if l[i] in comset:
                        temp_seq_list.extend(l[i])
                    elif l[i].isalpha():
                        continue
                    else:
                        print('Error: character \"' + l[i] + '\" does not match with specified type \"' \
                              + mode + '\" in function fasta_reader(' + dna + ').')
        temp_seq = ''.join(temp_seq_list)
        out.append((temp_header, temp_seq))

        print(lines)

        return out
    def _tag_select(self, mode):
        tag = self.buttons_tag.checkedButton().text()

        if tag == 'Other:':
            tag = self.text_tag.toPlainText()
            comset = mode_set(mode)
            temp_tag = ''
            check_err = 0
            for char in tag:
                if char in comset:
                    temp_tag += char
                else:
                    check_err += 1

            self.popup_err('    ' + str(check_err) + ' INVALID CHARACTER(s) WERE IGNORED IN CUSTOM TAG')
            tag = temp_tag

        elif tag == 'His-Tag':
            tag = 'His6'
        else:
            tag = ''

        return tag