-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #102 from nf-core/genome_ideogram
Aded BUSCO ideogram for ``GENOME`` mode
- Loading branch information
Showing
8 changed files
with
129 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/usr/bin/env Rscript | ||
|
||
# Modified from https://gitlab.com/ezlab/busco_protocol/-/blob/main/support_protocol2/plot_markers/scripts/plot_markers1.R?ref_type=heads | ||
|
||
# load libraries | ||
require(RIdeogram) | ||
|
||
args <- commandArgs(trailingOnly = TRUE) | ||
file_name_for_karyotype <- args[1] | ||
out_name <- args[2] # how to name the karyotype | ||
|
||
##### karyotype------- | ||
karyotype1 <- read.csv(file=file_name_for_karyotype, sep="\t", header = FALSE, stringsAsFactors = F) | ||
karyotype1$start <- 1 | ||
karyotype1$genome <- out_name | ||
karyotype1$size <- 12 | ||
karyotype1$color <- "25252" | ||
|
||
# fix columns names | ||
colnames(karyotype1) <- c("Chr", "End", "Start", "species", "size", "color") | ||
# reorder columns | ||
karyotype <- karyotype1[, c(1,3,2,4,5,6)] | ||
|
||
# debugging code | ||
print("Karyotype table\n") | ||
head(karyotype) | ||
|
||
write.table(karyotype, file = paste0(out_name, "_karyotype.txt"), quote = FALSE, row.names = FALSE, col.names = TRUE, sep = "\t") | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
modules/local/plot_busco_ideogram.nf → ...local/genome_annotation_busco_ideogram.nf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
process GENOME_ONLY_BUSCO_IDEOGRAM { | ||
tag "$meta.id" | ||
label 'process_single' | ||
|
||
conda "bioconda::r-rideogram=0.2.2 bioconda::r-svglite=2.1.1" | ||
container "community.wave.seqera.io/library/seqkit_r-dplyr_r-optparse_r-readr_pruned:92b750716d244919" | ||
|
||
input: | ||
tuple val(meta), path(genome), path(busco_full_table) | ||
|
||
output: | ||
tuple val(meta), path("*.svg"), emit: svg | ||
tuple val(meta), path("*.png"), emit: png | ||
path "versions.yml" , emit: versions | ||
|
||
script: | ||
def args = task.ext.args ?: '' | ||
def prefix = task.ext.prefix ?: "${meta.id}" | ||
""" | ||
grep -v "#" ${busco_full_table} | cut -f 2,3,4,5 | grep -v "Missing" > ${prefix}_busco_coordinates.txt | ||
# Get chromosome lengths: | ||
seqkit fx2tab -i -n -l ${genome} > ${prefix}_for_karyotype.txt | ||
# Call script for table wrangling | ||
plot_markers1.R ${prefix}_for_karyotype.txt ${prefix} | ||
# Call script for plotting | ||
plot_busco_ideogram.R \\ | ||
--busco_output ${prefix}_busco_coordinates.txt \\ | ||
--karyotype ${prefix}_karyotype.txt \\ | ||
--prefix ${prefix} \\ | ||
$args | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
r-base: \$(Rscript -e "cat(as.character(getRversion()))") | ||
r-rideogram: \$(Rscript -e "cat(as.character(packageVersion('RIdeogram')))") | ||
END_VERSIONS | ||
""" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters