skovaka / UNCALLED

Raw nanopore signal mapper that enables real-time targeted sequencing
MIT License
520 stars 44 forks source link

undemultiplex fast5 #32

Closed aspitaleri closed 3 years ago

aspitaleri commented 3 years ago

Hi all just to make sure I understood well. I have a MinIon run of a set of amplicon samples (which includes sequencing from different bacterial strains). In order to use UNCALLED a posteriori (non in real time) on the fast5 files, do I need to split them as function of barcode, isn't? Or I can generate a huge multi fasta file and then split based on ... what? Best for any advice

skovaka commented 3 years ago

If you want to run uncalled map, you could tell UNCALLED to only map those reads with the -l option. -l takes a text file with one read ID per line, and it will only map reads from the FAST5 file which are contained in the text file.

If you want to run uncalled sim you could do something similar by only including reads from each barcode in the sequencing summary file.

Another option, as you suggested, is to separate out the FAST5 files out using something like the ONT fast5 API. I'd only recommend this if you expect to run UNCALLED map or sim a number of times since it will save time loading the smaller number of FAST5s, at the expense of the time to run the initial command and additional disk space.

aspitaleri commented 3 years ago

Hi @skovaka thanks a lot for your advice. Using -l option means I should know which read belong to which sample. Where do I get this information?

skovaka commented 3 years ago

I'm not very familiar with barcoded data, but if you have separate fastq files for each sample you can find the read IDs in the fastq headers. Each header has the ID after the "@" and before the first space. You should be able to extract all read IDs from reads.fq using the command awk 'NR % 4 ==1 {print substr($1, 2)}' reads.fq > read_ids.txt.

aspitaleri commented 3 years ago

Okay I see but this means that I need to basecall my fast5 first, which I'd like to avoid. The best is to split the fast5 using some fast5 library to separate them first and then use uncalled. Probably ont_fast5_api can do this.

skovaka commented 3 years ago

I see, I didn't realize you were trying to avoid basecalling. As you initially suggested, you could map all reads to a fasta file containing genomes from all your samples, and then split based on which genome each read maps to. That would not take barcodes into account however, since that's not what UNCALLED was designed for.