Skip to content

Commit

Permalink
Update rename_apollo_annotation.py
Browse files Browse the repository at this point in the history
  • Loading branch information
MichelMoser authored Jan 17, 2017
1 parent acca410 commit 8eba0c0
Showing 1 changed file with 1 addition and 36 deletions.
37 changes: 1 addition & 36 deletions tools/rename_apollo_annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

######################################
##
## USAGE: python rename-_apollo_annotation.py apollo.gff output.gff
## USAGE: python rename_apollo_annotation.py apollo.gff output.gff
##
#####################################

Expand All @@ -16,41 +16,6 @@
output_file = sys.argv[2]


def rev_comp(seq):
revcompl = lambda x: ''.join([{'N':'N','A':'T','C':'G','G':'C','T':'A'}[B] for B in x][::-1])
return revcompl(seq)

def get_mRNA(position_list, seq):
"""
given sequence, list of tuples of start and end positions of exons and gene name, create fasta output
"""
mRNA = ""
for start, end in position_list:
mRNA += seq[int(start):int(end)]

return mRNA


def fasta_iter(fasta_name):
"""
given a fasta file. yield tuples of header, sequence
"""

fh = open(fasta_name)
# ditch the boolean (x[0]) and just keep the header or sequence since
# we know they alternate.
fa_list = []
faiter = (x[1] for x in groupby(fh, lambda line: line[0] == ">"))
for header in faiter:
# drop the ">"
header = header.next()[1:].strip()
# join all sequence lines to one.
seq = "".join(s.strip() for s in faiter.next())
fa_list.append((header, seq))
#yield header, seq
return fa_list



gene = 0
counter = 0
Expand Down

0 comments on commit 8eba0c0

Please sign in to comment.