I came across a problems with FastqSampler from the ShortRead package. I get non-matching pairs/mates (reads that don;t belong to each other) when doing:
f1 <- FastqSampler("file1.fastq", n=1e6) f2 <- FastqSampler("file2.fastq", n=1e6) set.seed(123L); p1 <- yield(f1) set.seed(123L); p2 <- yield(f2)
(as suggested by Martin in https://www.biostars.org/p/6544/ )
The problem is that my reads are already post-processed (our core facility already removed a random 0-8 base oligo from the reads that was used to generate cluster diversity), and this results in reads of randomly different lengths in the two mate files, though both files have the same number of reads in the same order.
It seems that a random file pointer is used from which the next read entry is accessed in both paired end files, and if reads have randomly different length this results in non-matching pairs.
What's the best way to sample such paired-end files?
thanks for your help,