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

Fix prefix for eukulele columns in summary #180

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
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()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these really be in here? I don't see any issue with .view, it's just that I've mostly used it to verify code.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, should not be there of course!


SUM_TAXONOMY ( ch_sum_taxonomy, feature_counts )

emit:
taxonomy_summary = SUM_TAXONOMY.out.taxonomy_summary
Expand Down
Loading