Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Serulab/Py4Bio
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Bassi committed Mar 4, 2017
2 parents ed1751f + 9b67baa commit e2a55c4
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
11 changes: 11 additions & 0 deletions code/ch15_1st/15_4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from Bio import SeqIO

INPUT_FILE = 'fasta22_out.fas'
OUTPUT_FILE = 'fasta33.fas'

with open(INPUT_FILE) as in_fh:
with open(OUTPUT_FILE, 'w') as out_fh:
for record in SeqIO.parse(in_fh,'fasta'):
# Modify description
record.description += '[Rattus norvegicus]'
SeqIO.write([record], out_fh, 'fasta')
9 changes: 9 additions & 0 deletions code/ch15_1st/15_5.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
INPUT_FILE = 'fasta22_out.fas'
OUTPUT_FILE = 'fasta33.fas'

with open(INPUT_FILE) as in_fh:
with open(OUTPUT_FILE, 'w') as out_fh:
for line in in_fh:
if line.startswith('>'):
line = line.replace('\n', '[Rattus norvegicus]\n')
out_fh.write(line)
9 changes: 9 additions & 0 deletions code/ch15_1st/fasta33.fas
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
>SSR86 [ssr] : Tomato-EXPEN 2000 map, chr 3[Rattus norvegicus]
AGGCCAGCCCCCTTTTCCCTTAAGAACTCTTTGTGAGCTTCCCGCGGTGGCGGCCGCTCT
AG
>SSR252 [ssr][Rattus norvegicus]
TGGGCAGAGGAGCTCGTANGCATACCGCGAATTGGGTACACTTACCTGGTACCCCACCCG
GGTGGAAAATCGATGGGCCCGCGGCCGCTCTAGAAGTACTCTCTCTCT
>SSR257 [ssr][Rattus norvegicus]
TGAGAATGAGCACATCGATACGGCAATTGGTACACTTACCTGCGACCCCACCCGGGTGGA
AAATCGATGGGCCCGCGGCC

0 comments on commit e2a55c4

Please sign in to comment.