[Biopython] Writing fasta+qual files and adjusting adapter clip positions in sff files

Martin Mokrejs mmokrejs at fold.natur.cuni.cz
Wed Apr 6 10:17:46 EDT 2011


Peter Cock wrote:
> On Wed, Apr 6, 2011 at 2:54 PM, Martin Mokrejs
> <mmokrejs at fold.natur.cuni.cz> wrote:
>> Peter wrote:
>>> I'm a bit confused if you are trying to write out a new trimmed SFF file, a pair
>>> of trimmed FASTA and QUAL files, or even a trimmed FASTQ file. All of
>>> those are possible with Biopython.
>>
>> I wanted either trimmed fasta+qual or trimmed sff (preferably) both with my _new_
>> trim points. From the above it is now clear for fasta+qual it can be done through
>> biopython ...
> 
> Yes, and it is easy as you can just slice the SeqRecord objects.
> 
>> ... while for sff alterations/creations I have to stick to sfffile (which
>> is fine for me).
> 
> No, you can do that in Biopython too - very similar to the example you
> quoted. You load the SFF file in, move the trim points by changing
> the values of record.annotations["clip_qual_left"] and/or
> record.annotations["clip_qual_right"] then save this as a new
> SFF file. Note you need to use Python zero-based counting.

And this kind of awkward as I have to sort the list of readnames with trimpoints
to make the code efficient. Well, I haven't tried that but think the convert()
function could take the advantage of the sff file index internally and accept the
input in any order and just work well. Just a thought. As I wrote, I anyways use
sfffile-based approach at the very moment.

Thanks,
Martin


More information about the Biopython mailing list