Error following matlab's working with genomes

I tried following matlab's exapmle of how to memmorry map a genome file ( https://www.mathworks.com/help/bioinfo/examples/working-with-whole-genome-data.html ), but am getting the foollowing error -
Array indices must be positive integers or logical values.
Error in nt2int (line 92)
seq = map((uint8(nt) + 1) - uint8('a'));
I am using 'hg38.fa' from the UCSC genome browser.
Thank you,
Guy

6 Comments

Give the command
dbstop if error
and run the code. When it stops, look at double(nt) . If there are any entries in it less than 97 then you would get the indexing problem.
In particular you would get the error if nt contains any capital letters.
Thank you Walter.
I did as you suggested. Indeed, the lowest entry is 49.
Obviously, char(49)=1. So, I'm not sure yet whether the genome sequence contains numbers or that the code for some reason turned ot a chrracter into a number. All I basically did is to follow the example a the URL I gave.
Guy
I cannot seem to locate a copy of hg38.fa at the moment. The primary source is in Southern California, where there are quite a lot of fires at the moment, so it would not surprise me if they temporarily shut down the servers to make it easier to filter the air.
This is where I downloaded ‘hg38.fa.gz’. After downloading I gunzipped it.
I’m not near my laptop so cannot verify it actually downloads.
Thank you, Guy
Unfortunately that is timing out for me today.
Thank you for trying

Sign in to comment.

 Accepted Answer

I added a command to remove any character which is not a letter:
% Remove numbers
numIdx=find(~isletter(charData));
charData(numIdx)='';
% Convert to integers
intData = nt2int(charData);
I think Matlab should consider adjusting some of their functions to whole-genome files (instead of whole chromosmes). Other algorithms use these numbers within the FASTA file for info about these sequences.

More Answers (0)

Categories

Products

Release

R2019b

Tags

Asked:

on 12 Sep 2020

Answered:

on 13 Sep 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!