Skip to content

Commit

Permalink
Merge branch 'devel'
Browse files Browse the repository at this point in the history
  • Loading branch information
dridk committed Mar 14, 2017
2 parents 4ecc9ef + c495247 commit f1f11ad
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 65 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/)
.

## [0.2.3] - 2017-14-03
### Changed
- Fix delay time before running. Now analysis doesn't wait to run
- Remove debugging message
- Fix bug when exporting PNG data.

## [0.2.2] - 2017-03-03
### Changed
- Fix Crash when reading .xz file
Expand Down
2 changes: 1 addition & 1 deletion FastQt.pro
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
QT += core gui concurrent charts svg
#QMAKE_CXXFLAGS += -Ofast
QMAKE_CXXFLAGS += -std=c++11
#CONFIG(release, debug|release):DEFINES += QT_NO_DEBUG_OUTPUT
CONFIG(release, debug|release):DEFINES += QT_NO_DEBUG_OUTPUT


# METHOD 1 : If KArchive is not installed as a Qt Module then copy to your Qt installation :
Expand Down
2 changes: 1 addition & 1 deletion analysis/analysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void Analysis::save(const QString &path)
QString pngPath = dir.filePath(QString("%1.png").arg(name));

capture(svgPath);
capture(pngPath);
capture(pngPath, ImageFormat::PngFormat);
}


Expand Down
27 changes: 11 additions & 16 deletions analysis/analysisrunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,30 +61,30 @@ void AnalysisRunner::run()

QFileInfo fileInfo(mFilename);

QIODevice * file = Q_NULLPTR;
QIODevice * file = Q_NULLPTR;
QIODevice * rawFile = new QFile(mFilename);

file = new QFile(mFilename);
if (is_gz(file))
if (is_gz(rawFile))
{
file = new KCompressionDevice(mFilename, KCompressionDevice::GZip);
file = new KCompressionDevice(rawFile,true,KCompressionDevice::GZip);
if (!is_fastq(file))
file = Q_NULLPTR;
}
else if (is_bz2(file))
else if (is_bz2(rawFile))
{
file = new KCompressionDevice(mFilename, KCompressionDevice::BZip2);
file = new KCompressionDevice(rawFile, true, KCompressionDevice::BZip2);
if (!is_fastq(file))
file = Q_NULLPTR;
}
else if (is_xz(file))
else if (is_xz(rawFile))
{
file = new KCompressionDevice(mFilename, KCompressionDevice::Xz);
file = new KCompressionDevice(rawFile,true, KCompressionDevice::Xz);
if (!is_fastq(file))
file = Q_NULLPTR;
}
else if (is_fastq(file))
else if (is_fastq(rawFile))
{
file = new QFile(mFilename);
file = rawFile;
}

if (file == Q_NULLPTR)
Expand All @@ -108,11 +108,6 @@ void AnalysisRunner::run()
FastqReader reader(file);
mStartTime.start();

// pre compute total size for sequencial access .
//emitUpdate(tr("Analysis ..."));
reader.computeTotalSize();



