INNER CODE UNIT · Python
__process_seqentry
Gabaldonlab/redundans · bin/FastaIndex.py:88
def __process_seqentry(self, out, header, seq, offset, pi):
"""Write stats to file and report any issues"""
if header:
# get seqid and sequence stats
seqid = self.get_id(header)
# catch empty headers
if not seqid:
self.log("[WARNING] No header at line: %s\n"%", ".join(map(str, (pi,seqid,header))))
return
stats = self.get_stats(header, seq, offset)
# warn about empty sequences
if not stats[0]:
self.log("[WARNING] No sequence for: %s at line: %s\n"%(seqid, pi))
# catch duplicates
if seqid in self.id2stats:
self.log("[WARNING] Duplicated sequence ID: %s at line: %s\n"%(seqid, pi))
self.id2stats[seqid] = stats
out.write("%s\t%s\n"%(seqid, "\t".join(map(str, stats))))