Workflow for identifying and classifying homologous gene/protein sequences

public public 1yr ago Version: v3.0 0 bookmarks

Introduction

A nalysis of MO lecular E volution with BA tch E ntry (AMOEBAE) is a customizable bioinformatics workflow for identifying homologues (and potential orthologues) of genes of interest among a mid-size sampling of genomes. This workflow is designed to be run on high-performance computing (HPC) clusters and is executed via the SnakeMake workflow management system. Code for steps in this workflow is written primarily in Python3 , relying heavily on the Biopython library, and apply bioinformatics packages including BLAST+ and HMMER3 to input data files. AMOEBAE is open-source, and all dependencies are freely available. Lael D. Barlow is the author.

AMOEBAE is useful for certain mid-scale comparative genomics studies that might otherwise require time-intensive and repetitive manual/visual manipulation of data. Webservices such as those provided by NCBI and EMBL-EBI provide a means to readily investigate the evolution of one or a few genes via similarity searching, and large-scale analysis workflows such as OrthoMCL and OrthoFinder attempt to rapidly perform orthology prediction for all genes among several genomes. AMOEBAE addresses analyses which are too cumbersome to be performed via webservices or simple scripts and yet require a level of detail and flexibility not offered by large-scale analysis workflows. AMOEBAE is useful for analyzing the distribution of homologues of up to approximately 30 genes/proteins among a sampling of no more than approximately 100 eukaryotic genomes, especially when follow-up with custom phylogenetic analysis is planned.

AMOEBAE serves this purpose by providing several unique features. The core functionality of AMOEBAE is to run sequence similarity searches with multiple algorithms, multiple queries, and multiple databases simultaneously and to allow highly customizable implementation of reciprocal-best-hit search strategies. The output includes detailed summaries of results in the form of a spreadsheet and presence/absence plots. A particular advantage of AMOEBAE compared to other workflows is its functionality for parsing results of TBLASTN (which searches nucleotide sequences with peptide sequence queries) search results. This allows rapid identification of High-scoring Segment Pair (HSP) clusters at separate gene loci, automatic checking of those loci against information in genome annotation files, and systematic use of the Exonerate package where possible for obtaining exon predictions. In addition, AMOEBAE provides many options which can be tailored to the specific genes/proteins being analyzed. Despite the complexity of this workflow, analyses performed using AMOEBAE can be reproduced via SnakeMake .

The output files include a plot of the number of identified homologues (potential orthologues) of several genes across several genomes, as well as a spreadsheet in CSV format providing a detailed summary of search results.

Here's a diagram of the steps in the overall workflow:

Here's an example coulson plot output by the workflow:

Protocol

See the workflow protocol for instructions and guidelines for running the AMOEBAE workflow.

Questions and bug reporting

Please use the issue tracker on the GitHub webpage to report any problems you encounter while using AMOEBAE.

How to cite AMOEBAE

Please cite the AMOEBAE GitHub repository (or alternative permanent repositories if relevant).

Acknowledgments

AMOEBAE was initially developed at the Dacks Laboratory at the University of Alberta, and was supported by National Sciences and Engineering Council of Canada (NSERC) Discovery grants RES0021028, RES0043758, and RES0046091 awarded to Joel B. Dacks, as well as an NSERC Postgraduate Scholarship-Doctoral awarded to Lael D. Barlow.

We acknowledge the support of the Natural Sciences and Engineering Research Council of Canada (NSERC).

Cette recherche a été financée par le Conseil de recherches en sciences naturelles et en génie du Canada (CRSNG).

Also, help with testing AMOEBAE has been kindly provided by numerous members of the Dacks laboratory.

License

Copyright 2018 Lael D. Barlow

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Code Snippets

2
3
4
5
6
7
DOCTEX=amoebae_commands
pdflatex --shell-escape $DOCTEX.tex &&\
bibtex $DOCTEX &&\
makeglossaries $DOCTEX &&\
pdflatex --shell-escape $DOCTEX.tex &&\
pdflatex --shell-escape $DOCTEX.tex
106
107
108
109
run:
    for rule in workflow.rules:
        print(rule.name)
        print(rule.docstring)
123
124
125
126
shell:
    """
	python3 {input.script} {input.csv_file} results/temp_databases
    """
143
144
145
146
147
148
shell:
    """
	python3 {input.script} {input.csv_file} \
            results/temp_single_seq_queries \
            results/temp_multi_seq_queries
    """
