I wrote a new entryway to my pipeline that gets th...
# nostupidquestions
i
I wrote a new entryway to my pipeline that gets the input data from a different source and now one of my downstream processes that worked before is throwing a confusing error. Does anyone have an idea what happened? The error I am getting is
ERROR ~ Error executing process > 'FROMSEQ:PREPROCESS_BOSS:truncateFq (1)'
Caused by: Cannot invoke method values() on null object
This is confusing to me because the truncateFq process takes just one input (a fastq file) and uses cut to cut every line to a length of 400. The input fastq file now comes from a different process than before but I looked at the fastq file in question and it looks perfectly normal. I'll add the actual processes in a thread.
✅ 1
This is the relevant part of the FROMSEQ workflow:
Copy code
workflow FROMSEQ{
    main:
        // Get genome with variants from benchmark vcf set
        input_ref = Channel.of(params.link_ref)
        input_reads = Channel.of(params.reads)

        // Download ref, Might have to combine ref
        ref_genome = getUnzipComb(input_ref)
        // Download reads, Might have to gunzip reads
        reads = getGunzipReads(input_reads)

        // Preprocess genome for sequence simulation
        preprocessed = PREPROCESS_BOSS(reads, ref_genome)
...
}
Essentially, I download a reference and reads and then feed them into my preprocessing workflow.
This is the process that downloads and gunzips the reads:
Copy code
process getGunzipReads {
    input:
        val link
    output:
        path '*.fastq'
    script:
    """
    wget ${link}
    gunzip *.gz
    """

}
Maybe not the most elegant, but the output looks as I would expect.
This is the beginning of the preprocessing workflow that the reference and reads get fed into:
Copy code
workflow PREPROCESS_BOSS{
    take:
        aligned_fastq
        ref
    main:
        // Prepare input for BRsim
        // Truncate fq Step 1 of prepare input for BRsim
        trunc_fq = truncateFq(aligned_fastq)
...
}
And this is the truncateFq process that fails because I am supposedly invoking a method on a null object:
Copy code
// Truncate fq Step 1 of prepare input for BRsim
process truncateFq {
    input:
        path aligned_fastq
    output:
        path "*_trunc.fq", emit:trunc_fq
        path aligned_fastq, emit:full_fq

    script:
    """
    cut -c -${<http://params.mu|params.mu>} ${aligned_fastq} > ${aligned_fastq.getSimpleName()}_trunc.fq
    """
}
I am convinced there must be some odd hidden issue that causes this error downstream, but I cannot seem to find it. I would really appreciate any pointers. Thank you
n
I am not sure if
${<http://params.mu|params.mu>}
is actually allowed in a script block, at least in nf-core modules I think params need to be converted into an input. Does your
truncateFq
receive a correct input, i..e have you dumped the input channel and checked if it is ok?
i
I didn't know about the first one, that didn't cause issues in the past, but when I have time I'll adjust that everywhere in my pipeline to conform to standards. Thank you for mentioning it. I hadn't thought about your second point, I'll try that. What I just did was comment out
truncateFq
and see if the next process (a mapping step) that just used that read fastq file would run successfully and that finished without complaints, so my understanding that the fastq file is valid seems supported. This makes it even more important to check whether the right file is fed to
truncateFq
. Thanks so much!
I just used
.view()
on the channel that is fed into
truncateFq
and it is the correct file I would expect (ERR3152366.fastq). If I use head on that file I get output that looks like a fastq file.
n
can you try getting rid of
{<http://params.mu|params.mu>}
for testing?
i
Of course, just a moment
n
bc if that is not available in the script block, you cannot get the value
mu
i
Okay, I have now changed the preprocessing workflow to this:
Copy code
workflow PREPROCESS_BOSS{
    take:
        aligned_fastq
        ref
    main:
        // Prepare input for BRsim
        // Truncate fq Step 1 of prepare input for BRsim
        mu_ch = channel.of(<http://params.mu|params.mu>)
        mu_ch.view()
        trunc_fq = truncateFq(aligned_fastq, mu_ch)
and
truncateFq
to this:
Copy code
process truncateFq {
    input:
        path aligned_fastq
        val mu
    output:
        path "*_trunc.fq", emit:trunc_fq
        path aligned_fastq, emit:full_fq

    script:
    """
    cut -c -${mu} ${aligned_fastq} > ${aligned_fastq.getSimpleName()}_trunc.fq
    """
}
mu_ch.view()
returns the expected 400, so the parameter is defined, but I still get an error when I run it, this time a longer one though.
n
I guess that is some kind of progress
i
Copy code
Exception in thread "Task submitter" java.lang.NullPointerException: Cannot invoke method values() on null object
        at org.codehaus.groovy.runtime.NullObject.invokeMethod(NullObject.java:113)
        at org.codehaus.groovy.vmplugin.v8.IndyGuardsFiltersAndSignatures.invokeGroovyObjectInvoker(IndyGuardsFiltersAndSignatures.java:151)
        at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:321)
        at Script27A0DD985F3BE2B20E09F5475A27A919$_run_closure1$_closure33$_closure96.doCall(Script27A0DD985F3BE2B20E09F5475A27A919:236)
        at Script27A0DD985F3BE2B20E09F5475A27A919$_run_closure1$_closure33$_closure96.doCall(Script27A0DD985F3BE2B20E09F5475A27A919)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:343)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:328)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:280)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1007)
        at groovy.lang.Closure.call(Closure.java:433)
        at groovy.lang.Closure.call(Closure.java:412)
        at nextflow.processor.LazyMap.resolveImpl(TaskConfig.groovy:698)
        at nextflow.processor.LazyMap.resolveImpl(TaskConfig.groovy)
        at nextflow.processor.LazyMap.resolve(TaskConfig.groovy:659)
        at nextflow.processor.LazyMap.getValue(TaskConfig.groovy:726)
        at nextflow.processor.LazyMap.get(TaskConfig.groovy:721)
        at nextflow.processor.TaskConfig.get(TaskConfig.groovy:153)
        at nextflow.processor.TaskConfig.getMemory0(TaskConfig.groovy:249)
        at nextflow.processor.TaskConfig.getMemory(TaskConfig.groovy:266)
        at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:321)
        at nextflow.processor.TaskHandler.getTraceRecord(TaskHandler.groovy:218)
        at nextflow.executor.GridTaskHandler.getTraceRecord(GridTaskHandler.groovy:533)
        at nextflow.processor.TaskPollingMonitor.handleException(TaskPollingMonitor.groovy:630)
        at nextflow.processor.TaskPollingMonitor.submitPendingTasks(TaskPollingMonitor.groovy:612)
        at nextflow.processor.TaskPollingMonitor.submitLoop(TaskPollingMonitor.groovy:420)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:343)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:328)
        at groovy.lang.MetaClassImpl.doInvokeMethod(MetaClassImpl.java:1333)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1088)
        at groovy.lang.MetaClassImpl.invokeMethodClosure(MetaClassImpl.java:1017)
        at groovy.lang.MetaClassImpl.doInvokeMethod(MetaClassImpl.java:1207)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1088)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1007)

ERROR ~ Error executing process > 'FROMSEQ:PREPROCESS_BOSS:truncateFq (1)'

Caused by:
  Cannot invoke method values() on null object



 -- Check '.nextflow.log' file for details
I don't really understand what this means
I'm running this on a slurm hpc cluster in case that makes any difference
n
I dont think this is a slurm problem, these types of errors are ususally due to syntax
Sometimes it works ok to just slap your whole error log into https://ai.seqera.io/chat
i
I'll try that, thanks for sanity checking that there isn't anything obviously wrong here.
I found it! It was an issue with my module config that called .values() on something that used to be a map but is currently just a value. Thank you for your help @Niklas Schandry.