Skip to content

Commit

Permalink
update blobtk naming
Browse files Browse the repository at this point in the history
  • Loading branch information
priyanka-surana committed Dec 21, 2023
1 parent 8ef790d commit 45639a7
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 25 deletions.
8 changes: 4 additions & 4 deletions bin/windowstats_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def parse_args(args=None):
parser = argparse.ArgumentParser(description=Description)
parser.add_argument("--freq", help="Frequence fasta windows input file", required=True)
parser.add_argument("--mononuc", help="Mononucleotide fasta windows input file", required=True)
parser.add_argument("--mosdepth", help="Mosdepth coverage input file", nargs="+", required=True)
parser.add_argument("--depth", help="Depth coverage input file", nargs="+", required=True)
parser.add_argument("--countbusco", help="BUSCO gene counts by region", required=True)
parser.add_argument("--output", help="Output TSV file.", required=True)
parser.add_argument("--version", action="version", version="%(prog)s 1.0.0")
Expand All @@ -24,15 +24,15 @@ def make_dir(path):
os.makedirs(path, exist_ok=True)


def merge_all(freq, mononuc, mosdepth, countbusco):
def merge_all(freq, mononuc, depth, countbusco):
freq_fw = pd.read_csv(freq, sep="\t")
mononuc_fw = pd.read_csv(mononuc, sep="\t")
combo_fw = freq_fw.merge(mononuc_fw).rename(
columns={"ID": "sequence", "GC_prop": "gc", "Prop_Ns": "n", "N": "ncount"}
)

