From 559456bbcbbe70a9cec7349aa8ea30f11236b33d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bertrand=20N=C3=A9ron?= <bneron@pasteur.fr> Date: Tue, 25 Nov 2014 18:29:03 +0100 Subject: [PATCH] fix fasta_to_one_line function --- source/Data_Types.rst | 11 ++++++----- source/_static/code/fasta_to_one_line.py | 6 +++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/source/Data_Types.rst b/source/Data_Types.rst index 65de161..100eee4 100644 --- a/source/Data_Types.rst +++ b/source/Data_Types.rst @@ -181,8 +181,8 @@ create a representation in fasta format of following sequence : Exercise -------- -For the following exercise use the python file :download:`sv40 in fasta <_static/code/sv40.py>` which is a python file with the sequence of sv40 in fasta format -already embeded, and use python -i sv40.py to work. +For the following exercise use the python file :download:`sv40 in fasta <_static/code/sv40_file.py>` which is a python file with the sequence of sv40 in fasta format +already embeded, and use python -i sv40_file.py to work. how long is the sv40 in bp? Hint : the fasta header is 61bp long. @@ -212,14 +212,15 @@ pseudocode: :: python - >>> import sv40 + >>> import sv40_file >>> import fasta_to_one_line >>> - >>> sv40seq = fasta_to_one_line(sv40) - >>> print len(sv40_sequence) + >>> sv40_seq = fasta_to_one_line(sv40_file.sv40_fasta) + >>> print len(sv40_seq) 5243 Is that the following enzymes: + * BamHI (ggatcc), * EcorI (gaattc), * HindIII (aagctt), diff --git a/source/_static/code/fasta_to_one_line.py b/source/_static/code/fasta_to_one_line.py index 6ef59c0..86b86b9 100644 --- a/source/_static/code/fasta_to_one_line.py +++ b/source/_static/code/fasta_to_one_line.py @@ -1,7 +1,7 @@ -def fasta_2_one_line(seq): - header_end_at = find('\n') - seq = seq[:header_end_at + 1] +def fasta_to_one_line(seq): + header_end_at = seq.find('\n') + seq = seq[header_end_at + 1:] seq = seq.replace('\n', '') return seq -- GitLab