Skip to content

Commit

Permalink
Dram fixes (#3)
Browse files Browse the repository at this point in the history
Fixes in dram and pangenome_db_builder script
  • Loading branch information
Ales-ibt authored Apr 18, 2024
1 parent bc33f93 commit 7a604f5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 27 deletions.
27 changes: 8 additions & 19 deletions bin/pangenomeDB_builder_codon.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ def metadata_parser(catalogue_metadata):
def accessory_writer(reps_clusters, loc_prefix):
for rep in reps_clusters:
if len(reps_clusters[rep]) > 1:
rep_prefix = rep[:-2]
if rep.endswith('.1'):
rep_prefix = rep[:-4]
else:
rep_prefix = rep[:-2]
pan_loc = (
loc_prefix
+ "/species_catalogue/"
Expand Down Expand Up @@ -85,7 +88,10 @@ def accessory_writer(reps_clusters, loc_prefix):
def annot_writer(reps_clusters, loc_prefix, pfam_desc):
for rep in reps_clusters:
core_list, core_mgygs = [], []
rep_prefix = rep[:-2]
if rep.endswith('.1'):
rep_prefix = rep[:-4]
else:
rep_prefix = rep[:-2]
rep_loc = (
loc_prefix + "/species_catalogue/" + rep_prefix + "/" + rep + "/genome/"
)
Expand Down Expand Up @@ -205,23 +211,6 @@ def gff_parser(gff_file):
att_l = attr.split(";")
gene_id = att_l[0].replace("ID=", "")
gff_dict[gene_id] = [contig, start, end, strand]
"""
kegg_flag, pfam_flag = 0, 0
for attribute in att_l:
att_key,att_val = attribute.split('=')
if att_key == 'KEGG':
ko = att_val.replace('ko:','')
kegg_flag = 1
if att_key == 'Pfam':
pfam = att_val
pfam_flag = 1
if kegg_flag == 0:
ko = '-'
if pfam_flag == 0:
pfam = '-'
gff_dict[gene_id].append(ko)
gff_dict[gene_id].append(pfam)
"""
return gff_dict


Expand Down
20 changes: 12 additions & 8 deletions modules/local/dram/distill.nf
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ process DRAM_DISTILL {
val(in_type) //species or community

output:
tuple val(meta), path("*_dram*"), emit: destill_out
path "versions.yml" , emit: versions
tuple val(meta), path("*_dram*"), emit: destill_out, optional: true
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when
Expand All @@ -31,12 +31,16 @@ process DRAM_DISTILL {
fi
cat $dram_summary >> dram_input.txt
DRAM.py \\
distill \\
-i dram_input.txt \\
-o dram_out
mv dram_out/product.html ${prefix}_${tool}_${in_type}_dram.html
mv dram_out/product.tsv ${prefix}_${tool}_${in_type}_dram.tsv
line_count=\$(wc -l dram_input.txt)
if [[ \$line_count -gt 1 ]]; then
DRAM.py \\
distill \\
-i dram_input.txt \\
-o dram_out
mv dram_out/product.html ${prefix}_${tool}_${in_type}_dram.html
mv dram_out/product.tsv ${prefix}_${tool}_${in_type}_dram.tsv
fi
cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand Down

0 comments on commit 7a604f5

Please sign in to comment.