176
177
178
179
180
181
182
183
184
shell:
    'sc=$( python3 {input.split_char_script} ' + database_csv + ' {input.input_file} ) && '
    'sp=$( python3 {input.split_pos_script} ' + database_csv + ' {input.input_file} ) && '
    'python3 {input.amoebae_script} '
     'add_to_dbs '
         '{input.input_file} '
         '{input.data_dir} '
         '--split_char $sc '
         '--split_pos $sp '
212
213
214
215
216
217
218
219
220
shell:
    'sc=$( python3 {input.split_char_script} ' + database_csv + ' {input.input_file} ) && '
    'sp=$( python3 {input.split_pos_script} ' + database_csv + ' {input.input_file} ) && '
    'python3 {input.amoebae_script} '
        'add_to_dbs '
            '{input.input_file} '
            '{input.data_dir} '
                 '--split_char $sc '
                 '--split_pos $sp '
243
244
245
246
247
shell:
    'python3 {input.amoebae_script} '
    'add_to_queries '
        '{input.input_file} '
        '{input.data_dir} '
271
272
273
274
275
shell:
    'python3 {input.amoebae_script} '
    'add_to_queries '
        '{input.input_file} '
        '{input.data_dir} '
296
297
298
299
300
shell:
    'python3 {input.amoebae_script} '
        'align_fa '
            '{input.input_file} '
            '--output_format fasta '
323
324
325
326
327
shell:
    'python3 {input.amoebae_script} '
       'add_to_queries '
           '{input.input_file} '
           '{input.data_dir} '
351
352
353
354
355
shell:
    'python3 {input.amoebae_script} '
       'add_to_queries '
           '{input.input_file} '
           '{input.data_dir} '
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
run:
    # Get list of .faa and .fna database files (excluding .gff3 files).
    fa_database_names_all = [x for x in database_names_all if \
                             x.endswith('.faa') or x.endswith('.fna')]

    # Get alignment names from multifasta names.
    alignment_fasta_query_names = [x.rsplit('.', 1)[0] + '.afaa' for x in \
    multi_fasta_query_names_all]

    # Write lists to files.
    with open(output.dbs, 'w') as dbsfh, open(output.queries, 'w') as queriesfh:
        # Write database name list to file.
        dbsfh.write('\n'.join(fa_database_names_all))
        # Write query name list to file.
        queriesfh.write('\n'.join(single_fasta_query_names_all + alignment_fasta_query_names))

    # Write basic pre-filled coulson plot organization CSV file.
    with open(output.coulson_plot_org, 'w') as coulson_plot_org:
        # Make a non-redundant list of query names.
        nonredun_query_names = list(set(single_fasta_query_names_all + \
                               alignment_fasta_query_names))

        # Get a list of just the query titles from the query names.
        nonredun_query_titles = list(set([x.split('_', 1)[0].rsplit('.', 1)[0] for x in nonredun_query_names]))
        nonredun_query_titles.sort()

        # Write lines, just using the first character of the query name as the
        # category name.
        for i in nonredun_query_titles:
            coulson_plot_org.write(i[0] + ',' + i + '\n')
430
431
432
433
434
435
436
437
438
439
440
441
442
shell:
    'python3 {input.amoebae_script} ' + \
        'get_redun_hits ' + \
            'results/Ref_seqs_1 ' + \
            'results/AMOEBAE_Data ' + \
            '--db_list_file {input.db_list_file} ' + \
            '--query_list_file {input.query_list_file} ' + \
            '--csv_file ' + \
            'results/Ref_seqs_1/0_ref_seqs.csv ' + \
            '--predict_redun_hit_selection ' + \
            '--max_number_of_hits_to_summarize 200 ' + \
    ' && cp results/Ref_seqs_1/0_ref_seqs_auto_predictions.csv ' + \
           'results/Ref_seqs_1_auto_predictions.csv'
468
469
470
471
472
473
474
475
476
477
478
479
shell:
    'python3 {input.amoebae_script} ' + \
        'setup_fwd_srch ' + \
            'results ' + \
            '{input.query_list_file} ' + \
            '{input.db_list_file} ' + \
            '--outdir {output.outdir} ' + \
    '&& ' + \
    'python3 {input.amoebae_script} ' + \
        'run_fwd_srch ' + \
            '{output.outdir} ' + \
            'results/AMOEBAE_Data '
