Entering edit mode
8.1 years ago
Beñat
▴
20
I am trying to align my fastq files using Matlab. I need to sort the fastq files by coordinate to use them after in other workflows, but I have problems to do it using bowtie function in Matlab. Do you know any workflow to align and sort the files by coordinate? Thanks for all
Why do you want to run bowtie from Matlab? You can run the aligner directly through the command-line, then use samtools sort to sort the bam file. Using Matlab for this has no specific advantage I could think of. Also fastq files cannot be sorted by coordinate, because they have no coordinates assigned to the reads.
I am more used to work with Matlab and R than through the command-line, cause I am not used to work with this kind of files Thanks for all!
As Michael points out, the FASTQ file does not contain where the reads map to, only the read sequence and confidence/quality scores. You can however map the FASTQ to a BAM file (which has the mapping positions relative to a reference genome), then sort the BAM file, then convert that BAM file back to a FASTQ by essentially throwing away the mapping positions (but keeping the reads in the same order).
This sounds really really "odd", and suggests a logical error somewhere along the lines - however we don't know what you want to do with the FASTQ file so it's difficult to say. One thing i can strongly recommend against is using Matlab for this. Matlab is great for certain things, and so is R, but frankly I think this is an excellent opportunity for you to learn a bit of command-line stuff anyway. I doubt you can sort a BAM file from inside Matlab without calling samtools anyway...