mgnify-pipelines-toolkit 0.1.3__py3-none-any.whl → 0.1.4__py3-none-any.whl

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 mgnify-pipelines-toolkit might be problematic. Click here for more details.

@@ -223,6 +223,25 @@ def make_tax_assignment_dict_pr2(taxa_df, asv_dict):
223
223
 
224
224
  return tax_assignment_dict
225
225
 
226
+ def generate_asv_count_dict(asv_dict):
227
+
228
+ res_dict = defaultdict(list)
229
+
230
+ for asv_id, count in asv_dict.items():
231
+
232
+ if count == 0:
233
+ continue
234
+
235
+ res_dict['asv'].append(asv_id)
236
+ res_dict['count'].append(count)
237
+
238
+ res_df = pd.DataFrame.from_dict(res_dict)
239
+ res_df = res_df.sort_values(by='asv', ascending=True)
240
+ res_df = res_df.sort_values(by='count', ascending=False)
241
+
242
+ return res_df
243
+
244
+
226
245
  def main():
227
246
  _TAXA, _FWD, _REV, _AMP, _HEADERS, _SAMPLE = parse_args()
228
247
 
@@ -250,23 +269,12 @@ def main():
250
269
  for line_fwd in fwd_fr:
251
270
  counter += 1
252
271
  line_fwd = line_fwd.strip()
253
- fwd_asvs = line_fwd.split(",")
254
272
 
255
- if paired_end:
256
- line_rev = next(rev_fr).strip()
257
- rev_asvs = line_rev.split(",")
258
- asv_intersection = list(set(fwd_asvs).intersection(rev_asvs))
259
-
260
- if len(asv_intersection) == 0:
261
- continue
262
-
263
- if len(asv_intersection) == 1 and asv_intersection[0] == "0":
264
- continue
265
- else:
266
- asv_intersection = fwd_asvs
273
+ if line_fwd == '0':
274
+ continue
267
275
 
268
276
  if headers[counter] in amp_reads:
269
- asv_dict[f"seq_{int(asv_intersection[0]) - 1}"] += 1
277
+ asv_dict[f"seq_{line_fwd}"] += 1
270
278
 
271
279
  fwd_fr.close()
272
280
  if paired_end:
@@ -285,6 +293,8 @@ def main():
285
293
  for tax_assignment, count in tax_assignment_dict.items():
286
294
  fw.write(f"{count}\t{tax_assignment}\n")
287
295
 
296
+ asv_count_df = generate_asv_count_dict(asv_dict)
297
+ asv_count_df.to_csv(f'./{_SAMPLE}_{amp_region}_asv_read_counts.tsv', sep='\t', index=False)
288
298
 
289
299
  if __name__ == "__main__":
290
300
  main()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mgnify_pipelines_toolkit
3
- Version: 0.1.3
3
+ Version: 0.1.4
4
4
  Summary: Collection of scripts and tools for MGnify pipelines
5
5
  Author-email: MGnify team <metagenomics-help@ebi.ac.uk>
6
6
  License: Apache Software License 2.0
@@ -6,7 +6,7 @@ mgnify_pipelines_toolkit/analysis/amplicon/assess_inflection_point_mcp.py,sha256
6
6
  mgnify_pipelines_toolkit/analysis/amplicon/assess_mcp_proportions.py,sha256=BCzLlfvRqiPC-YwzET901f_d0anYt1zpf5y0iOCQnvs,5191
7
7
  mgnify_pipelines_toolkit/analysis/amplicon/classify_var_regions.py,sha256=89LKH4rvqRydAEGvfaWqIClcitJ1Vbu7b5d4FApzGp4,18392
8
8
  mgnify_pipelines_toolkit/analysis/amplicon/find_mcp_inflection_points.py,sha256=5emeZjk8891IgyL5ygVcr8wMP-hGEJoEs2rcBbseWj0,3536
9
- mgnify_pipelines_toolkit/analysis/amplicon/make_asv_count_table.py,sha256=dZIygTbMZvVbSVBmFFAZz7x24oQEpvdEOTpTcnYAyoM,8444
9
+ mgnify_pipelines_toolkit/analysis/amplicon/make_asv_count_table.py,sha256=-Kh9KlEuWWFAWUaNjkCxl-L3IdEMURLM3UKb2Tf81CM,8605
10
10
  mgnify_pipelines_toolkit/analysis/amplicon/mapseq_to_asv_table.py,sha256=lWVIhDxfsTuDzWjjUlMGx3RL7iD_Yy8m9Ppc9wjfCFg,4765
11
11
  mgnify_pipelines_toolkit/analysis/amplicon/primer_val_classification.py,sha256=F4ALSuH8N-0hHUqPCFwHgoAnteb2Ft3tUN9j6DaD5h8,3539
12
12
  mgnify_pipelines_toolkit/analysis/amplicon/remove_ambiguous_reads.py,sha256=yhDJFGD3t3TMfUlBCJGwzlK4IjFwm7Bporwp-aIM8uU,3139
@@ -20,9 +20,9 @@ mgnify_pipelines_toolkit/constants/regex_ambiguous_bases.py,sha256=oVeeCy33bY1WJ
20
20
  mgnify_pipelines_toolkit/constants/tax_ranks.py,sha256=fP97JvlUdxJBakJ694VresIY8-N3pcU99m7kZ9buKys,867
21
21
  mgnify_pipelines_toolkit/constants/thresholds.py,sha256=7J3caCikkEcLdKF4zSR0z8qMQw4-h9aSkSbFbS0LNg4,873
22
22
  mgnify_pipelines_toolkit/constants/var_region_coordinates.py,sha256=E8Cd3A1Hj9M95zw9Ut-2x8sE6_PlH6RJJEoikyZUMaQ,1303
23
- mgnify_pipelines_toolkit-0.1.3.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
24
- mgnify_pipelines_toolkit-0.1.3.dist-info/METADATA,sha256=D8bYOR2kQZzJPdqtFkHj_Xd4axEHjzJPJXKAHtFj8L0,4950
25
- mgnify_pipelines_toolkit-0.1.3.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
26
- mgnify_pipelines_toolkit-0.1.3.dist-info/entry_points.txt,sha256=K8nqnyAQG9jqHGgIfMIaCIe20u5a0FFCCqJWi4DoD2U,1306
27
- mgnify_pipelines_toolkit-0.1.3.dist-info/top_level.txt,sha256=xA_wC7C01V3VwuDnqwRM2QYeJJ45WtvF6LVav4tYxuE,25
28
- mgnify_pipelines_toolkit-0.1.3.dist-info/RECORD,,
23
+ mgnify_pipelines_toolkit-0.1.4.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
24
+ mgnify_pipelines_toolkit-0.1.4.dist-info/METADATA,sha256=1s--DpsRsfAyM2HomRYTAfLF3shjuZ5o0CF-FoceZmw,4950
25
+ mgnify_pipelines_toolkit-0.1.4.dist-info/WHEEL,sha256=Z4pYXqR_rTB7OWNDYFOm1qRk0RX6GFP2o8LgvP453Hk,91
26
+ mgnify_pipelines_toolkit-0.1.4.dist-info/entry_points.txt,sha256=K8nqnyAQG9jqHGgIfMIaCIe20u5a0FFCCqJWi4DoD2U,1306
27
+ mgnify_pipelines_toolkit-0.1.4.dist-info/top_level.txt,sha256=xA_wC7C01V3VwuDnqwRM2QYeJJ45WtvF6LVav4tYxuE,25
28
+ mgnify_pipelines_toolkit-0.1.4.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.43.0)
2
+ Generator: setuptools (70.3.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5