Skip to content

Commit

Permalink
Fix prefix for eukulele columns in summary
Browse files Browse the repository at this point in the history
  • Loading branch information
erikrikarddaniel committed Sep 13, 2023
1 parent d57e1db commit 34148ec
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
22 changes: 9 additions & 13 deletions modules/local/sum_taxonomy.nf
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ process SUM_TAXONOMY {

input:

tuple val(meta), path(taxonomy)
path(fcs)
tuple val(meta), val(db), path(taxonomy)
path feature_counts

output:

Expand All @@ -29,21 +29,17 @@ process SUM_TAXONOMY {
library(tidyverse)
TYPE_ORDER = c('sample', 'database', 'field', 'value')
# call the tables into variables
taxonomy <- read_tsv("${prefix}.taxonomy_classification.tsv.gz", show_col_types = FALSE )
# Read the taxonomy and counts tables
taxonomy <- read_tsv("${taxonomy}", show_col_types = FALSE )
counts <- list.files(pattern = "*.counts.tsv.gz") %>%
map_df(~read_tsv(., show_col_types = FALSE)) %>%
counts <- read_tsv("${feature_counts}", show_col_types = FALSE) %>%
mutate(sample = as.character(sample))
# Join the two and count the number of ORFs with assigned taxonomy
counts %>%
right_join(taxonomy, by = 'orf') %>%
group_by(sample) %>%
drop_na() %>%
count(orf) %>%
summarise( value = sum(n), .groups = 'drop') %>%
add_column(database = "${prefix}", field = "n_orfs") %>%
inner_join(taxonomy, by = 'orf') %>%
count(sample, name = 'value') %>%
mutate(database = "${db}", field = "eukulele_n_orfs") %>%
relocate(value, .after = last_col()) %>%
write_tsv('${prefix}_summary.tsv.gz')
Expand Down
15 changes: 12 additions & 3 deletions subworkflows/local/eukulele.nf
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ workflow SUB_EUKULELE {

take:
eukulele // Channel: val(meta), path(fasta), val(database), path(directory)
collect_fcs
feature_counts

main:
ch_versions = Channel.empty()

EUKULELE_DOWNLOAD ( eukulele.filter{ it[2] }.map { [ it[2], it[3] ] } )

EUKULELE_DOWNLOAD ( eukulele.filter { it[2] }.map { [ it[2], it[3] ] } )
ch_download = EUKULELE_DOWNLOAD.out.db

Channel.empty()
Expand All @@ -28,7 +29,15 @@ workflow SUB_EUKULELE {
EUKULELE_SEARCH( ch_eukulele )

FORMAT_TAX( EUKULELE_SEARCH.out.taxonomy_estimation.map { [ it[0], it[1] ] } )
SUM_TAXONOMY( FORMAT_TAX.out.tax, collect_fcs )

FORMAT_TAX.out.tax
.join(ch_eukulele)
.map { [ it[0], it[3], it[1] ] }
.set { ch_sum_taxonomy }
ch_sum_taxonomy.view()
feature_counts.view()

SUM_TAXONOMY ( ch_sum_taxonomy, feature_counts )

emit:
taxonomy_summary = SUM_TAXONOMY.out.taxonomy_summary
Expand Down

0 comments on commit 34148ec

Please sign in to comment.