I would strongly recommend using Matlab, it does not read ab1 files directly, but it can if Staden tools are installed. The reason being is that the data is presented a lot better and there is documentation. I recently wrote a QQC calculation script in Matlab as proof of principle and I will rewrite it in python (due to server building) using it as a benchmark.
In Biopython the manual says:
from Bio import SeqIO
handle = open("myfile.ab1", "rb")
And that is where it stops. It does have the data. The trace data is stored as annotations:
print(json.dumps(record.annotations, sort_keys=True, indent=4))
Specifically, the actual raw data is:
but wait! The bases are not ATGC. but GATC as found here:
Having played with
ab1 files in Matlab using the command:
[Sample, Probability] = scfread('temp_via_matlab.scf');
I know that there is not only raw data (Sample), but also probability data. The latter tells me where the peaks are (e.g.
Probability.peak_index(100)) and how good they are. This will be very helpful. That data is saved here:
print('PLOC1 is peak_index in Matlab', record.annotations['abif_raw']['PLOC1']) # tuple of int
print('PBAS1 is what base it is', record.annotations['abif_raw']['PBAS1']) # str
Note that it is a wee bit different from MatLab and there are keys called PLOC2 and PBAS2 which have the same data as their 1 counterparts from what I can tell.
For a more detailed explanation of the many keys present see the vignette for the R package sangerseqR, which does the same and is annotated slightly better than biopython —although
scfread in Matlab is a lot more neater (hence my recommendation).