Exemplo n.º 1
0
def ask_if_copy_to_clipboard(fasta, auto_yes):
    '''Ask the user if the FASTA sequence should be copied to the clipboard,
    if we're not told to automatically do so.'''
    if not auto_yes:
        user_interaction.ask_yes_no("Copy to clipboard", "Alright then. Bye!")
    pyperclip.copy(fasta)
    print "FASTA sequence copied to clipboard."
def ask_if_copy_to_clipboard(fasta, auto_yes):
    '''Ask the user if the FASTA sequence should be copied to the clipboard,
    if we're not told to automatically do so.'''
    if not auto_yes:
        user_interaction.ask_yes_no("Copy to clipboard", "Alright then. Bye!")
    pyperclip.copy(fasta)
    print "FASTA sequence copied to clipboard."
caption = "n/a"
title = "n/a"
extra = "n/a"

for item in root.iter("Item"):
    if item.attrib["Name"] == "Caption":
        caption = item.text
    if item.attrib["Name"] == "Title":
        title = item.text
    if item.attrib["Name"] == "Extra":
        extra = item.text

generate_output.print_summary(caption, title, extra)

if not args.yestoall:
    user_interaction.ask_yes_no("\nIs this the result you were looking for",
                                "Sorry about that.")

fasta = get_from_url(url_construction.construct_fetch_url(database,
                                                          results_id,
                                                          sequence_format))

# Final sequence output
generate_output.print_fasta(fasta)
if args.output_file:
    # Write the sequence to the specified filename.
    generate_output.write_sequence_to_file(fasta, args.output_file)
else:
    # Copy the sequence to the clipboard
    generate_output.ask_if_copy_to_clipboard(fasta, args.yestoall)

exit(0)
caption = "n/a"
title = "n/a"
extra = "n/a"

for item in root.iter("Item"):
    if item.attrib["Name"] == "Caption":
        caption = item.text
    if item.attrib["Name"] == "Title":
        title = item.text
    if item.attrib["Name"] == "Extra":
        extra = item.text

generate_output.print_summary(caption, title, extra)

if not args.yestoall:
    user_interaction.ask_yes_no("\nIs this the result you were looking for",
                                "Sorry about that.")

fasta = get_from_url(
    url_construction.construct_fetch_url(database, results_id,
                                         sequence_format))

# Final sequence output
generate_output.print_fasta(fasta)
if args.output_file:
    # Write the sequence to the specified filename.
    generate_output.write_sequence_to_file(fasta, args.output_file)
else:
    # Copy the sequence to the clipboard
    generate_output.ask_if_copy_to_clipboard(fasta, args.yestoall)

exit(0)