Dada2: ITS workflow in DADA2 issue: Error in .Call2("new_XString_from_CHARACTER", classname, x, start(solved_SEW), : key 48 (char '0') not in lookup table

Created on 15 Oct 2018  Â·  19Comments  Â·  Source: benjjneb/dada2

Hello @benjjneb,

Many thanks for DADA2 and the support you provide to the community.
It is the first time I am doing fungal ITS analysis of 16 MiSeq samples.
It seemed like a relief when I found 'DADA2 ITS Pipeline Workflow (1.8)', because usual DADA2 I was used to didn't work. I am following the tutorial, however, I encountered this issue:

rbind(FWD.ForwardReads = sapply(FWD.orients, primerHits, fn = fnFs.filtN[[1]]),
FWD.ReverseReads = sapply(FWD.orients, primerHits, fn = fnRs.filtN[[1]]),
REV.ForwardReads = sapply(REV.orients, primerHits, fn = fnFs.filtN[[1]]),
REV.ReverseReads = sapply(REV.orients, primerHits, fn = fnRs.filtN[[1]]))

gives

Error in .Call2("new_XString_from_CHARACTER", classname, x, start(solved_SEW), :
key 48 (char '0') not in lookup table
Error in normargPattern(pattern, subject) :
could not turn 'pattern' into a DNAString instance

error.

Your help on resolving the issue would be much appreciated.
Thanks.

Most helpful comment

Another possibility is that you have another definition of the complement function in your workspace, for example from some other package that defines that function, that is over-riding the expected function from Biostrings, and that is causing this problem.

What is the output from complement(DNAString("ACGT"))?
Or complement(DNAString(FWD))?

What is output when you just enter complement and hit enter?

All 19 comments

It looks like there is an unexpected character somewhere.

Can you provide the output to print(FWD.orients) and print(REV.orients)?

It looks like there is an unexpected character somewhere.

Can you provide the output to print(FWD.orients) and print(REV.orients)?

This is print(FWD.orients):
Forward Complement1 Complement2 Complement3 Complement4
"CTTGGTCATTTAGAGGAAGTAA" "00" "00" "00" "04"
Complement5 Complement6 Complement7 Complement8 Complement9
"00" "00" "04" "04" "00"
Complement10 Complement11 Complement12 Complement13 Complement14
"04" "00" "00" "00" "00"
Complement15 Complement16 Complement17 Complement18 Complement19
"00" "02" "00" "04" "04"
Complement20 Complement21 Complement22 Reverse RevComp
"00" "00" "02" "AATGAAGGAGATTTACTGGTTC" "TTACTTCCTCTAAATGACCAAG"

This is print(REV.orients):
Forward Complement1 Complement2 Complement3 Complement4 Complement5
"GCTGCGTTCTTCATCGATGC" "02" "04" "00" "00" "04"
Complement6 Complement7 Complement8 Complement9 Complement10 Complement11
"02" "00" "00" "02" "00" "00"
Complement12 Complement13 Complement14 Complement15 Complement16 Complement17
"02" "00" "00" "04" "02" "04"
Complement18 Complement19 Complement20 Reverse RevComp
"00" "02" "04" "CGTAGCTACTTCTTGCGTCG" "GCATCGATGAAGAACGCAGC"

That is where the error is, there should be 4 DNA strings for each, and not any of those "00" etc. entries names ComplementX.

Can you try reassigning FWD and REV, and then recreating FWD.orients and REV.orients and see if this can be fixed?

Alternatively, what is the exact command you are entering to define FWD and REV?

That is where the error is, there should be 4 DNA strings for each, and not any of those "00" etc. entries names ComplementX.

Can you try reassigning FWD and REV, and then recreating FWD.orients and REV.orients and see if this can be fixed?

Alternatively, what is the exact command you are entering to define FWD and REV?

I tried reassigning FWD and REV, but nothing changed.
The commands I used were:
FWD <- "GTGAATCATCGAATCTTTGAA" #I changed the sequences depending on the pair of primers used (see primer pairs below).
REV <- "TCCTCCGCTTATTGATATGC" #I changed the sequences depending on the pair of primers used (see primer pairs below).

I am not exactly sure which exactly primers were used by our molecular biologists for the experiment - they provided me with two pairs of primers:
ITS86F: 5'-GTGAATCATCGAATCTTTGAA-3'
ITS4: 5'-TCCTCCGCTTATTGATATGC-3'
and
ITS1F: 5'-CTTGGTCATTTAGAGGAAGTAA-3'
ITS2R: 5'-GCTGCGTTCTTCATCGATGC-3'

I explored the unzipped *_L001_R1_001.fastq file to manually search (eyeball) for primer sequences - I found both pairs present in a single file. How is that possible? Is there something wrong with sequencing?
The filenames are proper paired-end: *_L001_R1_001.fastq.gz & *_L001_R2_001.fastq.gz

It's not a sequencing files issue, this command is showing a problem:

This is print(REV.orients):
Forward Complement1 Complement2 Complement3 Complement4 Complement5
"GCTGCGTTCTTCATCGATGC" "02" "04" "00" "00" "04"
Complement6 Complement7 Complement8 Complement9 Complement10 Complement11
"02" "00" "00" "02" "00" "00"
Complement12 Complement13 Complement14 Complement15 Complement16 Complement17
"02" "00" "00" "04" "02" "04"
Complement18 Complement19 Complement20 Reverse RevComp
"00" "02" "04" "CGTAGCTACTTCTTGCGTCG" "GCATCGATGAAGAACGCAGC"

There should be none of those Complement18 (e.g.) or "00" entries. Somehow the FWD.orient (e.g.) have been corrupted. Did you regenerate the FWD.orient and REV.orient variables, and see if that problem goes away?

For example, when I do the following I get sensible output. Do you?

FWD <- "GTGAATCATCGAATCTTTGAA"
allOrients(FWD)
           Forward              Complement                 Reverse                 RevComp

"GTGAATCATCGAATCTTTGAA" "CACTTAGTAGCTTAGAAACTT" "AAGTTTCTAAGCTACTAAGTG" "TTCAAAGATTCGATGATTCAC"

It's not a sequencing files issue, this command is showing a problem:

This is print(REV.orients):
Forward Complement1 Complement2 Complement3 Complement4 Complement5
"GCTGCGTTCTTCATCGATGC" "02" "04" "00" "00" "04"
Complement6 Complement7 Complement8 Complement9 Complement10 Complement11
"02" "00" "00" "02" "00" "00"
Complement12 Complement13 Complement14 Complement15 Complement16 Complement17
"02" "00" "00" "04" "02" "04"
Complement18 Complement19 Complement20 Reverse RevComp
"00" "02" "04" "CGTAGCTACTTCTTGCGTCG" "GCATCGATGAAGAACGCAGC"

There should be none of those Complement18 (e.g.) or "00" entries. Somehow the FWD.orient (e.g.) have been corrupted. Did you regenerate the FWD.orient and REV.orient variables, and see if that problem goes away?

For example, when I do the following I get sensible output. Do you?

FWD <- "GTGAATCATCGAATCTTTGAA"
allOrients(FWD)
           Forward              Complement                 Reverse                 RevComp 

"GTGAATCATCGAATCTTTGAA" "CACTTAGTAGCTTAGAAACTT" "AAGTTTCTAAGCTACTAAGTG" "TTCAAAGATTCGATGATTCAC"

I regenerated the FWD.orient and REV.orient variables, but nothing changed.

When I type

FWD <- "GTGAATCATCGAATCTTTGAA"
allOrients(FWD)

the output I get is same as for print(FWD.orients)

I even made a test comparison:
> FWD.orients==allOrients(FWD) Forward Complement1 Complement2 Complement3 Complement4 Complement5 Complement6 Complement7 Complement8 Complement9 TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE Complement10 Complement11 Complement12 Complement13 Complement14 Complement15 Complement16 Complement17 Complement18 Complement19 TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE Complement20 Complement21 Reverse RevComp TRUE TRUE TRUE TRUE

I regenerated the FWD.orient and REV.orient variables, but nothing changed.
When I type

FWD <- "GTGAATCATCGAATCTTTGAA"
allOrients(FWD)

the output I get is same as for print(FWD.orients)

Something is wrong with your allOrients function then. Can you re-enter the allOrients function from the tutorial exactly as is, and then regenerate allOrients(FWD)? The output should be 4 DNA sequences, named Forward, Complement, Reverse, and ReverseComplement.

I regenerated the FWD.orient and REV.orient variables, but nothing changed.
When I type

FWD <- "GTGAATCATCGAATCTTTGAA"
allOrients(FWD)

the output I get is same as for print(FWD.orients)

Something is wrong with your allOrients function then. Can you re-enter the allOrients function from the tutorial exactly as is, and then regenerate allOrients(FWD)? The output should be 4 DNA sequences, named Forward, Complement, Reverse, and ReverseComplement.

I did what you've just said, but with the data from tutorial, and the result was not like it says in the tutorial. I still get a lot of ComplementXs even in the data from tutorial.

The only difference I can see is in my newer versions of packages.
?Can it be due to the updated versions of

packageVersion("ShortRead")
[1] ‘1.38.0’
packageVersion("Biostrings")
[1] ‘2.48.0’

Another possibility is that you have another definition of the complement function in your workspace, for example from some other package that defines that function, that is over-riding the expected function from Biostrings, and that is causing this problem.

What is the output from complement(DNAString("ACGT"))?
Or complement(DNAString(FWD))?

What is output when you just enter complement and hit enter?

Another possibility is that you have another definition of the complement function in your workspace, for example from some other package that defines that function, that is over-riding the expected function from Biostrings, and that is causing this problem.

What is the output from complement(DNAString("ACGT"))?
Or complement(DNAString(FWD))?

What is output when you just enter complement and hit enter?

complement(DNAString("ACGT"))
1 DNA sequence in binary format stored in a vector.
Sequence length: 4
Base composition:
a c g t
NaN NaN NaN NaN

complement(DNAString(FWD))
1 DNA sequence in binary format stored in a vector.
Sequence length: 16
Base composition:
a c g t
NaN NaN NaN NaN

complement
function (x)
{
f <- function(x) {
comp <- as.raw(._bs_[c(4:1, 10:9, 7:8, 6:5, 14:11, 15:17)])
ans <- comp[match(as.integer(x), ._bs_)]
rev(ans)
}
if (is.matrix(x)) {
for (i in 1:nrow(x)) x[i, ] <- f(x[i, ])
return(x)
}
else if (is.list(x)) {
x <- lapply(x, f)
}
else x <- f(x)
class(x) <- "DNAbin"
x
}

The above comment was using the 16bp FWD primer from tutorial: FWD <- "ACCTGCGGARGGATCA". I still get the same ComplementXs (even with tutorial data):
> FWD.orients Forward Complement1 Complement2 Complement3 Complement4 Complement5 Complement6 "ACCTGCGGARGGATCA" "00" "02" "00" "00" "04" "04" Complement7 Complement8 Complement9 Complement10 Complement11 Complement12 Complement13 "00" "00" "04" "04" "02" "04" "00" Complement14 Complement15 Complement16 Reverse RevComp "02" "02" "00" "ACTAGGRAGGCGTCCA" "TGATCCYTCCGCAGGT"

We found it!

the ape version of complement is over-riding the Biostrings version of complement. This will be fixed if you go back to the function allOrients and replace the call to complement with Biostrings::complement. If you do that, all should work again as expected.

We found it!

the ape version of complement is over-riding the Biostrings version of complement. This will be fixed if you go back to the function allOrients and replace the call to complement with Biostrings::complement. If you do that, all should work again as expected.

It seems to have worked. Thank you for your help, @benjjneb ! :)

Thank you all for this. Had exact same issue. You're my heroes for today.

This happens time and again with both dada2 and phyloseq, I say we premise
all the evil "common function names"
with the package:: or otherwise use Hadley's
https://cran.r-project.org/web/packages/conflicted/index.html
conflicted
package

On Mon, Mar 25, 2019 at 4:19 PM alouyakis notifications@github.com wrote:

Thank you all for this. Had exact same issue. You're my heroes for today.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/benjjneb/dada2/issues/586#issuecomment-476414073, or mute
the thread
https://github.com/notifications/unsubscribe-auth/ABJcvUZ0FeLwIvoeL5tC5g1TmRwWDblDks5vaVmLgaJpZM4Xbnh3
.

--
Susan Holmes
John Henry Samter Fellow in Undergraduate Education
Professor, Statistics
2017-2018 CASBS Fellow,
Sequoia Hall,
390 Serra Mall
Stanford, CA 94305
http://www-stat.stanford.edu/~susan/

Thanks all! Had the same issue and this worked beautifully.

Hi I am having exactly the same issue. I tried all of the trouble shooting mentioned above, but I am still not able to assign taxonomies to my dataset. I made my own OTU table to reassign taxonomy by filtered the original OTU table taxonomic assignments to remove eukaryotes, and my new filtered table is not being read properly when re-assigning taxonomies. I really need the help, thank you!

@CarlaCristinaUranga I don't understand your post, as the previous discussion in this thread was not about assigning taxonomy.

Another possibility is that you have another definition of the complement function in your workspace, for example from some other package that defines that function, that is over-riding the expected function from Biostrings, and that is causing this problem.

What is the output from complement(DNAString("ACGT"))?
Or complement(DNAString(FWD))?

What is output when you just enter complement and hit enter?

Thank you very much, I was having this same issue and reducing the opened packages to just the ones from the tutorial fixed this problem for me. Cheers Ben, thank you for everything!

Was this page helpful?
0 / 5 - 0 ratings