python 3.x - How to read multiple lines input as single input using Python3? -
input file :
>sp|p31946|1433b_human 14-3-3 protein beta/alpha os=homo sapiens gn=ywhab pe=3 sv=3 mtmdkselvqkaklaeqaeryddmaaamkavteqghelsneernllsvayknvvgarrss wrvissieqkternekkqqmgkeyrekieaelqdicndvlelldkylipnatqpeskvfy >sp|p62258|1433e_human 14-3-3 protein epsilon os=homo sapiens gn=ywhae pe=1 sv=1 mddredlvyqaklaeqaerydemvesmkkvagmdveltveernllsvayknvigarrasw riissieqkeenkggedklkmireyrqmvetelkliccdildvldkhlipaantgeskvf
expected output :
sp|p62258|1433e_human 14-3-3 protein epsilon os=homo sapiens gn=ywhae pe=1 sv=1 mddredlvyqaklaeqaerydemvesmkkvagmdveltveernllsvayknvigarrasw riissieqkeenkggedklkmireyrqmvetelkliccdildvldkhlipaantgeskvf
code written far:
#!/usr/bin/python import re fh = open("test_seq") line in fh: if line.startswith('>'): if re.search('pe=1',line): print line
append lines , function single string.
python-3.x
No comments:
Post a Comment