#include <trapperparser.h>
Collaboration diagram for TrapperParser:
Public Member Functions | |
TrapperParser (DbEnv *dbenv, QString projectDir) | |
bool | startElement (const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &attributes) |
bool | endElement (const QString &namespaceURI, const QString &localName, const QString &qName) |
Private Member Functions | |
QStringList | contigNamesInProjectDir () |
Private Attributes | |
DbEnv * | env |
QString | projDir |
TrapperDoc * | current_doc |
db_recno_t | current_read_recno |
bool | format_ok |
Definition at line 11 of file trapperparser.h.
|
Definition at line 15 of file trapperparser.h. 00015 : 00016 env(dbenv), projDir(projectDir), current_doc(0), format_ok(false) {}
|
|
Definition at line 89 of file trapperparser.cpp. References projDir. Referenced by startElement(). 00090 { 00091 QString contigName; 00092 QDir d( projDir ); 00093 Q_ASSERT( d.exists() ); 00094 d.setFilter( QDir::Dirs | QDir::NoSymLinks ); 00095 d.setSorting( QDir::Name ); 00096 QStringList slist = d.entryList(); 00097 return slist; 00098 }
|
|
Definition at line 76 of file trapperparser.cpp. References current_doc. 00078 { 00079 if ( qName == "contig" ) { 00080 //Delete old doc, if any 00081 delete current_doc; 00082 // cerr<<"end contig"<<endl; 00083 } 00084 return true; 00085 }
|
|
Definition at line 9 of file trapperparser.cpp. References contigNamesInProjectDir(), Database::Creator< T >::create(), current_doc, current_read_recno, Database::Creator< T >::data(), env, format_ok, TrapperView::message(), TrapperDoc::openDocument(), projDir, GeneralData::readAttributes(), FeatureData::setReadRecno(), and TrapperView::TrapperDoc. 00013 { 00014 //Three cases: 00015 if ( qName == "TRAPPER" ) { 00016 format_ok = true; 00017 return true; 00018 } 00019 else if ( qName == "contig" && format_ok ) { 00020 // cerr<<"new contig"<<endl; 00021 /* Basically, all the functionality of TrapperApp::slotImport() 00022 has moved here. The other two cases below now contains the 00023 old functionality of TrapperDoc::import(). */ 00024 00025 00026 //Use attributes to get name 00027 QString contigName = attributes.value("name"); 00028 00029 00030 //Some bookkeeping to check if contig is already present 00031 QStringList contigNamesAlreadyPresent = contigNamesInProjectDir(); 00032 if ( contigNamesAlreadyPresent.contains( contigName ) ) { 00033 QString message; 00034 message = QString("The contig name \"%1\" was specified in the import file, but that contig is already present in the project dir. Skipping this one").arg(contigName); 00035 QMessageBox::warning(0,"",message); 00036 return false; 00037 } 00038 //Create directory for contig 00039 QString fName = projDir + "/" + contigName; 00040 00041 00042 //Create directories and databases for this contig 00043 00044 current_doc = new TrapperDoc(env); 00045 current_doc->openDocument(fName); 00046 00047 return true; 00048 } 00049 else if ( format_ok ) { 00050 // cerr<<"parsing "<<qName<<endl; 00051 //Get data name from attributes and put into QString generalDataName 00052 00053 //Create object factory for this data type 00054 00055 Database::Creator<GeneralData> creator( current_doc, qName.ascii() ); 00056 00057 creator.data()->readAttributes( attributes ); 00058 00059 if ( qName != "ReadData" ) {//All other cases are FeatureData and need the corresponding read recno 00060 00061 FeatureData* fdata = dynamic_cast<FeatureData*>(creator.data()); 00062 assert( fdata ); 00063 fdata->setReadRecno( current_read_recno ); 00064 00065 } 00066 db_recno_t new_recno = creator.create( false );//Should give dna, quality etc same recno as read (as previously) 00067 if ( qName == "ReadData" ) { 00068 00069 current_read_recno = new_recno; 00070 } 00071 return true; 00072 } 00073 return false; 00074 }
|
|
Definition at line 34 of file trapperparser.h. Referenced by endElement(), and startElement(). |
|
Definition at line 35 of file trapperparser.h. Referenced by startElement(). |
|
Definition at line 31 of file trapperparser.h. Referenced by startElement(). |
|
Definition at line 36 of file trapperparser.h. Referenced by startElement(). |
|
Definition at line 32 of file trapperparser.h. Referenced by contigNamesInProjectDir(), and startElement(). |