count_df = pd.read_csv(countbusco, sep="\t").rename(columns={"ID": "sequence"})
for f in mosdepth:
for f in depth:
tag = os.path.basename(f).replace(".regions.bed.gz", "")
cov_df = pd.read_csv(
f,
Expand All @@ -52,7 +52,7 @@ def main(args=None):
out_dir = os.path.dirname(args.output)
make_dir(out_dir)

merge_all(args.freq, args.mononuc, args.mosdepth, args.countbusco).to_csv(args.output, sep="\t", index=False)
merge_all(args.freq, args.mononuc, args.depth, args.countbusco).to_csv(args.output, sep="\t", index=False)


if __name__ == "__main__":
Expand Down
4 changes: 2 additions & 2 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ process {
ext.args = "--evalue 1.0e-25 --max-target-seqs 10 --max-hsps 1"
}

withName: "BLOBTOOLKIT_DEPTH" {
withName: "BLOBTK_DEPTH" {
ext.args = "-s 1000"
}

Expand Down Expand Up @@ -108,7 +108,7 @@ process {
]
}

withName: "BLOBTOOLKIT_IMAGES" {
withName: "BLOBTK_IMAGES" {
publishDir = [
path: { "${params.outdir}/${blobdir.name}/" },
mode: params.publish_dir_mode,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
process BLOBTOOLKIT_DEPTH {
process BLOBTK_DEPTH {
tag "${meta.id}"
label 'process_single'

Expand Down Expand Up @@ -28,7 +28,7 @@ process BLOBTOOLKIT_DEPTH {
cat <<-END_VERSIONS > versions.yml
"${task.process}":
blobtoolkit: \$(btk --version | cut -d' ' -f2 | sed 's/v//')
blobtk: \$(blobtk --version | cut -d' ' -f2)
END_VERSIONS
"""
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
process BLOBTOOLKIT_IMAGES {
process BLOBTK_IMAGES {
tag "${meta.id}_${plot}"
label 'process_single'

Expand Down Expand Up @@ -32,7 +32,7 @@ process BLOBTOOLKIT_IMAGES {
cat <<-END_VERSIONS > versions.yml
"${task.process}":
blobtoolkit: \$(btk --version | cut -d' ' -f2 | sed 's/v//')
blobtk: \$(blobtk --version | cut -d' ' -f2)
END_VERSIONS
"""
}
4 changes: 2 additions & 2 deletions modules/local/windowstats_input.nf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ process WINDOWSTATS_INPUT {
input:
tuple val(meta), path(freq)
tuple val(meta), path(mononuc)
tuple val(meta), path(mosdepth)
tuple val(meta), path(depth)
tuple val(meta), path(countbusco)

output:
Expand All @@ -27,7 +27,7 @@ process WINDOWSTATS_INPUT {
windowstats_input.py \\
--freq ${freq} \\
--mononuc ${mononuc} \\
--mosdepth ${mosdepth} \\
--depth ${depth} \\
--countbusco ${countbusco} \\
--output ${prefix}.tsv \\
${args}
Expand Down
2 changes: 1 addition & 1 deletion subworkflows/local/collate_stats.nf
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ workflow COLLATE_STATS {
ch_versions = ch_versions.mix ( BLOBTOOLKIT_COUNTBUSCOS.out.versions.first() )


// Combine outputs from Fasta windows, mosdepth, and count BUSCO genes
// Combine outputs from Fasta windows, blobtk depth, and count BUSCO genes
WINDOWSTATS_INPUT ( freq, mononuc, cov, BLOBTOOLKIT_COUNTBUSCOS.out.tsv )
ch_versions = ch_versions.mix ( WINDOWSTATS_INPUT.out.versions.first() )

Expand Down
16 changes: 8 additions & 8 deletions subworkflows/local/coverage_stats.nf
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
// Calculate genome coverage and statistics
//

include { SAMTOOLS_VIEW } from '../../modules/nf-core/samtools/view/main'
include { SAMTOOLS_INDEX } from '../../modules/nf-core/samtools/index/main'
include { BLOBTOOLKIT_DEPTH } from '../../modules/local/blobtoolkit/depth'
include { FASTAWINDOWS } from '../../modules/nf-core/fastawindows/main'
include { CREATE_BED } from '../../modules/local/create_bed'
include { SAMTOOLS_VIEW } from '../../modules/nf-core/samtools/view/main'
include { SAMTOOLS_INDEX } from '../../modules/nf-core/samtools/index/main'
include { BLOBTK_DEPTH } from '../../modules/local/blobtk/depth'
include { FASTAWINDOWS } from '../../modules/nf-core/fastawindows/main'
include { CREATE_BED } from '../../modules/local/create_bed'


workflow COVERAGE_STATS {
Expand Down Expand Up @@ -59,12 +59,12 @@ workflow COVERAGE_STATS {


// Calculate coverage
BLOBTOOLKIT_DEPTH ( ch_bam_csi )
ch_versions = ch_versions.mix ( BLOBTOOLKIT_DEPTH.out.versions.first() )
BLOBTK_DEPTH ( ch_bam_csi )
ch_versions = ch_versions.mix ( BLOBTK_DEPTH.out.versions.first() )


// Combining regions_bed in single channel
BLOBTOOLKIT_DEPTH.out.bed
BLOBTK_DEPTH.out.bed
| combine ( fasta )
| map { meta, bed, meta2, fasta -> [ meta2, bed ] }
| groupTuple ()
Expand Down
8 changes: 4 additions & 4 deletions subworkflows/local/view.nf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//

include { BLOBTOOLKIT_SUMMARY } from '../../modules/local/blobtoolkit/summary'
include { BLOBTOOLKIT_IMAGES } from '../../modules/local/blobtoolkit/images'
include { BLOBTK_IMAGES } from '../../modules/local/blobtk/images'

workflow VIEW {
take:
Expand All @@ -26,12 +26,12 @@ workflow VIEW {
//
plots = [ "blob", "cumulative", "snail" ]

BLOBTOOLKIT_IMAGES ( blobdir, plots )
ch_versions = ch_versions.mix( BLOBTOOLKIT_IMAGES.out.versions )
BLOBTK_IMAGES ( blobdir, plots )
ch_versions = ch_versions.mix( BLOBTK_IMAGES.out.versions )


emit:
summary = BLOBTOOLKIT_SUMMARY.out.json // channel: [ val(meta), path(json) ]
images = BLOBTOOLKIT_IMAGES.out.png // channel: [ val(meta), path(png) ]
images = BLOBTK_IMAGES.out.png // channel: [ val(meta), path(png) ]
versions = ch_versions // channel: [ versions.yml ]
}

0 comments on commit 45639a7

Please sign in to comment.