def append_to_description(seqrecord, text): 'it appends the text to the seqrecord description' desc = get_description(seqrecord) if desc in (None, get_name(seqrecord), '<unknown description>'): desc = '' desc += text seqrecord.object.description = desc
def _read_estcan_result(fhand, result, file_type): 'It reads a dna or pep ESTscan result file' for seq in read_seqs([fhand], file_format='fasta'): items = [i.strip() for i in get_description(seq).split(';')] strand = -1 if 'minus strand' in items else 1 start, end = items[0].split(' ', 3)[1:3] # estscan changes the name, we have to fix it seqid = get_name(seq).strip(';') try: seq_orfs = result[seqid] except KeyError: seq_orfs = {} result[seqid] = seq_orfs orf_key = (int(start), int(end), strand) if orf_key in seq_orfs: orf = seq_orfs[orf_key] else: orf = {} seq_orfs[orf_key] = orf orf[file_type] = get_str_seq(seq)