501
502
503
504
505
506
507
508
shell:
    'python3 {input.amoebae_script} '
        'sum_fwd_srch ' + \
            '{input.fwd_srch_out} ' + \
            '{output.csv_out_path} ' + \
            '{input.main_data_dir} ' + \
            '--max_hits_to_sum 5 ' + \
            '--max_gap_between_tblastn_hsps 1000 '
531
532
533
534
535
536
537
538
539
540
541
542
543
544
shell:
    'python3 {input.amoebae_script} '
        'setup_rev_srch ' + \
            'results ' + \
            '{input.fwd_srch_csv} ' + \
            '{input.reverse_srch_db_file} ' + \
            '{input.main_data_dir} ' + \
            '--outdir  {output.out_dir} ' + \
            '--aasubseq ' + \
    '&& ' + \
    'python3 {input.amoebae_script} '
        'run_rev_srch ' + \
            '{output.out_dir} ' + \
            '{input.main_data_dir} '
568
569
570
571
572
573
574
575
576
577
shell:
    'python3 {input.amoebae_script} '
        'sum_rev_srch ' + \
            '{input.fwd_srch_csv} ' + \
            '{input.rev_srch_dir} ' + \
            '{output.csv_out_path} ' + \
            '{input.main_data_dir} ' + \
            '--redun_hit_csv {input.ref_seq_csv} ' + \
            '--aasubseq ' + \
            '--min_evaldiff 2 '
597
598
599
600
601
shell:
    'python3 {input.amoebae_script} '
        'interp_srchs ' + \
            '{input.rev_srch_csv} ' + \
            '--out_csv_path {output.interp_csv} '
628
629
630
631
632
633
634
635
636
637
638
639
640
641
shell:
    'python3 {input.amoebae_script} '
        'find_redun_seqs ' + \
            '{input.interp_csv} ' + \
            '{input.main_data_dir} ' + \
            '--out_csv_path {output.interp_csv_with_ali_col} ' + \
            '--add_ali_col ' + \
    '&& ' + \
    'python3 {input.amoebae_script} '
        'find_redun_seqs ' + \
            '{output.interp_csv_with_ali_col} ' + \
            '{input.main_data_dir} ' + \
            '--out_csv_path {output.nonredun_seq_csv} ' + \
            '--min_length 55'
669
670
671
672
673
674
675
shell:
    'python3 {input.amoebae_script} '
        'plot ' + \
            '{input.nonredun_seq_csv} ' + \
            '--complex_info {input.coulson_org_csv} ' + \
            '--row_order {input.row_order} ' + \
            '--out_pdf {output.main_plot_pdf} '
696
697
698
699
700
701
shell:
    'python3 {input.amoebae_script} '
        'csv_to_fasta ' + \
            '{input.nonredun_seq_csv} ' + \
            '--abbrev ' + \
            '--split_by_query_title '
722
723
724
725
726
727
728
shell:
    'python3 {input.amoebae_script} '
        'csv_to_fasta ' + \
            '{input.fwd_hit_seq_csv} ' + \
            '--abbrev ' + \
            '--split_by_query_title ' + \
            '--all_hits '
750
751
752
753
754
755
756
757
758
759
shell:
    'mkdir -p {output.ali_dir} && '
    'for X in {input.fasta_dir}/*.fa; '
    'do '
    'python3 {input.amoebae_script} ' + \
        'align_fa ' + \
            '{input.fasta_dir}/$( basename $X ) ' + \
            '--output_dir_path {output.ali_dir} ' + \
            '--output_format fasta '
    '; done '
772
773
shell: 
    'bash documentation/build_pdf.sh'
795
796
797
shell: 
    'snakemake --cores 1 -p --rulegraph | dot -Tpdf > {output} && '
    'snakemake --cores 1 -p --rulegraph | dot -Tpng > images/example_workflow_diagram.png '
ShowHide 24 more snippets with no or duplicated tags.

Login to post a comment if you would like to share your experience with this workflow.

Do you know this workflow well? If so, you can request seller status , and start supporting this workflow.

Free

Created: 1yr ago
Updated: 1yr ago
Maitainers: public
URL: https://github.com/laelbarlow/amoebae
Name: amoebae
Version: v3.0
Badge:
workflow icon

Insert copied code into your website to add a link to this workflow.

Downloaded: 0
Copyright: Public Domain
License: None
  • Future updates

Related Workflows

cellranger-snakemake-gke
snakemake workflow to run cellranger on a given bucket using gke.
A Snakemake workflow for running cellranger on a given bucket using Google Kubernetes Engine. The usage of this workflow ...