This is a test version of Biostars. For the public version, visit https://www.biostars.org.
[R, ShortRead] Subscript contains out-of-bounds indices

Hello everyone,

I am using an R package, ShortRead, to read a fasta file. The look of the info in the fasta file is like the following:

>81001@A01|ORF_ID: 403|ORF_SIZE:159|TEMPLATE_ACCESSION: BC009508.2, BC010491.1|GENE_ID: 112597|PERFECT_MATCH
ATGACAGACACCGAAAATCACGACTCAGCCCCCTCCAGCACCTCTACCTGTTGCCCGCCGATCACAGCCGGAATGCAGCTGAAAGATTCCCTGGGGCCTGGTTCCAACCGCCCACTGTGGACTCTGAGGCCTCTGCATTTGCGGGTGGTCTGCCTGA

>81001@A02|ORF_ID: 228|ORF_SIZE:135|TEMPLATE_ACCESSION: BC016025.1|GENE_ID: 9168|PERFECT_MATCH
ATGGCAGACAAACCAGACATGGGGGAAATCGCCAGCTTCGATAAGGCCAAGCTGAAGAAAACGGAGACGCAGGAAAAGAACACCCTGCCGACCAAAGAGACCATTGAGCAGGAGAAGCGGAGTGAAATTTCCTAA

I used to be able to execute a ShortRead function, readFasta, to read the fasta file, but when I just came back to use it again, it gave me an error saying,

Error: Subscript contains out-of-bounds indices

Could anyone help me with this ? I am an R beginner, and I could not troubleshoot this problem. Thank you so much for your help !

r

Can you add the full command you are currently using?

Yes, thank you so much @rpolicastro !

It is:

library(ShortRead)

fa <- file.path("horf81_cloneInfo20120427.fa")

rfa <- readFasta(fa)

As simple as this. Please kindly let me know if you need additional information. Thank you so much !

What version of ShortRead do you have? You can check with sessionInfo() or packageVersion("ShortRead").

I ran a command like this as you suggested:

The result looks like this:

R version 4.0.2 (2020-06-22)

Platform: x86_64-w64-mingw32/x64 (64-bit)

Running under: Windows 10 x64 (build 19041)

Matrix products: default

locale:

[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    

LC_MONETARY=English_United States.1252

[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

attached base packages:

character(0)

other attached packages:

[1] ShortRead_1.46.0

loaded via a namespace (and not attached):
 [1] rstudioapi_0.13             XVector_0.28.0              GenomicRanges_1.40.0        BiocGenerics_0.36.0         zlibbioc_1.34.0            
 [6] GenomicAlignments_1.24.0    IRanges_2.24.0              grDevices_4.0.2             BiocParallel_1.22.0         lattice_0.20-41            
[11] jpeg_0.1-8.1                hwriter_1.3.2               GenomeInfoDb_1.24.2         tools_4.0.2                 utils_4.0.2                
[16] SummarizedExperiment_1.18.2 parallel_4.0.2              grid_4.0.2                  Biobase_2.48.0              png_0.1-7                  
[21] latticeExtra_0.6-29         stats_4.0.2                 datasets_4.0.2              matrixStats_0.58.0          base_4.0.2                 
[26] crayon_1.4.1                Matrix_1.2-18               GenomeInfoDbData_1.2.3      RColorBrewer_1.1-2          graphics_4.0.2             
[31] S4Vectors_0.28.0            bitops_1.0-6                RCurl_1.98-1.2              DelayedArray_0.14.1         compiler_4.0.2             
[36] methods_4.0.2               Biostrings_2.56.0           Rsamtools_2.4.0             stats4_4.0.2               
>

Sorry, @rpolicastro. I just saw the later command.

It is 1.46.0. Please let me know if I could assist you with other things. Thanks !!

1 answer

Hi everyone,

I would like to give an update that I was able to solve the problem ! Thanks to @rpolicastro, I realized that there is an issue with my installed ShortRead version. I deleted the old ShortRead package and installed the newest version (1.48.0). It works now ! Thanks @rpolicastro !!

Log in to answer this question.