Commit 8308e914 authored by Mathieu Giraud's avatar Mathieu Giraud

germline/fasta.py: revcomp() does not fail when a nucleotide is unknown

parent 00c82a62
import sys
COMPLEMENT_NUCLEOTIDE = {
'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C',
......@@ -18,7 +18,11 @@ def revcomp(seq):
'''
rc = ''
for nucl in seq[::-1]:
rc += COMPLEMENT_NUCLEOTIDE[nucl.upper()]
try:
rc += COMPLEMENT_NUCLEOTIDE[nucl.upper()]
except:
sys.stderr.write("! Unknown nucleotide : '%s' " % nucl + seq)
rc += 'N'
return rc
def parse(fasta, endline=''):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment