pipemake-utils 1.2.2__tar.gz → 1.2.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pipemake-utils might be problematic. Click here for more details.

Files changed (43) hide show
  1. {pipemake_utils-1.2.2 → pipemake_utils-1.2.4}/PKG-INFO +1 -1
  2. {pipemake_utils-1.2.2 → pipemake_utils-1.2.4}/pipemake_utils/__init__.py +1 -1
  3. pipemake_utils-1.2.4/pipemake_utils/process_juicebox.py +82 -0
  4. pipemake_utils-1.2.4/pipemake_utils/process_ncbi_annotations.py +265 -0
  5. pipemake_utils-1.2.4/pipemake_utils/unchunk_blast.py +53 -0
  6. {pipemake_utils-1.2.2 → pipemake_utils-1.2.4}/pipemake_utils.egg-info/PKG-INFO +1 -1
  7. {pipemake_utils-1.2.2 → pipemake_utils-1.2.4}/pipemake_utils.egg-info/SOURCES.txt +2 -0
  8. {pipemake_utils-1.2.2 → pipemake_utils-1.2.4}/pipemake_utils.egg-info/entry_points.txt +1 -0
  9. {pipemake_utils-1.2.2 → pipemake_utils-1.2.4}/setup.py +1 -0
  10. pipemake_utils-1.2.2/pipemake_utils/unchunk_blast.py +0 -39
  11. {pipemake_utils-1.2.2 → pipemake_utils-1.2.4}/LICENSE +0 -0
  12. {pipemake_utils-1.2.2 → pipemake_utils-1.2.4}/MANIFEST.in +0 -0
  13. {pipemake_utils-1.2.2 → pipemake_utils-1.2.4}/README.rst +0 -0
  14. {pipemake_utils-1.2.2 → pipemake_utils-1.2.4}/pipemake_utils/add_eggnog_annotations.py +0 -0
  15. {pipemake_utils-1.2.2 → pipemake_utils-1.2.4}/pipemake_utils/align.py +0 -0
  16. {pipemake_utils-1.2.2 → pipemake_utils-1.2.4}/pipemake_utils/chunk_fasta.py +0 -0
  17. {pipemake_utils-1.2.2 → pipemake_utils-1.2.4}/pipemake_utils/codon_alignment.py +0 -0
  18. {pipemake_utils-1.2.2 → pipemake_utils-1.2.4}/pipemake_utils/confirm_cds_files.py +0 -0
  19. {pipemake_utils-1.2.2 → pipemake_utils-1.2.4}/pipemake_utils/featureCounts_report.py +0 -0
  20. {pipemake_utils-1.2.2 → pipemake_utils-1.2.4}/pipemake_utils/filter_gemma.py +0 -0
  21. {pipemake_utils-1.2.2 → pipemake_utils-1.2.4}/pipemake_utils/iHS_manhattan_plot.py +0 -0
  22. {pipemake_utils-1.2.2 → pipemake_utils-1.2.4}/pipemake_utils/logger.py +0 -0
  23. {pipemake_utils-1.2.2 → pipemake_utils-1.2.4}/pipemake_utils/longest_transcript.py +0 -0
  24. {pipemake_utils-1.2.2 → pipemake_utils-1.2.4}/pipemake_utils/manhattan_plot.py +0 -0
  25. {pipemake_utils-1.2.2 → pipemake_utils-1.2.4}/pipemake_utils/map_orthologs.py +0 -0
  26. {pipemake_utils-1.2.2 → pipemake_utils-1.2.4}/pipemake_utils/misc.py +0 -0
  27. {pipemake_utils-1.2.2 → pipemake_utils-1.2.4}/pipemake_utils/mk.py +0 -0
  28. {pipemake_utils-1.2.2 → pipemake_utils-1.2.4}/pipemake_utils/model.py +0 -0
  29. {pipemake_utils-1.2.2 → pipemake_utils-1.2.4}/pipemake_utils/model_inds.py +0 -0
  30. {pipemake_utils-1.2.2 → pipemake_utils-1.2.4}/pipemake_utils/model_pop_files.py +0 -0
  31. {pipemake_utils-1.2.2 → pipemake_utils-1.2.4}/pipemake_utils/ped_phenotype_file.py +0 -0
  32. {pipemake_utils-1.2.2 → pipemake_utils-1.2.4}/pipemake_utils/plot_pca.py +0 -0
  33. {pipemake_utils-1.2.2 → pipemake_utils-1.2.4}/pipemake_utils/process_braker.py +0 -0
  34. {pipemake_utils-1.2.2 → pipemake_utils-1.2.4}/pipemake_utils/seqDB.py +0 -0
  35. {pipemake_utils-1.2.2 → pipemake_utils-1.2.4}/pipemake_utils/softmask.py +0 -0
  36. {pipemake_utils-1.2.2 → pipemake_utils-1.2.4}/pipemake_utils/translate_seq_file.py +0 -0
  37. {pipemake_utils-1.2.2 → pipemake_utils-1.2.4}/pipemake_utils/vcf.py +0 -0
  38. {pipemake_utils-1.2.2 → pipemake_utils-1.2.4}/pipemake_utils/z_normalize.py +0 -0
  39. {pipemake_utils-1.2.2 → pipemake_utils-1.2.4}/pipemake_utils.egg-info/dependency_links.txt +0 -0
  40. {pipemake_utils-1.2.2 → pipemake_utils-1.2.4}/pipemake_utils.egg-info/requires.txt +0 -0
  41. {pipemake_utils-1.2.2 → pipemake_utils-1.2.4}/pipemake_utils.egg-info/top_level.txt +0 -0
  42. {pipemake_utils-1.2.2 → pipemake_utils-1.2.4}/requirements.txt +0 -0
  43. {pipemake_utils-1.2.2 → pipemake_utils-1.2.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pipemake_utils
3
- Version: 1.2.2
3
+ Version: 1.2.4
4
4
  Summary: Pipemake Utilities
5
5
  Home-page: https://github.com/kocherlab/pipemake_utils
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  # Basic Information
2
2
  __name__ = "pipemake_utils"
3
- __version__ = "1.2.2"
3
+ __version__ = "1.2.4"
4
4
  __summary__ = "Pipemake Utilities"
5
5
  __url__ = "https://github.com/kocherlab/pipemake_utils"
6
6
  __code__ = "https://github.com/kocherlab/pipemake_utils"
@@ -0,0 +1,82 @@
1
+ import argparse
2
+
3
+ from Bio import SeqIO
4
+ from collections import defaultdict
5
+
6
+ def filterMinLength(seq_lengths, min_length):
7
+ filtered_lengths = {k: v for k, v in seq_lengths.items() if v >= min_length}
8
+ return filtered_lengths
9
+
10
+ def processAssembly(input_filename, output_filename, min_length = None, chrom_count = None, mt_filename = '', no_mt = None, input_format = "fasta", output_format = "fasta", species = ''):
11
+
12
+ # Create a dictionary to store the sequence lengths
13
+ seq_lengths = defaultdict(int)
14
+
15
+ # Read in the sequences from the input file
16
+ with open(input_filename, 'r') as input_file:
17
+ for record in SeqIO.parse(input_file, input_format):
18
+ seq_lengths[record.id] = len(record.seq)
19
+
20
+ # Filter by minimum length if specified
21
+ if min_length is not None:
22
+ seq_lengths = filterMinLength(seq_lengths, min_length)
23
+
24
+ # Sort the sequences by length, only keeping the id
25
+ seq_lengths = sorted(seq_lengths, key=seq_lengths.get, reverse=True)
26
+
27
+ # Filter by chromosome count if specified
28
+ if chrom_count is not None:
29
+ seq_lengths = list(seq_lengths)[:chrom_count]
30
+
31
+ # Create a dictionary to store the ids with chromosome names
32
+ chrom_ids = {}
33
+
34
+ # Assign the chromosome names
35
+ for chrom_int, seq_id in enumerate(seq_lengths, 1):
36
+ chrom_id = f"chr_{chrom_int}"
37
+ if species:
38
+ chrom_id = f"{species}_" + chrom_id
39
+ chrom_ids[seq_id] = chrom_id
40
+
41
+ # Index the input file
42
+ input_file = SeqIO.index(input_filename, input_format)
43
+
44
+ # Loop through the sequence lengths and write to the output file
45
+ with open(output_filename, 'w') as output_file:
46
+ for seq_id in seq_lengths:
47
+ record = input_file[seq_id]
48
+ record.id = chrom_ids[seq_id]
49
+ record.description = ''
50
+ record.name = ''
51
+ SeqIO.write(record, output_file, output_format)
52
+
53
+ # Check if there is a mitochondrial sequence to add
54
+ if not no_mt:
55
+
56
+ # Open the mitochondrial input file using seqIO
57
+ mt_chr = list(SeqIO.parse(mt_filename, input_format))
58
+
59
+ # Confirm a single mitochondrial sequence
60
+ if len(mt_chr) != 1:
61
+ raise ValueError("Mitochondrial input file must contain a single sequence")
62
+
63
+ # Write the mitochondrial sequence
64
+ SeqIO.write(mt_chr, output_file, output_format)
65
+
66
+ def processAssemblyParser():
67
+ parser = argparse.ArgumentParser(description="Process an assembly file.")
68
+ parser.add_argument("--input", dest="input_filename", type=str, help="Input assembly file", required=True)
69
+ parser.add_argument("--output", dest="output_filename", type=str, help="Output assembly file", default="output.fasta")
70
+ parser.add_argument("--species", type=str, default='', help="Species id")
71
+ parser.add_argument("--min-length", type=int, default=None, help="Minimum length of sequences to keep")
72
+ parser.add_argument("--chrom-count", type=int, default=None, help="Number of longest sequences to keep")
73
+ parser.add_argument("--input-format", type=str, default="fasta", help="Input file format")
74
+ parser.add_argument("--output-format", type=str, default="fasta", help="Output file format")
75
+ mt_parser = parser.add_mutually_exclusive_group(required = True)
76
+ mt_parser.add_argument("--mt-input", dest="mt_filename", type=str, help = "Mitochondrial sequence input file")
77
+ mt_parser.add_argument("--no-mt", help = "Indicates there is no mitochondrial sequence", action = "store_true")
78
+ return vars(parser.parse_args())
79
+
80
+ if __name__ == "__main__":
81
+ args = processAssemblyParser()
82
+ processAssembly(**args)
@@ -0,0 +1,265 @@
1
+ import re
2
+ import csv
3
+ import argparse
4
+
5
+ from pipemake_utils.misc import *
6
+ from pipemake_utils.logger import *
7
+
8
+ def processID (id_attribute_dict, species_tag):
9
+
10
+ for id_str in id_attribute_dict:
11
+
12
+ id_attribute_dict[id_str] = id_attribute_dict[id_str].replace('%2C', ',')
13
+ id_attribute_dict[id_str] = id_attribute_dict[id_str].replace('egapxtmp_', f'{species_tag}_')
14
+
15
+ return id_attribute_dict
16
+
17
+ def processTranscript (transcript_attribute_dict, species_tag):
18
+
19
+ for transcript_str in list(transcript_attribute_dict):
20
+
21
+ transcript_attribute_dict[transcript_str] = transcript_attribute_dict[transcript_str].replace('gnl|WGS:ZZZZ|egapxtmp_', f'{species_tag}_')
22
+
23
+ if bool(re.search(r'orig_(protein|transcript)_id', transcript_str)):
24
+ del transcript_attribute_dict[transcript_str]
25
+
26
+ return transcript_attribute_dict
27
+
28
+ def processExon (exon_attribute_dict, species_tag):
29
+
30
+ for exon_str in list(exon_attribute_dict):
31
+
32
+ exon_attribute_dict[exon_str] = exon_attribute_dict[exon_str].replace('gnl|WGS:ZZZZ|egapxtmp_', f'{species_tag}_')
33
+
34
+ if bool(re.search(r'orig_(protein|transcript)_id', exon_str)):
35
+ del exon_attribute_dict[exon_str]
36
+
37
+ return exon_attribute_dict
38
+
39
+ def processCDS (cds_attribute_dict, species_tag):
40
+
41
+ for cds_str in list(cds_attribute_dict):
42
+
43
+ cds_attribute_dict[cds_str] = cds_attribute_dict[cds_str].replace('gnl|WGS:ZZZZ|egapxtmp_', f'{species_tag}_')
44
+ cds_attribute_dict[cds_str] = cds_attribute_dict[cds_str].replace('WGS:ZZZZ:egapxtmp_', f'{species_tag}_')
45
+
46
+ if bool(re.search(r'orig_(protein|transcript)_id', cds_str)):
47
+ del cds_attribute_dict[cds_str]
48
+
49
+ return cds_attribute_dict
50
+
51
+ def processCodon (codon_attribute_dict, species_tag):
52
+
53
+ for codon_str in list(codon_attribute_dict):
54
+
55
+ codon_attribute_dict[codon_str] = codon_attribute_dict[codon_str].replace('gnl|WGS:ZZZZ|egapxtmp_', f'{species_tag}_')
56
+ codon_attribute_dict[codon_str] = codon_attribute_dict[codon_str].replace('WGS:ZZZZ:egapxtmp_', f'{species_tag}_')
57
+
58
+ if bool(re.search(r'orig_(protein|transcript)_id', codon_str)):
59
+ del codon_attribute_dict[codon_str]
60
+
61
+ return codon_attribute_dict
62
+
63
+ def gtfAttributesToDict (attribute_str):
64
+
65
+ attribute_dict = {}
66
+ for attribute in attribute_str.split(';'):
67
+ if attribute.strip() == '':
68
+ continue
69
+ key, value = attribute.strip().split(' ', 1)
70
+ value = value.strip('"')
71
+ attribute_dict[key] = value
72
+
73
+ return attribute_dict
74
+
75
+ def gtfAttributesToGFF (gtf_attributes):
76
+
77
+ gff_attributes = {}
78
+
79
+ for key, value in gtf_attributes.items():
80
+ if key == 'db_xref':
81
+ gff_attributes['Dbxref'] = value
82
+ else:
83
+ gff_attributes[key] = value
84
+
85
+ return gff_attributes
86
+
87
+ def gffAttributesToStr (gff_attributes, order = []):
88
+
89
+ gff_attribute_str = ''
90
+
91
+ if order:
92
+
93
+ for ordered_gff_attribute in order:
94
+ if ordered_gff_attribute not in gff_attributes:
95
+ continue
96
+ gff_attribute_str += f'{ordered_gff_attribute}={gff_attributes[ordered_gff_attribute]};'
97
+ del gff_attributes[ordered_gff_attribute]
98
+
99
+ gff_attribute_str += ';'.join([f'{key}={value}' for key, value in gff_attributes.items()])
100
+
101
+ if gff_attribute_str.endswith(';'):
102
+ gff_attribute_str = gff_attribute_str[:-1]
103
+
104
+ return gff_attribute_str
105
+
106
+ def gffGeneAttributeStr (gff_gene_attributes):
107
+
108
+ for gene_attribute in list(gff_gene_attributes):
109
+
110
+ if gene_attribute == 'gene':
111
+ gff_gene_attributes['Name'] = gff_gene_attributes[gene_attribute]
112
+ elif gene_attribute == 'gene_id':
113
+ gff_gene_attributes['ID'] = gff_gene_attributes[gene_attribute]
114
+ del gff_gene_attributes[gene_attribute]
115
+ elif gene_attribute == 'transcript_id':
116
+ del gff_gene_attributes[gene_attribute]
117
+
118
+ if 'Name' not in gff_gene_attributes:
119
+ gff_gene_attributes['Name'] = gff_gene_attributes['ID']
120
+
121
+ return gffAttributesToStr(gff_gene_attributes, order = ['ID', 'Name', 'description'])
122
+
123
+ def gffTranscriptAttributeStr (gff_transcript_attributes):
124
+
125
+ for transcript_attribute in list(gff_transcript_attributes):
126
+
127
+ if transcript_attribute == 'gene_id':
128
+ gff_transcript_attributes['Parent'] = gff_transcript_attributes[transcript_attribute]
129
+ del gff_transcript_attributes[transcript_attribute]
130
+ elif transcript_attribute == 'transcript_id':
131
+ gff_transcript_attributes['ID'] = gff_transcript_attributes[transcript_attribute]
132
+ gff_transcript_attributes['Name'] = gff_transcript_attributes[transcript_attribute]
133
+ del gff_transcript_attributes[transcript_attribute]
134
+
135
+ return gffAttributesToStr(gff_transcript_attributes, order = ['ID', 'Parent', 'Name', 'product'])
136
+
137
+ def gffExonAttributeStr (gff_exon_attributes):
138
+
139
+ if 'transcript_id' not in gff_exon_attributes and 'number' not in gff_exon_attributes:
140
+ raise ValueError("Exon attributes must contain 'transcript_id' and 'number' keys.")
141
+
142
+ gff_exon_attributes['ID'] = gff_exon_attributes['transcript_id'] + ':exon-' + gff_exon_attributes['exon_number']
143
+
144
+ for exon_attribute in list(gff_exon_attributes):
145
+
146
+ if exon_attribute == 'transcript_id':
147
+ gff_exon_attributes['Parent'] = gff_exon_attributes[exon_attribute]
148
+ del gff_exon_attributes[exon_attribute]
149
+ elif exon_attribute == 'exon_number':
150
+ gff_exon_attributes['number'] = gff_exon_attributes[exon_attribute]
151
+ del gff_exon_attributes[exon_attribute]
152
+ elif exon_attribute == 'gene_id':
153
+ del gff_exon_attributes[exon_attribute]
154
+
155
+ return gffAttributesToStr(gff_exon_attributes, order = ['ID', 'Parent', 'number'])
156
+
157
+ def gffCDSAttributeStr (gff_cds_attributes):
158
+
159
+ if 'transcript_id' not in gff_cds_attributes and 'number' not in gff_cds_attributes:
160
+ raise ValueError("Exon attributes must contain 'transcript_id' and 'number' keys.")
161
+
162
+ gff_cds_attributes['ID'] = gff_cds_attributes['transcript_id'] + ':cds-' + gff_cds_attributes['exon_number']
163
+
164
+ for exon_attribute in list(gff_cds_attributes):
165
+
166
+ if exon_attribute == 'transcript_id':
167
+ gff_cds_attributes['Parent'] = gff_cds_attributes[exon_attribute]
168
+ del gff_cds_attributes[exon_attribute]
169
+ elif exon_attribute == 'exon_number':
170
+ gff_cds_attributes['number'] = gff_cds_attributes[exon_attribute]
171
+ del gff_cds_attributes[exon_attribute]
172
+ elif exon_attribute == 'protein_id':
173
+ del gff_cds_attributes[exon_attribute]
174
+
175
+ return gffAttributesToStr(gff_cds_attributes, order = ['ID', 'Parent', 'number'])
176
+
177
+ def processGTF (gtf_filename, out_prefix, species_tag):
178
+
179
+ gff_output = open(f'{out_prefix}.gff', 'w')
180
+ gff_output.write('##gff-version 3\n')
181
+
182
+ gtf_output = open(f'{out_prefix}.gtf', 'w')
183
+ gtf_output.write('#gtf-version 2.2\n')
184
+
185
+ # Open the GFF file for reading
186
+ with open(gtf_filename, 'r') as gtf_file:
187
+ gtf_reader = csv.reader(gtf_file, delimiter='\t')
188
+
189
+ for row in gtf_reader:
190
+
191
+ # Check if the row is a comment or header
192
+ if row[0].startswith('#'):
193
+ continue
194
+
195
+ # Parse the attributes column into a dictionary
196
+ gtf_attributes = gtfAttributesToDict(row[8])
197
+
198
+ # Process attributes based on feature type
199
+ if row[2] in ['gene']:
200
+ pass
201
+ elif row[2] in ['transcript']:
202
+ gtf_attributes = processTranscript(gtf_attributes, species_tag)
203
+ elif row[2] in ['exon']:
204
+ gtf_attributes = processExon(gtf_attributes, species_tag)
205
+ elif row[2] in ['CDS']:
206
+ gtf_attributes = processCDS(gtf_attributes, species_tag)
207
+ elif row[2] in ['start_codon', 'stop_codon']:
208
+ gtf_attributes = processCodon(gtf_attributes, species_tag)
209
+ else:
210
+ raise ValueError(f"Unknown feature type: {row[2]}")
211
+
212
+ # Process basic IDs for all feature types
213
+ gtf_attributes = processID(gtf_attributes, species_tag)
214
+
215
+ # Create the gtf attribute string
216
+ gtf_attribute_str = '; '.join([f'{key} "{value}"' for key, value in gtf_attributes.items()]) + ';'
217
+
218
+ # Create a the new GTF line with the modified attributes
219
+ gtf_output.write('\t'.join(row[:8] + [gtf_attribute_str]) + '\n')
220
+
221
+ # Convert GTF attributes to GFF attributes
222
+ gff_attributes = gtfAttributesToGFF(gtf_attributes)
223
+
224
+ # Create a the new GFF line with the modified attributes
225
+ if row[2] in ['gene']:
226
+ gff_attribute_str = gffGeneAttributeStr(gff_attributes)
227
+ elif row[2] in ['transcript']:
228
+ gff_attribute_str = gffTranscriptAttributeStr(gff_attributes)
229
+ if 'mRNA' == gff_attributes['gbkey']:
230
+ row[2] = 'mRNA'
231
+ elif row[2] in ['exon']:
232
+ gff_attribute_str = gffExonAttributeStr(gff_attributes)
233
+ elif row[2] in ['CDS']:
234
+ gff_attribute_str = gffCDSAttributeStr(gff_attributes)
235
+ elif row[2] in ['start_codon', 'stop_codon']:
236
+ continue
237
+ else:
238
+ raise ValueError(f"Unknown feature type: {row[2]}")
239
+
240
+ # Write the GFF line to the output file
241
+ gff_output.write('\t'.join(row[:8] + [gff_attribute_str]) + '\n')
242
+
243
+ gff_output.close()
244
+ gtf_output.close()
245
+
246
+ def processNCBIAnnotationsParser():
247
+ parser = argparse.ArgumentParser(description='Process NCBI GTF annotations andd generate GFF and GTF files with modified IDs.')
248
+ parser.add_argument('--gtf-file', dest = 'gtf_filename', help = 'GTF output from the NCBI annotation pipeline', type = str, required = True, action = confirmFile())
249
+ parser.add_argument('--species-tag', help = 'Species tag to replace in IDs', type = str, required = True)
250
+ parser.add_argument('--out-prefix', help = 'Output prefix for GFF and GTF files', type = str, default = 'out')
251
+
252
+ return vars(parser.parse_args())
253
+
254
+ def main():
255
+
256
+ process_ncbi_args = processNCBIAnnotationsParser()
257
+
258
+ # Start logger and log the arguments
259
+ startLogger(f"{process_ncbi_args['out_prefix']}.cvt.log")
260
+ logArgDict(process_ncbi_args)
261
+
262
+ processGTF(**process_ncbi_args)
263
+
264
+ if __name__ == '__main__':
265
+ main()
@@ -0,0 +1,53 @@
1
+ import csv
2
+ import argparse
3
+
4
+ from pipemake_utils.logger import startLogger, logArgDict
5
+
6
+
7
+ def unchunkArgs():
8
+ parser = argparse.ArgumentParser()
9
+ parser.add_argument(
10
+ "--chunked-blast",
11
+ help="Input file containing chunked BLAST results.",
12
+ required=True,
13
+ )
14
+ parser.add_argument(
15
+ "--unchunked-blast",
16
+ help="Output file for unchunked BLAST results.",
17
+ default="unchunked_blast.out",
18
+ )
19
+ return vars(parser.parse_args())
20
+
21
+
22
+ def unchunkBlast(input_filename, output_filename):
23
+ with open(input_filename, "r") as input_file, open(
24
+ output_filename, "w"
25
+ ) as output_file:
26
+ input_reader = csv.reader(input_file, delimiter="\t")
27
+ for input_row in input_reader:
28
+ # Process the chunked header
29
+ input_header, input_range = input_row[0].split(":")
30
+ input_start, _ = map(int, input_range.split("-"))
31
+
32
+ # Update the input_row with the unchunked header and adjusted positions
33
+ input_row[0] = input_header
34
+ input_row[3] = input_header
35
+ input_row[9] = int(input_row[9]) + input_start - 1
36
+ input_row[10] = int(input_row[10]) + input_start - 1
37
+
38
+ # Write the modified row to the output file
39
+ output_file.write("\t".join(map(str, input_row)) + "\n")
40
+
41
+
42
+ def main():
43
+ args = unchunkArgs()
44
+
45
+ # Start logger and log the arguments
46
+ startLogger("unchunked_blast.log")
47
+ logArgDict(args)
48
+
49
+ unchunkBlast(args["chunked_blast"], args["unchunked_blast"])
50
+
51
+
52
+ if __name__ == "__main__":
53
+ main()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pipemake-utils
3
- Version: 1.2.2
3
+ Version: 1.2.4
4
4
  Summary: Pipemake Utilities
5
5
  Home-page: https://github.com/kocherlab/pipemake_utils
6
6
  License: MIT
@@ -24,6 +24,8 @@ pipemake_utils/model_pop_files.py
24
24
  pipemake_utils/ped_phenotype_file.py
25
25
  pipemake_utils/plot_pca.py
26
26
  pipemake_utils/process_braker.py
27
+ pipemake_utils/process_juicebox.py
28
+ pipemake_utils/process_ncbi_annotations.py
27
29
  pipemake_utils/seqDB.py
28
30
  pipemake_utils/softmask.py
29
31
  pipemake_utils/translate_seq_file.py
@@ -12,6 +12,7 @@ model-pop-files = pipemake_utils.model_pop_files:main
12
12
  ped-phenotype-file = pipemake_utils.ped_phenotype_file:main
13
13
  plot-pca = pipemake_utils.plot_pca:main
14
14
  process-braker = pipemake_utils.process_braker:main
15
+ process-ncbi-annotations = pipemake_utils.process_ncbi_annotations:main
15
16
  softmask = pipemake_utils.softmask:main
16
17
  translate-seq-file = pipemake_utils.translate_seq_file:main
17
18
  unchunk-blast = pipemake_utils.unchunk_blast:main
@@ -50,6 +50,7 @@ setup(
50
50
  "translate-seq-file = pipemake_utils.translate_seq_file:main",
51
51
  "chunk-fasta = pipemake_utils.chunk_fasta:main",
52
52
  "unchunk-blast = pipemake_utils.unchunk_blast:main",
53
+ "process-ncbi-annotations = pipemake_utils.process_ncbi_annotations:main",
53
54
  ],
54
55
  },
55
56
  python_requires=">=3.7",
@@ -1,39 +0,0 @@
1
- import csv
2
- import argparse
3
-
4
- from pipemake_utils.logger import startLogger, logArgDict
5
-
6
- def unchunkArgs():
7
- parser = argparse.ArgumentParser()
8
- parser.add_argument("--chunked-blast", help = "Input file containing chunked BLAST results.", required = True)
9
- parser.add_argument("--unchunked-blast", help = "Output file for unchunked BLAST results.", default = "unchunked_blast.out")
10
- return vars(parser.parse_args())
11
-
12
- def unchunkBlast(input_filename, output_filename):
13
- with open(input_filename, 'r') as input_file, open(output_filename, 'w') as output_file:
14
- input_reader = csv.reader(input_file, delimiter='\t')
15
- for input_row in input_reader:
16
-
17
- # Process the chunked header
18
- input_header, input_range = input_row[0].split(':')
19
- input_start, _ = map(int, input_range.split('-'))
20
-
21
- # Update the input_row with the unchunked header and adjusted positions
22
- input_row[0] = input_header
23
- input_row[6] = int(input_row[6]) + input_start - 1
24
- input_row[7] = int(input_row[7]) + input_start - 1
25
-
26
- # Write the modified row to the output file
27
- output_file.write('\t'.join(map(str, input_row)) + '\n')
28
-
29
- def main():
30
- args = unchunkArgs()
31
-
32
- # Start logger and log the arguments
33
- startLogger("unchunked_blast.log")
34
- logArgDict(args)
35
-
36
- unchunkBlast(args['chunked_blast'], args['unchunked_blast'])
37
-
38
- if __name__ == "__main__":
39
- main()
File without changes
File without changes