|
1 | 1 | #!/usr/bin/env python3 |
2 | 2 | """ |
3 | 3 | author: Asher Preska Steinberg |
4 | | -merge proteomegenerator results across multiple samples on AA seq identity |
| 4 | +merge proteomegenerator fasta and results across multiple samples on AA seq identity |
5 | 5 | """ |
6 | 6 | import os |
7 | 7 | import pandas as pd |
@@ -48,24 +48,9 @@ def plot_upset(countdat, upset_path): |
48 | 48 | plt.savefig(upset_path, dpi=300, bbox_inches="tight") |
49 | 49 | return |
50 | 50 |
|
51 | | -@click.command() |
52 | | -@click.option('-i', '--input_csv', required=True, type=click.Path(exists=True), |
53 | | - help='four column csv (fasta: fasta path, ' |
54 | | - 'protein_table: protein.tsv path, ' |
55 | | - 'name: sample name, condition: condition)') |
56 | | -@click.option('-t', '--info_table', required=False, |
57 | | - default='info_table.tsv', |
58 | | - type=click.Path(), help="Path to index tsv for merged protein IDs") |
59 | | -@click.option('-fa','--merged_fasta', required=False, |
60 | | - type=click.Path(), default='merged.fasta', |
61 | | - help="Path to merged fasta file") |
62 | | -@click.option('--upset', is_flag=True, default=False, help="plot upset") |
63 | | -@click.option('--upset_path', required=False, |
64 | | - type=click.Path(), default='upset_plot.svg', |
65 | | - help="Path to upset plot") |
66 | | -def merge_pg_results(input_csv, info_table, merged_fasta, upset, upset_path, unique_proteins=True): |
| 51 | +def merge_proteome(input_csv, info_table, merged_fasta, upset, upset_path, unique_proteins=True): |
67 | 52 | """ |
68 | | - merge proteomegenerator results across multiple samples on AA seq identity |
| 53 | + merge proteomegenerator fasta/results across multiple samples on AA seq identity |
69 | 54 | """ |
70 | 55 | # read in metadata |
71 | 56 | metadata = pd.read_csv(input_csv) |
@@ -130,5 +115,45 @@ def merge_pg_results(input_csv, info_table, merged_fasta, upset, upset_path, uni |
130 | 115 | # plot upset plot: |
131 | 116 | if upset: |
132 | 117 | plot_upset(countdat, upset_path) |
133 | | -if __name__ == '__main__': |
134 | | - merge_pg_results() |
| 118 | + return |
| 119 | + |
| 120 | +@click.command() |
| 121 | +@click.option('-i', '--input_csv', required=True, type=click.Path(exists=True), |
| 122 | + help='four column csv (fasta: fasta path, ' |
| 123 | + 'protein_table: protein.tsv path, ' |
| 124 | + 'name: sample name, condition: condition)') |
| 125 | +@click.option('-t', '--info_table', required=False, |
| 126 | + default='info_table.tsv', |
| 127 | + type=click.Path(), help="Path to index tsv for merged protein IDs") |
| 128 | +@click.option('-fa','--merged_fasta', required=False, |
| 129 | + type=click.Path(), default='merged.fasta', |
| 130 | + help="Path to merged fasta file") |
| 131 | +@click.option('--upset', is_flag=True, default=False, help="plot upset") |
| 132 | +@click.option('--upset_path', required=False, |
| 133 | + type=click.Path(), default='upset_plot.svg', |
| 134 | + help="Path to upset plot") |
| 135 | +def merge_pg_results(input_csv, info_table, merged_fasta, upset, upset_path): |
| 136 | + """ |
| 137 | + merge proteomegenerator results across multiple samples on AA seq identity |
| 138 | + """ |
| 139 | + return merge_proteome(input_csv, info_table, merged_fasta, upset, upset_path, unique_proteins=True) |
| 140 | + |
| 141 | +@click.command() |
| 142 | +@click.option('-i', '--input_csv', required=True, type=click.Path(exists=True), |
| 143 | + help='three column csv (fasta: fasta path, ' |
| 144 | + 'name: sample name, condition: condition)') |
| 145 | +@click.option('-t', '--info_table', required=False, |
| 146 | + default='info_table.tsv', |
| 147 | + type=click.Path(), help="Path to index tsv for merged protein IDs") |
| 148 | +@click.option('-fa','--merged_fasta', required=False, |
| 149 | + type=click.Path(), default='merged.fasta', |
| 150 | + help="Path to merged fasta file") |
| 151 | +@click.option('--upset', is_flag=True, default=False, help="plot upset") |
| 152 | +@click.option('--upset_path', required=False, |
| 153 | + type=click.Path(), default='upset_plot.svg', |
| 154 | + help="Path to upset plot") |
| 155 | +def merge_fasta(input_csv, info_table, merged_fasta, upset, upset_path): |
| 156 | + """ |
| 157 | + merge multiple fasta on sequence identity |
| 158 | + """ |
| 159 | + return merge_proteome(input_csv, info_table, merged_fasta, upset, upset_path, unique_proteins=False) |
0 commit comments