for (Analysis * a : mAnalysisHash)
a->before();
Expand All @@ -137,7 +132,7 @@ void AnalysisRunner::run()
// this is critcal and can decrease the speed. Send message only 1 sequence / 1000
if (mSequenceCount % 1000 == 0)
{
int percentNow = reader.percentComplete();
int percentNow = (float)(rawFile->pos()) / fileInfo.size() * 100;
// if percentNow is still null, return empty percent ...
if ( (percentNow >= mProgression + 5) || (percentNow == 0))
{
Expand Down
1 change: 1 addition & 0 deletions analysis/analysisrunner.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Copyright Copyright 2016-17 Sacha Schutz
#define ANALYSISRUNNER_H
#include <QtCore>
#include <KCompressionDevice>
#include <KFilterBase>
#include "analysis.h"
#include "fastqreader.h"
#include "imageformatdefinition.h"
Expand Down
2 changes: 1 addition & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ int main(int argc, char *argv[])
a.setApplicationName("FastQt");
a.setOrganizationName("Labsquare");
a.setOrganizationDomain("labsquare.org");
a.setApplicationVersion("0.2.2");
a.setApplicationVersion("0.2.3");

QString locale = QLocale::system().name().section('_', 0, 0);

Expand Down
3 changes: 2 additions & 1 deletion model/mainanalysemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ MainAnalyseModel::MainAnalyseModel(QObject * parent)
// connect(mSignalMapper,SIGNAL(mapped(int)),this,SLOT(updated(int)));
connect(mTimer,SIGNAL(timeout()),this,SLOT(timeUpdated()));

mTimer->setInterval(1000);
mTimer->setInterval(300);

}

Expand Down Expand Up @@ -56,6 +56,7 @@ QVariant MainAnalyseModel::data(const QModelIndex &index, int role) const
if (index.column() == ProgressColumn)
return mRunners.at(index.row())->progression();


if (index.column() == ReadsColumn)
return mRunners.at(index.row())->sequenceCount();

Expand Down
29 changes: 0 additions & 29 deletions sequence/abstractsequencereader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,42 +29,13 @@ AbstractSequenceReader::AbstractSequenceReader(QIODevice *device)
{


}

int AbstractSequenceReader::percentComplete() const
{
if (totalSize() == 0)
return 0;

quint64 percent = qFloor(qreal(mDevice->pos()) / totalSize() * 100);
return percent;

}

const Sequence &AbstractSequenceReader::sequence() const
{
return mSequence;
}

void AbstractSequenceReader::computeTotalSize()
{
if (mDevice->size() == 0) // sequential
{
while (!mDevice->atEnd())
mDevice->readLine();
mTotalSize = mDevice->pos();
mDevice->seek(0);
}
else { // Random access
mTotalSize = mDevice->size();
}
}

long long AbstractSequenceReader::totalSize() const
{
return mTotalSize;
}

QIODevice *AbstractSequenceReader::device() const
{
return mDevice;
Expand Down
10 changes: 0 additions & 10 deletions sequence/abstractsequencereader.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@ class AbstractSequenceReader
* \return false if the file end has been reach.
*/
virtual bool next() = 0;
/*!
* \brief percentComplete return percent of bytes processed
* \return a a value between 0 and 100
*/
virtual int percentComplete() const;

/*!
* \brief Return the current sequence.
Expand All @@ -63,18 +58,13 @@ class AbstractSequenceReader
*/
const Sequence& sequence() const;


void computeTotalSize() ;
long long totalSize() const;

protected:
void setSequence(const Sequence& seq);
QIODevice * device() const;

private:
QIODevice * mDevice;
Sequence mSequence;
long long mTotalSize = 0;
};

#endif // ABSTRACTSEQUENCEREADER_H
4 changes: 2 additions & 2 deletions ui/mainanalyseview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ void MainAnalyseDelegate::paint(QPainter *painter, const QStyleOptionViewItem &o


progressBarOption.minimum = 0;
progressBarOption.maximum = 100;
progressBarOption.maximum = progress == -1 ? 0 : 100;
progressBarOption.textAlignment = Qt::AlignCenter;
progressBarOption.progress = progress;
progressBarOption.text = QString ( "%1%" ).arg ( progress );
progressBarOption.text = progress == -1 ? QString("") : QString ( "%1%" ).arg ( progress );
progressBarOption.textVisible = true;
QApplication::style()->drawControl ( QStyle::CE_ProgressBar, &progressBarOption, painter );

Expand Down
11 changes: 8 additions & 3 deletions utils/format_detection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,10 @@ bool is_fastq(QIODevice* file)

line = file->readLine();
// Some not alphabetic caractere are in range but you know isn't a problem
if (line[0] < 'A' || line[0] > 'z')
if (line[0] < 'A' || line[0] > 'z'){
file->close();
return false;
}

line = file->readLine();
if (line[0] != '+')
Expand All @@ -103,11 +105,14 @@ bool is_fastq(QIODevice* file)
}

line = file->readLine();
if (line[0] < '!' || line[0] > '~')
if (line[0] < '!' || line[0] > '~'){
file->close();
return false;

}
file->close();
return true;
}

else
{
return false;
Expand Down

0 comments on commit f1f11ad

Please sign in to comment.