Skip to content

Commit fecacea

Browse files
authored
Merge pull request labsquare#73 from bokic/master
Some improvements here and there ver2
2 parents db5d9b4 + 9864bde commit fecacea

35 files changed

+136
-89
lines changed

.coveralls.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
repo_token: Dj6d3Ke8T5Ikm96bvMvronbJV1AI1Cu9I

CHANGELOG

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,19 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/)
55
and this project adheres to [Semantic Versioning](http://semver.org/)
66

7+
<<<<<<< HEAD
8+
## [0.2.3] - 2017-14-03
9+
### Changed
10+
- Fix delay time before running. Now analysis doesn't wait to run
11+
- Remove debugging message
12+
- Fix bug when exporting PNG data.
13+
=======
714
## [0.2.3] - 2017-29-03
815
### Changed
916
- Exporting file displays a progress dialog
1017
- Add recent menu
1118

19+
>>>>>>> devel
1220

1321
## [0.2.2] - 2017-03-03
1422
### Changed
@@ -21,7 +29,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/)
2129
### Changed
2230
- Remove filter of file by extension
2331

24-
2532
## [0.2] - 2017-02-10
2633
### Changed
2734
- Main UI is now a list of analysis

FastQt.pro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#-------------------------------------------------
66
QT += core gui concurrent charts svg
77
#QMAKE_CXXFLAGS += -Ofast
8-
QMAKE_CXXFLAGS += -std=c++11
8+
CONFIG += c++11
99

1010
CONFIG(release, debug|release):DEFINES += QT_NO_DEBUG_OUTPUT
1111

QFontIcon/qfonticon.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ SOFTWARE.
2525
#include "qfonticon.h"
2626
#include <QDebug>
2727
#include <QFontDatabase>
28-
QFontIcon * QFontIcon::mInstance = Q_NULLPTR;
28+
QFontIcon * QFontIcon::mInstance = nullptr;
2929

