Package: abifpy
abifpy is a python module that extracts sequence and various other data from
Applied Biosystem’s, Inc. format (ABI) file. The module is python3-compatible
and was written based on theofficial specreleased by Applied Biosystems.A modified version of this module has been merged into theBiopython
project, available from version 1.58 onwards. If you already have Biopython
version >=1.58, there is no need to use abifpy. Despite that, I am keeping
the module available as a stand-alone for personal reasons :).abifpy provides the following items:classTrace(in_file)Class representing the trace filein_file.Trace object attributes and methodsseqString of base-called nucleotide sequence stored in the file.qualString of phred quality characters of the base-called sequence.qual_valList of phred quality values of the base-called sequence.idString of the sequence file name.nameString of the sample name entered prior to sequencing.trim(sequence[, cutoff=0.05])Returns a trimmed sequence using Richard Mott’s algorithm (used in phred)
with the probability cutoff of 0.05. Can be used onseq,qual, andqual_val.get_data(key)Returns metadata stored in the file, accepts keys fromtags(see below).export([out_file=””, fmt=’fasta’])Writes a fasta (fmt='fasta'), qual (fmt='qual'), or
fastq (fmt='fastq') file from the trace file. Default format isfasta.close()Closes the Trace file object.seq_remove_ambig(seq)Replaces extra ambigous base characters (K, Y, W, M, R, S) with ‘N’. Acceptsseqfor input.EXTRACTDictionary for determining which metadata are extracted.dataDictionary that contains the file metadata. The keys are values ofEXTRACT.tagsDictionary of tags with values of data directory class instance. Keys are tag name and
tag number, concatenated. Useget_data()to access values in eachtagsentry.Usage$ python
>>> from abifpy import Trace
>>> yummy = Trace('tests/3730.ab1')Or if you want to perform base trimming directly:>>> yummy = Trace('tests/3730.ab1', trimming=True)Sequence can be accessed with theseqattribute. Other attributes of note
arequalfor phred quality characters,qual_valfor phred quality values,idfor sequencing trace file name, andnamefor the sample name:>>> yummy.seq
'GGGCGAGCKYYAYATTTTGGCAAGAATTGAGCTCT...
>>> yummy.qual
'5$%%%\'%%!!!\'!+5;726@>A=3824DESHSS...
>>> yummy.qual_val
[20, 3, 4, 4, 4, 6, 4, 4, 0, 0, 0, 6, 0, 10, 20, 26, 22, 17, 21...
>>> yummy.id
'3730'
>>> yummy.name
'226032_C-ME-18_pCAGseqF'If trimming was not performed when instantiating, you can still do it afterwards:>>> yummy.trim(yummy.seq)The quality values itself can be trimmed as well:>>> yummy.trim(yummy.qual)Viewing the trace file metadata is easy. Use the values fromEXTRACTas the keys indata:>>> yummy.data['well']
'B9'
>>> yummy.data['model']
'3730'
>>> yummy.data['run start date']
datetime.date(2009, 12, 12)metadata not contained indatacan be viewed usingget_data()with one of the keys intagsas the argument, e.g.:>>> yummy.get_data('PTYP1')
'96-well'For more info on the meaning of these tags and the file metadata, consult theofficial spec.Installationpip install abifpy, orAdd the abifpy directory to your$PYTHONPATH(in.bashrcto make it persistent)Licenseabifpy is licensed under the MIT License.Copyright (c) 2011 by Wibowo Arindrarto <bow@bow.web.id>Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the “Software”), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.