Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Github provides better functionality than Sourceforge.
Instead of using

https://sourceforge.net/projects/abi2xml/

the development of abi2xml will continue at

https://github.com/eriksjolund/abi2xml

The file abi2xml-1.2.tar.gz was downloaded from
https://sourceforge.net/projects/abi2xml/files/abi2xml/1.2/
and its contents were added to this git commit.

According to the Sourceforge page the file
was modified 3 April 2006.

Signed-off-by: Erik Sjölund <erik.sjolund@gmail.com>
  • Loading branch information
eriksjolund committed Feb 6, 2020
0 parents commit b4f26c1
Show file tree
Hide file tree
Showing 21 changed files with 2,441 additions and 0 deletions.
17 changes: 17 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Design and implementation: Erik Sjolund
( Erik Sj&ouml;nd )
email: erik.sjolund@gmail.com

in assignment from:
Martti Tammi and Erik Arner
Karolinska Insitutet, Stockholm, Sweden ( http://www.ki.se )

Many thanks to Martti Tammi and Erik Arner who gave me expert advice concerning
the Abi format.

Many thanks to Clark Tibbetts for describing the ABI format in his publication
( see README file )

Erik Arner also provided valuable feedback and ideas about "polishing" the end
product. Some new command line flags arose that way.

340 changes: 340 additions & 0 deletions COPYING

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
2005-11-26 Erik Sjolund <erik.sjolund@gmail.com>

* Release 1.1

* AUTHORS: typo fix

* src/main.cpp: Add functionality to convert a whole directory of abi files
* src/gengetopt/abi2xml.ggo: Add command line flags for directory processing

2006-03-30 Erik Sjolund <erik.sjolund@gmail.com>

* Release 1.2

* : ported the code to Qt 4.1


18 changes: 18 additions & 0 deletions INSTALL
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Prerequisites: You must have the qt library ( version >= 4.1 ) installed ( see http://www.trolltech.com )

For instance Fedora Core 4 is a Linux distribution where abi2xml is known to build. But first you need to download, build
and install Qt-4.1 first, as it is not included in Fedora Core 4.

abi2xml is also known to build on Windows with Qt-4.1. The qt library is also available on MacOS, so abi2xml should probably work there too although
this has not yet been tested.

To install this program on a Unix platform ( e.g. Linux ), follow these steps:

1. qmake
2. make
3. make install

You should then find the executable in the bin subdirectory.



44 changes: 44 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
This program parses the binary file format coming from a
ABI PRISM TM 377 DNA Sequencer and writes the information in
plain text to an xml file.

The ABI file binary format is described in this publication:
http://www.cs.cmu.edu/afs/cs/project/genome/WWW/Papers/clark.html

-------------------------------------------

Raw Data File Formats,
and the Digital and Analog Raw Data Streams
of the ABI PRISM TM 377 DNA Sequencer

A preliminary technical examination

by

Clark Tibbetts, Ph. D.
Professor of Microbiology

A5217 Medical Center North
Vanderbilt University
Nashville, TN 37232-2363

August 1995

----------------------------------------------


Usage:
abi2xml -i binaryfile -o xmlfile

Other option flags are also available. To list them type "abi2xml --help".

An xslt script can be useful when you want to retrieve information from the xml file.
Take a look in the xslt_examples sub directory. There you find some example scripts.

You run a xslt script like this:
xsltproc xsltscript abi2xml-generated-xmlfile

( xsltproc is a command line utility from the package libxslt )



15 changes: 15 additions & 0 deletions TODO
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Todo list:

* implement datarecord "KUKU"
* implement datarecord "THUM"
* implement datarecord "GELT"

* implement a command line flag to list available codecs.

Qt 4.0 has a new function to list available codecs.
http://doc.trolltech.com/4.0/qtextcodec.html
"QList<QByteArray> availableCodecs ()"




8 changes: 8 additions & 0 deletions abi2xml.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# File generated by kdevelop's qmake manager.
# -------------------------------------------
# Subdir relative project main directory: .
# Target is a subdirs project

TEMPLATE=subdirs
SUBDIRS += src

146 changes: 146 additions & 0 deletions src/abi2xml.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@


/*******************************************************************************
* *
* Copyright (C) 2003 Erik Sjolund, (<html>Erik Sj&ouml;lund</html>) *
* Center for Genomics and Bioinformatics, *
* Karolinska Institutet, *
* Stockholm, *
* Sweden *
* *
* Author: Erik Sjolund *
* Email: erik.sjolund@adivo.se *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
* *
*******************************************************************************
*/

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <iostream>
#include <qdatastream.h>
#include <qiodevice.h>

#include <qregexp.h>
#include <algorithm>

#include "abi2xml.h"
#include "datarecordmaker.h"
#include "datarecord.h"
#include <QByteArray>

Abi2xml::Abi2xml( QDataStream & stream_, QDomElement parseRoot, Params *params_ )
: stream ( stream_ ), params( params_ )
{
device = stream.device();
domDoc = parseRoot.ownerDocument();
domDataStructs = domDoc.createElement( "dataStructures" );
parseRoot.appendChild( domDataStructs );
parseInfo = domDoc.createElement( "parseInfo" );
parseRoot.appendChild( parseInfo );
}
Abi2xml::~Abi2xml()
{
}

void Abi2xml::parse()
{
m_offset_to_ABIF = offset_to_ABIF();
qint32 num_rec = num_records();
qint32 offset_to_first = offset_to_first_record();
quint16 blk_size = block_size();
if ( blk_size != 28 )
{
std::cerr << "Warning: Blocksize is not 28. Maybe you passed a non-valid indata file." << std::endl;
exit(1);
}
parseInfo.setAttribute("block_size" , blk_size);
parseInfo.setAttribute("offset_to_first_record",offset_to_first);
parseInfo.setAttribute("read_num_tagged_file_records",num_rec);
for ( int i=0 ; i< num_rec; ++i )
{
qlonglong offset = offset_to_first + i * blk_size;
device->seek( offset );
DataRecord * record = DataRecordMaker::newDataRecord( stream, m_offset_to_ABIF, params );
Q_ASSERT( record );
if ( record )
{
QDomElement elem = domDoc.createElement( record->xmlElementName() );
domDataStructs.appendChild( elem );
record->produceDom( elem );
} else
{
exit( 1 );
}
}
}

quint16 Abi2xml::block_size()
{
device->seek( 16 + m_offset_to_ABIF );
quint16 number;
stream >> number;
return number;
}

qint32 Abi2xml::num_records()
{
qint32 number = read_int32_at( 18 + m_offset_to_ABIF );
return number;
}

qint32 Abi2xml::offset_to_first_record()
{
qint32 number = read_int32_at( 26 + m_offset_to_ABIF );
return number + m_offset_to_ABIF;
}

qint32 Abi2xml::read_int32_at( qlonglong offset )
{
device->seek( offset );
qint32 number;
stream >> number;
return number;
}

qint32 Abi2xml::offset_to_ABIF()
{
qint32 index = 0;
qint32 size = device->size();
int len = 5;
bool found = false;
while ( ( ! found && ( index <= size - len )) )
{
device->seek( index );
char array[ len ];
stream.readRawData(&array[0], len );
array[ len -1 ] = '\0';
QString str = QString(&array[0]);
if ( str == "ABIF" ) {
found = true;
break;
}
++index;
}
if ( ! found )
{
std::cerr << "could not find a qualitive guess of the start position" << std::endl;
exit(1);
}
return index;
}
65 changes: 65 additions & 0 deletions src/abi2xml.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*******************************************************************************
* *
* Copyright (C) 2003 Erik Sjolund, (<html>Erik Sj&ouml;lund</html>) *
* Center for Genomics and Bioinformatics, *
* Karolinska Institutet, *
* Stockholm, *
* Sweden *
* *
* Author: Erik Sjolund *
* Email: erik.sjolund@adivo.se *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
* *
*******************************************************************************
*/

#ifndef ABI2XML_H
#define ABI2XML_H

// include files for QT

#include <QIODevice>
#include <QList>
#include <QDomElement>

class QDataStream;
class DataRecord;
struct Params;

class Abi2xml
{
public:
Abi2xml( QDataStream & stream, QDomElement, Params *params );
~Abi2xml();
void parse();
quint16 block_size();
qint32 num_records( );
qint32 offset_to_first_record();
qint32 offset_to_ABIF();
protected:
qint32 read_int32_at( qlonglong offset );
QIODevice * device;
QDataStream & stream;
DataRecord * dataRecord;
QDomElement domDataStructs;
QDomElement parseInfo;
qint32 m_offset_to_ABIF;
QDomDocument domDoc;
Params *params;
};

#endif

Loading

0 comments on commit b4f26c1

Please sign in to comment.