serulab / py4bio Goto Github PK
View Code? Open in Web Editor NEWPublic data for the book Python for Bioinformatics
License: MIT License
Public data for the book Python for Bioinformatics
License: MIT License
Dear Seulab,
When running muscleserver.py, I got two errors.
File "muscleserver.py", line 38, in result
fi_fh.write(sequence)
TypeError: a bytes-like object is required, not 'str'
% if bad_option:
NameError: name 'bad_option' is not defined
For the latter one, I fixed it by changing "bad_opt" in line 55 to "bad_option".
And for the former one, I changed "fi_fh.write(sequence)" in line 38 to "fi_fh.write(sequence.encode(โutf-8โ))" but I'm not sure this is right way.
Could you give me some advice?
[murphy@eva02 ch4]$ python3 protnetcharge.py
Enter protein sequence: KVFGRCELAAAMKRHGLDNYRGYSLGNWVCAAKFESNFNTQATNRNTDGSTDYGILQINSRWWCNDGRTPGSRNLCNIPCSALLSSDITASVNCAKKIVSDGNGMNAWVAWRNRCKGTDVQAWIRGCRL
7.736999999999999
[murphy@eva02 ch4]$ python3 protnetcharge2.py
File "protnetcharge2.py", line 8
nd{verbatim}
^
SyntaxError: invalid syntax
[murphy@eva02 ch4]$ cat protnetcharge2.py
prot_seq = input('Enter protein sequence: ').upper()
charge = -0.002
aa_charge = {'C':-.045,'D':-.999,'E':-.998,'H':.091,
'K':1,'R':1,'Y':-.001}
for aa in prot_seq:
charge += aa_charge.get('aa', 0)
print(charge)
nd{verbatim}
[murphy@eva02 ch4]$ vim protnetcharge2.py
[murphy@eva02 ch4]$ head -n 7 protnetcharge2.py > pnc2.py
[murphy@eva02 ch4]$ tail pnc2.py
prot_seq = input('Enter protein sequence: ').upper()
charge = -0.002
aa_charge = {'C':-.045,'D':-.999,'E':-.998,'H':.091,
'K':1,'R':1,'Y':-.001}
for aa in prot_seq:
charge += aa_charge.get('aa', 0)
print(charge)
[murphy@eva02 ch4]$ python3 pnc2.py
Enter protein sequence: KVFGRCELAAAMKRHGLDNYRGYSLGNWVCAAKFESNFNTQATNRNTDGSTDYGILQINSRWWCNDGRTPGSRNLCNIPCSALLSSDITASVNCAKKIVSDGNGMNAWVAWRNRCKGTDVQAWIRGCRL
-0.002
Dear @sbassi,
When I run primer3 using the file generated with primer31.py I got the following error.
$ ./primer3_core < swforprimer3.txt
...
PRIMER_PRODUCT_SIZE_RANGE=45-57544
PRIMER_ERROR=thermodynamic approach chosen, but path to thermodynamic parameters not specified
=
I fixed it by changing the template like this,
https://github.com/Serulab/Py4Bio/tree/master/code/ch17
PRIMER_SEQUENCE_ID={title}
SEQUENCE_TEMPLATE={seq}
TARGET={pos},{win_size}
PRIMER_OPT_SIZE=18
PRIMER_MIN_SIZE=15
PRIMER_MAX_SIZE=20
PRIMER_NUM_NS_ACCEPTED=0
PRIMER_EXPLAIN_FLAG=1
PRIMER_PRODUCT_SIZE_RANGE={win_size}-{len_seq}
PRIMER_THERMODYNAMIC_PARAMETERS_PATH=primer3-2.4.0/src/primer3_config/
=
https://www.biostars.org/p/355320/
https://primer3.org/manual.html#inputOutputConventions
Could you check these and give me any advice?
Best regards,
kzfm
[murphy@eva02 ch4]$ python3 seachindict.py
Traceback (most recent call last):
File "seachindict.py", line 4, in <module>
print(color_code[name])
TypeError: list indices must be integers or slices, not str
[murphy@eva02 ch4]$ cat seachindict.py
color_code = [('red',1), ('green',2), ('blue',3), ('black',4)]
name = 'blue'
color_code_d = dict(color_code)
print(color_code[name])
[murphy@eva02 ch4]$ python
Python 3.7.4 (default, Aug 12 2019, 14:45:07)
[GCC 9.1.1 20190605 (Red Hat 9.1.1-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> color_code = [('red',1), ('green',2), ('blue',3), ('black',4)]
>>> name = 'blue'
>>> color_code_d = dict(color_code)
>>> print(color_code[name])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: list indices must be integers or slices, not str
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.