Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@raises(FetchError)
def test_bounds_error(self):
result = self.genes_buffer['KF435150.1'][100-1:15000].seq.lower()
@raises(FetchError)
def test_fetch_past_bounds(self):
""" Fetch past the end of a gene entry """
faidx = Faidx('data/genes.fasta', strict_bounds=True)
result = faidx.fetch('gi|557361099|gb|KF435150.1|',
480, 5000)
@raises(FetchError)
def test_fetch_error(self):
main(['data/genes.fasta', 'gi|557361099|gb|KF435150.1|:1-1000'])
@raises(FetchError)
def test_fetch_border(self):
""" Fetch past the end of a gene entry """
faidx = Faidx('data/genes.fasta.gz')
expect = 'TC'
result = faidx.fetch('gi|557361099|gb|KF435150.1|',
480, 500)
print(result)
assert str(result) == expect
@raises(FetchError)
def test_fetch_negative(self):
""" Fetch starting with a negative coordinate """
faidx = Faidx('data/genes.fasta.gz', strict_bounds=True)
result = faidx.fetch('gi|557361099|gb|KF435150.1|',
-10, 10)
@raises(FetchError)
def test_fetch_negative(self):
""" Fetch starting with a negative coordinate """
faidx = Faidx('data/genes.fasta', strict_bounds=True)
result = faidx.fetch('gi|557361099|gb|KF435150.1|',
-10, 10)
outfile = open(filename, 'w')
elif args.out:
outfile = args.out
else:
outfile = sys.stdout
try:
if args.transform:
if not header and args.transform == 'nucleotide':
outfile.write("name\tstart\tend\tA\tT\tC\tG\tN\tothers\n")
header = True
outfile.write(transform_sequence(args, fasta, name, start, end))
else:
for line in fetch_sequence(args, fasta, name, start, end):
outfile.write(line)
except FetchError as e:
raise FetchError(str(e) + " Try setting --lazy.\n")
if args.split_files:
outfile.close()
fasta.__exit__()
filename = ''.join(c for c in filename if c.isalnum() or c in keepcharacters)
outfile = open(filename, 'w')
elif args.out:
outfile = args.out
else:
outfile = sys.stdout
try:
if args.transform:
if not header and args.transform == 'nucleotide':
outfile.write("name\tstart\tend\tA\tT\tC\tG\tN\tothers\n")
header = True
outfile.write(transform_sequence(args, fasta, name, start, end))
else:
for line in fetch_sequence(args, fasta, name, start, end):
outfile.write(line)
except FetchError as e:
raise FetchError(str(e) + " Try setting --lazy.\n")
if args.split_files:
outfile.close()
fasta.__exit__()