3030
bool QFontIcon::addFont(const QString &filename)
3131
{

QFontIcon/qfonticon.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class QFontIcon : public QObject
6464
static bool addFont(const QString& filename);
6565
static QFontIcon * instance();
6666
// main methods. Return icons from code
67-
static QIcon icon(const QChar& code, const QColor& baseColor = QColor(),const QString& family = QString());
67+
static QIcon icon(const QChar& code, const QColor& baseColor = QColor(),const QString& family = QStringLiteral());
6868
// return added fonts
6969
const QStringList& families() const;
7070

README.md

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,36 @@
1-
#FastQt ![travis](https://api.travis-ci.org/labsquare/fastQt.svg?branch=master) ![Qt](https://img.shields.io/badge/Qt-qmake-green.svg) [![Gitter](https://badges.gitter.im/labsquare/fastQt.svg)](https://gitter.im/labsquare/fastQt?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
1+
# FastQt
2+
3+
![travis](https://api.travis-ci.org/labsquare/fastQt.svg?branch=master) [![Gitter](https://badges.gitter.im/labsquare/fastQt.svg)](https://gitter.im/labsquare/fastQt?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![Build status](https://ci.appveyor.com/api/projects/status/skmgugijflggfq4x?svg=true)](https://ci.appveyor.com/project/dridk/fastqt) [![Coverage Status](https://coveralls.io/repos/github/labsquare/fastQt/badge.svg?branch=master)](https://coveralls.io/github/labsquare/fastQt?branch=master)
4+
25
FastQt is the clone of [FastQC](http://www.bioinformatics.babraham.ac.uk/projects/fastqc/) application ported
36
from Java to [C++/Qt5](https://www.qt.io/)
47

8+
59
![Preview](https://raw.githubusercontent.com/labsquare/fastQt/master/screenshot.gif)
610

7-
##Installation
8-
### Ubuntu
9-
deb package has not yet ready. But An [AppImage](http://appimage.org/) has been made for Linux x86_64 and has been tested on ubuntu 16.04.
10-
You can download it from [here](https://github.com/labsquare/fastQt/releases/download/0.1/fastqt-0.1-linux-x86_64.AppImage) and run it as follow :
11+
## Installation
1112

12-
chmod +x fastqt-0.1-linux-x86_64.AppImage
13-
./fastqt-0.1-linux-x86_64.AppImage
13+
### Linux
14+
An [AppImage](http://appimage.org/) has been created and should work on recent Linux distribution.
15+
Download the last release from [here](https://github.com/labsquare/fastQt/releases/) and run it as follow :
16+
17+
chmod +x fastqt-0.2.3-linux-x86_64.AppImage
18+
./fastqt-0.2.3-linux-x86_64.AppImage
1419

1520
### Archlinux
1621
There is an AUR package for Archlinux. [Just get it from the AUR](https://aur.archlinux.org/packages/fastqt/).
17-
18-
19-
Other package will come soon for Windows and MacOS. You can try to compile it anyway.
20-
22+
23+
### Windows
24+
Windows installer and portable version are avaible [here]( https://github.com/labsquare/fastQt/releases/)
25+
2126
## Compilation
2227
### Prerequisites - Install KArchive
23-
You need to install karchive before compiling FastQt.
28+
On Linux, you need to install karchive before compiling FastQt.
2429
**From ubuntu** >xenial you can install it from repositories :
2530

2631
sudo apt install libkf5archive-dev
2732

28-
**From fedoar** >= 24 you can install it from repositories :
33+
**From fedora** >= 24 you can install it from repositories :
2934

3035
sudo dnf install kf5-karchive-devel
3136

@@ -43,14 +48,17 @@ You need to install karchive before compiling FastQt.
4348
cmake .. -DCMAKE_INSTALL_PREFIX=/usr/
4449
make
4550
sudo make install
51+
52+
** From Windows **
53+
Nothing to do. Compiled library are avaible in win32 directory.
4654

4755
### Install Qt >5.7
4856

4957
**From website** : Download Qt > 5.7 from https://www.qt.io/.
5058
Don't forget to check QtChart module during installation.
5159

5260
**From ubuntu** : Qt 5.7 is not yet avaible with ubuntu. But you can add PPA to your software system.
53-
For exemple for xenial
61+
For exemple from xenial
5462

5563
sudo add-apt-repository ppa:beineri/opt-qt57-xenial
5664
sudo apt-get install qt57base qt57charts-no-lgpl
@@ -61,7 +69,7 @@ For exemple for xenial
6169
sudo dnf install qt5-qtbase-devel qt5-qtcharts-devel
6270

6371
### Compile FastQt
64-
Be sure you have the correct version of Qt (>5.7) by using qmake. You will find qmake in bin folder where you installed Qt. For exemple, if you installed Qt from ppa:beineri, you will find it under /opt/qt57/bin/qmake. Then launch the compilation from FastQC folder as follow.
72+
Be sure you have the correct version of Qt (>5.7) by using qmake --version. For exemple, if you have installed Qt from ppa:beineri, you will find it under /opt/qt57/bin/qmake. Then launch the compilation from FastQC folder as follow.
6573

6674
/opt/qt57/bin/qmake --version
6775
/opt/qt57/bin/qmake
@@ -70,7 +78,14 @@ Be sure you have the correct version of Qt (>5.7) by using qmake. You will find
7078

7179
## Usage
7280

73-
You can use FastQt as GUI application or in Command Line Interface.
81+
FastQt can analyse uncompress and compress fastq files. The following extensions are supported :
82+
83+
- *.fastq
84+
- *.fastq.gz
85+
- *.fastq.xz
86+
- *.fastq.bz2
87+
88+
You can use FastQt as GUI application or as a Command Line Interface.
7489

7590
Some usage example :
7691

@@ -80,3 +95,6 @@ fastqt file1.fastq file2.fastq.gz file3.fastq.bzip # File save in file1 file 2 f
8095
fastqt file1.fastq -o specific_path # Create specific directory for each file in specific_path
8196
fastqt file1.fastq -t 2 # Fastqt run maximal two process this option is valid for GUI too
8297
```
98+
99+
## How to cite FastQt
100+
Labsquare Team, et al (2017). FastQt: a quality control tool for high throughput sequence data. Available online at: https://github.com/labsquare/fastQt

analysis/analysis.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Copyright Copyright 2016-17 Sacha Schutz
2424
Analysis::Analysis(QObject * parent)
2525
:QObject(parent)
2626
{
27-
mParentRunner = Q_NULLPTR;
27+
mParentRunner = nullptr;
2828
}
2929

3030
Analysis::~Analysis()
@@ -36,8 +36,8 @@ void Analysis::save(const QString &path)
3636
{
3737
QString name = metaObject()->className();
3838
QDir dir(path);
39-
QString svgPath = dir.filePath(QString("%1.svg").arg(name));
40-
QString pngPath = dir.filePath(QString("%1.png").arg(name));
39+
QString svgPath = dir.filePath(QStringLiteral("%1.svg").arg(name));
40+
QString pngPath = dir.filePath(QStringLiteral("%1.png").arg(name));
4141

4242
capture(svgPath);
4343
capture(pngPath, ImageFormat::PngFormat);

analysis/analysis.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class Analysis : public QObject
4848
Success , Warning, Error, Unknown
4949
};
5050

51-
Analysis(QObject * parent = Q_NULLPTR);
51+
Analysis(QObject * parent = nullptr);
5252

5353
virtual ~Analysis();
5454
/*!

analysis/analysisrunner.cpp

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -61,42 +61,54 @@ void AnalysisRunner::run()
6161

6262
QFileInfo fileInfo(mFilename);
6363

64-
QIODevice * file = Q_NULLPTR;
65-
QIODevice * rawFile = new QFile(mFilename);
64+
QIODevice * file = nullptr;
65+
QFile rawFile(mFilename);
6666

67-
if (is_gz(rawFile))
67+
if (is_gz(&rawFile))
6868
{
69-
file = new KCompressionDevice(rawFile,true,KCompressionDevice::GZip);
69+
file = new KCompressionDevice(&rawFile,true,KCompressionDevice::GZip);
7070
if (!is_fastq(file))
71-
file = Q_NULLPTR;
71+
{
72+
delete file;
73+
file = nullptr;
74+
}
7275
}
73-
else if (is_bz2(rawFile))
76+
else if (is_bz2(&rawFile))
7477
{
75-
file = new KCompressionDevice(rawFile, true, KCompressionDevice::BZip2);
78+
file = new KCompressionDevice(&rawFile, true, KCompressionDevice::BZip2);
7679
if (!is_fastq(file))
77-
file = Q_NULLPTR;
80+
{
81+
delete file;
82+
file = nullptr;
83+
}
7884
}
79-
else if (is_xz(rawFile))
85+
else if (is_xz(&rawFile))
8086
{
81-
file = new KCompressionDevice(rawFile,true, KCompressionDevice::Xz);
87+
file = new KCompressionDevice(&rawFile,true, KCompressionDevice::Xz);
8288
if (!is_fastq(file))
83-
file = Q_NULLPTR;
89+
{
90+
delete file;
91+
file = nullptr;
92+
}
8493
}
85-
else if (is_fastq(rawFile))
94+
else if (is_fastq(&rawFile))
8695
{
87-
file = rawFile;
96+
rawFile.close();
97+
file = new QFile(mFilename);
8898
}
8999

90-
if (file == Q_NULLPTR)
100+
if (file == nullptr)
91101
{
92102
qDebug()<<Q_FUNC_INFO<<fileInfo.suffix()<< " file is not supported";
93103
setStatus(Canceled);
104+
delete file;
94105
return;
95106
}
96107

97108
if (fileInfo.size() == 0)
98109
{
99110
setStatus(Canceled);
111+
delete file;
100112
return;
101113
}
102114

@@ -123,6 +135,7 @@ void AnalysisRunner::run()
123135
{
124136
qCritical()<<Q_FUNC_INFO<<"Cannot read sequence. Are you sure it's a Fastq file ?";
125137
setStatus(Canceled);
138+
delete file;
126139
return ;
127140
}
128141
}
@@ -132,12 +145,12 @@ void AnalysisRunner::run()
132145
// this is critcal and can decrease the speed. Send message only 1 sequence / 1000
133146
if (mSequenceCount % 1000 == 0)
134147
{
135-
int percentNow = (float)(rawFile->pos()) / fileInfo.size() * 100;
148+
int percentNow = qRound(static_cast<qreal>(file->pos()) / fileInfo.size() * 100);
136149
// if percentNow is still null, return empty percent ...
137150
if ( (percentNow >= mProgression + 5) || (percentNow == 0))
138151
{
139152
mProgression = percentNow;
140-
//emitUpdate(QString(tr("%1 Sequences procceed ( %2 \% )")).arg(mSequenceCount).arg(mProgression));
153+
//emitUpdate(tr("%1 Sequences procceed ( %2 \% )").arg(mSequenceCount).arg(mProgression));
141154
}
142155
}
143156

@@ -218,7 +231,7 @@ void AnalysisRunner::cancel()
218231
mStatus = Canceled;
219232
}
220233

221-
quint64 AnalysisRunner::fileSize() const
234+
qint64 AnalysisRunner::fileSize() const
222235
{
223236
return mFileSize;
224237
}
@@ -227,11 +240,11 @@ QString AnalysisRunner::humanFileSize() const
227240
{
228241
int unit;
229242
const char *units [] = {" Bytes", " kB", " MB", " GB"};
230-
quint64 size = fileSize(); // or whatever
243+
qint64 size = fileSize(); // or whatever
231244

232245
for (unit=-1; (++unit<3) && (size>1023); size/=1024);
233246

234-
return QString::number(size, 'f', 1) + QString(units[unit]);
247+
return QString::number(size, 'f', 1) + QString::fromLatin1(units[unit]);
235248

236249
}
237250

@@ -262,7 +275,7 @@ Analysis *AnalysisRunner::analysis(const QString &className)
262275
{
263276
if (mAnalysisHash.contains(className))
264277
return mAnalysisHash[className];
265-
return Q_NULLPTR;
278+
return nullptr;
266279
}
267280

268281

analysis/analysisrunner.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class AnalysisRunner : public QRunnable
9090

9191
void cancel();
9292

93-
quint64 fileSize() const;
93+
qint64 fileSize() const;
9494

9595
QString humanFileSize() const;
9696

@@ -123,7 +123,7 @@ class AnalysisRunner : public QRunnable
123123
QString mMessage;
124124
int mProgression = 0;
125125
int mSequenceCount = 0;
126-
int mFileSize = 0;
126+
qint64 mFileSize = 0;
127127
int mDuration = 0;
128128
Status mStatus = Waiting;
129129
bool mCancel = false;

analysis/basicstatsanalysis.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ QWidget *BasicStatsAnalysis::createResultWidget()
7777
KeyValueModel * model = new KeyValueModel(view);
7878
view->setModel(model);
7979

80-
QString length = mMinLength == mMaxLength ? QString("%1").arg(mMaxLength) : QString("%1-%2").arg(mMinLength).arg(mMaxLength);
80+
QString length = mMinLength == mMaxLength ? QString::number(mMaxLength) : QStringLiteral("%1-%2").arg(mMinLength).arg(mMaxLength);
8181

8282

8383
model->addValue(tr("Total Sequences"), QLocale::system().toString(mReadCount));
@@ -113,7 +113,7 @@ void BasicStatsAnalysis::save(const QString &path)
113113
QJsonObject json;
114114

115115
QDir dir(path);
116-
QString filename = dir.filePath(QString("%1.json").arg(metaObject()->className()));
116+
QString filename = dir.filePath(QStringLiteral("%1.json").arg(metaObject()->className()));
117117

118118
QFile file(filename);
119119
if (file.open(QIODevice::WriteOnly))

analysis/basicstatsanalysis.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class BasicStatsAnalysis : public Analysis
4242
Q_PROPERTY(int readCount READ readCount)
4343

4444
public:
45-
BasicStatsAnalysis(QObject * parent = Q_NULLPTR);
45+
BasicStatsAnalysis(QObject * parent = nullptr);
4646
void processSequence(const Sequence& sequence) Q_DECL_OVERRIDE;
4747
void reset() Q_DECL_OVERRIDE;
4848
QWidget * createResultWidget() Q_DECL_OVERRIDE;

analysis/lengthdistributionanalysis.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ QWidget *LengthDistributionAnalysis::createResultWidget()
2929
QChartView * view = new QChartView;
3030
view->setRenderHint(QPainter::Antialiasing);
3131

32-
QLineSeries * serie = new QLineSeries;
33-
3432
if (mGraphCounts.isEmpty())
3533
return view;
3634

35+
QLineSeries * serie = new QLineSeries;
36+
3737
int yMax = 0;
3838
auto graph_count_it = mGraphCounts.begin();
3939
for (int i=mMin; i < mMax+mIntervale; i += mIntervale)

analysis/lengthdistributionanalysis.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class LengthDistributionAnalysis : public Analysis
1515
{
1616
Q_OBJECT
1717
public:
18-
LengthDistributionAnalysis(QObject * parent = Q_NULLPTR);
18+
LengthDistributionAnalysis(QObject * parent = nullptr);
1919
void processSequence(const Sequence& sequence) Q_DECL_OVERRIDE;
2020
void reset() Q_DECL_OVERRIDE;
2121
QWidget * createResultWidget() Q_DECL_OVERRIDE;

analysis/overrepresentedseqsanalysis.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ QWidget *OverRepresentedSeqsAnalysis::createResultWidget()
8989
void OverRepresentedSeqsAnalysis::save(const QString &path)
9090
{
9191
QDir dir(path);
92-
QString tsvPath = dir.filePath(QString("%1.tsv").arg(metaObject()->className()));
93-
QString fastaPath = dir.filePath(QString("%1.fasta").arg(metaObject()->className()));
92+
QString tsvPath = dir.filePath(QStringLiteral("%1.tsv").arg(metaObject()->className()));
93+
QString fastaPath = dir.filePath(QStringLiteral("%1.fasta").arg(metaObject()->className()));
9494

9595
QFile tsvFile(tsvPath);
9696
QFile fastaFile(fastaPath);
@@ -106,7 +106,7 @@ void OverRepresentedSeqsAnalysis::save(const QString &path)
106106
{
107107
double percentage = ((double)mSequences[s] / mCount) * 100;
108108
tsvStream<<s<<"\t"<<mSequences[s]<<"\t"<<percentage<<"\n";
109-
fastaStream<<QString(">Seq_%1;count=%2;percentage=%3").arg(index).arg(mSequences[s]).arg(percentage)<<"\n";
109+
fastaStream<<QStringLiteral(">Seq_%1;count=%2;percentage=%3").arg(index).arg(mSequences[s]).arg(percentage)<<"\n";
110110
fastaStream<<s<<endl;
111111

112112
++index;

0 commit comments

Comments
 (0)