Skip to content
Snippets Groups Projects
Commit 2cee53f8 authored by Boris Jurič's avatar Boris Jurič
Browse files

Update src/poly_a.py

parent 0ecfcb13
No related branches found
No related tags found
No related merge requests found
Pipeline #14080 failed
...@@ -72,13 +72,12 @@ def generate_poly_a( ...@@ -72,13 +72,12 @@ def generate_poly_a(
def main(): def main():
"""Append poly A tails to fasta sequences and write to file """Append poly A tails to fasta sequences and write to file.
This function iterates over `input` fasta sequences from a specified file, This function iterates over `input` fasta sequences from a specified file,
appends tails of given `length` and composition specified by `weights`, appends tails of given `length` and composition specified by `weights`,
and writes them to file specified as `output`. and writes them to file specified as `output`.
""" """
parser = argparse.ArgumentParser(description='Process some integers.') parser = argparse.ArgumentParser(description='Process some integers.')
parser.add_argument('-i', '--input', required=True, parser.add_argument('-i', '--input', required=True,
help='Fasta file to add tails to') help='Fasta file to add tails to')
...@@ -91,7 +90,7 @@ def main(): ...@@ -91,7 +90,7 @@ def main():
args = parser.parse_args() args = parser.parse_args()
new_records = [] new_records = []
for fasta in SeqIO.parse(open(args.input),'fasta'): for fasta in SeqIO.parse(open(args.input), 'fasta'):
new_seq = fasta.seq + Seq(generate_poly_a(args.length, args.weights)) new_seq = fasta.seq + Seq(generate_poly_a(args.length, args.weights))
new_records.append(SeqRecord(new_seq, id=fasta.id, description=fasta.description)) new_records.append(SeqRecord(new_seq, id=fasta.id, description=fasta.description))
SeqIO.write(new_records, args.output, "fasta") SeqIO.write(new_records, args.output, "fasta")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment