BioSAK 1.76.1__tar.gz → 1.76.3__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.
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/VERSION +2 -2
- BioSAK-1.76.3/BioSAK/metaAssembly.py +158 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK.egg-info/PKG-INFO +2 -2
- {BioSAK-1.76.1 → BioSAK-1.76.3}/PKG-INFO +2 -2
- {BioSAK-1.76.1 → BioSAK-1.76.3}/bin/BioSAK +1 -0
- BioSAK-1.76.1/BioSAK/metaAssembly.py +0 -108
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/BLCA_op_parser.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/BioSAK_config.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/COG2020.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/COG_boxplot_last1row.R +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/COG_boxplot_last2row.R +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/CheckM.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/ConvertMSA.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/DnaFeaturesViewer.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/FastaSplitler_by_num.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/FastaSplitler_by_size.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/GTDB_for_BLCA.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/Gene2Ctg.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/KEGG.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/KEGG_boxplot_last1row.R +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/KEGG_get_eukaryotic_kos.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/KeepRemovingTmp.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/MeanMappingDepth.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/MetaBiosample.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/MetaCHIP_phylo.hmm +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/MetaCyc_reactions_with_ec.txt +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/NetEnzymes.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/Newick_tree_plotter.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/OneLineAln.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/PhyloBiAssoc.R +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/PhyloBiAssoc.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/Prodigal.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/Reads_simulator.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/RunGraphMB.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/SILVA_for_BLCA.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/SankeyTaxon.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/SliceMSA.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/SubsampleLongReads.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/Tax4Fun2IndOTU.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/VisBlastOp.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/VisGeneFlk.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/__init__.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/arCOG.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/bam2reads.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/boxplot_last1row.R +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/boxplot_matrix_COG.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/boxplot_matrix_COG_backup.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/boxplot_matrix_KEGG.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/boxplot_matrix_dbCAN.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/cat_fa.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/cdd2cog.pl +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/checkm_marker.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/compare_trees.R +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/compare_trees.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/cross_link_seqs.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/dbCAN.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/download_GenBank_genome_subset_prokaryotes_csv.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/dwnld_sra_reads.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/enrich.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/exe_cmds.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/ezaai2mat.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/fa2id.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/fa2phy.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/fa2tree.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/format_converter.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/format_leaf_name.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/fq2fa.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/gbk2faa.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/gbk2ffn.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/gbk2fna.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/gbk_to_ffn_faa.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/get_EC_from_ko_stats_D.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/get_GTDB_taxon_gnm.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/get_MAG_reads_long.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/get_Pfam_hmms.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/get_SCG_tree.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/get_TopHits_taxonomy.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/get_aa_composition.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/get_bin_abundance copy.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/get_gc.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/get_gene_depth.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/get_genome_GTDB.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/get_genome_NCBI.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/get_genome_NCBI_v1.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/get_genome_NCBI_v2.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/get_gnm_size.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/get_ko_gene_seqs.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/get_krona_plot.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/get_reads_from_sam.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/get_reads_id_in_sam.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/get_sankey_plot.R +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/get_top_hit.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/get_total_length.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/global_functions.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/hpc3.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/iTOL.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/js_cmds.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/keep_best_hit.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/ko00001.keg +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/label_tree.R +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/label_tree.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/link_16S_MAG.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/magabund.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/magabund2.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/manipulator_fasta.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/manipulator_msa.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/manipulator_newick.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/manipulator_sam.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/mean_MAG_cov.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/merge_seq.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/metabat2concoct.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/metabat2maxbin.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/msa_to_distance_matrix.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/ncbi_dataset.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/parse_MetaCyc_RxnDB.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/parse_mmseqs_tsv.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/plot_mag.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/plot_sam_depth.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/plot_tree.R +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/prefix_file.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/prokka.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/reads2bam.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/rename_leaves.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/rename_reads_for_Reago.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/rename_seq.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/rename_seqs.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/sam2bam.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/sampling_GTDB_gnms.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/select_seq.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/sep_reads_by_barcode.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/slice_seq.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/split_fasta.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/split_folder.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/split_sam.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/submitHPC.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/subset_GTDB_meta.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/subset_tree.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/top_16S_hits.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/top_hits_in_a_group.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK/usearch_uc.py +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK.egg-info/SOURCES.txt +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK.egg-info/dependency_links.txt +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK.egg-info/requires.txt +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/BioSAK.egg-info/top_level.txt +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/LICENSE +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/MANIFEST.in +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/README.md +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/setup.cfg +0 -0
- {BioSAK-1.76.1 → BioSAK-1.76.3}/setup.py +0 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import argparse
|
|
3
|
+
import subprocess
|
|
4
|
+
import multiprocessing as mp
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
metaAssembly_usage = '''
|
|
8
|
+
==================== metaAssembly example commands ====================
|
|
9
|
+
|
|
10
|
+
BioSAK metaAssembly -i GCA_947846245.1 -o output_dir -f
|
|
11
|
+
BioSAK metaAssembly -i assembly_id.txt -o output_dir -f
|
|
12
|
+
|
|
13
|
+
# format of assembly_id.txt (one id per line)
|
|
14
|
+
GCA_947846245.1
|
|
15
|
+
GCF_026914265.1
|
|
16
|
+
GCF_002022765.2
|
|
17
|
+
|
|
18
|
+
Dependencies: datasets and dataformat
|
|
19
|
+
https://www.ncbi.nlm.nih.gov/datasets/docs/v2/download-and-install/
|
|
20
|
+
|
|
21
|
+
=======================================================================
|
|
22
|
+
'''
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def check_executables(program_list):
|
|
26
|
+
|
|
27
|
+
not_detected_programs = []
|
|
28
|
+
for needed_program in program_list:
|
|
29
|
+
|
|
30
|
+
if subprocess.call(['which', needed_program], stdout=open(os.devnull, 'wb')) != 0:
|
|
31
|
+
not_detected_programs.append(needed_program)
|
|
32
|
+
|
|
33
|
+
if not_detected_programs != []:
|
|
34
|
+
print('%s not detected, program exited!' % ','.join(not_detected_programs))
|
|
35
|
+
exit()
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def metaAssembly(args):
|
|
39
|
+
|
|
40
|
+
assembly_id_txt = args['i']
|
|
41
|
+
op_dir = args['o']
|
|
42
|
+
#num_threads = args['t']
|
|
43
|
+
force_overwrite = args['f']
|
|
44
|
+
|
|
45
|
+
check_executables(['datasets', 'dataformat'])
|
|
46
|
+
|
|
47
|
+
if os.path.isdir(op_dir) is True:
|
|
48
|
+
if force_overwrite is True:
|
|
49
|
+
os.system('rm -r %s' % op_dir)
|
|
50
|
+
else:
|
|
51
|
+
print('Output folder detected, program exited!')
|
|
52
|
+
exit()
|
|
53
|
+
|
|
54
|
+
tmp_dir = '%s/tmp' % op_dir
|
|
55
|
+
op_txt = '%s/output.txt' % op_dir
|
|
56
|
+
|
|
57
|
+
os.mkdir(op_dir)
|
|
58
|
+
os.mkdir(tmp_dir)
|
|
59
|
+
|
|
60
|
+
assembly_id_set = set()
|
|
61
|
+
if os.path.isfile(assembly_id_txt):
|
|
62
|
+
for assembly_id in open(assembly_id_txt):
|
|
63
|
+
assembly_id_set.add(assembly_id.strip())
|
|
64
|
+
if len(assembly_id_set) == 0:
|
|
65
|
+
print('No id found in %s, program exited!' % assembly_id_txt)
|
|
66
|
+
exit()
|
|
67
|
+
else:
|
|
68
|
+
assembly_id_set.add(assembly_id_txt)
|
|
69
|
+
|
|
70
|
+
# run datasets and dataformat with mp
|
|
71
|
+
cmd_set = set()
|
|
72
|
+
for assembly_id in assembly_id_set:
|
|
73
|
+
op_metadata_tsv = '%s/%s_data_report.tsv' % (tmp_dir, assembly_id)
|
|
74
|
+
ncbi_datasets_cmd = 'datasets summary genome accession %s --as-json-lines | dataformat tsv genome > %s' % (assembly_id, op_metadata_tsv)
|
|
75
|
+
cmd_set.add(ncbi_datasets_cmd)
|
|
76
|
+
|
|
77
|
+
# print('Running %s commands with %s cores' % (len(cmd_set), num_threads))
|
|
78
|
+
# pool = mp.Pool(processes=num_threads)
|
|
79
|
+
# pool.map(os.system, cmd_set)
|
|
80
|
+
# pool.close()
|
|
81
|
+
# pool.join()
|
|
82
|
+
|
|
83
|
+
cmd_index = 1
|
|
84
|
+
for each_cmd in cmd_set:
|
|
85
|
+
print('Processing %s/%s' % (cmd_index, len(cmd_set)))
|
|
86
|
+
os.system(each_cmd)
|
|
87
|
+
cmd_index += 1
|
|
88
|
+
|
|
89
|
+
op_txt_handle = open(op_txt, 'w')
|
|
90
|
+
op_txt_handle.write('Assembly\tBioSample\tDescription\tModel\tIsolation_Source\tMetagenome_Source\tHost\tLocation\tComment\n')
|
|
91
|
+
op_txt_handle.close()
|
|
92
|
+
|
|
93
|
+
# parse outputs from datasets and dataformat
|
|
94
|
+
print('Parsing outputs from datasets and dataformat')
|
|
95
|
+
missing_output_id_set = set()
|
|
96
|
+
for assembly_id in assembly_id_set:
|
|
97
|
+
op_metadata_tsv = '%s/%s_data_report.tsv' % (tmp_dir, assembly_id)
|
|
98
|
+
if os.path.isfile(op_metadata_tsv) is False:
|
|
99
|
+
missing_output_id_set.add(assembly_id)
|
|
100
|
+
else:
|
|
101
|
+
biosample_accession = 'na'
|
|
102
|
+
biosample_description_title = 'na'
|
|
103
|
+
biosample_description_comment = 'na'
|
|
104
|
+
isolation_source = 'na'
|
|
105
|
+
metagenome_source = 'na'
|
|
106
|
+
biosample_model = 'na'
|
|
107
|
+
host = 'na'
|
|
108
|
+
geo_loc_name = 'na'
|
|
109
|
+
col_index = dict()
|
|
110
|
+
line_num_index = 0
|
|
111
|
+
for each_line in open(op_metadata_tsv):
|
|
112
|
+
line_num_index += 1
|
|
113
|
+
line_split = each_line.strip().split('\t')
|
|
114
|
+
if line_num_index == 1:
|
|
115
|
+
col_index = {key: i for i, key in enumerate(line_split)}
|
|
116
|
+
else:
|
|
117
|
+
if line_split[col_index['Assembly BioSample Accession']] != '':
|
|
118
|
+
biosample_accession = line_split[col_index['Assembly BioSample Accession']]
|
|
119
|
+
if line_split[col_index['Assembly BioSample Description Title']] != '':
|
|
120
|
+
biosample_description_title = line_split[col_index['Assembly BioSample Description Title']]
|
|
121
|
+
if line_split[col_index['Assembly BioSample Description Comment']] != '':
|
|
122
|
+
biosample_description_comment = line_split[col_index['Assembly BioSample Description Comment']]
|
|
123
|
+
if line_split[col_index['Assembly BioSample Models']] != '':
|
|
124
|
+
biosample_model = line_split[col_index['Assembly BioSample Models']]
|
|
125
|
+
if line_split[col_index['Assembly BioSample Attribute Name']] != '':
|
|
126
|
+
biosample_attribute_name = line_split[col_index['Assembly BioSample Attribute Name']]
|
|
127
|
+
if line_split[col_index['Assembly BioSample Attribute Value']] != '':
|
|
128
|
+
biosample_attribute_value = line_split[col_index['Assembly BioSample Attribute Value']]
|
|
129
|
+
if biosample_attribute_name == 'isolation_source':
|
|
130
|
+
isolation_source = biosample_attribute_value
|
|
131
|
+
elif biosample_attribute_name == 'metagenome_source':
|
|
132
|
+
metagenome_source = biosample_attribute_value
|
|
133
|
+
elif biosample_attribute_name == 'host':
|
|
134
|
+
host = biosample_attribute_value
|
|
135
|
+
elif biosample_attribute_name == 'geo_loc_name':
|
|
136
|
+
geo_loc_name = biosample_attribute_value
|
|
137
|
+
|
|
138
|
+
str_to_write = '%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s' % (assembly_id, biosample_accession, biosample_description_title, biosample_model, isolation_source, metagenome_source, host, geo_loc_name, biosample_description_comment)
|
|
139
|
+
|
|
140
|
+
with open(op_txt, 'a') as op_txt_handle:
|
|
141
|
+
op_txt_handle.write(str_to_write + '\n')
|
|
142
|
+
|
|
143
|
+
if len(missing_output_id_set) > 0:
|
|
144
|
+
print('datasets and dataformat failed on the following IDs:')
|
|
145
|
+
print(','.join(missing_output_id_set))
|
|
146
|
+
|
|
147
|
+
print('Done!')
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
if __name__ == '__main__':
|
|
151
|
+
|
|
152
|
+
metaAssembly_parser = argparse.ArgumentParser(usage=metaAssembly_usage)
|
|
153
|
+
metaAssembly_parser.add_argument('-i', required=True, help='file contains assembly ids')
|
|
154
|
+
metaAssembly_parser.add_argument('-o', required=True, help='output directory')
|
|
155
|
+
metaAssembly_parser.add_argument('-f', required=False, action="store_true", help='force overwrite')
|
|
156
|
+
#metaAssembly_parser.add_argument('-t', required=False, type=int, default=1, help='number of core, default: 1')
|
|
157
|
+
args = vars(metaAssembly_parser.parse_args())
|
|
158
|
+
metaAssembly(args)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: BioSAK
|
|
3
|
-
Version: 1.76.
|
|
3
|
+
Version: 1.76.3
|
|
4
4
|
Summary: BioSAK
|
|
5
5
|
Home-page: https://github.com/songweizhi/BioSAK
|
|
6
6
|
Author: Weizhi Song
|
|
@@ -20,4 +20,4 @@ Requires-Dist: beautifulsoup4
|
|
|
20
20
|
Requires-Dist: ete3
|
|
21
21
|
Requires-Dist: statsmodels
|
|
22
22
|
|
|
23
|
-
BioSAK v1.76.
|
|
23
|
+
BioSAK v1.76.3
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: BioSAK
|
|
3
|
-
Version: 1.76.
|
|
3
|
+
Version: 1.76.3
|
|
4
4
|
Summary: BioSAK
|
|
5
5
|
Home-page: https://github.com/songweizhi/BioSAK
|
|
6
6
|
Author: Weizhi Song
|
|
@@ -20,4 +20,4 @@ Requires-Dist: beautifulsoup4
|
|
|
20
20
|
Requires-Dist: ete3
|
|
21
21
|
Requires-Dist: statsmodels
|
|
22
22
|
|
|
23
|
-
BioSAK v1.76.
|
|
23
|
+
BioSAK v1.76.3
|
|
@@ -887,6 +887,7 @@ if __name__ == '__main__':
|
|
|
887
887
|
metaAssembly_parser.add_argument('-i', required=True, help='file contains assembly ids')
|
|
888
888
|
metaAssembly_parser.add_argument('-o', required=True, help='output directory')
|
|
889
889
|
metaAssembly_parser.add_argument('-f', required=False, action="store_true", help='force overwrite')
|
|
890
|
+
#metaAssembly_parser.add_argument('-t', required=False, type=int, default=1, help='number of core, default: 1')
|
|
890
891
|
args = vars(parser.parse_args())
|
|
891
892
|
metaAssembly.metaAssembly(args)
|
|
892
893
|
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import argparse
|
|
3
|
-
import subprocess
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
metaAssembly_usage = '''
|
|
7
|
-
==================== metaAssembly example commands ====================
|
|
8
|
-
|
|
9
|
-
BioSAK metaAssembly -i GCA_947846245.1 -o output_dir -f
|
|
10
|
-
BioSAK metaAssembly -i assembly_id.txt -o output_dir -f
|
|
11
|
-
|
|
12
|
-
# format of assembly_id.txt (one id per line)
|
|
13
|
-
GCA_947846245.1
|
|
14
|
-
GCF_026914265.1
|
|
15
|
-
GCF_002022765.2
|
|
16
|
-
|
|
17
|
-
Dependencies: datasets and dataformat
|
|
18
|
-
https://www.ncbi.nlm.nih.gov/datasets/docs/v2/download-and-install/
|
|
19
|
-
|
|
20
|
-
=======================================================================
|
|
21
|
-
'''
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
def check_executables(program_list):
|
|
25
|
-
|
|
26
|
-
not_detected_programs = []
|
|
27
|
-
for needed_program in program_list:
|
|
28
|
-
|
|
29
|
-
if subprocess.call(['which', needed_program], stdout=open(os.devnull, 'wb')) != 0:
|
|
30
|
-
not_detected_programs.append(needed_program)
|
|
31
|
-
|
|
32
|
-
if not_detected_programs != []:
|
|
33
|
-
print('%s not detected, program exited!' % ','.join(not_detected_programs))
|
|
34
|
-
exit()
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
def metaAssembly(args):
|
|
38
|
-
|
|
39
|
-
assembly_id_txt = args['i']
|
|
40
|
-
op_dir = args['o']
|
|
41
|
-
force_overwrite = args['f']
|
|
42
|
-
|
|
43
|
-
check_executables(['datasets', 'dataformat'])
|
|
44
|
-
|
|
45
|
-
if os.path.isdir(op_dir) is True:
|
|
46
|
-
if force_overwrite is True:
|
|
47
|
-
os.system('rm -r %s' % op_dir)
|
|
48
|
-
else:
|
|
49
|
-
print('Output folder detected, program exited!')
|
|
50
|
-
exit()
|
|
51
|
-
|
|
52
|
-
tmp_dir = '%s/tmp' % op_dir
|
|
53
|
-
op_txt = '%s/output.txt' % op_dir
|
|
54
|
-
|
|
55
|
-
os.mkdir(op_dir)
|
|
56
|
-
os.mkdir(tmp_dir)
|
|
57
|
-
|
|
58
|
-
assembly_id_set = set()
|
|
59
|
-
if os.path.isfile(assembly_id_txt):
|
|
60
|
-
for assembly_id in open(assembly_id_txt):
|
|
61
|
-
assembly_id_set.add(assembly_id.strip())
|
|
62
|
-
if len(assembly_id_set) == 0:
|
|
63
|
-
print('No id found in %s, program exited!' % assembly_id_txt)
|
|
64
|
-
exit()
|
|
65
|
-
else:
|
|
66
|
-
assembly_id_set.add(assembly_id_txt)
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
op_txt_handle = open(op_txt, 'w')
|
|
70
|
-
op_txt_handle.write('Assembly\tBioSample\tTitle\tDescription\n')
|
|
71
|
-
op_txt_handle.close()
|
|
72
|
-
|
|
73
|
-
processing_index = 1
|
|
74
|
-
for assembly_id in assembly_id_set:
|
|
75
|
-
print('Processing %s/%s: %s' % (processing_index, len(assembly_id_set), assembly_id))
|
|
76
|
-
op_metadata_tsv = '%s/%s_data_report.tsv' % (tmp_dir, assembly_id)
|
|
77
|
-
ncbi_datasets_cmd = 'datasets summary genome accession %s --as-json-lines | dataformat tsv genome > %s' % (assembly_id, op_metadata_tsv)
|
|
78
|
-
os.system(ncbi_datasets_cmd)
|
|
79
|
-
biosample_title = ''
|
|
80
|
-
biosample_accession = ''
|
|
81
|
-
biosample_description = ''
|
|
82
|
-
col_index = dict()
|
|
83
|
-
line_num_index = 0
|
|
84
|
-
for each_line in open(op_metadata_tsv):
|
|
85
|
-
line_num_index += 1
|
|
86
|
-
line_split = each_line.strip().split('\t')
|
|
87
|
-
if line_num_index == 1:
|
|
88
|
-
col_index = {key: i for i, key in enumerate(line_split)}
|
|
89
|
-
elif line_num_index == 2:
|
|
90
|
-
biosample_accession = line_split[col_index['Assembly BioSample Accession']]
|
|
91
|
-
biosample_title = line_split[col_index['Assembly BioSample Description Title']]
|
|
92
|
-
biosample_description = line_split[col_index['Assembly BioSample Description Comment']]
|
|
93
|
-
str_to_write = '%s\t%s\t%s\t%s' % (assembly_id, biosample_accession, biosample_title, biosample_description)
|
|
94
|
-
|
|
95
|
-
with open(op_txt, 'a') as op_txt_handle:
|
|
96
|
-
op_txt_handle.write(str_to_write + '\n')
|
|
97
|
-
|
|
98
|
-
processing_index += 1
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
if __name__ == '__main__':
|
|
102
|
-
|
|
103
|
-
metaAssembly_parser = argparse.ArgumentParser(usage=metaAssembly_usage)
|
|
104
|
-
metaAssembly_parser.add_argument('-i', required=True, help='file contains assembly ids')
|
|
105
|
-
metaAssembly_parser.add_argument('-o', required=True, help='output directory')
|
|
106
|
-
metaAssembly_parser.add_argument('-f', required=False, action="store_true", help='force overwrite')
|
|
107
|
-
args = vars(metaAssembly_parser.parse_args())
|
|
108
|
-
metaAssembly(args)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|