BioSAK 1.86.2__tar.gz → 1.86.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.
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/VERSION +1 -1
- BioSAK-1.86.4/BioSAK/gbk2gff.py +212 -0
- BioSAK-1.86.4/BioSAK/gff2chrom.py +50 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/ribbon.py +148 -84
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK.egg-info/PKG-INFO +2 -2
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK.egg-info/SOURCES.txt +2 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/PKG-INFO +2 -2
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/BLCA_op_parser.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/BioSAK_config.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/COG2020.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/COG_boxplot_last1row.R +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/COG_boxplot_last2row.R +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/CheckM.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/ConvertMSA.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/DnaFeaturesViewer.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/FastaSplitler_by_num.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/FastaSplitler_by_size.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/GTDB_for_BLCA.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/Gene2Ctg.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/KEGG.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/KEGG_boxplot_last1row.R +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/KEGG_get_eukaryotic_kos.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/KeepRemovingTmp.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/MeanMappingDepth.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/MetaBiosample.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/MetaCHIP_phylo.hmm +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/MetaCyc_reactions_with_ec.txt +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/NetEnzymes.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/Newick_tree_plotter.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/OneLineAln.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/Prodigal.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/Reads_simulator.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/RunGraphMB.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/SILVA_for_BLCA.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/SankeyTaxon.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/SliceMSA.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/SubsampleLongReads.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/Tax4Fun2IndOTU.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/VisBlastOp.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/VisGeneFlk.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/__init__.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/add_desc.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/arCOG.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/bam2reads.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/boxplot.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/boxplot_last1row.R +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/boxplot_matrix_COG.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/boxplot_matrix_COG_backup.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/boxplot_matrix_KEGG.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/boxplot_matrix_dbCAN.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/cat_fa.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/cdd2cog.pl +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/checkm_marker.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/compare_trees.R +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/compare_trees.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/cross_link_seqs.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/dbCAN.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/download_GenBank_genome_subset_prokaryotes_csv.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/dwnld_sra_reads.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/enrich.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/exe_cmds.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/ezaai2mat.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/fa2id.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/fa2phy.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/fa2tree.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/format_converter.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/format_leaf_name.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/fq2fa.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/gapseq.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/gbk2faa.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/gbk2ffn.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/gbk2fna.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/gbk_to_ffn_faa.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/gc.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/get_EC_from_ko_stats_D.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/get_GTDB_taxon_gnm.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/get_MAG_reads_long.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/get_Pfam_hmms.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/get_SCG_tree.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/get_TopHits_taxonomy.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/get_aa_composition.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/get_bin_abundance copy.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/get_data_matrix.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/get_gene_depth.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/get_genome_GTDB.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/get_genome_NCBI.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/get_genome_NCBI_v1.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/get_genome_NCBI_v2.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/get_gnm_size.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/get_ko_gene_seqs.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/get_krona_plot.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/get_reads_from_sam.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/get_reads_id_in_sam.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/get_sankey_plot.R +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/get_top_hit.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/get_total_length.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/global_functions.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/hpc3.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/iTOL.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/js_cmds.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/js_hpc3.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/keep_best_hit.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/ko00001.keg +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/koala.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/label_tree.R +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/label_tree.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/link_16S_MAG.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/magabund.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/magabund2.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/manipulator_fasta.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/manipulator_msa.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/manipulator_newick.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/manipulator_sam.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/mannwhitneyu.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/mean_MAG_cov.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/merge_df.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/merge_seq.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/metaAssembly.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/metabat2concoct.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/metabat2maxbin.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/msa_to_distance_matrix.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/ncbi_dataset.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/odp.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/parse_MetaCyc_RxnDB.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/parse_mmseqs_tsv.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/plot_mag.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/plot_sam_depth.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/plot_tree.R +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/prefix_file.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/prokka.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/reads2bam.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/rename_leaves.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/rename_reads_for_Reago.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/rename_seq.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/rename_seqs.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/sam2bam.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/sampling_GTDB_gnms.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/select_seq.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/sep_reads_by_barcode.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/slice_seq.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/split_fasta.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/split_folder.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/split_sam.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/submitHPC.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/subset_GTDB_meta.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/subset_df.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/subset_tree.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/tmp_1.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/top_16S_hits.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/top_hits_in_a_group.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/transpose.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/usearch_uc.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK/wilcox.py +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK.egg-info/dependency_links.txt +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK.egg-info/requires.txt +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/BioSAK.egg-info/top_level.txt +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/LICENSE +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/MANIFEST.in +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/README.md +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/bin/BioSAK +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/setup.cfg +0 -0
- {BioSAK-1.86.2 → BioSAK-1.86.4}/setup.py +0 -0
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import re
|
|
3
|
+
import sys
|
|
4
|
+
import collections
|
|
5
|
+
from Bio import SeqIO
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
"""
|
|
9
|
+
Convert data from Genbank format to GFF.
|
|
10
|
+
|
|
11
|
+
Usage:
|
|
12
|
+
python gbk_to_gff.py in.gbk > out.gff
|
|
13
|
+
|
|
14
|
+
Requirements:
|
|
15
|
+
BioPython:- http://biopython.org/
|
|
16
|
+
helper.py:- https://github.com/vipints/GFFtools-GX/blob/master/helper.py
|
|
17
|
+
|
|
18
|
+
Copyright (C)
|
|
19
|
+
2009-2012 Friedrich Miescher Laboratory of the Max Planck Society, Tubingen, Germany.
|
|
20
|
+
2012-2015 Memorial Sloan Kettering Cancer Center New York City, USA.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
def feature_table(chr_id, source, orient, genes, transcripts, cds, exons, unk):
|
|
24
|
+
"""
|
|
25
|
+
Write the feature information
|
|
26
|
+
"""
|
|
27
|
+
for gname, ginfo in genes.items():
|
|
28
|
+
line = [str(chr_id),
|
|
29
|
+
'gbk2gff',
|
|
30
|
+
ginfo[3],
|
|
31
|
+
str(ginfo[0]),
|
|
32
|
+
str(ginfo[1]),
|
|
33
|
+
'.',
|
|
34
|
+
ginfo[2],
|
|
35
|
+
'.',
|
|
36
|
+
'ID=%s;Name=%s' % (str(gname), str(gname))]
|
|
37
|
+
sys.stdout.write('\t'.join(line) + "\n")
|
|
38
|
+
## construct the transcript line is not defined in the original file
|
|
39
|
+
t_line = [str(chr_id), 'gbk2gff', source, '0', '1', '.', ginfo[2], '.']
|
|
40
|
+
|
|
41
|
+
if not transcripts:
|
|
42
|
+
t_line.append('ID=Transcript:%s;Parent=%s' % (str(gname), str(gname)))
|
|
43
|
+
|
|
44
|
+
if exons: ## get the entire transcript region from the defined feature
|
|
45
|
+
t_line[3] = str(exons[gname][0][0])
|
|
46
|
+
t_line[4] = str(exons[gname][0][-1])
|
|
47
|
+
elif cds:
|
|
48
|
+
t_line[3] = str(cds[gname][0][0])
|
|
49
|
+
t_line[4] = str(cds[gname][0][-1])
|
|
50
|
+
|
|
51
|
+
if not cds:
|
|
52
|
+
t_line[2] = 'transcript'
|
|
53
|
+
else:
|
|
54
|
+
t_line[2] = 'mRNA'
|
|
55
|
+
sys.stdout.write('\t'.join(t_line) + "\n")
|
|
56
|
+
|
|
57
|
+
if exons:
|
|
58
|
+
exon_line_print(t_line, exons[gname], 'Transcript:' + str(gname), 'exon')
|
|
59
|
+
|
|
60
|
+
if cds:
|
|
61
|
+
exon_line_print(t_line, cds[gname], 'Transcript:' + str(gname), 'CDS')
|
|
62
|
+
if not exons:
|
|
63
|
+
exon_line_print(t_line, cds[gname], 'Transcript:' + str(gname), 'exon')
|
|
64
|
+
|
|
65
|
+
else: ## transcript is defined
|
|
66
|
+
for idx in transcripts[gname]:
|
|
67
|
+
t_line[2] = idx[3]
|
|
68
|
+
t_line[3] = str(idx[0])
|
|
69
|
+
t_line[4] = str(idx[1])
|
|
70
|
+
t_line.append('ID=' + str(idx[2]) + ';Parent=' + str(gname))
|
|
71
|
+
sys.stdout.write('\t'.join(t_line) + "\n")
|
|
72
|
+
|
|
73
|
+
## feature line print call
|
|
74
|
+
if exons:
|
|
75
|
+
exon_line_print(t_line, exons[gname], str(idx[2]), 'exon')
|
|
76
|
+
if cds:
|
|
77
|
+
exon_line_print(t_line, cds[gname], str(idx[2]), 'CDS')
|
|
78
|
+
if not exons:
|
|
79
|
+
exon_line_print(t_line, cds[gname], str(idx[2]), 'exon')
|
|
80
|
+
|
|
81
|
+
if len(genes) == 0: ## feature entry with fragment information
|
|
82
|
+
|
|
83
|
+
line = [str(chr_id), 'gbk2gff', source, 0, 1, '.', orient, '.']
|
|
84
|
+
fStart = fStop = None
|
|
85
|
+
|
|
86
|
+
for eid, ex in cds.items():
|
|
87
|
+
fStart = ex[0][0]
|
|
88
|
+
fStop = ex[0][-1]
|
|
89
|
+
|
|
90
|
+
for eid, ex in exons.items():
|
|
91
|
+
fStart = ex[0][0]
|
|
92
|
+
fStop = ex[0][-1]
|
|
93
|
+
|
|
94
|
+
if fStart or fStart:
|
|
95
|
+
|
|
96
|
+
line[2] = 'gene'
|
|
97
|
+
line[3] = str(fStart)
|
|
98
|
+
line[4] = str(fStop)
|
|
99
|
+
line.append('ID=Unknown_Gene_' + str(unk) + ';Name=Unknown_Gene_' + str(unk))
|
|
100
|
+
sys.stdout.write('\t'.join(line) + "\n")
|
|
101
|
+
|
|
102
|
+
if not cds:
|
|
103
|
+
line[2] = 'transcript'
|
|
104
|
+
else:
|
|
105
|
+
line[2] = 'mRNA'
|
|
106
|
+
|
|
107
|
+
line[8] = 'ID=Unknown_Transcript_' + str(unk) + ';Parent=Unknown_Gene_' + str(unk)
|
|
108
|
+
sys.stdout.write('\t'.join(line) + "\n")
|
|
109
|
+
|
|
110
|
+
if exons:
|
|
111
|
+
exon_line_print(line, cds[None], 'Unknown_Transcript_' + str(unk), 'exon')
|
|
112
|
+
|
|
113
|
+
if cds:
|
|
114
|
+
exon_line_print(line, cds[None], 'Unknown_Transcript_' + str(unk), 'CDS')
|
|
115
|
+
if not exons:
|
|
116
|
+
exon_line_print(line, cds[None], 'Unknown_Transcript_' + str(unk), 'exon')
|
|
117
|
+
|
|
118
|
+
unk += 1
|
|
119
|
+
|
|
120
|
+
return unk
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def exon_line_print(temp_line, trx_exons, parent, ftype):
|
|
124
|
+
"""
|
|
125
|
+
Print the EXON feature line
|
|
126
|
+
"""
|
|
127
|
+
for ex in trx_exons:
|
|
128
|
+
temp_line[2] = ftype
|
|
129
|
+
temp_line[3] = str(ex[0])
|
|
130
|
+
temp_line[4] = str(ex[1])
|
|
131
|
+
temp_line[8] = 'Parent=%s' % parent
|
|
132
|
+
sys.stdout.write('\t'.join(temp_line) + "\n")
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
def gbk_parse(fname):
|
|
136
|
+
"""
|
|
137
|
+
Extract genome annotation recods from genbank format
|
|
138
|
+
|
|
139
|
+
@args fname: gbk file name
|
|
140
|
+
@type fname: str
|
|
141
|
+
"""
|
|
142
|
+
unk = 1
|
|
143
|
+
for record in SeqIO.parse(gbkfname, "genbank"):
|
|
144
|
+
gene_tags = dict()
|
|
145
|
+
tx_tags = collections.defaultdict(list)
|
|
146
|
+
exon = collections.defaultdict(list)
|
|
147
|
+
cds = collections.defaultdict(list)
|
|
148
|
+
mol_type, chr_id = None, None
|
|
149
|
+
|
|
150
|
+
for rec in record.features:
|
|
151
|
+
|
|
152
|
+
if rec.type == 'source':
|
|
153
|
+
try:
|
|
154
|
+
mol_type = rec.qualifiers['mol_type'][0]
|
|
155
|
+
except:
|
|
156
|
+
mol_type = '.'
|
|
157
|
+
pass
|
|
158
|
+
try:
|
|
159
|
+
chr_id = rec.qualifiers['chromosome'][0]
|
|
160
|
+
except:
|
|
161
|
+
chr_id = record.name
|
|
162
|
+
continue
|
|
163
|
+
|
|
164
|
+
strand = '-'
|
|
165
|
+
strand = '+' if rec.strand > 0 else strand
|
|
166
|
+
|
|
167
|
+
fid = None
|
|
168
|
+
try:
|
|
169
|
+
fid = rec.qualifiers['gene'][0]
|
|
170
|
+
except:
|
|
171
|
+
pass
|
|
172
|
+
|
|
173
|
+
transcript_id = None
|
|
174
|
+
try:
|
|
175
|
+
transcript_id = rec.qualifiers['transcript_id'][0]
|
|
176
|
+
except:
|
|
177
|
+
pass
|
|
178
|
+
|
|
179
|
+
if re.search(r'gene', rec.type):
|
|
180
|
+
gene_tags[fid] = (rec.location._start.position + 1,
|
|
181
|
+
rec.location._end.position,
|
|
182
|
+
strand,
|
|
183
|
+
rec.type
|
|
184
|
+
)
|
|
185
|
+
elif rec.type == 'exon':
|
|
186
|
+
exon[fid].append((rec.location._start.position + 1,
|
|
187
|
+
rec.location._end.position))
|
|
188
|
+
elif rec.type == 'CDS':
|
|
189
|
+
cds[fid].append((rec.location._start.position + 1,
|
|
190
|
+
rec.location._end.position))
|
|
191
|
+
else:
|
|
192
|
+
# get all transcripts
|
|
193
|
+
if transcript_id:
|
|
194
|
+
tx_tags[fid].append((rec.location._start.position + 1,
|
|
195
|
+
rec.location._end.position,
|
|
196
|
+
transcript_id,
|
|
197
|
+
rec.type))
|
|
198
|
+
# record extracted, generate feature table
|
|
199
|
+
unk = feature_table(chr_id, mol_type, strand, gene_tags, tx_tags, cds, exon, unk)
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
if __name__ == '__main__':
|
|
203
|
+
|
|
204
|
+
try:
|
|
205
|
+
gbkfname = sys.argv[1]
|
|
206
|
+
except:
|
|
207
|
+
print
|
|
208
|
+
__doc__
|
|
209
|
+
sys.exit(-1)
|
|
210
|
+
|
|
211
|
+
## extract gbk records
|
|
212
|
+
gbk_parse(gbkfname)
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import gzip
|
|
2
|
+
import sys
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def gff2chrom(gff_in, chrom_out):
|
|
6
|
+
|
|
7
|
+
# This function was modified based on the NCBIgff2chrom.py from https://github.com/conchoecia/odp
|
|
8
|
+
# This program parses a NCBI GFF annotation and generates a .chrom file
|
|
9
|
+
# see https://github.com/conchoecia/odp for the specification
|
|
10
|
+
|
|
11
|
+
gzipped = False
|
|
12
|
+
for thisend in [".gz", ".gzip", ".GZ", ".GZIP", ".gzipped", ".GZIPPED"]:
|
|
13
|
+
if gff_in.endswith(thisend):
|
|
14
|
+
gzipped = True
|
|
15
|
+
|
|
16
|
+
if gzipped:
|
|
17
|
+
handle = gzip.open(gff_in,'rt')
|
|
18
|
+
else:
|
|
19
|
+
handle = open(gff_in, "r")
|
|
20
|
+
|
|
21
|
+
prots = dict()
|
|
22
|
+
for line in handle:
|
|
23
|
+
line = line.strip()
|
|
24
|
+
splitd=line.split("\t")
|
|
25
|
+
if line and len(splitd) > 7 and splitd[2] == "CDS" and "protein_id=" in line:
|
|
26
|
+
pid = [x for x in splitd[8].split(";") if x.startswith("protein_id=")][0].replace("protein_id=", "")
|
|
27
|
+
scaf = splitd[0]
|
|
28
|
+
strand = splitd[6]
|
|
29
|
+
start = int(splitd[3])
|
|
30
|
+
stop = int(splitd[3])
|
|
31
|
+
if pid not in prots:
|
|
32
|
+
prots[pid] = {"scaf": scaf, "strand": strand, "start": start, "stop": stop}
|
|
33
|
+
else:
|
|
34
|
+
if start < prots[pid]["start"]:
|
|
35
|
+
prots[pid]["start"] = start
|
|
36
|
+
if stop > prots[pid]["stop"]:
|
|
37
|
+
prots[pid]["stop"] = stop
|
|
38
|
+
handle.close()
|
|
39
|
+
|
|
40
|
+
# write out .chrom file
|
|
41
|
+
chrom_out_handle = open(chrom_out, 'w')
|
|
42
|
+
for pid in prots:
|
|
43
|
+
chrom_out_handle.write("{}\t{}\t{}\t{}\t{}\n".format(pid, prots[pid]["scaf"], prots[pid]["strand"], prots[pid]["start"], prots[pid]["stop"]))
|
|
44
|
+
chrom_out_handle.close()
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
gff_in = '/Users/songweizhi/Desktop/Limpet/GCF_932274485.2_xgPatVulg1.2_genomic.gff'
|
|
48
|
+
chrom_out = '/Users/songweizhi/Desktop/Limpet/GCF_932274485.2_xgPatVulg1.2_genomic.chrom'
|
|
49
|
+
gff2chrom(gff_in, chrom_out)
|
|
50
|
+
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import os
|
|
2
2
|
import glob
|
|
3
|
+
import gzip
|
|
3
4
|
import argparse
|
|
4
5
|
from Bio import SeqIO
|
|
5
6
|
|
|
6
|
-
# Make ribbon diagrams of conserved linkages between genomes
|
|
7
|
-
# https://github.com/conchoecia/odp
|
|
8
7
|
|
|
9
8
|
ribbon_usage = '''
|
|
10
9
|
==================== ribbon example commands ====================
|
|
@@ -13,11 +12,13 @@ ribbon_usage = '''
|
|
|
13
12
|
|
|
14
13
|
# example commands
|
|
15
14
|
odp="/scratch/PI/ocessongwz/Software/odp/scripts/odp"
|
|
16
|
-
|
|
17
|
-
BioSAK ribbon -co chrom_order.txt -o ribbon_op_dir -fa
|
|
15
|
+
ribbon="/scratch/PI/ocessongwz/Software/odp/scripts/odp_rbh_to_ribbon"
|
|
16
|
+
BioSAK ribbon -plot_lgs -co chrom_order.txt -o ribbon_op_dir -fa demo_files -pep demo_files -chrom demo_files -f -odp $odp -odp_rbh_to_ribbon $ribbon
|
|
18
17
|
|
|
19
18
|
Note:
|
|
20
19
|
1. Species names can't have '_' char
|
|
20
|
+
2. Reference: https://github.com/conchoecia/odp
|
|
21
|
+
3. Demo data: https://github.com/songweizhi/BioSAK/tree/master/demo_data/ribbon
|
|
21
22
|
|
|
22
23
|
=================================================================
|
|
23
24
|
'''
|
|
@@ -33,6 +34,48 @@ def sep_path_basename_ext(file_in):
|
|
|
33
34
|
return f_name, f_path, f_base, f_ext[1:]
|
|
34
35
|
|
|
35
36
|
|
|
37
|
+
def gff2chrom(gff_in, chrom_out):
|
|
38
|
+
|
|
39
|
+
# This function was modified based on the NCBIgff2chrom.py from https://github.com/conchoecia/odp
|
|
40
|
+
# This program parses a NCBI GFF annotation and generates a .chrom file
|
|
41
|
+
# see https://github.com/conchoecia/odp for the specification
|
|
42
|
+
|
|
43
|
+
gzipped = False
|
|
44
|
+
for thisend in [".gz", ".gzip", ".GZ", ".GZIP", ".gzipped", ".GZIPPED"]:
|
|
45
|
+
if gff_in.endswith(thisend):
|
|
46
|
+
gzipped = True
|
|
47
|
+
|
|
48
|
+
if gzipped:
|
|
49
|
+
handle = gzip.open(gff_in, 'rt')
|
|
50
|
+
else:
|
|
51
|
+
handle = open(gff_in, "r")
|
|
52
|
+
|
|
53
|
+
prots = dict()
|
|
54
|
+
for line in handle:
|
|
55
|
+
line = line.strip()
|
|
56
|
+
splitd = line.split("\t")
|
|
57
|
+
if line and len(splitd) > 7 and splitd[2] == "CDS" and "protein_id=" in line:
|
|
58
|
+
pid = [x for x in splitd[8].split(";") if x.startswith("protein_id=")][0].replace("protein_id=", "")
|
|
59
|
+
scaf = splitd[0]
|
|
60
|
+
strand = splitd[6]
|
|
61
|
+
start = int(splitd[3])
|
|
62
|
+
stop = int(splitd[3])
|
|
63
|
+
if pid not in prots:
|
|
64
|
+
prots[pid] = {"scaf": scaf, "strand": strand, "start": start, "stop": stop}
|
|
65
|
+
else:
|
|
66
|
+
if start < prots[pid]["start"]:
|
|
67
|
+
prots[pid]["start"] = start
|
|
68
|
+
if stop > prots[pid]["stop"]:
|
|
69
|
+
prots[pid]["stop"] = stop
|
|
70
|
+
handle.close()
|
|
71
|
+
|
|
72
|
+
# write out .chrom file
|
|
73
|
+
chrom_out_handle = open(chrom_out, 'w')
|
|
74
|
+
for pid in prots:
|
|
75
|
+
chrom_out_handle.write("{}\t{}\t{}\t{}\t{}\n".format(pid, prots[pid]["scaf"], prots[pid]["strand"], prots[pid]["start"], prots[pid]["stop"]))
|
|
76
|
+
chrom_out_handle.close()
|
|
77
|
+
|
|
78
|
+
|
|
36
79
|
def ribbon(args):
|
|
37
80
|
|
|
38
81
|
fa_in = args['fa']
|
|
@@ -58,11 +101,12 @@ def ribbon(args):
|
|
|
58
101
|
|
|
59
102
|
################################################# define file name #################################################
|
|
60
103
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
104
|
+
wd_path = os.path.abspath(os.getcwd())
|
|
105
|
+
|
|
106
|
+
get_macrosynteny_plot_wd = '%s/get_macrosynteny_plot' % op_dir
|
|
107
|
+
get_ribbon_diagram_wd = '%s/get_ribbon_diagram' % op_dir
|
|
108
|
+
config_yaml_macrosynteny = '%s/config.yaml' % get_macrosynteny_plot_wd
|
|
109
|
+
cmd_txt = '%s/commands.txt' % op_dir
|
|
66
110
|
|
|
67
111
|
####################################################################################################################
|
|
68
112
|
|
|
@@ -109,18 +153,10 @@ def ribbon(args):
|
|
|
109
153
|
chrom_order_dict[s_id] = []
|
|
110
154
|
chrom_order_dict[s_id].append(c_id)
|
|
111
155
|
|
|
112
|
-
fa_in_abspath
|
|
113
|
-
op_dir_abspath
|
|
114
|
-
get_macrosynteny_plot_wd_abspath
|
|
115
|
-
get_ribbon_diagram_wd_abspath
|
|
116
|
-
rbh_file_dir = '%s/odp/step2-figures/synteny_nocolor' % get_macrosynteny_plot_wd_abspath
|
|
117
|
-
step2_figures_abspath = '%s/odp/step2-figures' % get_macrosynteny_plot_wd_abspath
|
|
118
|
-
|
|
119
|
-
rbh_file_dir_plot_lgs = ''
|
|
120
|
-
step2_figures_sub_dir_list = next(os.walk(step2_figures_abspath))[1]
|
|
121
|
-
for each_sub_dir in step2_figures_sub_dir_list:
|
|
122
|
-
if each_sub_dir.startwith('synteny_coloredby'):
|
|
123
|
-
rbh_file_dir_plot_lgs = '%s/%s' % (step2_figures_abspath, each_sub_dir)
|
|
156
|
+
fa_in_abspath = os.path.abspath(fa_in)
|
|
157
|
+
op_dir_abspath = os.path.abspath(op_dir)
|
|
158
|
+
get_macrosynteny_plot_wd_abspath = os.path.abspath(get_macrosynteny_plot_wd)
|
|
159
|
+
get_ribbon_diagram_wd_abspath = os.path.abspath(get_ribbon_diagram_wd)
|
|
124
160
|
|
|
125
161
|
################################### get config.yaml for getting macrosynteny plot ##################################
|
|
126
162
|
|
|
@@ -152,71 +188,15 @@ def ribbon(args):
|
|
|
152
188
|
config_yaml_macrosynteny_handle.write(' minscafsize: %s\n' % minscafsize)
|
|
153
189
|
config_yaml_macrosynteny_handle.close()
|
|
154
190
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
config_yaml_ribbon_handle = open(config_yaml_ribbon, 'w')
|
|
158
|
-
config_yaml_ribbon_handle.write('chr_sort_order: optimal-chr-or\n')
|
|
159
|
-
if plot_all is True:
|
|
160
|
-
config_yaml_ribbon_handle.write('plot_all: True\n')
|
|
161
|
-
else:
|
|
162
|
-
config_yaml_ribbon_handle.write('plot_all: False\n')
|
|
163
|
-
config_yaml_ribbon_handle.write('\n')
|
|
164
|
-
|
|
165
|
-
# write out species_order section
|
|
166
|
-
config_yaml_ribbon_handle.write('species_order:\n')
|
|
167
|
-
for species in species_order_list:
|
|
168
|
-
config_yaml_ribbon_handle.write(' - %s\n' % species)
|
|
169
|
-
config_yaml_ribbon_handle.write('\n')
|
|
191
|
+
############################################### get macrosynteny plot ##############################################
|
|
170
192
|
|
|
171
|
-
|
|
172
|
-
config_yaml_ribbon_handle.write('chromorder:\n')
|
|
173
|
-
if chrom_order_txt is not None:
|
|
174
|
-
for each_s in chrom_order_dict:
|
|
175
|
-
config_yaml_ribbon_handle.write(' %s:\n' % each_s)
|
|
176
|
-
for each_chrom in chrom_order_dict[each_s]:
|
|
177
|
-
config_yaml_ribbon_handle.write(' - %s\n' % each_chrom)
|
|
178
|
-
config_yaml_ribbon_handle.write('\n')
|
|
179
|
-
else:
|
|
180
|
-
for each_species in species_order_list:
|
|
181
|
-
current_chrom_list = species_to_chrom_dict.get(each_species, [])
|
|
182
|
-
if len(current_chrom_list) > 0:
|
|
183
|
-
config_yaml_ribbon_handle.write(' %s:\n' % each_species)
|
|
184
|
-
for each_chrom in current_chrom_list:
|
|
185
|
-
config_yaml_ribbon_handle.write(' - %s\n' % each_chrom)
|
|
186
|
-
config_yaml_ribbon_handle.write('\n')
|
|
187
|
-
|
|
188
|
-
# write out rbh_directory section
|
|
189
|
-
if plot_lgs is False:
|
|
190
|
-
config_yaml_ribbon_handle.write('rbh_directory: %s\n' % rbh_file_dir)
|
|
191
|
-
else:
|
|
192
|
-
config_yaml_ribbon_handle.write('rbh_directory: %s\n' % rbh_file_dir_plot_lgs)
|
|
193
|
-
config_yaml_ribbon_handle.write('\n')
|
|
194
|
-
|
|
195
|
-
# write out species section
|
|
196
|
-
config_yaml_ribbon_handle.write('species:\n')
|
|
197
|
-
for each_species in species_order_list:
|
|
198
|
-
current_fa = '%s/%s.fa' % (fa_in_abspath, each_species)
|
|
199
|
-
current_pep = '%s/%s.pep' % (fa_in_abspath, each_species)
|
|
200
|
-
current_chrom = '%s/%s.chrom' % (fa_in_abspath, each_species)
|
|
201
|
-
config_yaml_ribbon_handle.write(' %s:\n' % each_species)
|
|
202
|
-
config_yaml_ribbon_handle.write(' proteins: %s\n' % current_pep)
|
|
203
|
-
config_yaml_ribbon_handle.write(' chrom: %s\n' % current_chrom)
|
|
204
|
-
config_yaml_ribbon_handle.write(' genome: %s\n' % current_fa)
|
|
205
|
-
config_yaml_ribbon_handle.write(' minscafsize: %s\n' % minscafsize)
|
|
206
|
-
config_yaml_ribbon_handle.close()
|
|
207
|
-
|
|
208
|
-
################################################## run snakemake ###################################################
|
|
209
|
-
|
|
210
|
-
snakemake_cmd_macrosynteny = 'snakemake --cores %s --snakefile %s' % (thread_num, odp_exe)
|
|
211
|
-
snakemake_cmd_ribbon = 'snakemake --cores %s --snakefile %s' % (thread_num, odp_rbh_to_ribbon_exe)
|
|
193
|
+
snakemake_cmd_macrosynteny = 'snakemake --cores %s --snakefile %s' % (thread_num, odp_exe)
|
|
212
194
|
|
|
213
195
|
# write out commands
|
|
214
196
|
cmd_txt_handle = open(cmd_txt, 'w')
|
|
215
197
|
cmd_txt_handle.write('cd %s\n' % get_macrosynteny_plot_wd_abspath)
|
|
216
198
|
cmd_txt_handle.write(snakemake_cmd_macrosynteny + '\n')
|
|
217
199
|
cmd_txt_handle.write('\n')
|
|
218
|
-
cmd_txt_handle.write('cd %s\n' % get_ribbon_diagram_wd_abspath)
|
|
219
|
-
cmd_txt_handle.write(snakemake_cmd_ribbon + '\n')
|
|
220
200
|
cmd_txt_handle.close()
|
|
221
201
|
|
|
222
202
|
# get macrosynteny plot
|
|
@@ -224,14 +204,95 @@ def ribbon(args):
|
|
|
224
204
|
os.chdir(get_macrosynteny_plot_wd_abspath)
|
|
225
205
|
os.system(snakemake_cmd_macrosynteny)
|
|
226
206
|
|
|
207
|
+
#################################### get config.yaml for getting ribbon diagram ####################################
|
|
208
|
+
|
|
209
|
+
os.chdir(wd_path)
|
|
210
|
+
step2_figures_abspath = '%s/odp/step2-figures' % get_macrosynteny_plot_wd_abspath
|
|
211
|
+
snakemake_cmd_ribbon = 'snakemake --cores %s --snakefile %s' % (thread_num, odp_rbh_to_ribbon_exe)
|
|
212
|
+
|
|
213
|
+
step2_figures_sub_dir_list = next(os.walk(step2_figures_abspath))[1]
|
|
214
|
+
synteny_plot_list = ['synteny_nocolor']
|
|
215
|
+
for each_sub_dir in step2_figures_sub_dir_list:
|
|
216
|
+
if each_sub_dir.startswith('synteny_coloredby'):
|
|
217
|
+
synteny_plot_list.append(each_sub_dir)
|
|
218
|
+
|
|
219
|
+
for color_setting in synteny_plot_list:
|
|
220
|
+
current_synteny_dir = '%s/%s' % (step2_figures_abspath, color_setting)
|
|
221
|
+
current_wd = '%s/%s' % (get_ribbon_diagram_wd_abspath, color_setting)
|
|
222
|
+
current_config_yaml_ribbon = '%s/config.yaml' % current_wd
|
|
223
|
+
os.mkdir(current_wd)
|
|
224
|
+
|
|
225
|
+
with open(cmd_txt, 'a') as cmd_txt_handle:
|
|
226
|
+
cmd_txt_handle.write('cd %s\n' % current_wd)
|
|
227
|
+
cmd_txt_handle.write(snakemake_cmd_ribbon + '\n')
|
|
228
|
+
cmd_txt_handle.write('\n')
|
|
229
|
+
|
|
230
|
+
config_yaml_ribbon_handle = open(current_config_yaml_ribbon, 'w')
|
|
231
|
+
config_yaml_ribbon_handle.write('chr_sort_order: optimal-chr-or\n')
|
|
232
|
+
if plot_all is True:
|
|
233
|
+
config_yaml_ribbon_handle.write('plot_all: True\n')
|
|
234
|
+
else:
|
|
235
|
+
config_yaml_ribbon_handle.write('plot_all: False\n')
|
|
236
|
+
config_yaml_ribbon_handle.write('\n')
|
|
237
|
+
|
|
238
|
+
# write out species_order section
|
|
239
|
+
config_yaml_ribbon_handle.write('species_order:\n')
|
|
240
|
+
for species in species_order_list:
|
|
241
|
+
config_yaml_ribbon_handle.write(' - %s\n' % species)
|
|
242
|
+
config_yaml_ribbon_handle.write('\n')
|
|
243
|
+
|
|
244
|
+
# write out chromorder section
|
|
245
|
+
config_yaml_ribbon_handle.write('chromorder:\n')
|
|
246
|
+
if chrom_order_txt is not None:
|
|
247
|
+
for each_s in chrom_order_dict:
|
|
248
|
+
config_yaml_ribbon_handle.write(' %s:\n' % each_s)
|
|
249
|
+
for each_chrom in chrom_order_dict[each_s]:
|
|
250
|
+
config_yaml_ribbon_handle.write(' - %s\n' % each_chrom)
|
|
251
|
+
config_yaml_ribbon_handle.write('\n')
|
|
252
|
+
else:
|
|
253
|
+
for each_species in species_order_list:
|
|
254
|
+
current_chrom_list = species_to_chrom_dict.get(each_species, [])
|
|
255
|
+
if len(current_chrom_list) > 0:
|
|
256
|
+
config_yaml_ribbon_handle.write(' %s:\n' % each_species)
|
|
257
|
+
for each_chrom in current_chrom_list:
|
|
258
|
+
config_yaml_ribbon_handle.write(' - %s\n' % each_chrom)
|
|
259
|
+
config_yaml_ribbon_handle.write('\n')
|
|
260
|
+
|
|
261
|
+
# write out rbh_directory section
|
|
262
|
+
config_yaml_ribbon_handle.write('rbh_directory: %s\n' % current_synteny_dir)
|
|
263
|
+
config_yaml_ribbon_handle.write('\n')
|
|
264
|
+
|
|
265
|
+
# write out species section
|
|
266
|
+
config_yaml_ribbon_handle.write('species:\n')
|
|
267
|
+
for each_species in species_order_list:
|
|
268
|
+
current_fa = '%s/%s.fa' % (fa_in_abspath, each_species)
|
|
269
|
+
current_pep = '%s/%s.pep' % (fa_in_abspath, each_species)
|
|
270
|
+
current_chrom = '%s/%s.chrom' % (fa_in_abspath, each_species)
|
|
271
|
+
config_yaml_ribbon_handle.write(' %s:\n' % each_species)
|
|
272
|
+
config_yaml_ribbon_handle.write(' proteins: %s\n' % current_pep)
|
|
273
|
+
config_yaml_ribbon_handle.write(' chrom: %s\n' % current_chrom)
|
|
274
|
+
config_yaml_ribbon_handle.write(' genome: %s\n' % current_fa)
|
|
275
|
+
config_yaml_ribbon_handle.write(' minscafsize: %s\n' % minscafsize)
|
|
276
|
+
config_yaml_ribbon_handle.close()
|
|
277
|
+
|
|
278
|
+
################################################## run snakemake ###################################################
|
|
279
|
+
|
|
227
280
|
# get ribbon diagram
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
281
|
+
for color_setting in synteny_plot_list:
|
|
282
|
+
|
|
283
|
+
current_wd = '%s/%s' % (get_ribbon_diagram_wd_abspath, color_setting)
|
|
284
|
+
pwd_plot_file = '%s/output.pdf' % current_wd
|
|
285
|
+
pwd_plot_file_relocated = '%s/%s.pdf' % (op_dir_abspath, color_setting.replace('synteny_', 'ribbon_'))
|
|
286
|
+
|
|
287
|
+
os.chdir(current_wd)
|
|
288
|
+
os.system(snakemake_cmd_ribbon)
|
|
289
|
+
|
|
290
|
+
if os.path.isfile(pwd_plot_file) is True:
|
|
291
|
+
os.system('mv %s %s' % (pwd_plot_file, pwd_plot_file_relocated))
|
|
231
292
|
|
|
232
293
|
################################################### final report ###################################################
|
|
233
294
|
|
|
234
|
-
print('Ribbon diagram exported to %s
|
|
295
|
+
print('Ribbon diagram exported to %s' % op_dir)
|
|
235
296
|
print('Done!')
|
|
236
297
|
|
|
237
298
|
####################################################################################################################
|
|
@@ -267,5 +328,8 @@ if __name__ == '__main__':
|
|
|
267
328
|
'''
|
|
268
329
|
|
|
269
330
|
python3 /Users/songweizhi/PycharmProjects/BioSAK/BioSAK/ribbon.py -o demo -fa example_files -f -odp /scratch/PI/ocessongwz/Software/odp/scripts/odp -odp_rbh_to_ribbon /scratch/PI/ocessongwz/Software/odp/scripts/odp_rbh_to_ribbon
|
|
270
|
-
|
|
331
|
+
|
|
332
|
+
cd /scratch/PI/ocessongwz/odp_wd
|
|
333
|
+
BioSAK hpc3 -q cpu -a oces -t 12 -conda odp -n odp -c "BioSAK ribbon -t 12 -plot_lgs -co chrom_order.txt -o ribbon_op_dir2 -fa example_files -pep example_files -chrom example_files -f -odp /scratch/PI/ocessongwz/Software/odp/scripts/odp -odp_rbh_to_ribbon /scratch/PI/ocessongwz/Software/odp/scripts/odp_rbh_to_ribbon"
|
|
334
|
+
|
|
271
335
|
'''
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: BioSAK
|
|
3
|
-
Version: 1.86.
|
|
3
|
+
Version: 1.86.4
|
|
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.86.
|
|
23
|
+
BioSAK v1.86.4
|
|
@@ -68,6 +68,7 @@ BioSAK/gapseq.py
|
|
|
68
68
|
BioSAK/gbk2faa.py
|
|
69
69
|
BioSAK/gbk2ffn.py
|
|
70
70
|
BioSAK/gbk2fna.py
|
|
71
|
+
BioSAK/gbk2gff.py
|
|
71
72
|
BioSAK/gbk_to_ffn_faa.py
|
|
72
73
|
BioSAK/gc.py
|
|
73
74
|
BioSAK/get_EC_from_ko_stats_D.py
|
|
@@ -92,6 +93,7 @@ BioSAK/get_reads_id_in_sam.py
|
|
|
92
93
|
BioSAK/get_sankey_plot.R
|
|
93
94
|
BioSAK/get_top_hit.py
|
|
94
95
|
BioSAK/get_total_length.py
|
|
96
|
+
BioSAK/gff2chrom.py
|
|
95
97
|
BioSAK/global_functions.py
|
|
96
98
|
BioSAK/hpc3.py
|
|
97
99
|
BioSAK/iTOL.py
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: BioSAK
|
|
3
|
-
Version: 1.86.
|
|
3
|
+
Version: 1.86.4
|
|
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.86.
|
|
23
|
+
BioSAK v1.86.4
|
|
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
|
|
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
|