I'm running into an error on the MAGeCK-FLUTE step...
# crisprseq
j
I'm running into an error on the MAGeCK-FLUTE step, it seems to be complaining about genes that have a duplicate Entrez ID? My command was
Copy code
nextflow run nf-core/crisprseq -r dev -c /pipelines/nfcore/nextflow.config -work-dir /nextflow/work --input crisprseq_samplesheet.csv --outdir nextflow_out --analysis screening --library gRNA_annotated_geneSymbol_withID.tsv --contrasts crisprseq_contrasts.csv --reference_fasta GRCh38.primary_assembly.genome.fa
contrasts are set up as
Copy code
reference;treatment
control;treated_5hr
control;treated_7hr
any clues?
Copy code
ERROR ~ Error executing process > 'NFCORE_CRISPRSEQ:CRISPRSEQ_SCREENING:MAGECK_FLUTEMLE_CONTRASTS (treated_5hr_vs_control)'

Caused by:
  Process `NFCORE_CRISPRSEQ:CRISPRSEQ_SCREENING:MAGECK_FLUTEMLE_CONTRASTS (treated_5hr_vs_control)` terminated with an error exit status (1)

Command executed [/homes8/jsimon/.nextflow/assets/nf-core/crisprseq/templates/template_fluteMLE.R]:

  #!/usr/bin/env Rscript
  #### author: Laurence Kuhlburger
  #### Released under the MIT license. See git repository (<https://github.com/nf-core/crisprseq>) for full license text.
  ####
  #### graphs mageck MLE

  library(MAGeCKFlute)
  library(clusterProfiler)
  library(ggplot2)

  library(pathview)
  options(ggrepel.max.overlaps = Inf)
  mle <- read.table("treated_5hr_vs_control.gene_summary.txt", header = TRUE, sep = "   ", stringsAsFactors = FALSE)

  if("treated_5hr_vs_control" == "day0") {
      beta_strings <- grep("\\.beta", colnames(mle), value = TRUE)
      before_beta <- sub("\\.beta.*", "", beta_strings)
      unique_strings <- unique(before_beta)
      for(i in unique_strings) {
          FluteMLE(mle, treatname= i, proj=i, <http://pathview.top|pathview.top>=5)
          }
  } else {
      beta_strings <- grep("\\.beta", colnames(mle), value = TRUE)
      before_beta <- sub("\\.beta.*", "", beta_strings)
      unique_strings <- unique(before_beta)
      for(i in unique_strings) {
          FluteMLE(mle, treatname= i, proj=i,  , <http://pathview.top|pathview.top>=5)
      }
  }

  version_file_path <- "versions.yml"
  version_flute <- paste(unlist(packageVersion("MAGeCKFlute")), collapse = ".")
  version_ggplot <- paste(unlist(packageVersion("ggplot2")), collapse = ".")
  version_clusterprofiler <- paste(unlist(packageVersion("clusterProfiler")), collapse = ".")
  version_pathview <- paste(unlist(packageVersion("pathview")), collapse = ".")

  f <- file(version_file_path, "w")
  writeLines('"NFCORE_CRISPRSEQ:CRISPRSEQ_SCREENING:MAGECK_FLUTEMLE_CONTRASTS":', f)
  writeLines("    MAGeCKFlute: ", f, sep = "")
  writeLines(version_flute, f)
  writeLines("    ggplot2: ", f, sep = "")
  writeLines(version_ggplot, f)
  writeLines("    clusterProfiler: ", f, sep = "")
  writeLines(version_clusterprofiler, f)
  writeLines("    pathview: ", f, sep = "")
  writeLines(version_pathview, f)
  close(f)

Command exit status:
  1

Command output:
  (empty)

Command error:
  36 genes have duplicate Entrez IDs: HIST1H2BC, HIST1H2BG, HIST1H2BF, PLEKHG7, DEC1, HIST1H2BI, MUM1, KIAA1107, AKAP2, NEBL, HN1L, SLC35E2, WWTR1, NOV, DCDC1, C10orf12, ZASP, HYAL1, MICALCL, QARS, LOXL2, CC2D2B, GIF, RAB34, C16orf47, TMEM257, C17orf47, ARHGAP42, MARS, TXNRD3, RRM2, HIST1H2BE, SEPT6, SEM1, C9orf47, DUPD1
  snapshotDate(): 2022-10-31
  see ?depmap and browseVignettes('depmap') for documentation
  loading from cache
  snapshotDate(): 2022-10-31
  see ?depmap and browseVignettes('depmap') for documentation
  loading from cache
  snapshotDate(): 2022-10-31
  see ?depmap and browseVignettes('depmap') for documentation
  loading from cache
  snapshotDate(): 2022-10-31
  see ?depmap and browseVignettes('depmap') for documentation
  loading from cache
  2024-07-03 19:14:43 # Enrichment analysis of Positive and Negative selected genes ...
  2024-07-03 19:14:43 # Running KEGG+REACTOME+GOBP+Complex enrichment analysis
        446 genes are mapped ...
  2024-07-03 19:14:52 # Running KEGG+REACTOME+GOBP+Complex enrichment analysis
        330 genes are mapped ...
  2024-07-03 19:15:07 # Starting plot kegg pathways for  Group A
  Info: Downloading xml files for hsa04115, 1/1 pathways..
  Info: Downloading png files for hsa04115, 1/1 pathways..
  'select()' returned 1:1 mapping between keys and columns
  Info: Working in directory /jsimonlab/scratch/jsimon/nextflow/work/20/2cd6d926916e086179100326a47cbe
  Info: Writing image file hsa04115.pathview.multi.png
  Info: Downloading xml files for hsa04215, 1/1 pathways..
  Info: Downloading png files for hsa04215, 1/1 pathways..
  'select()' returned 1:1 mapping between keys and columns
  Info: Working in directory /jsimonlab/scratch/jsimon/nextflow/work/20/2cd6d926916e086179100326a47cbe
  Info: Writing image file hsa04215.pathview.multi.png
  Info: some node width is different from others, and hence adjusted!
  pathview failed for hsa04215
  Info: Downloading xml files for hsa05222, 1/1 pathways..
  Info: Downloading png files for hsa05222, 1/1 pathways..
  'select()' returned 1:1 mapping between keys and columns
  Info: Working in directory /jsimonlab/scratch/jsimon/nextflow/work/20/2cd6d926916e086179100326a47cbe
  Info: Writing image file hsa05222.pathview.multi.png
  Info: Downloading xml files for hsa04210, 1/1 pathways..
  Info: Downloading png files for hsa04210, 1/1 pathways..
  'select()' returned 1:1 mapping between keys and columns
  Info: Working in directory /jsimonlab/scratch/jsimon/nextflow/work/20/2cd6d926916e086179100326a47cbe
  Info: Writing image file hsa04210.pathview.multi.png
  Info: Downloading xml files for hsa01524, 1/1 pathways..
  Info: Downloading png files for hsa01524, 1/1 pathways..
  'select()' returned 1:1 mapping between keys and columns
  Info: Working in directory /jsimonlab/scratch/jsimon/nextflow/work/20/2cd6d926916e086179100326a47cbe
  Info: Writing image file hsa01524.pathview.multi.png
  Error in png::readPNG(figure, native = FALSE) : file is not in PNG format
  Calls: FluteMLE ... arrangePathview -> lapply -> FUN -> <Anonymous> -> <Anonymous>
  In addition: There were 12 warnings (use warnings() to see them)
  Execution halted
👀 1
l
hi Jeremy! Could you confirm that mapping worked with
Copy code
--reference_fasta GRCh38.primary_assembly.genome.fa
like how does your count table look like from mageck?
j
both my counts and results from mageck mle look good! i can share snippets if helpful
but i didnt specify any
day0
label, and im wondering if that is somehow related?
l
No shouldn't be the case. So there aren't duplicates in the count table or the mle output one ? Sorry you're the first user that used the reference fasta so I'm also keen to hear the bowtie2 ran for you?
j
duplicate gene names there, you mean?
l
Yes :)
j
just grepped for one of the "duplicated" gene IDs in my mageck count table, looks like this:
Copy code
sgRNA16220	HIST1H2BC	336	86	102	120	14	105	171	129	72
sgRNA16221	HIST1H2BC	436	366	172	262	330	395	695	420	361
sgRNA16222	HIST1H2BC	346	780	247	392	578	482	431	519	177
what can i share that would be helpful?
i didnt specify to align with bowtie2, i kept the default there fyi
l
Ok i think you can run the command without
--reference_fasta GRCh38.primary_assembly.genome.fa
and it should work the same then
Could you share your count table and your design matrix? Then i should be able to run int othe same error as you
j
l
also just a general question, would the mageckflute output be of use to you as a user? I was thinking about making it not run automatically since it seems to be causing issues
I’d be generally curious what people do with the output of mageck mle to further develop crisprseq
j
if i understand what it does correctly, it sounds potentially useful. my goal here is to compare our treated_5hr vs control, treated_7hr vs control to get genes and pathways significantly enriched in each separately (and in common)
in this case we have an expectation of genes in 1 particular pathway to be heavily enriched in the results, but are mainly interested in genes not annotated as such
note this is a CRISPRi screen though. not sure if that changes anything in terms of expectations or assumptions of any of these models
l
no shouldn’t change anything, here it’d show you enriched pathways against all cell lines in depmap for each comparison
so it’s a more general enrichment view
so if you’re interested in 1 particular pathway it’d definitely be interesting to see if it pops up i think
j
depmap data used for understanding essentiality here?
l
Yes
👍 1
is your data only from one cell line? Thanks a lot for taking the time i appreciate it
j
yes, human iPS
appreciate your time and help looking into this! ❤️ the nf-core community
l
okay i’ll also have a look if it’s in the depmap database so that you use mageckflute only specifying that particular cell line. I’d then introduce a new param for users along those lines
j
is it not helpful to test against all cell lines in depmap?
l
I think it’d give you a broader overview of how your genes/experiments perform against all cell lines? But if you have a treatment and the depmap is only essential genes with no ttt it’d give you a more up close view if you pick one specific cell line?
j
k - in this case im not 100% sure there are any stem or induced pluripotent cells in depmap but still looking through the list
l
Yes also don’t think i’ve come accross any
BAGEL2 would allow you to pick up on essential genes if you run it against your control samples
j
ill have to read up more on how bagel2 works
separately- i would also say the day0 label info in the docs, both in crisprseq and mageck docs, was a bit unclear to me
ive read that over a few times in both and still dont really understand what should be specified and what it does
in the context of the crisprseq pipeline, its unclear if that would simply be
control
in my example, or a comma-separated list of
Untreated_0hr_Rep1,Untreated_0hr_Rep2,Untreated_0hr_Rep3
or something else
l
hm good point. Would you mind opening an issue for that so i keep in mind to improve the doc? I’ll play around with your count table and the day0 label to see what can be obtained, but i think
--day0_label 'Untreated_0hr_Rep1,Untreated_0hr_Rep2,Untreated_0hr_Rep3'
would be the correct way to go for your experiment, haven’t tried it though
👍 1
checked 1
j
let me know if youd like an issue for tracking purposes on the original error posted above ^^
btw there seems to be some overlap in my error above with this issue: https://github.com/nf-core/crisprseq/issues/161
i snipped the output i pasted above and seemingly missed the part that is in common with this reported bug. my complete log is here
@Laurence Kuhlburger any updates on this?
l
Hi Jeremy, I am trying to reproduce your error with the following command :
Copy code
nextflow run . -c user.config --count_table ../jeremy/count_table.count.txt --outdir test_jeremy --analysis screening --mle_design_matrix ../jeremy/treated_7hr_vs_control.txt -profile docker -resume
and get another error :
Copy code
Command error:
  retrieving 1 resource
  loading from cache
  snapshotDate(): 2022-10-31
  see ?depmap and browseVignettes('depmap') for documentation
  downloading 1 resources
  retrieving 1 resource
  loading from cache
  snapshotDate(): 2022-10-31
  see ?depmap and browseVignettes('depmap') for documentation
  loading from cache
  snapshotDate(): 2022-10-31
  see ?depmap and browseVignettes('depmap') for documentation
  loading from cache
  2024-07-10 12:02:37 # Enrichment analysis of Positive and Negative selected genes ...
  2024-07-10 12:02:37 # Running KEGG+REACTOME+GOBP+Complex enrichment analysis
        484 genes are mapped ...
  2024-07-10 12:02:41 # Running KEGG+REACTOME+GOBP+Complex enrichment analysis
        301 genes are mapped ...
  2024-07-10 12:02:49 # Starting plot kegg pathways for  Group A
  Info: Downloading xml files for hsa04115, 1/1 pathways..
  Info: Downloading png files for hsa04115, 1/1 pathways..
  'select()' returned 1:1 mapping between keys and columns
  Info: Working in directory /Users/laurencekuhlburger/Documents/crisprseq/crisprseq/work/d7/ef8f81048ef6d00888210cdd1e6731
  Info: Writing image file hsa04115.pathview.multi.png
  Info: Downloading xml files for hsa04215, 1/1 pathways..
  Info: Downloading png files for hsa04215, 1/1 pathways..
  'select()' returned 1:1 mapping between keys and columns
  Info: Working in directory /Users/laurencekuhlburger/Documents/crisprseq/crisprseq/work/d7/ef8f81048ef6d00888210cdd1e6731
  Info: Writing image file hsa04215.pathview.multi.png
  Info: some node width is different from others, and hence adjusted!
  pathview failed for hsa04215
  Info: Downloading xml files for hsa01524, 1/1 pathways..
  Info: Downloading png files for hsa01524, 1/1 pathways..
  'select()' returned 1:1 mapping between keys and columns
  Info: Working in directory /Users/laurencekuhlburger/Documents/crisprseq/crisprseq/work/d7/ef8f81048ef6d00888210cdd1e6731
  Info: Writing image file hsa01524.pathview.multi.png
  Info: Downloading xml files for hsa04210, 1/1 pathways..
  Info: Downloading png files for hsa04210, 1/1 pathways..
  'select()' returned 1:1 mapping between keys and columns
  Info: Working in directory /Users/laurencekuhlburger/Documents/crisprseq/crisprseq/work/d7/ef8f81048ef6d00888210cdd1e6731
  Info: Writing image file hsa04210.pathview.multi.png
  Info: Downloading xml files for hsa03040, 1/1 pathways..
  Info: Downloading png files for hsa03040, 1/1 pathways..
  'select()' returned 1:1 mapping between keys and columns
  Info: Working in directory /Users/laurencekuhlburger/Documents/crisprseq/crisprseq/work/d7/ef8f81048ef6d00888210cdd1e6731
  Info: Writing image file hsa03040.pathview.multi.png
  Error in png::readPNG(figure, native = FALSE) : file is not in PNG format
  Calls: FluteMLE ... arrangePathview -> lapply -> FUN -> <Anonymous> -> <Anonymous>
  In addition: There were 12 warnings (use warnings() to see them)
  Execution halted
which i think i’ve seen before on pathway enrichment
so i’m now removing pathway enrichment from fluteMLE and checking if it runs
could you by any chance try to run it with -profile docker?
j
hm my current setup is via singularity on our hpc. im not 100% sure if/how i can switch
are those interchangeable?
l
No i don’t think so
Would you mind trying my dev branch : https://github.com/LaurenceKuhl/crisprseq ?
I put a trycatch around mageckflute which then doesn’t fail the pipeline and seems to produce useful outputs from the FluteMLE function up until the errors I’ve encountered (but they’re different than the ones you have noticed)
so now for me i get output results
j
Thanks! So I can keep my singularity profile but instead specify -r dev, correct?
l
yes and also specify
laurencekuhl/crisprseq -r dev
instead of the nf-core one
j
Will give that a go, thanks!
Thanks @Laurence Kuhlburger confirmed that this now completes without error
l
yay 🙂 thanks a lot for reaching out and opening issues, appreciate it! if you see anything else don’t hesitate to reach out
j
thanks!
and just to confirm: i dont need to (properly) specify a
day0_label
at all, do i?
are the mageck mle results the same regardless?
l
No since you defined contrasts you don’t have to, i never used day0_label either
👍 1
j
one last question, i hope! my
mageck count
step shows my sample labels as
Copy code
--sample-label treated_5hr,treated_5hr,treated_5hr,treated_7hr,treated_7hr,treated_7hr,control,control,control
not as the sample labels (first column) in my sample sheet
Copy code
Etoposide_5hr_Rep1,Etoposide_5hr_Rep2,Etoposide_5hr_Rep3,Etoposide_7hr_Rep1,Etoposide_7hr_Rep2,Etoposide_7hr_Rep3,Untreated_0hr_Rep1,Untreated_0hr_Rep2,Untreated_0hr_Rep3
and as a result, i can't tell my replicates apart in my counts tables (
count_table.count.txt
,
count_table.count_normalized.txt
) is there an additional metadata column i can pass in my samplesheet, or is there another parameter somewhere ive missed?
l
sorry Jeremy didn’t have time to have a closer look, hope to get back to you by tomorrow”
j
no worries - i opened it as an issue on github too in case others are facing a similar issue
l
I think if you put the sample labels as the condition in your samplesheet as well you’d get what you need eventhough it’s not the best i agree
And then you’d have to modify
crisprseq_contrasts.csv
with your sample names to get the right contrast going
Ok i might remove the condition column altogether i feel like it just leads to confusion
j
oh really? i feel like "condition" makes sense in the case of replicates
its just like the rnaseq workflow in that sense
then the contrasts would be based on condition, however many samples there were per condition
l
how about outputting one count table with the sample names and one with the condition names then?
j
Is my case a rare one? Do most people not have replicates?
l
no i think it’s quite common
j
If most are set up like mine then my opinion is the table should be by Sample name, and leave it to the user to know how that maps to conditions
That would be just like how rnaseq works
l
yes because the design matrix needs to have the sample names
so the count table column names and the design matrix need to match
j
Is that how it's working right now? I feel like the design matrix it created for me has only conditions as row names
l
which right now works because your count table also has conditions as column names but doesn’t allow you to see which sample is which
j
I think my vote would be to mimic the rnaseq setup here
l
i’m just not sure if i can get it to output a count table with column names for sample name and then translate it to conditions
I can try to output the count table with the sample names + a count table with the conditions and then pass the condition one in the gene essentiality analysis
j
Which tool does the gene essentiality test?
What you describe would be fine at least as an intermediate step
l
mageck mle does gene essentiality
j
my interpretation of this is in the MAGeCK-MLE docs is that the design matrix rows would be samples, not conditions. is that incorrect?
if thats true, then how come we'd need a counts table/design matrix labeled by condition at all?
l
Yes i think this is an implementation mistake on my end which was why i was thinking of kicking out conditions, it’s just confusing users 😞
j
how would you change the contrasts specification to match then, if no condition column is supplied?
i feel like its fine to include both in the sample sheet, have the contrasts file be the thing that sets the condition-level comparisons, and then report out counts tables with sample names (not condition names)
but maybe theres something im still not understanding in terms of requirements of one of the other steps
l
Hi Jeremy, just added
Copy code
This label is not mandatory as in case you are running time series. If you wish to run MAGeCK MLE with the day0 label you can do so by specifying `--day0_label` and the sample names that should be used as day0. The contrast will then be automatically adjusted for the other days.
to the day0 label
👍 1
j
thanks, that is a helpful add
are you still working on the other part, related to unique sample names vs contrast names?
l
I have a solution in mind i still need to test out but it might make the pipeline slower 😕 i would run mageck count twice, once with the sample labels and once with the condition labels
in the meantime it’s a bit inconvenient but one can put the sample names as labels
j
how could they be added as labels?
alternatively, at least for now... are they placed in the counts table in order of the sample sheet? in other words, should mine be rep1, rep2, rep3 in order or is it not necessarily ordered that way
l
yes they should be, but if you want to be on the safe side i’d suggest rerunning the pipeline and putting the names of your samples in the condition column
j
okay- do i adjust the contrasts file too then? to something like
Copy code
reference;treatment
control_1,control_2,control_3;treated_5hr_1,treated_5hr_2,treated_5hr_3
control_1,control_2,control_3;treated_7hr_1,treated_7hr_2,treated_7hr_3
👍 1
ah i see, and i think i understand your suggestion earlier now: to remove the
condition
column altogether. if you can specify the contrasts this way, then there may be no need for that column
also im having trouble with the negative control gRNAs, like in this issue. i added some info to that ticket https://github.com/nf-core/crisprseq/issues/63
l
Thanks for reopening, I think since this one is a recurring ask I'll add it as a variable, can I contact you with a dev version as soon as I'm done?
j
Yes definitely!
l
could you try with you nextflow run with
-r *control-sgrna*
instead of dev and add
--mle_control_sgrna 'your_file.txt'
?
j
from your repo, yes?
l
No it's on nf-core, got a bit tangled up
👍 1
j
hmm it seems it ran, but the mageck count step didnt pass the parameter in as far as i can tell?
Copy code
/usr/local/bin/mageck count -l gRNA_annotated_geneSymbol_withID.tsv -n count_table --sample-label treated_5hr_1,treated_5hr_2,treated_5hr_3,treated_7hr_1,treated_7hr_2,treated_7hr_3,control_1,control_2,control_3 --fastq 20uM-etoposide-5hrs-1_S1_R1_001.fastq.gz 20uM-etoposide-5hrs-2_S4_R1_001.fastq.gz 20uM-etoposide-5hrs-3_S6_R1_001.fastq.gz 20uM-etoposide-7hrs-1_S2_R1_001.fastq.gz 20uM-etoposide-7hrs-2_S2_R1_001.fastq.gz 20uM-etoposide-7hrs-3_S7_R1_001.fastq.gz Untreated-1_S1_R1_001.fastq.gz Untreated-2_S3_R1_001.fastq.gz Untreated-3_S5_R1_001.fastq.gz
i dont see a mageck mle log file so im not sure how that part was run, even though there is a result produced and no errors
l
oh i was a bit tired and added it for mageck mle 😞 if you’re interested in contributing you could look at my PR and do the same for mageck count? Otherwise i will look at it another day
j
do you agree it should be on both?
l
I’m a bit surprised to see it in mageck count actually because for mageck mle it makes the model semi supervised and in my experience then adjusts the pvalues
Given that mageck count is just counting the sgRNA i’m not totally sure why it’s an option but i see it in the sourceforg of the mageck documentation
j
does it change the normalization on
count
? im not familiar with any of this so will defer to your expertise
l
Copy code
--norm-method {none,median,total,control}	Method for normalization, including "none" (no normalization), "median" (median normalization, default), "total" (normalization by total read counts), "control" (normalization by control sgRNAs specified by the --control-sgrna option).
https://sourceforge.net/p/mageck/wiki/usage/#count Looks like it does but i wonder if then the param --norm-method should then be added
j
i wish their documentation were better 😐
im in the same department where mageck was developed so can ask around about whether this is considered best practice or not
l
ah that’d be great
j
otherwise i generally agree that if the negatives are getting passed in, the norm method should also change to match
l
That's something that we'd be able to set in crisprseq fairly easily
👍 1
j
hey @Laurence Kuhlburger so it sounds like there is likely value in allowing the user to turn on the non-targeting gRNA normalization and correction in mle, but it seems probably not good practice to enable those by default
seems the user would need to evaluate how well or poorly the control guides behave - sometimes theres valuable info in there, sometimes not. likely depends on the experiment and context
l
Yes right now I'd add it as a feature
👍 1