Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add versions #2

Merged
merged 1 commit into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion modules/local/bagel2/bf.nf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ process BAGEL2_BF {

output:
tuple val(meta), path("*.bf"), emit: bf
//path "versions.yml" , emit: versions
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when
Expand All @@ -28,6 +28,11 @@ process BAGEL2_BF {
"""
BAGEL.py bf -i $foldchange -o '${meta.treatment}_vs_${meta.reference}.bf' $args -e $reference_essentials -n $reference_nonessentials -c ${meta.treatment}

cat <<-END_VERSIONS > versions.yml
"${task.process}":
python: \$(python --version | sed 's/Python //g')
BAGEL2: \$( BAGEL.py version | grep -o 'Version: [0-9.]*' | awk '{print \$2}' | grep -v '^\$')
END_VERSIONS
"""

}
12 changes: 8 additions & 4 deletions modules/local/bagel2/fc.nf
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ process BAGEL2_FC {
tuple val(meta), path(count_table)

output:
tuple val(meta), path("*.foldchange"), emit: foldchange
tuple val(meta), path("*.normed_readcount"), emit: normed_counts
//path "versions.yml" , emit: versions
tuple val(meta), path("*.foldchange") , emit: foldchange
tuple val(meta), path("*.normed_readcount") , emit: normed_counts
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when
Expand All @@ -24,7 +24,11 @@ process BAGEL2_FC {

"""
BAGEL.py fc -i $count_table -o ${meta.treatment}_vs_${meta.reference} -c $meta.reference $args

cat <<-END_VERSIONS > versions.yml
"${task.process}":
python: \$(python --version | sed 's/Python //g')
BAGEL2: \$( BAGEL.py version | grep -o 'Version: [0-9.]*' | awk '{print \$2}' | grep -v '^\$')
END_VERSIONS
"""

}
12 changes: 11 additions & 1 deletion modules/local/bagel2/graph.nf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ process BAGEL2_GRAPH {

output:
path("*.png") , emit: pictures

path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when
Expand Down Expand Up @@ -60,6 +60,16 @@ process BAGEL2_GRAPH {
plt.savefig(file_name)
plt.show()

# Output version information
version = pd. __version__
matplotlib_version = plt.matplotlib.__version__
# alas, no `pyyaml` pre-installed in the cellranger container
with open("versions.yml", "w") as f:
f.write('"${task.process}":\\n')
f.write(f' pandas: "{version}"\\n')
f.write(f' matplotlib.pyplot: "{matplotlib_version}"\\n')


"""


Expand Down
9 changes: 7 additions & 2 deletions modules/local/bagel2/pr.nf
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ process BAGEL2_PR {

output:
tuple val(meta), path("*.pr") , emit: pr

//path "versions.yml" , emit: versions
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when
Expand All @@ -25,6 +24,12 @@ process BAGEL2_PR {

"""
BAGEL.py pr -i $bf -o '${meta.treatment}_vs_${meta.reference}.pr' -e $reference_essentials -n $reference_nonessentials

cat <<-END_VERSIONS > versions.yml
"${task.process}":
python: \$(python --version | sed 's/Python //g')
BAGEL2: \$( BAGEL.py version | grep -o 'Version: [0-9.]*' | awk '{print \$2}' | grep -v '^\$')
END_VERSIONS
"""

}
15 changes: 15 additions & 0 deletions modules/local/mageck/graphrra.nf
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,21 @@ process MAGECK_GRAPHRRA {
print(p1)
dev.off()

version_file_path <- "versions.yml"
version_flute <- paste(unlist(packageVersion("MAGeCKFlute")), collapse = ".")
version_ggplot <- paste(unlist(packageVersion("MAGeCKFlute")), collapse = ".")

f <- file(version_file_path, "w")
writeLines('"${task.process}":', f)
writeLines(" MAGeCKFlute: ", f, sep = "")
writeLines(version_flute, f)
writeLines(" ggplot2: ", f, sep = "")
writeLines(version_ggplot, f)
close(f)




"""


Expand Down
19 changes: 18 additions & 1 deletion workflows/crisprseq_screening.nf
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ workflow CRISPRSEQ_SCREENING {
[[id: condition, single_end: single_end], fastqs]
}
.set { joined }
joined.dump(tag:"metadata")


//
// MODULE: Run mageck count
Expand Down Expand Up @@ -147,6 +147,9 @@ workflow CRISPRSEQ_SCREENING {
params.min_targeted_genes
)

ch_versions = ch_versions.mix(CRISPRCLEANR_NORMALIZE.out.versions)


CRISPRCLEANR_NORMALIZE.out.norm_count_file.map {
it -> it[1]
}.set { ch_counts }
Expand All @@ -162,9 +165,12 @@ workflow CRISPRSEQ_SCREENING {
counts
)

ch_versions = ch_versions.mix(MAGECK_TEST.out.versions)

MAGECK_GRAPHRRA (
MAGECK_TEST.out.gene_summary
)
//TODO: Missing versions
}

if(params.rra_contrasts) {
Expand All @@ -180,19 +186,26 @@ workflow CRISPRSEQ_SCREENING {
BAGEL2_FC (
counts
)
ch_versions = ch_versions.mix(BAGEL2_FC.out.versions)

BAGEL2_BF (
BAGEL2_FC.out.foldchange,
ch_bagel_reference_essentials,
ch_bagel_reference_nonessentials
)

ch_versions = ch_versions.mix(BAGEL2_BF.out.versions)


ch_bagel_pr = BAGEL2_BF.out.bf.combine(ch_bagel_reference_essentials)
.combine(ch_bagel_reference_nonessentials)

BAGEL2_PR (
ch_bagel_pr
)

ch_versions = ch_versions.mix(BAGEL2_PR.out.versions)

BAGEL2_GRAPH (
BAGEL2_PR.out.pr
)
Expand All @@ -207,6 +220,10 @@ workflow CRISPRSEQ_SCREENING {
MAGECK_MLE (
ch_designed_mle
)

ch_versions = ch_versions.mix(MAGECK_MLE.out.versions)


}

CUSTOM_DUMPSOFTWAREVERSIONS (
Expand Down
Loading