├── .appveyor.yml ├── .coveralls.yml ├── .gitignore ├── .gitmodules ├── .travis.yml ├── AUTHORS ├── CHANGELOG ├── CREDITS ├── FastQt.pro ├── LICENSE ├── QFontIcon ├── QFontIcon.pri ├── qfonticon.cpp └── qfonticon.h ├── README.md ├── _config.yml ├── analysis ├── analysis.cpp ├── analysis.h ├── analysis.pri ├── analysisrunner.cpp ├── analysisrunner.h ├── basicstatsanalysis.cpp ├── basicstatsanalysis.h ├── lengthdistributionanalysis.cpp ├── lengthdistributionanalysis.h ├── overrepresentedseqsanalysis.cpp ├── overrepresentedseqsanalysis.h ├── perbasecontentanalysis.cpp ├── perbasecontentanalysis.h ├── perbasencontentanalysis.cpp ├── perbasencontentanalysis.h ├── perbasequalityanalysis.cpp ├── perbasequalityanalysis.h ├── persequencegccontent.cpp ├── persequencegccontent.h ├── persequencequalityanalysis.cpp └── persequencequalityanalysis.h ├── cli ├── cli.pri ├── cliparser.cpp ├── cliparser.h ├── maincli.cpp └── maincli.h ├── docs ├── _config.yml └── test.txt ├── fastqt.desktop ├── fastqt.ico ├── fastqt.png ├── fontawesome.ttf ├── innosetup.iss ├── labsquare.png ├── main.cpp ├── model ├── keyvaluemodel.cpp ├── keyvaluemodel.h ├── mainanalysemodel.cpp ├── mainanalysemodel.h └── model.pri ├── myapp.rc ├── resources.qrc ├── screenshot.gif ├── sequence ├── abstractsequencereader.cpp ├── abstractsequencereader.h ├── bamreader.cpp ├── bamreader.h ├── fastqreader.cpp ├── fastqreader.h ├── phredencoding.cpp ├── phredencoding.h ├── sequence.cpp ├── sequence.h └── sequence.pri ├── ui ├── aboutdialog.cpp ├── aboutdialog.h ├── mainanalyseview.cpp ├── mainanalyseview.h ├── mainanalysewidget.cpp ├── mainanalysewidget.h ├── mainwindow.cpp ├── mainwindow.h └── ui.pri ├── utils ├── basegroup.cpp ├── basegroup.h ├── format_detection.cpp ├── format_detection.h ├── imageformatdefinition.h ├── progressbar.cpp ├── progressbar.h ├── quagzipfile.cpp ├── quagzipfile.h ├── statistic.h └── utils.pri └── win32 ├── KArchive ├── bin │ └── libKF5Archive.dll ├── include │ └── KF5 │ │ ├── KArchive │ │ ├── K7Zip │ │ ├── KAr │ │ ├── KArchive │ │ ├── KArchiveDirectory │ │ ├── KArchiveEntry │ │ ├── KArchiveFile │ │ ├── KCompressionDevice │ │ ├── KFilterBase │ │ ├── KFilterDev │ │ ├── KTar │ │ ├── KZip │ │ ├── KZipFileEntry │ │ ├── k7zip.h │ │ ├── kar.h │ │ ├── karchive.h │ │ ├── karchive_export.h │ │ ├── karchivedirectory.h │ │ ├── karchiveentry.h │ │ ├── karchivefile.h │ │ ├── kcompressiondevice.h │ │ ├── kfilterbase.h │ │ ├── kfilterdev.h │ │ ├── ktar.h │ │ ├── kzip.h │ │ └── kzipfileentry.h │ │ └── karchive_version.h ├── lib │ ├── cmake │ │ └── KF5Archive │ │ │ ├── KF5ArchiveConfig.cmake │ │ │ ├── KF5ArchiveConfigVersion.cmake │ │ │ ├── KF5ArchiveTargets-release.cmake │ │ │ └── KF5ArchiveTargets.cmake │ └── libKF5Archive.dll.a └── mkspecs │ └── modules │ └── qt_KArchive.pri ├── innosetup.iss ├── libbz2-1.dll ├── libhts-0.dll ├── libhts.a ├── libhts.dll.a ├── liblzma-5.dll └── zlib1.dll /.appveyor.yml: -------------------------------------------------------------------------------- 1 | branches: 2 | only: 3 | - master 4 | - devel 5 | 6 | install: 7 | - set QTDIR=C:\Qt\5.8\mingw53_32 8 | - choco install -y InnoSetup 9 | - set PATH=%QTDIR%\bin;C:\Qt\Tools\mingw530_32\bin;%PATH%;"C:\Program Files (x86)\Inno Setup 5" 10 | build_script: 11 | - qmake FastQt.pro 12 | - mingw32-make 13 | after_build: 14 | - windeployqt release/fastqt.exe 15 | - cmd: cp win32/KArchive/lib/libKF5Archive.dll.a release 16 | - cmd: cp win32/KArchive/bin/libKF5Archive.dll release 17 | - cmd: cp win32/zlib1.dll release 18 | - cmd: cp win32/liblzma-5.dll release 19 | - cmd: cp win32/libbz2-1.dll release 20 | - cmd: cp LICENSE release/LICENSE.txt 21 | - iscc innosetup.iss 22 | - rm release/*.o 23 | - rm release/*.cpp 24 | 25 | artifacts: 26 | - path: Output\fastqt-*.exe 27 | - path: release 28 | type: zip 29 | -------------------------------------------------------------------------------- /.coveralls.yml: -------------------------------------------------------------------------------- 1 | repo_token: Dj6d3Ke8T5Ikm96bvMvronbJV1AI1Cu9I 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.pro.user 2 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "htslib"] 2 | path = htslib 3 | url = https://github.com/samtools/htslib.git 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: cpp 2 | dist: bionic 3 | compiler: g++ 4 | sudo: required 5 | 6 | before_install: 7 | - sudo add-apt-repository ppa:beineri/opt-qt-5.12.0-bionic -y 8 | - sudo apt-get update 9 | - git submodule update --init --recursive 10 | 11 | install: 12 | - sudo apt-get install qt512base qt512svg qt512charts-no-lgpl 13 | - sudo apt-get install libgl-dev 14 | - source /opt/qt512/bin/qt512-env.sh 15 | 16 | 17 | script: 18 | - git clone https://github.com/KDE/extra-cmake-modules.git 19 | - cd extra-cmake-modules 20 | - mkdir build && cd build 21 | - cmake .. -DCMAKE_INSTALL_PREFIX=/usr/ 22 | - make && sudo make install 23 | - cd ../.. 24 | - git clone https://anongit.kde.org/frameworks/karchive.git 25 | - cd karchive 26 | - mkdir build && cd build 27 | - cmake .. -DCMAKE_INSTALL_PREFIX=/usr/ 28 | - make 29 | - sudo make install 30 | - cd ../.. 31 | - /opt/qt512/bin/qmake PREFIX=/usr 32 | - make 33 | - # Generate AppImage 34 | - sudo apt-get -y install checkinstall 35 | - sudo checkinstall --pkgname=app --pkgversion="1" --pkgrelease="1" --backup=no --fstrans=no --default --deldoc 36 | - mkdir -p appdir/usr/bin ; cd appdir 37 | - dpkg -x ../app_1-1_amd64.deb . ; find . 38 | - mv ./usr/local/bin/* ./usr/bin/ # Why is this needed despite PREFIX=/usr? Bug? 39 | - cp ./usr/share/icons/hicolor/48x48/apps/fastqt.png . 40 | - cp ./usr/share/applications/fastqt.desktop . 41 | - cd .. 42 | - wget -c "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage" 43 | - chmod a+x linuxdeployqt*.AppImage 44 | - unset QTDIR; unset QT_PLUGIN_PATH ; unset LD_LIBRARY_PATH 45 | - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/htslib/ 46 | - ./linuxdeployqt*.AppImage ./appdir/usr/bin/* -bundle-non-qt-libs 47 | - ./linuxdeployqt*.AppImage ./appdir/usr/bin/* -appimage 48 | - curl --upload-file ./FastQt*.AppImage https://transfer.sh/FastQt-git.$(git rev-parse --short HEAD)-x86_64.AppImage 49 | 50 | # For gitter 51 | notifications: 52 | webhooks: 53 | urls: 54 | - https://webhooks.gitter.im/e/de567d4879b8b044dfe7 55 | on_success: change # options: [always|never|change] default: always 56 | on_failure: always # options: [always|never|change] default: always 57 | on_start: never # options: [always|never|change] default: always 58 | 59 | # Temporarily disabled so that AppImage generation can be tested 60 | # branches: 61 | # only: 62 | # - master 63 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | FastQt is a free software created by labsquare team. Labsquare is a community of developers which aims to develop bioinformatics user interface for clinical usage. 2 | Here is the list of authors and contributor of FastQt. 3 | 4 | ## Developers 5 | @dridk Sacha Schutz 6 | @natir Pierre Marijon 7 | @arkanosis Jérémie Roquet 8 | 9 | ## Packagers 10 | @StuntsPT Francisco Pina-Martins 11 | @probonopd 12 | 13 | ## Translators 14 | @JuneBS June Sallou 15 | 16 | ## Designers 17 | @beardedpayton Payton Burdette 18 | 19 | 20 | FastQt is a clone of FastQC. I would like to mention and thanks authors of FastQC for their outstanding work. 21 | 22 | I also thanks the genetics laboratory at Brest hospital for giving me time to develop bioinformatics tools. 23 | https://www.chu-brest.fr/fr/notre-offre-soins/nos-specialites/biologie/genetique-moleculaire-histocompatibilite 24 | -------------------------------------------------------------------------------- /CHANGELOG: -------------------------------------------------------------------------------- 1 | # Change Log 2 | All notable changes to this project will be documented in this file. 3 | 4 | The format is based on [Keep a Changelog](http://keepachangelog.com/) 5 | and this project adheres to [Semantic Versioning](http://semver.org/) 6 | 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 | ======= 14 | ## [0.2.3] - 2017-29-03 15 | ### Changed 16 | - Exporting file displays a progress dialog 17 | - Add recent menu 18 | 19 | >>>>>>> devel 20 | 21 | ## [0.2.2] - 2017-03-03 22 | ### Changed 23 | - Fix Crash when reading .xz file 24 | - Add new Icons 25 | - Add new toolbar on Analysis Viewer widget 26 | - Windows binary are build automatically with AppVeyor 27 | 28 | ## [0.2.1] - 2017-02-03 29 | ### Changed 30 | - Remove filter of file by extension 31 | 32 | ## [0.2] - 2017-02-10 33 | ### Changed 34 | - Main UI is now a list of analysis 35 | - You can now drop file into the view 36 | - Fastqt can be now used as a CLI 37 | - Thread number can be set from the CLI. By default QThread::idealThreadCount() 38 | - Export results 39 | 40 | ## Analysis 41 | 42 | 43 | ## [0.1] - 2017-01-19 44 | ### Added 45 | - Clone FastQC 46 | 47 | ## Analysis 48 | - Basic Stat Analysis 49 | - Length distribution analysis 50 | - Overrepresented sequence analysis 51 | - Per base content analysis 52 | - Per base N content analysis 53 | - Per base quality analysis 54 | - Per sequence GC content analysis 55 | - Per Sequence quality analysis 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /CREDITS: -------------------------------------------------------------------------------- 1 | - KArchive from KDE community : 2 | https://api.kde.org/frameworks-api/frameworks-apidocs/frameworks/karchive/html/index.html 3 | - Awesome font : 4 | http://fontawesome.io/ 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /FastQt.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2016-10-27T15:00:28 4 | # 5 | #------------------------------------------------- 6 | QT += core gui concurrent charts svg 7 | #QMAKE_CXXFLAGS += -Ofast 8 | CONFIG += c++11 9 | 10 | CONFIG(release, debug|release):DEFINES += QT_NO_DEBUG_OUTPUT 11 | 12 | 13 | # METHOD 1 : If KArchive is not installed as a Qt Module then copy to your Qt installation : 14 | #exemple 15 | #cp /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/qt_KArchive.pri ~/path/to/Qt/5.7/gcc_64/mkspecs/modules 16 | 17 | #QT += KArchive 18 | 19 | # METHOD 2 : Otherwise link it as a common library 20 | unix { 21 | # COMPILE HTSLIB 22 | mytarget.target = $$PWD/htslib/libhts.so 23 | mytarget.commands = cd $$PWD/htslib; make -j 4 24 | mytarget_clean.commands = cd $$PWD/htslib; make clean 25 | QMAKE_EXTRA_TARGETS += mytarget 26 | PRE_TARGETDEPS += $$PWD/htslib/libhts.so 27 | INCLUDEPATH+=$$PWD/htslib 28 | LIBS += -L$$PWD/htslib -lhts 29 | 30 | 31 | 32 | 33 | INCLUDEPATH += "/usr/include/KF5/KArchive" 34 | LIBS += -L"/usr/lib" -lKF5Archive 35 | } 36 | 37 | win32{ 38 | 39 | #htslib 40 | LIBS += -L$$PWD/win32 -lhts 41 | INCLUDEPATH += $$PWD/htslib 42 | DEPENDPATH += $$PWD/htslib 43 | 44 | LIBS += -L$$PWD/win32/KArchive/lib -llibKF5Archive.dll 45 | INCLUDEPATH += $$PWD/win32/KArchive/include/KF5/KArchive 46 | RC_FILE = myapp.rc 47 | message("compile for windows") 48 | message($$PWD) 49 | message($$LIBS) 50 | 51 | 52 | } 53 | 54 | 55 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 56 | 57 | 58 | TARGET = fastqt 59 | TEMPLATE = app 60 | 61 | # Installation 62 | target.path = /usr/local/bin 63 | desktop.path = /usr/share/applications 64 | desktop.files += fastqt.desktop 65 | icons.path = /usr/share/icons/hicolor/48x48/apps 66 | icons.files += fastqt.png 67 | 68 | INSTALLS += target desktop icons 69 | 70 | SOURCES += main.cpp 71 | include("sequence/sequence.pri") 72 | include("analysis/analysis.pri") 73 | include("ui/ui.pri") 74 | include("model/model.pri") 75 | include("utils/utils.pri") 76 | include("QFontIcon/QFontIcon.pri") 77 | include("cli/cli.pri") 78 | 79 | RESOURCES += \ 80 | resources.qrc 81 | 82 | 83 | TRANSLATIONS = localization/fastqc_fr.ts 84 | 85 | 86 | -------------------------------------------------------------------------------- /QFontIcon/QFontIcon.pri: -------------------------------------------------------------------------------- 1 | HEADERS += \ 2 | $$PWD/qfonticon.h 3 | 4 | SOURCES += \ 5 | $$PWD/qfonticon.cpp 6 | 7 | 8 | INCLUDEPATH += $$PWD 9 | -------------------------------------------------------------------------------- /QFontIcon/qfonticon.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (c) 2017 Sacha Schutz 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #include "qfonticon.h" 26 | #include 27 | #include 28 | QFontIcon * QFontIcon::mInstance = nullptr; 29 | 30 | bool QFontIcon::addFont(const QString &filename) 31 | { 32 | qDebug()<<"add font"; 33 | int id = QFontDatabase::addApplicationFont(filename); 34 | 35 | if (id == -1){ 36 | qDebug()<<"Cannot load font"; 37 | return false; 38 | } 39 | 40 | QString family = QFontDatabase::applicationFontFamilies(id).first(); 41 | instance()->addFamily(family); 42 | return true; 43 | } 44 | 45 | QFontIcon *QFontIcon::instance() 46 | { 47 | if (!mInstance) 48 | mInstance = new QFontIcon; 49 | 50 | return mInstance; 51 | } 52 | 53 | QIcon QFontIcon::icon(const QChar &code, const QColor &baseColor, const QString &family) 54 | { 55 | if (instance()->families().isEmpty()) 56 | { 57 | qWarning()<families().first(); 64 | 65 | 66 | QFontIconEngine * engine = new QFontIconEngine; 67 | engine->setFontFamily(useFamily); 68 | engine->setLetter(code); 69 | engine->setBaseColor(baseColor); 70 | return QIcon(engine); 71 | 72 | 73 | } 74 | 75 | 76 | const QStringList &QFontIcon::families() const 77 | { 78 | return mfamilies; 79 | } 80 | 81 | void QFontIcon::addFamily(const QString &family) 82 | { 83 | mfamilies.append(family); 84 | } 85 | 86 | QFontIcon::QFontIcon(QObject *parent) 87 | :QObject(parent) 88 | { 89 | 90 | } 91 | 92 | QFontIcon::~QFontIcon() 93 | { 94 | 95 | } 96 | 97 | //======================================================================================================= 98 | 99 | 100 | QFontIconEngine::QFontIconEngine() 101 | :QIconEngine() 102 | { 103 | 104 | } 105 | 106 | QFontIconEngine::~QFontIconEngine() 107 | { 108 | } 109 | 110 | void QFontIconEngine::paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state) 111 | { 112 | Q_UNUSED(state); 113 | QFont font = QFont(mFontFamily); 114 | int drawSize = qRound(rect.height() * 0.8); 115 | font.setPixelSize(drawSize); 116 | 117 | QColor penColor; 118 | if (!mBaseColor.isValid()) 119 | penColor = QApplication::palette("QWidget").color(QPalette::Normal,QPalette::ButtonText); 120 | else 121 | penColor = mBaseColor; 122 | 123 | if (mode == QIcon::Disabled) 124 | penColor = QApplication::palette("QWidget").color(QPalette::Disabled,QPalette::ButtonText); 125 | 126 | 127 | if (mode == QIcon::Selected) 128 | penColor = QApplication::palette("QWidget").color(QPalette::Active,QPalette::ButtonText); 129 | 130 | 131 | painter->save(); 132 | painter->setPen(QPen(penColor)); 133 | painter->setFont(font); 134 | painter->drawText(rect, Qt::AlignCenter|Qt::AlignVCenter, mLetter); 135 | 136 | painter->restore(); 137 | } 138 | 139 | QPixmap QFontIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) 140 | { 141 | QPixmap pix(size); 142 | pix.fill(Qt::transparent); 143 | 144 | QPainter painter(&pix); 145 | paint(&painter, QRect(QPoint(0,0),size), mode, state); 146 | return pix; 147 | 148 | } 149 | 150 | void QFontIconEngine::setFontFamily(const QString &family) 151 | { 152 | mFontFamily = family; 153 | } 154 | 155 | void QFontIconEngine::setLetter(const QChar &letter) 156 | { 157 | mLetter = letter; 158 | } 159 | 160 | void QFontIconEngine::setBaseColor(const QColor &baseColor) 161 | { 162 | mBaseColor = baseColor; 163 | } 164 | 165 | 166 | QIconEngine *QFontIconEngine::clone() const 167 | { 168 | QFontIconEngine * engine = new QFontIconEngine; 169 | engine->setFontFamily(mFontFamily); 170 | engine->setBaseColor(mBaseColor); 171 | return engine; 172 | } 173 | 174 | -------------------------------------------------------------------------------- /QFontIcon/qfonticon.h: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (c) 2017 Sacha Schutz 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #ifndef QFONTICON_H 26 | #define QFONTICON_H 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | class QFontIcon; 36 | class QFontIconEngine; 37 | 38 | class QFontIconEngine : public QIconEngine 39 | { 40 | public: 41 | QFontIconEngine(); 42 | ~QFontIconEngine(); 43 | virtual void paint(QPainter * painter, const QRect& rect, QIcon::Mode mode, QIcon::State state)Q_DECL_OVERRIDE ; 44 | virtual QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state)Q_DECL_OVERRIDE; 45 | void setFontFamily(const QString& family); 46 | // define icon code using QChar or implicit using ushort ... 47 | void setLetter(const QChar& letter); 48 | // You can set a base color. I don't advice. Keep system color 49 | void setBaseColor(const QColor& baseColor); 50 | virtual QIconEngine* clone() const; 51 | 52 | private: 53 | QString mFontFamily; 54 | QChar mLetter; 55 | QColor mBaseColor; 56 | }; 57 | 58 | class QFontIcon : public QObject 59 | { 60 | Q_OBJECT 61 | 62 | public: 63 | // add Font. By default, the first one is used 64 | static bool addFont(const QString& filename); 65 | static QFontIcon * instance(); 66 | // main methods. Return icons from code 67 | static QIcon icon(const QChar& code, const QColor& baseColor = QColor(),const QString& family = QStringLiteral()); 68 | // return added fonts 69 | const QStringList& families() const; 70 | 71 | protected: 72 | void addFamily(const QString& family); 73 | 74 | 75 | private: 76 | explicit QFontIcon(QObject *parent = 0); 77 | ~QFontIcon(); 78 | static QFontIcon * mInstance; 79 | QStringList mfamilies; 80 | 81 | 82 | }; 83 | 84 | #endif // QFONTICON_H 85 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 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 | 5 | FastQt is the clone of [FastQC](http://www.bioinformatics.babraham.ac.uk/projects/fastqc/) application ported 6 | from Java to [C++/Qt5](https://www.qt.io/) 7 | 8 | 9 | ![Preview](https://raw.githubusercontent.com/labsquare/fastQt/master/screenshot.gif) 10 | 11 | ## Installation 12 | 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 19 | 20 | ### Archlinux 21 | There is an AUR package for Archlinux. [Just get it from the AUR](https://aur.archlinux.org/packages/fastqt/). 22 | 23 | ### Windows 24 | Windows installer and portable version are avaible [here]( https://github.com/labsquare/fastQt/releases/) 25 | 26 | ## Compilation 27 | ### Prerequisites - Install KArchive 28 | On Linux, you need to install karchive before compiling FastQt. 29 | **From ubuntu** >xenial you can install it from repositories : 30 | 31 | sudo apt install libkf5archive-dev 32 | 33 | **From fedora** >= 24 you can install it from repositories : 34 | 35 | sudo dnf install kf5-karchive-devel 36 | 37 | **From source** : 38 | 39 | git clone git://anongit.kde.org/extra-cmake-modules 40 | cd extra-cmake-modules 41 | mkdir build && cd build 42 | cmake .. -DCMAKE_INSTALL_PREFIX=/usr/ 43 | make && sudo make install 44 | cd ../.. 45 | git clone git://anongit.kde.org/karchive.git 46 | cd karchive 47 | mkdir build && cd build 48 | cmake .. -DCMAKE_INSTALL_PREFIX=/usr/ 49 | make 50 | sudo make install 51 | 52 | ** From Windows ** 53 | Nothing to do. Compiled library are avaible in win32 directory. 54 | 55 | ### Install Qt >5.7 56 | 57 | **From website** : Download Qt > 5.7 from https://www.qt.io/. 58 | Don't forget to check QtChart module during installation. 59 | 60 | **From ubuntu** : Qt 5.7 is not yet avaible with ubuntu. But you can add PPA to your software system. 61 | For exemple from xenial 62 | 63 | sudo add-apt-repository ppa:beineri/opt-qt57-xenial 64 | sudo apt-get install qt57base qt57charts-no-lgpl 65 | source /opt/qt57/bin/qt57-env.sh 66 | 67 | **From fedora** : Qt 5.7 is avaible 68 | 69 | sudo dnf install qt5-qtbase-devel qt5-qtcharts-devel 70 | 71 | ### Compile FastQt 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. 73 | 74 | /opt/qt57/bin/qmake --version 75 | /opt/qt57/bin/qmake 76 | make 77 | sudo make install 78 | 79 | ## Usage 80 | 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. 89 | 90 | Some usage example : 91 | 92 | ``` 93 | fastqt file1.fastq # File is save in file1 directory 94 | fastqt file1.fastq file2.fastq.gz file3.fastq.bzip # File save in file1 file 2 file3 directory 95 | fastqt file1.fastq -o specific_path # Create specific directory for each file in specific_path 96 | fastqt file1.fastq -t 2 # Fastqt run maximal two process this option is valid for GUI too 97 | ``` 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 101 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman -------------------------------------------------------------------------------- /analysis/analysis.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Copyright 2016-17 Sacha Schutz 3 | 4 | This file is part of fastQT. 5 | 6 | Foobar is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | Foobar is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with Foobar. If not, see . 18 | 19 | @author : Pierre Lindenbaum from FastQC 20 | @author : Sacha Schutz 21 | @author : Pierre Marijon 22 | */ 23 | #include "analysis.h" 24 | Analysis::Analysis(QObject * parent) 25 | :QObject(parent) 26 | { 27 | mParentRunner = nullptr; 28 | } 29 | 30 | Analysis::~Analysis() 31 | { 32 | 33 | } 34 | 35 | void Analysis::save(const QString &path) 36 | { 37 | QString name = metaObject()->className(); 38 | QDir dir(path); 39 | QString svgPath = dir.filePath(QStringLiteral("%1.svg").arg(name)); 40 | QString pngPath = dir.filePath(QStringLiteral("%1.png").arg(name)); 41 | 42 | capture(svgPath); 43 | capture(pngPath, ImageFormat::PngFormat); 44 | } 45 | 46 | 47 | void Analysis::capture(const QString &filename, ImageFormat format) 48 | { 49 | if (format == SvgFormat) 50 | { 51 | QSvgGenerator generator; 52 | generator.setFileName(filename); 53 | generator.setTitle(name()); 54 | generator.setDescription(description()); 55 | createResultWidget()->render(&generator); 56 | 57 | } 58 | 59 | else { 60 | if (!createResultWidget()->grab().save(filename)) 61 | qWarning()<palette("QWidget").highlight().color()); 94 | 95 | } 96 | -------------------------------------------------------------------------------- /analysis/analysis.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Copyright 2016-17 Sacha Schutz 3 | 4 | This file is part of fastQT. 5 | 6 | Foobar is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | Foobar is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with Foobar. If not, see . 18 | 19 | @author : Pierre Lindenbaum from FastQC 20 | @author : Sacha Schutz 21 | @author : Pierre Marijon 22 | */ 23 | #ifndef MODULE_H 24 | #define MODULE_H 25 | #include 26 | #include 27 | #include 28 | #include "qfonticon.h" 29 | #include "sequence.h" 30 | #include "analysisrunner.h" 31 | #include "imageformatdefinition.h" 32 | 33 | /*! 34 | * \class Analysis 35 | * \brief Analysis is the base class for all analysis 36 | * Create a new class inherites from Analysis and define the following methods : 37 | * - processSequence(const Sequence& sequence) 38 | * - reset() 39 | * - createResultWidget() 40 | */ 41 | class Analysis; 42 | class AnalysisRunner; 43 | class Analysis : public QObject 44 | { 45 | Q_OBJECT 46 | public: 47 | enum Status { 48 | Success , Warning, Error, Unknown 49 | }; 50 | 51 | Analysis(QObject * parent = nullptr); 52 | 53 | virtual ~Analysis(); 54 | /*! 55 | * \brief process each sequence 56 | * Each sequence readed from fastq file are process here one by one 57 | * \arg Sequence : a Sequence object 58 | */ 59 | virtual void processSequence(const Sequence& sequence) = 0; 60 | /*! 61 | * \brief reset analysis 62 | * This methods is called when an analysis need to be recomputed from start 63 | */ 64 | virtual void reset() = 0; 65 | /*! 66 | * \brief create result widget 67 | * Return result as a Widget based class, like a QChart 68 | * \return QWidget 69 | */ 70 | virtual QWidget* createResultWidget() = 0; 71 | 72 | /*! 73 | * \brief save result(s) data 74 | * \arg path : Contains the directory path where results are saved 75 | * By default, save a capture as svg of the result widget 76 | */ 77 | virtual void save(const QString& path); 78 | /*! 79 | * \brief this methods is launch before process 80 | * By default do nothing 81 | */ 82 | virtual void before(){} 83 | 84 | /*! 85 | * \brief this methods is launch after process 86 | * By default do nothing 87 | */ 88 | virtual void after(){} 89 | 90 | /*! 91 | * \brief save resultsWidget as image or svg 92 | * \return QPixmap 93 | */ 94 | void capture(const QString& filename, ImageFormat format = SvgFormat) ; 95 | 96 | const QString& name() const {return mName;} 97 | const QString& description() const {return mDescription;} 98 | 99 | void setName(const QString& name){mName = name;} 100 | void setDescription(const QString& description){mDescription = description;} 101 | 102 | AnalysisRunner * runner() const; 103 | void setRunner(AnalysisRunner * runner); 104 | 105 | 106 | // Not yet used 107 | virtual Status status() const; 108 | 109 | QIcon statusIcon() const; 110 | 111 | private: 112 | QString mName; 113 | QString mDescription; 114 | AnalysisRunner * mParentRunner; 115 | }; 116 | 117 | #endif // MODULE_H 118 | -------------------------------------------------------------------------------- /analysis/analysis.pri: -------------------------------------------------------------------------------- 1 | INCLUDEPATH+=$$PWD 2 | 3 | HEADERS += \ 4 | $$PWD/analysis.h \ 5 | $$PWD/analysisrunner.h \ 6 | $$PWD/basicstatsanalysis.h \ 7 | $$PWD/perbasequalityanalysis.h \ 8 | $$PWD/persequencequalityanalysis.h \ 9 | $$PWD/perbasecontentanalysis.h \ 10 | $$PWD/overrepresentedseqsanalysis.h \ 11 | $$PWD/perbasencontentanalysis.h \ 12 | $$PWD/persequencegccontent.h \ 13 | $$PWD/lengthdistributionanalysis.h 14 | 15 | SOURCES += \ 16 | $$PWD/analysis.cpp \ 17 | $$PWD/analysisrunner.cpp \ 18 | $$PWD/basicstatsanalysis.cpp \ 19 | $$PWD/perbasequalityanalysis.cpp \ 20 | $$PWD/persequencequalityanalysis.cpp \ 21 | $$PWD/perbasecontentanalysis.cpp \ 22 | $$PWD/overrepresentedseqsanalysis.cpp \ 23 | $$PWD/perbasencontentanalysis.cpp \ 24 | $$PWD/persequencegccontent.cpp \ 25 | $$PWD/lengthdistributionanalysis.cpp 26 | -------------------------------------------------------------------------------- /analysis/analysisrunner.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Copyright 2016-17 Sacha Schutz 3 | 4 | This file is part of fastQT. 5 | 6 | Foobar is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | Foobar is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with Foobar. If not, see . 18 | 19 | @author : Pierre Lindenbaum from FastQC 20 | @author : Sacha Schutz 21 | @author : Pierre Marijon 22 | */ 23 | #ifndef ANALYSISRUNNER_H 24 | #define ANALYSISRUNNER_H 25 | #include 26 | #include 27 | #include "bamreader.h" 28 | #include 29 | #include "analysis.h" 30 | #include "fastqreader.h" 31 | #include "imageformatdefinition.h" 32 | 33 | /*! 34 | * \class AnalysisRunner 35 | * \brief The AnalysisRunner class read a fastq file and computes all analysis from a QThread 36 | * @see AnalysisRunner 37 | */ 38 | class Analysis; 39 | class AnalysisRunner; 40 | class AnalysisRunner : public QRunnable 41 | 42 | { 43 | public: 44 | enum Status { 45 | Waiting, 46 | Running, 47 | Canceled, 48 | Finished 49 | }; 50 | 51 | AnalysisRunner(); 52 | AnalysisRunner(const QString& filename); 53 | 54 | virtual ~AnalysisRunner(); 55 | 56 | /*! 57 | * \brief run all analyis asynchronously 58 | */ 59 | virtual void run() Q_DECL_OVERRIDE; 60 | /*! 61 | * \brief add Analysis 62 | * \param Analysis: analysis 63 | */ 64 | void addAnalysis(Analysis* analysis); 65 | /*! 66 | * \brief set fastq file path 67 | * \param QString: file path 68 | */ 69 | void setFilename(const QString& filename); 70 | /*! 71 | * \brief reset all analysis 72 | */ 73 | void reset(); 74 | 75 | const QString& filename() const; 76 | 77 | Status status() const; 78 | 79 | /*! 80 | * \brief progression of analysis in percent 81 | * \return value between 0 and 100 82 | */ 83 | int progression() const; 84 | 85 | /*! 86 | * \brief return how many sequence has been analysed. 87 | * This value can be access during analysis from updated signals 88 | * \return number of sequence 89 | */ 90 | int sequenceCount() const; 91 | 92 | void cancel(); 93 | bool isCanceled(); 94 | 95 | qint64 fileSize() const; 96 | 97 | QString humanFileSize() const; 98 | 99 | const QString& lastMessage() const; 100 | 101 | int duration() const; 102 | 103 | /*! 104 | * \brief analysisList 105 | * \return all analysis avaible 106 | */ 107 | QList analysisList() const; 108 | Analysis * analysis(const QString& className); 109 | 110 | void saveAll(const QString& path); 111 | 112 | static AnalysisRunner* createAnalysisRunner(); 113 | 114 | protected: 115 | void emitUpdate(const QString& message); 116 | void setStatus(Status status); 117 | 118 | 119 | 120 | 121 | private: 122 | QTime mStartTime; 123 | QMap mAnalysisHash; 124 | QString mFilename; 125 | QString mMessage; 126 | int mProgression = 0; 127 | int mSequenceCount = 0; 128 | qint64 mFileSize = 0; 129 | int mDuration = 0; 130 | Status mStatus = Waiting; 131 | bool mCancel = false; 132 | QMutex mMutex; 133 | 134 | 135 | 136 | 137 | }; 138 | 139 | #endif // ANALYSISRUNNER_H 140 | -------------------------------------------------------------------------------- /analysis/basicstatsanalysis.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Copyright 2016-17 Sacha Schutz 3 | 4 | This file is part of fastQT. 5 | 6 | Foobar is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | Foobar is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with Foobar. If not, see . 18 | 19 | @author : Pierre Lindenbaum from FastQC 20 | @author : Sacha Schutz 21 | @author : Pierre Marijon 22 | */ 23 | #include "basicstatsanalysis.h" 24 | #include "sequence.h" 25 | #include 26 | #include 27 | BasicStatsAnalysis::BasicStatsAnalysis(QObject * parent) 28 | :Analysis(parent) 29 | { 30 | setName(tr("Basic Stat")); 31 | setDescription(("Basic statistic")); 32 | for (int i = 0; i < 256; ++i) { 33 | count[i] = &mXCount; 34 | } 35 | count['G'] = &mGCount; 36 | count['A'] = &mACount; 37 | count['T'] = &mTCount; 38 | count['C'] = &mCCount; 39 | count['N'] = &mNCount; 40 | } 41 | // ============================================================== 42 | void BasicStatsAnalysis::reset() 43 | { 44 | mEncoding.clear(); 45 | 46 | } 47 | // ============================================================== 48 | 49 | void BasicStatsAnalysis::processSequence(const Sequence &sequence) 50 | { 51 | 52 | 53 | mReadCount++; 54 | 55 | mMinLength = qMin(mMinLength, sequence.size()); 56 | mMaxLength = qMax(mMaxLength, sequence.size()); 57 | 58 | for (char base : sequence.sequence()) 59 | { 60 | ++(*count[static_cast(base)]); 61 | } 62 | 63 | 64 | 65 | for (char byte : sequence.quality()) 66 | { 67 | if (byte < mLowestChar) 68 | mLowestChar = byte; 69 | } 70 | } 71 | // ============================================================== 72 | 73 | QWidget *BasicStatsAnalysis::createResultWidget() 74 | { 75 | 76 | QTableView * view = new QTableView; 77 | KeyValueModel * model = new KeyValueModel(view); 78 | view->setModel(model); 79 | 80 | QString length = mMinLength == mMaxLength ? QString::number(mMaxLength) : QStringLiteral("%1-%2").arg(mMinLength).arg(mMaxLength); 81 | 82 | 83 | model->addValue(tr("Total Sequences"), QLocale::system().toString(mReadCount)); 84 | model->addValue(tr("Sequence length"), length); 85 | model->addValue(tr("Encoding"), PhredEncoding::fastqEncodingOffset(mLowestChar).name()); 86 | 87 | if (mACount + mCCount + mGCount + mTCount > 0) 88 | { 89 | qreal percent = qreal(mGCount + mCCount) * 100 / (mACount + mCCount + mGCount + mTCount); 90 | model->addValue(QObject::tr("%GC"), QString::number(percent,'f',2)); 91 | 92 | } 93 | 94 | 95 | view->horizontalHeader()->hide(); 96 | view->verticalHeader()->hide(); 97 | 98 | view->setAlternatingRowColors(true); 99 | view->setSelectionBehavior(QAbstractItemView::SelectRows); 100 | 101 | 102 | view->horizontalHeader()->setSectionResizeMode(0,QHeaderView::ResizeToContents); 103 | view->horizontalHeader()->setSectionResizeMode(1,QHeaderView::Stretch); 104 | 105 | 106 | return view; 107 | 108 | 109 | } 110 | 111 | void BasicStatsAnalysis::save(const QString &path) 112 | { 113 | QJsonObject json; 114 | 115 | QDir dir(path); 116 | QString filename = dir.filePath(QStringLiteral("%1.json").arg(metaObject()->className())); 117 | 118 | QFile file(filename); 119 | if (file.open(QIODevice::WriteOnly)) 120 | { 121 | json.insert("total_sequence",mReadCount); 122 | json.insert("sequence_min_length",mMinLength); 123 | json.insert("sequence_max_length",mMaxLength); 124 | json.insert("encoding",PhredEncoding::fastqEncodingOffset(mLowestChar).name()); 125 | 126 | QJsonDocument doc(json); 127 | file.write(doc.toJson()); 128 | } 129 | 130 | } 131 | 132 | int BasicStatsAnalysis::readCount() 133 | { 134 | return mReadCount; 135 | } 136 | -------------------------------------------------------------------------------- /analysis/basicstatsanalysis.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Copyright 2016-17 Sacha Schutz 3 | 4 | This file is part of fastQT. 5 | 6 | Foobar is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | Foobar is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with Foobar. If not, see . 18 | 19 | @author : Pierre Lindenbaum from FastQC 20 | @author : Sacha Schutz 21 | @author : Pierre Marijon 22 | */ 23 | #ifndef BASICSTATSANALYSIS_H 24 | #define BASICSTATSANALYSIS_H 25 | #include 26 | #include 27 | #include 28 | #include "analysis.h" 29 | #include "keyvaluemodel.h" 30 | #include "phredencoding.h" 31 | 32 | /*! 33 | * \class BasicStatsAnalysis 34 | * \brief he Basic Statistics module generates some simple composition statistics for the file analysed. 35 | * Relative to Basic Statistics FastQC module 36 | * 37 | */ 38 | 39 | class BasicStatsAnalysis : public Analysis 40 | { 41 | Q_OBJECT 42 | Q_PROPERTY(int readCount READ readCount) 43 | 44 | public: 45 | BasicStatsAnalysis(QObject * parent = nullptr); 46 | void processSequence(const Sequence& sequence) Q_DECL_OVERRIDE; 47 | void reset() Q_DECL_OVERRIDE; 48 | QWidget * createResultWidget() Q_DECL_OVERRIDE; 49 | void save(const QString& path) Q_DECL_OVERRIDE; 50 | 51 | int readCount(); 52 | 53 | private: 54 | QString mEncoding; 55 | int mReadCount = 0; 56 | int mMinLength = std::numeric_limits::max(); 57 | int mMaxLength = 0; 58 | quint64 mGCount = 0; 59 | quint64 mCCount = 0; 60 | quint64 mACount = 0; 61 | quint64 mTCount = 0; 62 | quint64 mNCount = 0; 63 | quint64 mXCount = 0; 64 | 65 | 66 | char mLowestChar = 126; 67 | quint64* count[256]; 68 | }; 69 | 70 | #endif // BASICSTATSANALYSIS_H 71 | -------------------------------------------------------------------------------- /analysis/lengthdistributionanalysis.cpp: -------------------------------------------------------------------------------- 1 | #include "lengthdistributionanalysis.h" 2 | LengthDistributionAnalysis::LengthDistributionAnalysis(QObject * parent) 3 | :Analysis(parent) 4 | { 5 | setName(tr("Sequence Length Distribution")); 6 | setDescription(tr("Shows the distribution of sequence length over all sequences")); 7 | } 8 | 9 | void LengthDistributionAnalysis::processSequence(const Sequence &sequence) 10 | { 11 | 12 | int seqLen = sequence.size(); 13 | if (seqLen + 2 > mLengthCounts.length()) 14 | mLengthCounts.resize(seqLen + 2); 15 | 16 | ++mLengthCounts[seqLen]; 17 | 18 | } 19 | 20 | void LengthDistributionAnalysis::reset() 21 | { 22 | mLengthCounts.clear(); 23 | mGraphCounts.clear(); 24 | } 25 | 26 | QWidget *LengthDistributionAnalysis::createResultWidget() 27 | { 28 | 29 | QChartView * view = new QChartView; 30 | view->setRenderHint(QPainter::Antialiasing); 31 | 32 | if (mGraphCounts.isEmpty()) 33 | return view; 34 | 35 | QLineSeries * serie = new QLineSeries; 36 | 37 | int yMax = 0; 38 | auto graph_count_it = mGraphCounts.begin(); 39 | for (int i=mMin; i < mMax+mIntervale; i += mIntervale) 40 | { 41 | serie->append(i, *graph_count_it); 42 | if(yMax < *graph_count_it) 43 | yMax = *graph_count_it; 44 | graph_count_it++; 45 | } 46 | 47 | QChart * chart = new QChart ; 48 | chart->addSeries(serie); 49 | 50 | /* Create fake series for set the chart dimension */ 51 | QLineSeries * fakeSerie = new QLineSeries(); 52 | fakeSerie->append(0, 0); 53 | fakeSerie->append(mGraphCounts.size(), yMax); 54 | fakeSerie->setVisible(false); 55 | chart->addSeries(fakeSerie); 56 | 57 | chart->createDefaultAxes(); 58 | chart->axisX()->setTitleText(tr("Position in read (bp)")); 59 | chart->axisY()->setTitleText(tr("Sequence count")); 60 | 61 | 62 | /* Set label of axis */ 63 | dynamic_cast(chart->axisX())->setMin(mMin); 64 | dynamic_cast(chart->axisX())->setLabelFormat("%d"); 65 | dynamic_cast(chart->axisY())->setLabelFormat("%d"); 66 | 67 | if (mGraphCounts.size() < 5) 68 | dynamic_cast(chart->axisX())->setTickCount(mGraphCounts.size()); 69 | 70 | chart->setTitle(tr("Distribution of sequence length over all sequences")); 71 | chart->setAnimationOptions(QChart::NoAnimation); 72 | // add Actions 73 | view->setRubberBand(QChartView::HorizontalRubberBand); 74 | QAction * zoomReset = new QAction(QFontIcon::icon(0xf002), tr("Zoom reset"), view); 75 | QAction * zoomIn = new QAction(QFontIcon::icon(0xf00e), tr("Zoom in"), view); 76 | QAction * zoomOut = new QAction(QFontIcon::icon(0xf010), tr("Zoom out"), view); 77 | 78 | connect(zoomReset, &QAction::triggered, [chart](){chart->zoomReset();}); 79 | connect(zoomIn, &QAction::triggered, [chart](){chart->zoomIn();}); 80 | connect(zoomOut, &QAction::triggered, [chart](){chart->zoomOut();}); 81 | 82 | view->addAction(zoomReset); 83 | view->addAction(zoomIn); 84 | view->addAction(zoomOut); 85 | view->setChart(chart); 86 | 87 | return view; 88 | } 89 | 90 | void LengthDistributionAnalysis::after() 91 | { 92 | computeDistribution(); 93 | } 94 | 95 | void LengthDistributionAnalysis::computeDistribution() 96 | { 97 | int maxLen = 0; 98 | int minLen = -1; 99 | 100 | // qDebug()<0) { 104 | if (minLen < 0) { 105 | minLen = i; 106 | } 107 | maxLen = i; 108 | } 109 | } 110 | 111 | // We put one extra category either side of the actual size 112 | if (minLen>0) minLen--; 113 | maxLen++; 114 | 115 | 116 | QVector startAndInterval = sizeDistribution(minLen, maxLen); 117 | 118 | // Work out how many categories we need 119 | int categories = 0; 120 | int currentValue = startAndInterval[0]; 121 | while (currentValue<= maxLen) { 122 | ++categories; 123 | currentValue+= startAndInterval[1]; 124 | } 125 | 126 | mGraphCounts.resize(categories); 127 | 128 | for (int i=0;i maxLen) { 134 | maxValue = maxLen; 135 | } 136 | 137 | for (int bp=minValue;bp<=maxValue;bp++) { 138 | if (bp < mLengthCounts.length()) { 139 | mGraphCounts[i] += mLengthCounts[bp]; 140 | } 141 | } 142 | 143 | if (mGraphCounts[i] > mMax) mMax = mGraphCounts[i]; 144 | } 145 | 146 | mIntervale = startAndInterval[1]; 147 | mMin = minLen; 148 | mMax = maxLen; 149 | } 150 | 151 | QVector LengthDistributionAnalysis::sizeDistribution(int min, int max) 152 | { 153 | int base = 1; 154 | while (base > (max-min)) { 155 | base /= 10; 156 | } 157 | 158 | int interval =0; 159 | int starting =0; 160 | 161 | QVector divisions ={1,2,5}; 162 | 163 | // Little hack to exit the while loop.. 164 | bool loop = true; 165 | while (loop) { 166 | for (int d=0;d 4 | #include "analysis.h" 5 | 6 | using namespace QT_CHARTS_NAMESPACE; 7 | 8 | /*! 9 | * \class SequenceLengthDistributionAnalysis 10 | * \brief This analysis generates a graph showing the distribution of fragment sizes in the file which was analysed. 11 | * Relative to Sequence length distribution in FastQC module 12 | * 13 | */ 14 | class LengthDistributionAnalysis : public Analysis 15 | { 16 | Q_OBJECT 17 | public: 18 | LengthDistributionAnalysis(QObject * parent = nullptr); 19 | void processSequence(const Sequence& sequence) Q_DECL_OVERRIDE; 20 | void reset() Q_DECL_OVERRIDE; 21 | QWidget * createResultWidget() Q_DECL_OVERRIDE; 22 | 23 | protected: 24 | virtual void after() Q_DECL_OVERRIDE; 25 | 26 | void computeDistribution(); 27 | QVector sizeDistribution (int min, int max); 28 | 29 | 30 | private: 31 | 32 | QVector mGraphCounts; 33 | QVector mLengthCounts; 34 | double mMax; 35 | double mMin; 36 | int mIntervale; 37 | }; 38 | 39 | #endif // SEQUENCELENGTHDISTRIBUTIONANALYSIS_H 40 | -------------------------------------------------------------------------------- /analysis/overrepresentedseqsanalysis.cpp: -------------------------------------------------------------------------------- 1 | #include "overrepresentedseqsanalysis.h" 2 | #include "sequence.h" 3 | 4 | OverRepresentedSeqsAnalysis::OverRepresentedSeqsAnalysis(QObject * parent) 5 | :Analysis(parent) 6 | { 7 | setName(tr("Overrepresented sequences")); 8 | setDescription(tr("Identifies sequences which are overrepresented in the set")); 9 | } 10 | 11 | void OverRepresentedSeqsAnalysis::processSequence(const Sequence &sequence) 12 | { 13 | 14 | ++mCount; 15 | 16 | 17 | 18 | // Since we rely on identity to match sequences we can't trust really long 19 | // sequences, so anything over 75bp gets truncated to 50bp. 20 | 21 | QByteArray seq = sequence.sequence(); 22 | 23 | if (seq.length() > 75) { 24 | seq = seq.left(50); 25 | } 26 | 27 | 28 | if (mSequences.contains(seq)) 29 | { 30 | mSequences[seq]++; 31 | // We need to increment the count at unique limit just in case 32 | // we never hit the unique sequence limit, so we need to know 33 | // that we'd actually seen all of the sequences. 34 | if (!mFrozen) 35 | mCountAtUniqueLimit = mCount; 36 | } 37 | 38 | else 39 | { 40 | if (!mFrozen) 41 | mSequences[seq] = 1; 42 | mUniqueSequenceCount++; 43 | mCountAtUniqueLimit = mCount; 44 | if (mUniqueSequenceCount == OBSERVATION_CUTOFF) 45 | mFrozen = true; 46 | 47 | } 48 | 49 | 50 | } 51 | 52 | void OverRepresentedSeqsAnalysis::reset() 53 | { 54 | mFrozen = 0; 55 | mSequences.clear(); 56 | mCount = 0; 57 | mCountAtUniqueLimit = 0; 58 | } 59 | 60 | QWidget *OverRepresentedSeqsAnalysis::createResultWidget() 61 | { 62 | 63 | 64 | QTableView * view = new QTableView; 65 | ResultsModel * model = new ResultsModel(view); 66 | 67 | for (QByteArray s : mSequences.keys()) 68 | { 69 | double percentage = ((double)mSequences[s] / mCount) * 100; 70 | model->add(s,mSequences[s], percentage); 71 | } 72 | 73 | model->sort(); 74 | view->verticalHeader()->hide(); 75 | view->setAlternatingRowColors(true); 76 | 77 | view->setModel(model); 78 | 79 | view->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch); 80 | // view->horizontalHeader()->setSectionResizeMode(1, QHeaderView::ResizeToContents); 81 | // view->horizontalHeader()->setSectionResizeMode(2, QHeaderView::ResizeToContents); 82 | 83 | 84 | 85 | return view; 86 | 87 | } 88 | 89 | void OverRepresentedSeqsAnalysis::save(const QString &path) 90 | { 91 | QDir dir(path); 92 | QString tsvPath = dir.filePath(QStringLiteral("%1.tsv").arg(metaObject()->className())); 93 | QString fastaPath = dir.filePath(QStringLiteral("%1.fasta").arg(metaObject()->className())); 94 | 95 | QFile tsvFile(tsvPath); 96 | QFile fastaFile(fastaPath); 97 | 98 | if (tsvFile.open(QIODevice::WriteOnly) && fastaFile.open(QIODevice::WriteOnly)) 99 | { 100 | QTextStream tsvStream(&tsvFile); 101 | QTextStream fastaStream(&fastaFile); 102 | 103 | tsvStream<<"#Sequence"<<"Count"<<"Percentage"; 104 | int index = 0; 105 | for (QByteArray s : mSequences.keys()) 106 | { 107 | double percentage = ((double)mSequences[s] / mCount) * 100; 108 | tsvStream<Seq_%1;count=%2;percentage=%3").arg(index).arg(mSequences[s]).arg(percentage)<<"\n"; 110 | fastaStream< 4 | #include "analysis.h" 5 | 6 | class ResultsModel; 7 | class OverRepresentedSeq; 8 | class OverRepresentedSeqsAnalysis; 9 | 10 | class OverRepresentedSeqsAnalysis : public Analysis 11 | { 12 | Q_OBJECT 13 | public: 14 | OverRepresentedSeqsAnalysis(QObject * parent = nullptr); 15 | 16 | void processSequence(const Sequence& sequence) Q_DECL_OVERRIDE; 17 | void reset() Q_DECL_OVERRIDE; 18 | QWidget* createResultWidget() Q_DECL_OVERRIDE; 19 | void save(const QString& path) Q_DECL_OVERRIDE; 20 | 21 | 22 | 23 | protected: 24 | QHash mSequences; 25 | quint64 mCount = 0; 26 | quint64 mCountAtUniqueLimit = 0; 27 | quint64 mUniqueSequenceCount = 0; 28 | bool mFrozen = false; 29 | static const int OBSERVATION_CUTOFF = 100000; 30 | 31 | }; 32 | 33 | 34 | class OverRepresentedSeq 35 | { 36 | public: 37 | OverRepresentedSeq(const QByteArray& seq, quint64 count, double percentage); 38 | const QByteArray& seq() const; 39 | quint64 count() const; 40 | double percentage() const; 41 | 42 | bool operator <(const OverRepresentedSeq& other) const; 43 | 44 | private: 45 | QByteArray mSeq; 46 | quint64 mCount; 47 | double mPercentage; 48 | 49 | }; 50 | 51 | class ResultsModel : public QAbstractTableModel 52 | { 53 | Q_OBJECT 54 | public: 55 | ResultsModel(QObject * parent = nullptr); 56 | ~ResultsModel(); 57 | 58 | void add(const QByteArray& seq, quint64 count, double percentage); 59 | 60 | 61 | int rowCount(const QModelIndex &parent) const; 62 | int columnCount(const QModelIndex &parent) const; 63 | 64 | QVariant data(const QModelIndex &index, int role) const; 65 | QVariant headerData(int section, Qt::Orientation orientation, int role) const; 66 | 67 | void sort(); 68 | 69 | 70 | 71 | void clear() ; 72 | 73 | 74 | private: 75 | QList mSeqs; 76 | 77 | 78 | }; 79 | 80 | #endif // OVERREPRESENTEDSEQSANALYSIS_H 81 | -------------------------------------------------------------------------------- /analysis/perbasecontentanalysis.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Copyright 2016-17 Sacha Schutz 3 | 4 | This file is part of fastQT. 5 | 6 | Foobar is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | Foobar is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with Foobar. If not, see . 18 | 19 | @author : Pierre Lindenbaum from FastQC 20 | @author : Sacha Schutz 21 | @author : Pierre Marijon 22 | */ 23 | #ifndef PERBASECONTENTANALYSIS_H 24 | #define PERBASECONTENTANALYSIS_H 25 | #include 26 | #include 27 | #include "analysis.h" 28 | #include "basegroup.h" 29 | #include "lengthdistributionanalysis.h" 30 | 31 | using namespace QT_CHARTS_NAMESPACE; 32 | /*! 33 | * \class PerBaseContentAnalysis 34 | * \brief Per Base Sequence Content plots out the proportion of each base position in a file for which each of the four normal DNA bases has been called. 35 | * Relative to Per Base Sequence Content FastQC module Basic 36 | * 37 | */ 38 | class PerBaseContentAnalysis : public Analysis 39 | { 40 | Q_OBJECT 41 | 42 | public: 43 | PerBaseContentAnalysis(QObject * parent = nullptr); 44 | 45 | virtual void processSequence(const Sequence& sequence) Q_DECL_OVERRIDE; 46 | virtual void reset() Q_DECL_OVERRIDE; 47 | virtual QWidget* createResultWidget() Q_DECL_OVERRIDE; 48 | 49 | 50 | protected: 51 | void computePercentages(); 52 | virtual void after() Q_DECL_OVERRIDE; 53 | 54 | 55 | private: 56 | QVector mGCounts; 57 | QVector mACounts; 58 | QVector mCCounts; 59 | QVector mTCounts; 60 | QVector mXCounts; 61 | 62 | QVector gPercent; 63 | QVector aPercent; 64 | QVector tPercent; 65 | QVector cPercent; 66 | 67 | QVector mXCategories; 68 | QVector* counts[256]; 69 | 70 | }; 71 | 72 | #endif // PERBASECONTENTANALYSIS_H 73 | -------------------------------------------------------------------------------- /analysis/perbasencontentanalysis.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Copyright 2017 Pierre Marijon 3 | 4 | This file is part of fastQT. 5 | 6 | Foobar is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | Foobar is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with Foobar. If not, see . 18 | 19 | @author : Pierre Lindenbaum from FastQC 20 | @author : Sacha Schutz 21 | @author : Pierre Marijon 22 | */ 23 | #include "perbasencontentanalysis.h" 24 | #include "sequence.h" 25 | 26 | PerBaseNContentAnalysis::PerBaseNContentAnalysis(QObject * parent) 27 | :Analysis(parent) 28 | { 29 | 30 | setName(tr("Per Base N content")); 31 | setDescription(tr("Per base N content")); 32 | for (int i = 0; i < 256; ++i) { 33 | counts[i] = &mXCounts; 34 | } 35 | 36 | counts['N'] = &mNCounts; 37 | } 38 | 39 | void PerBaseNContentAnalysis::processSequence(const Sequence &sequence) 40 | { 41 | 42 | 43 | if (mXCounts.size() < sequence.size()) 44 | { 45 | mNCounts.resize(sequence.size()); 46 | mXCounts.resize(sequence.size()); 47 | } 48 | 49 | 50 | for (int i=0; i(sequence.sequence().at(i))])[i]; 52 | } 53 | 54 | void PerBaseNContentAnalysis::reset() 55 | { 56 | mNCounts.clear(); 57 | 58 | nPercent.clear(); 59 | } 60 | 61 | QWidget *PerBaseNContentAnalysis::createResultWidget() 62 | { 63 | 64 | 65 | QLineSeries * NSerie = new QLineSeries (); 66 | 67 | qreal xMul = mNCounts.size()/static_cast(nPercent.size()); 68 | for (int i=0; iappend(i * xMul, nPercent[i]); 71 | } 72 | 73 | 74 | QChart * chart = new QChart(); 75 | chart->addSeries(NSerie); 76 | 77 | /* Create fake series for set the chart dimension */ 78 | QLineSeries * fakeSerie = new QLineSeries(); 79 | fakeSerie->append(0, 0); 80 | fakeSerie->append(nPercent.size(), 100); 81 | fakeSerie->setVisible(false); 82 | chart->addSeries(fakeSerie); 83 | 84 | chart->createDefaultAxes(); 85 | 86 | /* Set label of axis */ 87 | dynamic_cast(chart->axisX())->setLabelFormat("%d"); 88 | dynamic_cast(chart->axisY())->setLabelFormat("%.2f %"); 89 | 90 | chart->axisX()->setTitleText(tr("Position in read (bp)")); 91 | chart->axisY()->setTitleText(tr("N percent (%)")); 92 | 93 | 94 | QPen pen; 95 | pen.setWidth(2); 96 | pen.setColor(QColor("#71e096")); 97 | NSerie->setPen(pen); 98 | 99 | chart->setTitle(tr("Per Base N content")); 100 | chart->setAnimationOptions(QChart::NoAnimation); 101 | 102 | 103 | QChartView * view = new QChartView; 104 | view->setRenderHint(QPainter::Antialiasing); 105 | 106 | view->setChart(chart); 107 | // add Actions 108 | view->setRubberBand(QChartView::HorizontalRubberBand); 109 | QAction * zoomReset = new QAction(QFontIcon::icon(0xf002), tr("Zoom reset"), view); 110 | QAction * zoomIn = new QAction(QFontIcon::icon(0xf00e), tr("Zoom in"), view); 111 | QAction * zoomOut = new QAction(QFontIcon::icon(0xf010), tr("Zoom out"), view); 112 | 113 | connect(zoomReset, &QAction::triggered, [chart](){chart->zoomReset();}); 114 | connect(zoomIn, &QAction::triggered, [chart](){chart->zoomIn();}); 115 | connect(zoomOut, &QAction::triggered, [chart](){chart->zoomOut();}); 116 | 117 | view->addAction(zoomReset); 118 | view->addAction(zoomIn); 119 | view->addAction(zoomOut); 120 | return view; 121 | } 122 | 123 | void PerBaseNContentAnalysis::computePercentages() 124 | { 125 | 126 | 127 | QVector groups = BaseGroup::makeBaseGroups(mNCounts.size()); 128 | mXCategories.resize(groups.length()); 129 | 130 | nPercent.resize(groups.length()); 131 | 132 | quint64 total; 133 | quint64 nCount; 134 | 135 | for (int i=0;i. 17 | 18 | @author : Pierre Lindenbaum from FastQC 19 | @author : Sacha Schutz 20 | @author : Pierre Marijon 21 | */ 22 | #ifndef PERBASENCONTENTANALYSIS_H 23 | #define PERBASENCONTENTANALYSIS_H 24 | #include 25 | #include 26 | #include "analysis.h" 27 | #include "basegroup.h" 28 | 29 | using namespace QT_CHARTS_NAMESPACE; 30 | /*! 31 | * \class PerBaseNContentAnalysis 32 | * \brief Per Base Sequence Content plots out the proportion of each base position in a file for which each of N bases has been called. 33 | * Relative to Per Base N Content FastQC module Basic 34 | * 35 | */ 36 | class PerBaseNContentAnalysis : public Analysis 37 | { 38 | Q_OBJECT 39 | 40 | public: 41 | PerBaseNContentAnalysis(QObject * parent = nullptr); 42 | 43 | virtual void processSequence(const Sequence& sequence) Q_DECL_OVERRIDE; 44 | virtual void reset() Q_DECL_OVERRIDE; 45 | virtual QWidget* createResultWidget() Q_DECL_OVERRIDE; 46 | 47 | protected: 48 | void computePercentages(); 49 | virtual void after() Q_DECL_OVERRIDE; 50 | 51 | private: 52 | QVector mNCounts; 53 | QVector mXCounts; 54 | 55 | QVector nPercent; 56 | 57 | QVector mXCategories; 58 | QVector* counts[256]; 59 | }; 60 | 61 | #endif // PERBASENCONTENTANALYSIS_H 62 | -------------------------------------------------------------------------------- /analysis/perbasequalityanalysis.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Copyright 2016-17 Sacha Schutz 3 | 4 | This file is part of fastQT. 5 | 6 | Foobar is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | Foobar is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with Foobar. If not, see . 18 | 19 | @author : Pierre Lindenbaum from FastQC 20 | @author : Sacha Schutz 21 | @author : Pierre Marijon 22 | */ 23 | #ifndef PERBASEQUALITYANALYSIS_H 24 | #define PERBASEQUALITYANALYSIS_H 25 | 26 | #include 27 | #include "analysis.h" 28 | #include "basegroup.h" 29 | #include "phredencoding.h" 30 | 31 | #define QUALITY_COUNT_SIZE 150 32 | 33 | using namespace QT_CHARTS_NAMESPACE; 34 | 35 | class QualityCount; 36 | /*! 37 | * \class PerBaseQualityAnalysis 38 | * \brief This view shows an overview of the range of quality values across all bases at each position in the FastQ file. 39 | * Relative to Per Base Sequence Quality FastQC module 40 | * 41 | */ 42 | class PerBaseQualityAnalysis : public Analysis 43 | { 44 | Q_OBJECT 45 | public: 46 | PerBaseQualityAnalysis(QObject * parent = nullptr); 47 | 48 | virtual void processSequence(const Sequence& sequence) Q_DECL_OVERRIDE; 49 | virtual void reset() Q_DECL_OVERRIDE; 50 | virtual QWidget* createResultWidget() Q_DECL_OVERRIDE; 51 | virtual Status status() const Q_DECL_OVERRIDE; 52 | 53 | protected: 54 | virtual void after() Q_DECL_OVERRIDE; 55 | qreal mean(int maxbp, int minbp, int offset); 56 | qreal percentile(int minbp, int offset, int maxbp,int percentile); 57 | void computePercentages(); 58 | QPair computeOffsets(); 59 | 60 | 61 | private: 62 | QVector means; 63 | QVector medians; 64 | QVector lowerQuartile; 65 | QVector upperQuartile; 66 | QVector lowest; 67 | QVector highest; 68 | QVector xLabels; 69 | QVector mQualityCounts; 70 | PhredEncoding mEncodingScheme; 71 | int mLow = 0; 72 | int mHigh = 0; 73 | 74 | 75 | }; 76 | 77 | 78 | class QualityCount { 79 | 80 | public: 81 | QualityCount(); 82 | void addValue(char c); 83 | qreal mean(int offset)const; 84 | char min()const; 85 | char max()const; 86 | qreal percentile(int offset,int percentile)const; 87 | int count() const; 88 | 89 | 90 | 91 | private: 92 | // faster than QVector 93 | 94 | quint64 mCounts[QUALITY_COUNT_SIZE] = {0}; 95 | int mTotalCounts = 0; 96 | }; 97 | 98 | 99 | 100 | 101 | #endif // PERBASEQUALITYANALYSIS_H 102 | -------------------------------------------------------------------------------- /analysis/persequencegccontent.cpp: -------------------------------------------------------------------------------- 1 | #include "persequencegccontent.h" 2 | #include "statistic.h" 3 | 4 | PerSequenceGCContent::PerSequenceGCContent(QObject * parent) 5 | :Analysis(parent) 6 | { 7 | setName(tr("Sequence GC %")); 8 | setDescription(tr("Per sequence gc %")); 9 | 10 | /* Series is in 0 and 100 -> 101 values*/ 11 | mGCCounts.resize(101); 12 | mNbSeq = 0; 13 | mXMax = 0; 14 | } 15 | 16 | void PerSequenceGCContent::processSequence(const Sequence& sequence) 17 | { 18 | mGCCounts[qRound(sequence.gc_percent())]++; 19 | mNbSeq++; 20 | if(mXMax < (quint64)(sequence.size())) 21 | mXMax = sequence.size(); 22 | } 23 | 24 | void PerSequenceGCContent::reset() 25 | { 26 | mGCCounts.clear(); 27 | mGCCounts.resize(101); 28 | mNbSeq = 0; 29 | mXMax = 0; 30 | } 31 | 32 | QWidget* PerSequenceGCContent::createResultWidget() 33 | { 34 | /* Compute gc% not reacheable value */ 35 | QSet not_reacheable; 36 | QSet reacheable; 37 | for(quint64 i = 0; i != mXMax; i++) 38 | reacheable << qRound((i/75.0) * 100); 39 | 40 | for(quint64 i = 0; i != 101; i++) 41 | not_reacheable << i; 42 | 43 | not_reacheable -= reacheable; 44 | 45 | /* Compute theorical distribution */ 46 | qreal gcMean = mean_ponderate(mGCCounts); 47 | qreal gcStddev = stddev(mGCCounts, gcMean); 48 | 49 | QChartView * view = new QChartView; 50 | view->setRubberBand(QChartView::HorizontalRubberBand); 51 | view->setRenderHint(QPainter::Antialiasing); 52 | 53 | QLineSeries * normalseries = new QLineSeries(); 54 | QLineSeries * lineseries = new QLineSeries(); 55 | 56 | qreal yMax = 0; 57 | for(int i = 0; i != mGCCounts.size(); i++) 58 | { 59 | if(!not_reacheable.contains(i)) 60 | { 61 | lineseries->append(QPoint(i, mGCCounts[i])); 62 | normalseries->append(QPoint(i, normal_distribution(gcMean, gcStddev, i)*mNbSeq)); 63 | 64 | if(mGCCounts[i] > yMax) 65 | yMax = mGCCounts[i]; 66 | } 67 | } 68 | 69 | QChart * chart = new QChart(); 70 | chart->addSeries(lineseries); 71 | chart->addSeries(normalseries); 72 | chart->setTitle("Sequence GC %"); 73 | chart->setAnimationOptions(QChart::NoAnimation); 74 | 75 | QPen pen; 76 | pen.setWidth(2); 77 | pen.setColor(QColor("#71e096")); 78 | normalseries->setPen(pen); 79 | 80 | QValueAxis * axisX = new QValueAxis; 81 | axisX->setTickCount(10); 82 | axisX->setRange(0, 100); 83 | axisX->setLabelFormat("%.2f %"); 84 | axisX->setTitleText(tr("Percent of GC (%)")); 85 | 86 | chart->setAxisX(axisX); 87 | 88 | QValueAxis * axisY= new QValueAxis; 89 | axisY->setTickCount(10); 90 | axisY->setRange(0, yMax); 91 | axisY->setLabelFormat("%d"); 92 | axisY->setTitleText(tr("Read count(s)")); 93 | 94 | chart->setAxisY(axisY); 95 | 96 | view->setChart(chart); 97 | 98 | // add Actions 99 | QAction * zoomReset = new QAction(QFontIcon::icon(0xf002), tr("Zoom reset"), view); 100 | QAction * zoomIn = new QAction(QFontIcon::icon(0xf00e), tr("Zoom in"), view); 101 | QAction * zoomOut = new QAction(QFontIcon::icon(0xf010), tr("Zoom out"), view); 102 | 103 | connect(zoomReset, &QAction::triggered, [chart](){chart->zoomReset();}); 104 | connect(zoomIn, &QAction::triggered, [chart](){chart->zoomIn();}); 105 | connect(zoomOut, &QAction::triggered, [chart](){chart->zoomOut();}); 106 | 107 | view->addAction(zoomReset); 108 | view->addAction(zoomIn); 109 | view->addAction(zoomOut); 110 | 111 | 112 | 113 | 114 | return view; 115 | 116 | } 117 | -------------------------------------------------------------------------------- /analysis/persequencegccontent.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Copyright 2016-17 Pierre Marijon 3 | 4 | This file is part of fastQT. 5 | 6 | Foobar is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | Foobar is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with Foobar. If not, see . 18 | 19 | @author : Pierre Lindenbaum from FastQC 20 | @author : Sacha Schutz 21 | @author : Pierre Marijon 22 | */ 23 | #ifndef PERSEQUENCEGCCONTENT_H 24 | #define PERSEQUENCEGCCONTENT_H 25 | 26 | #include 27 | #include 28 | 29 | #include "analysis.h" 30 | #include "basegroup.h" 31 | 32 | using namespace QT_CHARTS_NAMESPACE; 33 | 34 | /*! 35 | * \class PerSequenceGCCContent 36 | * \brief Per Sequence GC Content plots out the mean sequence GC % distribution 37 | * 38 | */ 39 | class PerSequenceGCContent : public Analysis 40 | { 41 | Q_OBJECT 42 | public: 43 | PerSequenceGCContent(QObject * parent = nullptr); 44 | 45 | virtual void processSequence(const Sequence& sequence) Q_DECL_OVERRIDE; 46 | virtual void reset() Q_DECL_OVERRIDE; 47 | virtual QWidget* createResultWidget() Q_DECL_OVERRIDE; 48 | 49 | private: 50 | 51 | QVector mGCCounts; 52 | quint64 mNbSeq; 53 | quint64 mXMax; 54 | }; 55 | 56 | #endif // PERSEQUENCEGCCONTENT_H 57 | -------------------------------------------------------------------------------- /analysis/persequencequalityanalysis.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Copyright 2016-17 Sacha Schutz 3 | 4 | This file is part of fastQT. 5 | 6 | Foobar is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | Foobar is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with Foobar. If not, see . 18 | 19 | @author : Pierre Lindenbaum from FastQC 20 | @author : Sacha Schutz 21 | @author : Pierre Marijon 22 | */ 23 | #include "persequencequalityanalysis.h" 24 | #include "sequence.h" 25 | 26 | PerSequenceQualityAnalysis::PerSequenceQualityAnalysis(QObject * parent) 27 | :Analysis(parent) 28 | { 29 | 30 | setName(tr("Sequence quality")); 31 | setDescription(tr("Per sequence quality scores")); 32 | 33 | } 34 | 35 | void PerSequenceQualityAnalysis::processSequence(const Sequence &sequence) 36 | { 37 | 38 | int averageQuality = 0; 39 | for (char bytes : sequence.quality()) 40 | { 41 | averageQuality += int(bytes); 42 | } 43 | 44 | if (sequence.size() > 0) 45 | averageQuality /= sequence.size(); 46 | 47 | averageQuality = int(averageQuality); 48 | 49 | if (mAverageScoreCounts.contains(averageQuality)) 50 | mAverageScoreCounts[averageQuality]++; 51 | else 52 | mAverageScoreCounts[averageQuality] = 1; 53 | 54 | 55 | 56 | } 57 | 58 | void PerSequenceQualityAnalysis::reset() 59 | { 60 | mAverageScoreCounts.clear(); 61 | } 62 | 63 | QWidget *PerSequenceQualityAnalysis::createResultWidget() 64 | { 65 | 66 | QLineSeries *lineseries = new QLineSeries (); 67 | 68 | QList keys = mAverageScoreCounts.keys(); 69 | QList values = mAverageScoreCounts.values(); 70 | 71 | 72 | 73 | QChartView * view = new QChartView; 74 | view->setRenderHint(QPainter::Antialiasing); 75 | 76 | // avoid crash 77 | if (keys.isEmpty() || values.isEmpty()) 78 | return view; 79 | 80 | qSort(keys); 81 | qSort(values); 82 | 83 | mEncodingScheme = PhredEncoding::fastqEncodingOffset(keys.first()); 84 | 85 | 86 | 87 | for (int key : keys ) 88 | { 89 | lineseries->append(QPoint(key-mEncodingScheme.offset(), mAverageScoreCounts[key])); 90 | } 91 | 92 | 93 | QChart * chart = new QChart(); 94 | chart->addSeries(lineseries); 95 | chart->setTitle(tr("Sequence quality")); 96 | chart->setAnimationOptions(QChart::NoAnimation); 97 | 98 | QValueAxis * axisX= new QValueAxis; 99 | axisX->setTickCount(10); 100 | axisX->setRange(keys.first()-mEncodingScheme.offset(), keys.last()-mEncodingScheme.offset()); 101 | axisX->setLabelFormat("%i"); 102 | axisX->setTitleText(tr("Score quality (phred)")); 103 | chart->setAxisX(axisX); 104 | 105 | QValueAxis * axisY= new QValueAxis; 106 | axisY->setTickCount(10); 107 | axisY->setRange(values.first(), values.last()); 108 | axisY->setLabelFormat("%i"); 109 | axisY->setTitleText(tr("Read count(s)")); 110 | 111 | 112 | chart->setAxisY(axisY); 113 | 114 | // add Actions 115 | view->setRubberBand(QChartView::HorizontalRubberBand); 116 | QAction * zoomReset = new QAction(QFontIcon::icon(0xf002), tr("Zoom reset"), view); 117 | QAction * zoomIn = new QAction(QFontIcon::icon(0xf00e), tr("Zoom in"), view); 118 | QAction * zoomOut = new QAction(QFontIcon::icon(0xf010), tr("Zoom out"), view); 119 | 120 | connect(zoomReset, &QAction::triggered, [chart](){chart->zoomReset();}); 121 | connect(zoomIn, &QAction::triggered, [chart](){chart->zoomIn();}); 122 | connect(zoomOut, &QAction::triggered, [chart](){chart->zoomOut();}); 123 | 124 | view->addAction(zoomReset); 125 | view->addAction(zoomIn); 126 | view->addAction(zoomOut); 127 | view->setChart(chart); 128 | 129 | return view; 130 | } 131 | -------------------------------------------------------------------------------- /analysis/persequencequalityanalysis.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Copyright 2016-17 Sacha Schutz 3 | 4 | This file is part of fastQT. 5 | 6 | Foobar is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | Foobar is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with Foobar. If not, see . 18 | 19 | @author : Pierre Lindenbaum from FastQC 20 | @author : Sacha Schutz 21 | @author : Pierre Marijon 22 | */ 23 | #ifndef PERSEQUENCEQUALITYANALYSIS_H 24 | #define PERSEQUENCEQUALITYANALYSIS_H 25 | 26 | #include 27 | #include 28 | #include "analysis.h" 29 | #include "phredencoding.h" 30 | 31 | using namespace QT_CHARTS_NAMESPACE; 32 | /*! 33 | * \class PerSequenceQualityAnalysis 34 | * \brief The per sequence quality score report allows you to see if a subset of your sequences have universally low quality values. 35 | * Relative to Per Sequence Quality Scores Scores FastQC module 36 | * 37 | */ 38 | class PerSequenceQualityAnalysis : public Analysis 39 | { 40 | Q_OBJECT 41 | public: 42 | PerSequenceQualityAnalysis(QObject * parent = nullptr); 43 | 44 | virtual void processSequence(const Sequence& sequence) Q_DECL_OVERRIDE; 45 | virtual void reset() Q_DECL_OVERRIDE; 46 | virtual QWidget* createResultWidget()Q_DECL_OVERRIDE; 47 | 48 | 49 | private: 50 | QHash mAverageScoreCounts; 51 | PhredEncoding mEncodingScheme; 52 | }; 53 | 54 | #endif // PERSEQUENCEQUALITYANALYSIS_H 55 | -------------------------------------------------------------------------------- /cli/cli.pri: -------------------------------------------------------------------------------- 1 | INCLUDEPATH+=$$PWD 2 | 3 | SOURCES += \ 4 | $$PWD/cliparser.cpp \ 5 | $$PWD/maincli.cpp 6 | 7 | HEADERS += \ 8 | $$PWD/cliparser.h \ 9 | $$PWD/maincli.h 10 | -------------------------------------------------------------------------------- /cli/cliparser.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Copyright 2016-17 Pierre Marijon 3 | 4 | This file is part of fastQT. 5 | 6 | Foobar is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | Foobar is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with Foobar. If not, see . 18 | 19 | @author : Pierre Lindenbaum from FastQC 20 | @author : Sacha Schutz 21 | @author : Pierre Marijon 22 | */ 23 | 24 | #include "cliparser.h" 25 | 26 | void populateCLIParser(QCommandLineParser &parser) 27 | { 28 | parser.setApplicationDescription("FastQt"); 29 | parser.addHelpOption(); 30 | parser.addVersionOption(); 31 | 32 | parser.addPositionalArgument("files", QCoreApplication::translate("files", "List of fastq files"), "[files...]"); 33 | 34 | QCommandLineOption outputOption(QStringList() << "o" << "outdir", 35 | QCoreApplication::tr("Create all output files in the specified output directory. Please note that this directory must exist as the program will not create it. If this option is not set then the output file for each sequence file is created in the same directory as the sequence file which was processed."), 36 | "outdir"); 37 | 38 | QCommandLineOption threadOption(QStringList() << "t" << "threads", 39 | QCoreApplication::tr("Specifies the number of files which can be processed simultaneously. Use by default all avaible CPU"), 40 | "threads"); 41 | QCommandLineOption citeOption("cite", 42 | QCoreApplication::tr("Get in bibtex format to cite FastQt")); 43 | 44 | // QCommandLineOption outImgFormatOption(QStringList() << "out-img-format", 45 | // QCoreApplication::tr("Specifies the format image output. By default value is \"svg\". Possible value is \"svg\" and \"png\"."), 46 | // "outimgformat", 47 | // "svg"); 48 | 49 | 50 | parser.addOption(outputOption); 51 | parser.addOption(threadOption); 52 | parser.addOption(citeOption); 53 | // parser.addOption(outImgFormatOption); 54 | } 55 | -------------------------------------------------------------------------------- /cli/cliparser.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Copyright 2016-17 Pierre Marijon 3 | 4 | This file is part of fastQT. 5 | 6 | Foobar is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | Foobar is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with Foobar. If not, see . 18 | 19 | @author : Pierre Lindenbaum from FastQC 20 | @author : Sacha Schutz 21 | @author : Pierre Marijon 22 | */ 23 | 24 | #ifndef CLIPARSER_H 25 | #define CLIPARSER_H 26 | 27 | #include 28 | 29 | void populateCLIParser(QCommandLineParser &parser); 30 | 31 | #endif // CLIPARSER_H 32 | -------------------------------------------------------------------------------- /cli/maincli.cpp: -------------------------------------------------------------------------------- 1 | #include "maincli.h" 2 | 3 | MainCLI::MainCLI(QCommandLineParser* parser, QObject *parent) : QEventLoop(parent), mParser(parser), mFormat(ImageFormat::SvgFormat) 4 | { 5 | mTimer = new QTimer(this); 6 | mTimer->start(1000); 7 | connect(mTimer,SIGNAL(timeout()),this,SLOT(updateInfo())); 8 | 9 | } 10 | 11 | int MainCLI::exec() 12 | { 13 | // check cite option if is set return citation in bibtex format and stop 14 | if (mParser->isSet("cite")) 15 | { 16 | cout<<"@misc{FastQt,"<positionalArguments().isEmpty()) 30 | { 31 | qDebug()<<"No fastq provided"; 32 | exit(); 33 | return 0; 34 | } 35 | 36 | // QString tmp = mParser->value("out-img-format"); 37 | // if (mParser->value("out-img-format") == "svg") 38 | // { 39 | // mFormat = ImageFormat::SvgFormat; 40 | // } 41 | // else if (mParser->value("out-img-format") == "png") 42 | // { 43 | // mFormat = ImageFormat::PngFormat; 44 | // } 45 | // else 46 | // { 47 | // qDebug()<value("out-img-format")<<" isn't a valid value for out-img-format, run --help option"; 48 | // exit(); 49 | // } 50 | 51 | // Set thread number 52 | int threadNumber; 53 | if (mParser->value("threads").isEmpty()) 54 | threadNumber = QThread::idealThreadCount(); 55 | else 56 | threadNumber = mParser->value("threads").toInt(); 57 | 58 | cout<<"Starting Analysis..."<positionalArguments().count()<positionalArguments()) 63 | cout<setMaxThreadCount(threadNumber); 68 | 69 | AnalysisRunner* runner; 70 | for(QString filename : mParser->positionalArguments()) 71 | { 72 | runner = AnalysisRunner::createAnalysisRunner(); 73 | runner->setFilename(filename); 74 | 75 | mRunnerList.append(runner); 76 | QFileInfo info(filename); 77 | cout<<"Start Analysis "<start(runner); 79 | } 80 | 81 | 82 | return QEventLoop::exec(); // Loop until all runner has been finished 83 | } 84 | 85 | void MainCLI::updateInfo() 86 | { 87 | 88 | for (AnalysisRunner * r : mRunnerList) 89 | { 90 | QFileInfo info(r->filename()); 91 | if (r->status() == AnalysisRunner::Running) 92 | cout<progression()<<" %"<value("outdir"); 106 | 107 | if (path.isEmpty()) 108 | { 109 | QFileInfo info(mRunnerList.first()->filename()); 110 | path = info.dir().path(); 111 | } 112 | 113 | cout<<"Save results in "<< path.toStdString()<saveAll(dir.path()); 119 | 120 | } 121 | 122 | 123 | } 124 | 125 | bool MainCLI::checkFinish() 126 | { 127 | 128 | for (AnalysisRunner * r : mRunnerList) 129 | { 130 | if (r->status() == AnalysisRunner::Running) 131 | return false; 132 | } 133 | 134 | return true; 135 | } 136 | -------------------------------------------------------------------------------- /cli/maincli.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINCLI_H 2 | #define MAINCLI_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include "analysisrunner.h" 10 | #include "imageformatdefinition.h" 11 | 12 | using namespace std; 13 | 14 | class MainCLI : public QEventLoop 15 | { 16 | Q_OBJECT 17 | public: 18 | explicit MainCLI(QCommandLineParser *parser, QObject *parent = 0); 19 | 20 | int exec(); 21 | 22 | 23 | protected Q_SLOTS: 24 | void updateInfo(); 25 | void saveResult(); 26 | 27 | protected: 28 | bool checkFinish(); 29 | 30 | private: 31 | QCommandLineParser* mParser; 32 | QTimer * mTimer; 33 | QList mRunnerList; 34 | ImageFormat mFormat; 35 | }; 36 | 37 | #endif // MAINCLI_H 38 | -------------------------------------------------------------------------------- /docs/_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-slate -------------------------------------------------------------------------------- /docs/test.txt: -------------------------------------------------------------------------------- 1 | ghpage 2 | -------------------------------------------------------------------------------- /fastqt.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=Application 3 | Name=FastQt 4 | Comment=A quality control tool for high throughput genomics sequence data. 5 | Exec=fastqt %F 6 | Icon=fastqt 7 | Terminal=false 8 | Categories=Science;Biology;Qt; 9 | -------------------------------------------------------------------------------- /fastqt.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/labsquare/FastQt/f69f9d5ba51b8863e7a645dbfc775fa0d8e41a50/fastqt.ico -------------------------------------------------------------------------------- /fastqt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/labsquare/FastQt/f69f9d5ba51b8863e7a645dbfc775fa0d8e41a50/fastqt.png -------------------------------------------------------------------------------- /fontawesome.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/labsquare/FastQt/f69f9d5ba51b8863e7a645dbfc775fa0d8e41a50/fontawesome.ttf -------------------------------------------------------------------------------- /innosetup.iss: -------------------------------------------------------------------------------- 1 | ; Script generated by the Inno Setup Script Wizard. 2 | ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! 3 | 4 | #define MyAppName "fastqt" 5 | #define MyAppVersion "0.2-rc" 6 | #define MyAppPublisher "labsquare" 7 | #define MyAppURL "http://www.labsquare.org" 8 | #define MyAppExeName "fastqt.exe" 9 | 10 | [Setup] 11 | ; NOTE: The value of AppId uniquely identifies this application. 12 | ; Do not use the same AppId value in installers for other applications. 13 | ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) 14 | AppId={{2E6BDE27-73F1-46FD-A12A-274E254CC13B} 15 | AppName={#MyAppName} 16 | AppVersion={#MyAppVersion} 17 | ;AppVerName={#MyAppName} {#MyAppVersion} 18 | AppPublisher={#MyAppPublisher} 19 | AppPublisherURL={#MyAppURL} 20 | AppSupportURL={#MyAppURL} 21 | AppUpdatesURL={#MyAppURL} 22 | DefaultDirName={pf}\labsquare\{#MyAppName} 23 | DisableProgramGroupPage=yes 24 | OutputBaseFilename=fastqt-0.2-rc 25 | Compression=lzma 26 | SolidCompression=yes 27 | LicenseFile=release\LICENSE.txt 28 | 29 | [Languages] 30 | Name: "english"; MessagesFile: "compiler:Default.isl" 31 | 32 | [Tasks] 33 | Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked 34 | 35 | [Files] 36 | Source: "release\fastqt.exe"; DestDir: "{app}"; Flags: ignoreversion 37 | Source: "release\D3Dcompiler_47.dll"; DestDir: "{app}"; Flags: ignoreversion 38 | Source: "release\fastqt.exe"; DestDir: "{app}"; Flags: ignoreversion 39 | ;Source: "release\libbz2-1.dll"; DestDir: "{app}"; Flags: ignoreversion 40 | Source: "release\libEGL.dll"; DestDir: "{app}"; Flags: ignoreversion 41 | Source: "release\libgcc_s_dw2-1.dll"; DestDir: "{app}"; Flags: ignoreversion 42 | Source: "release\libGLESV2.dll"; DestDir: "{app}"; Flags: ignoreversion 43 | Source: "release\libKF5Archive.dll"; DestDir: "{app}"; Flags: ignoreversion 44 | ;Source: "release\liblzma-5.dll"; DestDir: "{app}"; Flags: ignoreversion 45 | Source: "release\libstdc++-6.dll"; DestDir: "{app}"; Flags: ignoreversion 46 | Source: "release\libwinpthread-1.dll"; DestDir: "{app}"; Flags: ignoreversion 47 | Source: "release\opengl32sw.dll"; DestDir: "{app}"; Flags: ignoreversion 48 | Source: "release\Qt5Charts.dll"; DestDir: "{app}"; Flags: ignoreversion 49 | Source: "release\Qt5Core.dll"; DestDir: "{app}"; Flags: ignoreversion 50 | Source: "release\Qt5Gui.dll"; DestDir: "{app}"; Flags: ignoreversion 51 | Source: "release\Qt5Svg.dll"; DestDir: "{app}"; Flags: ignoreversion 52 | Source: "release\Qt5Widgets.dll"; DestDir: "{app}"; Flags: ignoreversion 53 | Source: "release\zlib1.dll"; DestDir: "{app}"; Flags: ignoreversion 54 | Source: "release\liblzma-5.dll"; DestDir: "{app}"; Flags: ignoreversion 55 | Source: "release\libbz2-1.dll"; DestDir: "{app}"; Flags: ignoreversion 56 | 57 | Source: "release\iconengines\*"; DestDir: "{app}\iconengines"; Flags: ignoreversion recursesubdirs createallsubdirs 58 | Source: "release\imageformats\*"; DestDir: "{app}\imageformats"; Flags: ignoreversion recursesubdirs createallsubdirs 59 | Source: "release\platforms\*"; DestDir: "{app}\platforms"; Flags: ignoreversion recursesubdirs createallsubdirs 60 | Source: "release\translations\*"; DestDir: "{app}\translations"; Flags: ignoreversion recursesubdirs createallsubdirs 61 | 62 | 63 | 64 | ; NOTE: Don't use "Flags: ignoreversion" on any shared system files 65 | 66 | [Icons] 67 | Name: "{commonprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}" 68 | Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon 69 | 70 | [Run] 71 | Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent 72 | 73 | -------------------------------------------------------------------------------- /labsquare.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/labsquare/FastQt/f69f9d5ba51b8863e7a645dbfc775fa0d8e41a50/labsquare.png -------------------------------------------------------------------------------- /main.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | Copyright Copyright 2016-17 Sacha Schutz 4 | 5 | This file is part of FastQt. 6 | 7 | Foobar is free software: you can redistribute it and/or modify 8 | it under the terms of the GNU General Public License as published by 9 | the Free Software Foundation, either version 3 of the License, or 10 | (at your option) any later version. 11 | 12 | Foobar is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with Foobar. If not, see . 19 | 20 | @author : Pierre Lindenbaum from FastQC 21 | @author : Sacha Schutz 22 | @author : Pierre Marijon 23 | */ 24 | #include 25 | #include "mainwindow.h" 26 | #include "perbasequalityanalysis.h" 27 | #include "sequence.h" 28 | #include "fastqreader.h" 29 | #include "qfonticon.h" 30 | #include "cliparser.h" 31 | #include "maincli.h" 32 | 33 | #include "htslib/hfile.h" 34 | 35 | int main(int argc, char *argv[]) 36 | { 37 | QApplication a(argc, argv); 38 | 39 | // Fix the threads numbers 40 | // QThreadPool::globalInstance()->setMaxThreadCount(2); 41 | 42 | 43 | 44 | a.setApplicationName("FastQt"); 45 | a.setOrganizationName("Labsquare"); 46 | a.setOrganizationDomain("labsquare.org"); 47 | a.setApplicationVersion("0.2.3"); 48 | 49 | QString locale = QLocale::system().name().section('_', 0, 0); 50 | 51 | QTranslator translator; 52 | translator.load(QStringLiteral("localization/fastqc_")+locale); 53 | a.installTranslator(&translator); 54 | 55 | 56 | qRegisterMetaType(); 57 | 58 | QFontIcon::addFont(":/fonts/fontawesome.ttf"); 59 | 60 | QCommandLineParser parser; 61 | populateCLIParser(parser); 62 | 63 | parser.process(a); 64 | 65 | if(parser.positionalArguments().empty() && !parser.isSet("cite")) 66 | { 67 | MainWindow window; 68 | window.show(); 69 | 70 | return a.exec(); 71 | } 72 | 73 | else 74 | { 75 | MainCLI cli(&parser); 76 | cli.exec(); 77 | 78 | } 79 | 80 | return 0; 81 | } 82 | -------------------------------------------------------------------------------- /model/keyvaluemodel.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Copyright 2016-17 Sacha Schutz 3 | 4 | This file is part of FastQt. 5 | 6 | Foobar is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | Foobar is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with Foobar. If not, see . 18 | 19 | @author : Pierre Lindenbaum from FastQC 20 | @author : Sacha Schutz 21 | @author : Pierre Marijon 22 | */ 23 | #include "keyvaluemodel.h" 24 | 25 | 26 | KeyValueModel::KeyValueModel(QObject *parent) 27 | :QAbstractListModel(parent) 28 | { 29 | 30 | } 31 | 32 | void KeyValueModel::addValue(const QString &label, const QVariant &value, const QString &description) 33 | { 34 | beginResetModel(); 35 | mDatas.insert(label, value); 36 | mDescriptions.insert(label, description); 37 | endResetModel(); 38 | 39 | } 40 | 41 | int KeyValueModel::columnCount(const QModelIndex &parent) const 42 | { 43 | Q_UNUSED(parent) 44 | return 2; 45 | } 46 | 47 | int KeyValueModel::rowCount(const QModelIndex &parent) const 48 | { 49 | Q_UNUSED(parent) 50 | return mDatas.count(); 51 | } 52 | 53 | QVariant KeyValueModel::data(const QModelIndex &index, int role) const 54 | { 55 | if (!index.isValid()) 56 | return QVariant(); 57 | 58 | 59 | QString key = mDatas.keys().at(index.row()); 60 | 61 | if (role == Qt::DisplayRole) 62 | { 63 | if (index.column() == 0) 64 | return key; 65 | 66 | if (index.column() == 1) 67 | return mDatas.value(key); 68 | } 69 | 70 | 71 | if ( role == Qt::ToolTipRole) 72 | return mDescriptions.value(key); 73 | 74 | return QVariant(); 75 | 76 | } 77 | -------------------------------------------------------------------------------- /model/keyvaluemodel.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Copyright 2016-17 Sacha Schutz 3 | 4 | This file is part of FastQt. 5 | 6 | Foobar is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | Foobar is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with Foobar. If not, see . 18 | 19 | @author : Pierre Lindenbaum from FastQC 20 | @author : Sacha Schutz 21 | @author : Pierre Marijon 22 | */ 23 | #ifndef KEYVALUEMODEL_H 24 | #define KEYVALUEMODEL_H 25 | #include 26 | #include 27 | /*! 28 | * \class KeyValueModel 29 | * \brief A simple key/model view 30 | * Display Key/value in a Table View. This class is used in BasicStatsAnalysis 31 | */ 32 | class KeyValueModel : public QAbstractListModel 33 | { 34 | public: 35 | KeyValueModel(QObject * parent = 0); 36 | 37 | void addValue(const QString& label, const QVariant& value, const QString& description = QStringLiteral()); 38 | 39 | 40 | 41 | protected: 42 | int columnCount(const QModelIndex &parent) const override; 43 | int rowCount(const QModelIndex &parent) const override; 44 | QVariant data(const QModelIndex &index, int role) const override; 45 | 46 | private: 47 | QHash mDatas; 48 | QHash mDescriptions; 49 | 50 | 51 | }; 52 | 53 | #endif // KEYVALUEMODEL_H 54 | -------------------------------------------------------------------------------- /model/mainanalysemodel.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINANALYSEMODEL_H 2 | #define MAINANALYSEMODEL_H 3 | 4 | #include 5 | #include 6 | 7 | #include "qfonticon.h" 8 | #include "analysisrunner.h" 9 | 10 | class MainAnalyseModel : public QAbstractListModel 11 | { 12 | Q_OBJECT 13 | public: 14 | enum { 15 | NameColumn = 0, 16 | StatusColumn, 17 | SizeColumn, 18 | ProgressColumn, 19 | ReadsColumn, 20 | TimeColumn 21 | }; 22 | MainAnalyseModel(QObject * parent = nullptr); 23 | int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; 24 | int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; 25 | QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE; 26 | QVariant headerData(int section, Qt::Orientation orientation, int role) const Q_DECL_OVERRIDE; 27 | 28 | 29 | void remove(const QList& index); 30 | 31 | 32 | void addFile(const QString& filename); 33 | AnalysisRunner * runner(const QModelIndex& index); 34 | 35 | protected Q_SLOTS: 36 | void timeUpdated(); 37 | 38 | 39 | private: 40 | QList mRunners; 41 | QSignalMapper *mSignalMapper; 42 | QTimer * mTimer; 43 | 44 | 45 | }; 46 | 47 | #endif // MAINANALYSEMODEL_H 48 | -------------------------------------------------------------------------------- /model/model.pri: -------------------------------------------------------------------------------- 1 | INCLUDEPATH+= $$PWD 2 | 3 | HEADERS += \ 4 | $$PWD/keyvaluemodel.h \ 5 | $$PWD/mainanalysemodel.h 6 | 7 | SOURCES += \ 8 | $$PWD/keyvaluemodel.cpp \ 9 | $$PWD/mainanalysemodel.cpp 10 | -------------------------------------------------------------------------------- /myapp.rc: -------------------------------------------------------------------------------- 1 | IDI_ICON1 ICON DISCARDABLE "fastqt.ico" -------------------------------------------------------------------------------- /resources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | fontawesome.ttf 4 | 5 | 6 | LICENSE 7 | AUTHORS 8 | CREDITS 9 | CHANGELOG 10 | 11 | 12 | labsquare.png 13 | fastqt.png 14 | 15 | 16 | -------------------------------------------------------------------------------- /screenshot.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/labsquare/FastQt/f69f9d5ba51b8863e7a645dbfc775fa0d8e41a50/screenshot.gif -------------------------------------------------------------------------------- /sequence/abstractsequencereader.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Copyright 2016-17 Sacha Schutz 3 | 4 | This file is part of FastQt. 5 | 6 | Foobar is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | Foobar is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with Foobar. If not, see . 18 | 19 | @author : Pierre Lindenbaum from FastQC 20 | @author : Sacha Schutz 21 | @author : Pierre Marijon 22 | */ 23 | #include "abstractsequencereader.h" 24 | #include "sequence.h" 25 | #include 26 | 27 | AbstractSequenceReader::AbstractSequenceReader(QIODevice *device) 28 | :mDevice(device) 29 | { 30 | 31 | 32 | } 33 | 34 | const Sequence &AbstractSequenceReader::sequence() const 35 | { 36 | return mSequence; 37 | } 38 | 39 | QIODevice *AbstractSequenceReader::device() const 40 | { 41 | return mDevice; 42 | } 43 | 44 | void AbstractSequenceReader::setSequence(const Sequence &seq) 45 | { 46 | 47 | mSequence = seq; 48 | } 49 | -------------------------------------------------------------------------------- /sequence/abstractsequencereader.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Copyright 2016-17 Sacha Schutz 3 | 4 | This file is part of FastQt. 5 | 6 | Foobar is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | Foobar is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with Foobar. If not, see . 18 | 19 | @author : Pierre Lindenbaum from FastQC 20 | @author : Sacha Schutz 21 | @author : Pierre Marijon 22 | */ 23 | #ifndef ABSTRACTSEQUENCEREADER_H 24 | #define ABSTRACTSEQUENCEREADER_H 25 | #include 26 | #include "sequence.h" 27 | /*! 28 | * \class AbstractSequenceReader 29 | * \brief Base class for all Sequence reader like FastqReader 30 | * Process each Sequence from a QIODevice like a file 31 | * \example 32 | * QFile file("example.fastq"); 33 | * if (file.open(QIODevice::ReadOnly)) 34 | * { 35 | * FastqReader reader(&file); 36 | * while (reader.next()) 37 | * { 38 | * qDebug()<fileName(); 7 | } 8 | 9 | bool BamReader::next() 10 | { 11 | if (fp_in == nullptr) 12 | { 13 | fp_in = hts_open(mFilename.toStdString().c_str(),"r"); //open bam file 14 | bamHdr = sam_hdr_read(fp_in); //read header 15 | aln = bam_init1(); //initialize an alignment 16 | } 17 | 18 | 19 | if ( sam_read1(fp_in,bamHdr,aln) > 0 ) 20 | { 21 | Sequence seq; 22 | 23 | uint32_t len = aln->core.l_qseq; //length of the read. 24 | 25 | uint8_t *q = bam_get_seq(aln); //sequence string 26 | uint8_t *q2 = bam_get_qual(aln); //sequence quality 27 | 28 | char *qseq = static_cast(malloc(len)); 29 | char* qqua = static_cast(malloc(len)); 30 | 31 | for(unsigned int i=0; i< len ; i++){ 32 | qseq[i] = seq_nt16_str[bam_seqi(q,i)]; //gets nucleotide id and converts them into IUPAC id. 33 | qqua[i] = static_cast(q2[i]); 34 | } 35 | 36 | seq.setSequence(QByteArray(qseq, len)); 37 | seq.setQuality(QByteArray(qqua, len)); 38 | 39 | 40 | // update sequence 41 | setSequence(seq); 42 | return true; 43 | 44 | } 45 | 46 | else 47 | { 48 | bam_destroy1(aln); 49 | sam_close(fp_in); 50 | } 51 | 52 | return false; 53 | } 54 | -------------------------------------------------------------------------------- /sequence/bamreader.h: -------------------------------------------------------------------------------- 1 | #ifndef BAMREADER_H 2 | #define BAMREADER_H 3 | #include 4 | #include "fastqreader.h" 5 | #include "htslib/sam.h" 6 | 7 | class BamReader : public AbstractSequenceReader 8 | { 9 | public: 10 | BamReader(QFile *device); 11 | bool next() Q_DECL_OVERRIDE; 12 | 13 | 14 | private: 15 | QString mFilename; 16 | 17 | samFile *fp_in = nullptr; 18 | bam_hdr_t *bamHdr = nullptr; 19 | bam1_t *aln = nullptr; 20 | }; 21 | 22 | #endif // BAMREADER_H 23 | -------------------------------------------------------------------------------- /sequence/fastqreader.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Copyright 2016-17 Sacha Schutz 3 | 4 | This file is part of FastQt. 5 | 6 | Foobar is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | Foobar is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with Foobar. If not, see . 18 | 19 | @author : Pierre Lindenbaum from FastQC 20 | @author : Sacha Schutz 21 | @author : Pierre Marijon 22 | */ 23 | #include "fastqreader.h" 24 | #include "sequence.h" 25 | 26 | 27 | FastqReader::FastqReader(QIODevice *device) 28 | :AbstractSequenceReader(device) 29 | { 30 | 31 | 32 | } 33 | 34 | 35 | 36 | bool FastqReader::next() 37 | { 38 | 39 | 40 | Sequence readSequence; 41 | 42 | // read ID 43 | 44 | 45 | readSequence.setId(device()->readLine()); 46 | 47 | // to make compatible with QUazip 48 | if (readSequence.id().isEmpty()) 49 | return false; 50 | 51 | // read sequence 52 | readSequence.setSequence(device()->readLine()); 53 | // read unused + 54 | device()->readLine(); 55 | // read qualities 56 | readSequence.setQuality(device()->readLine()); 57 | 58 | 59 | setSequence(readSequence); 60 | 61 | return true; 62 | } 63 | 64 | 65 | -------------------------------------------------------------------------------- /sequence/fastqreader.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Copyright 2016-17 Sacha Schutz 3 | 4 | This file is part of FastQt. 5 | 6 | Foobar is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | Foobar is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with Foobar. If not, see . 18 | 19 | @author : Pierre Lindenbaum from FastQC 20 | @author : Sacha Schutz 21 | @author : Pierre Marijon 22 | */ 23 | #ifndef FASTQREADER_H 24 | #define FASTQREADER_H 25 | 26 | #include "abstractsequencereader.h" 27 | /*! 28 | * \class FastqReader 29 | * \brief Base class for all Sequence Reader 30 | * Read each Sequence from a QIODevice 31 | */ 32 | class FastqReader : public AbstractSequenceReader 33 | { 34 | public: 35 | FastqReader(QIODevice * device); 36 | bool next() Q_DECL_OVERRIDE; 37 | 38 | 39 | 40 | private: 41 | 42 | }; 43 | 44 | #endif // FASTQREADER_H 45 | -------------------------------------------------------------------------------- /sequence/phredencoding.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Copyright 2016-17 Sacha Schutz 3 | 4 | This file is part of FastQt. 5 | 6 | Foobar is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | Foobar is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with Foobar. If not, see . 18 | 19 | @author : Pierre Lindenbaum from FastQC 20 | @author : Sacha Schutz 21 | @author : Pierre Marijon 22 | */ 23 | #include "phredencoding.h" 24 | 25 | PhredEncoding::PhredEncoding(const QString& n, int offset) 26 | :mName(n), mOffset(offset) 27 | { 28 | 29 | } 30 | 31 | PhredEncoding PhredEncoding::fastqEncodingOffset(char lowestChar) 32 | { 33 | qDebug()<< int(lowestChar); 34 | 35 | if (lowestChar < 33){ 36 | qCritical()< 126 (Yours was %1)").arg(lowestChar); 55 | return PhredEncoding(); 56 | 57 | } 58 | 59 | bool PhredEncoding::isValid() 60 | { 61 | return !mName.isEmpty(); 62 | } 63 | -------------------------------------------------------------------------------- /sequence/phredencoding.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Copyright 2016-17 Sacha Schutz 3 | 4 | This file is part of FastQt. 5 | 6 | Foobar is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | Foobar is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with Foobar. If not, see . 18 | 19 | @author : Pierre Lindenbaum from FastQC 20 | @author : Sacha Schutz 21 | @author : Pierre Marijon 22 | */ 23 | #ifndef PHREDENCODING_H 24 | #define PHREDENCODING_H 25 | #include 26 | /*! 27 | * \class PhredEncoding 28 | * \brief Detect Quality encoding from Fastq file 29 | */ 30 | class PhredEncoding 31 | { 32 | public: 33 | PhredEncoding(const QString& n = QStringLiteral(), int offset = 0); 34 | 35 | static PhredEncoding fastqEncodingOffset(char lowestChar); 36 | bool isValid(); 37 | 38 | const QString& name() const { return mName;} 39 | int offset() const {return mOffset;} 40 | 41 | 42 | private: 43 | 44 | QString mName; 45 | int mOffset; 46 | static const int SANGER_ENCODING_OFFSET = 33; 47 | static const int ILLUMINA_1_3_ENCODING_OFFSET = 64; 48 | 49 | 50 | 51 | }; 52 | 53 | #endif // PHREDENCODING_H 54 | -------------------------------------------------------------------------------- /sequence/sequence.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Copyright 2016-17 Pierre Marijon 3 | 4 | This file is part of FastQt. 5 | 6 | Foobar is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | Foobar is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with Foobar. If not, see . 18 | 19 | @author : Pierre Lindenbaum from FastQC 20 | @author : Sacha Schutz 21 | @author : Pierre Marijon 22 | */ 23 | 24 | #include "sequence.h" 25 | 26 | qreal Sequence::gc_percent() const 27 | { 28 | long nb_gc = 0; 29 | 30 | for(auto nuc : mSequence) 31 | { 32 | // When sequence is add is capitalized 33 | if(nuc == 'G' || nuc == 'C') 34 | nb_gc++; 35 | } 36 | 37 | return nb_gc/(double)size()*100; 38 | } 39 | 40 | bool Sequence::isValid() const 41 | { 42 | return (sequence().length() == quality().length()); 43 | } 44 | -------------------------------------------------------------------------------- /sequence/sequence.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Copyright 2016-17 Sacha Schutz 3 | 4 | This file is part of FastQt. 5 | 6 | Foobar is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | Foobar is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with Foobar. If not, see . 18 | 19 | @author : Pierre Lindenbaum from FastQC 20 | @author : Sacha Schutz 21 | @author : Pierre Marijon 22 | */ 23 | #ifndef SEQUENCE_H 24 | #define SEQUENCE_H 25 | #include 26 | /*! 27 | * \class Sequence 28 | * \brief Sequence contains identifier, nucleotid sequence and quality 29 | * @see AbstractSequenceReader 30 | */ 31 | class Sequence 32 | { 33 | public: 34 | Sequence(); 35 | Sequence(const QByteArray& id, const QByteArray& sequence, const QByteArray& quality); 36 | 37 | 38 | const QByteArray &id() const; 39 | void setId(const QByteArray &id); 40 | 41 | const QByteArray &sequence() const; 42 | void setSequence(const QByteArray &sequence); 43 | 44 | const QByteArray &quality() const; 45 | void setQuality(const QByteArray &quality); 46 | 47 | qreal gc_percent() const; 48 | 49 | int size() const; 50 | 51 | bool isValid() const; 52 | 53 | private: 54 | QByteArray mId; 55 | QByteArray mSequence; 56 | QByteArray mQuality; 57 | 58 | }; 59 | Q_DECLARE_METATYPE(Sequence) 60 | 61 | inline Sequence::Sequence() 62 | { 63 | 64 | } 65 | 66 | inline Sequence::Sequence(const QByteArray &id, const QByteArray &sequence, const QByteArray &quality) 67 | :mId(id), mSequence(sequence.trimmed().toUpper()), mQuality(quality.trimmed()) 68 | { 69 | 70 | } 71 | 72 | inline const QByteArray &Sequence::id() const 73 | { 74 | return mId; 75 | } 76 | 77 | inline void Sequence::setId(const QByteArray &id) 78 | { 79 | mId = id; 80 | } 81 | 82 | inline const QByteArray &Sequence::sequence() const 83 | { 84 | return mSequence; 85 | } 86 | 87 | inline void Sequence::setSequence(const QByteArray &sequence) 88 | { 89 | mSequence = sequence.trimmed().toUpper(); 90 | } 91 | 92 | inline const QByteArray &Sequence::quality() const 93 | { 94 | return mQuality; 95 | } 96 | 97 | inline void Sequence::setQuality(const QByteArray &quality) 98 | { 99 | mQuality = quality.trimmed(); 100 | } 101 | 102 | inline int Sequence::size() const 103 | { 104 | return mSequence.size(); 105 | } 106 | 107 | #endif // SEQUENCE_H 108 | -------------------------------------------------------------------------------- /sequence/sequence.pri: -------------------------------------------------------------------------------- 1 | INCLUDEPATH+=$$PWD 2 | 3 | HEADERS += \ 4 | $$PWD/sequence.h \ 5 | $$PWD/abstractsequencereader.h \ 6 | $$PWD/fastqreader.h \ 7 | $$PWD/phredencoding.h \ 8 | $$PWD/bamreader.h 9 | 10 | SOURCES += \ 11 | $$PWD/abstractsequencereader.cpp \ 12 | $$PWD/fastqreader.cpp \ 13 | $$PWD/phredencoding.cpp \ 14 | $$PWD/sequence.cpp \ 15 | $$PWD/bamreader.cpp 16 | -------------------------------------------------------------------------------- /ui/aboutdialog.cpp: -------------------------------------------------------------------------------- 1 | #include "aboutdialog.h" 2 | 3 | AboutDialog::AboutDialog(QWidget * parent) 4 | :QDialog(parent) 5 | { 6 | mTabWidget = new QTabWidget(this); 7 | mHeader = new QLabel(this); 8 | mButtonBox = new QDialogButtonBox(this); 9 | 10 | 11 | QPushButton * githubButton = mButtonBox->addButton("Github",QDialogButtonBox::HelpRole); 12 | QPushButton * twitterButton= mButtonBox->addButton("Twitter",QDialogButtonBox::HelpRole); 13 | 14 | mButtonBox->addButton(QDialogButtonBox::Ok); 15 | githubButton->setIcon(QFontIcon::icon(0xf09b)); 16 | twitterButton->setIcon(QFontIcon::icon(0xf099)); 17 | QVBoxLayout * vLayout = new QVBoxLayout; 18 | vLayout->addWidget(mHeader); 19 | vLayout->addWidget(mTabWidget); 20 | vLayout->addWidget(mButtonBox); 21 | 22 | 23 | 24 | // vLayout->setContentsMargins(0,0,0,0); 25 | // vLayout->setSpacing(2); 26 | setLayout(vLayout); 27 | 28 | addTab(":/text/LICENSE"); 29 | addTab(":/text/AUTHORS"); 30 | addTab(":/text/CREDITS"); 31 | addTab(":/text/CHANGELOG"); 32 | 33 | mTitle = qApp->applicationName(); 34 | mSubtitle = QStringLiteral("Version %1\nGPL3 Copyright (C) 2017\nLabsquare.org").arg(qApp->applicationVersion()); 35 | drawHeader(); 36 | 37 | setWindowTitle(tr("About %1").arg(qApp->applicationName())); 38 | 39 | 40 | 41 | connect(githubButton, SIGNAL(clicked(bool)), this,SLOT(openGithub())); 42 | connect(twitterButton, SIGNAL(clicked(bool)), this,SLOT(openTwitter())); 43 | 44 | connect(mButtonBox, SIGNAL(accepted()), this, SLOT(close())); 45 | 46 | /* easter egg */ 47 | i_kc_offset = 0; 48 | } 49 | 50 | void AboutDialog::addTab(const QString &textFile) 51 | { 52 | 53 | QFile file(textFile); 54 | QFileInfo info(file); 55 | if (file.open(QIODevice::ReadOnly)) 56 | { 57 | QPlainTextEdit * edit = new QPlainTextEdit(this); 58 | edit->setPlainText(file.readAll()); 59 | mTabWidget->addTab(edit,info.baseName()); 60 | edit->setFrameShape(QFrame::NoFrame); 61 | edit->setReadOnly(true); 62 | } 63 | 64 | file.close(); 65 | 66 | 67 | } 68 | 69 | void AboutDialog::drawHeader() 70 | { 71 | int pHeight = 90; 72 | int pMargin = 15; 73 | 74 | mHeader->setMinimumHeight(pHeight); 75 | mHeader->setFrameShape(QFrame::StyledPanel); 76 | 77 | mHeader->setContentsMargins(0,0,0,0); 78 | 79 | QPixmap pix(450, pHeight); 80 | pix.fill(Qt::transparent); 81 | QPainter painter(&pix); 82 | 83 | int iconY = (pHeight - 64)/2; 84 | QRect logoRect(pMargin,iconY,64,64); 85 | 86 | painter.setBrush(QBrush(Qt::red)); 87 | painter.drawPixmap(logoRect,QPixmap(":/icons/fastqt.png").scaled(logoRect.width(), logoRect.height(),Qt::KeepAspectRatio,Qt::SmoothTransformation)); 88 | 89 | QRect titleRect(logoRect.right()+ 10,iconY, 200, pHeight); 90 | 91 | QFont font; 92 | font.setBold(true); 93 | font.setPixelSize(16); 94 | painter.setFont(font); 95 | painter.setPen(QPen(QColor("#555753"))); 96 | painter.drawText(titleRect, Qt::AlignTop, mTitle); 97 | QFontMetrics fm(font); 98 | 99 | font.setBold(false); 100 | font.setPixelSize(12); 101 | painter.setFont(font); 102 | painter.setPen(QPen(Qt::darkGray)); 103 | titleRect.setY(titleRect.y() + fm.height()); 104 | 105 | painter.drawText(titleRect, Qt::AlignTop, mSubtitle); 106 | 107 | // QPixmap labsquareLogo(":/icons/labsquare.png"); 108 | // labsquareLogo = labsquareLogo.scaled(64,64,Qt::KeepAspectRatio,Qt::SmoothTransformation); 109 | // painter.drawPixmap(pix.rect().right()-labsquareLogo.width() - pMargin , pix.rect().bottom() - labsquareLogo.height() - 15, labsquareLogo); 110 | 111 | 112 | 113 | mHeader->setPixmap(pix); 114 | 115 | 116 | 117 | } 118 | 119 | void AboutDialog::openGithub() 120 | { 121 | QDesktopServices::openUrl(QUrl("https://github.com/labsquare/fastQt")) ; 122 | } 123 | 124 | void AboutDialog::openTwitter() 125 | { 126 | QDesktopServices::openUrl(QUrl("https://twitter.com/labsquare")) ; 127 | 128 | } 129 | 130 | bool AboutDialog::event(QEvent *e) 131 | { 132 | if (e->type() == QEvent::KeyRelease) 133 | { 134 | QKeyEvent * keyEvent = dynamic_cast(e); 135 | /* easter eggs sequence handling */ 136 | if ( keyEvent->key() == kc[ i_kc_offset ] ) 137 | i_kc_offset++; 138 | else 139 | i_kc_offset = 0; 140 | 141 | if ( i_kc_offset == (sizeof( kc ) / sizeof( Qt::Key )) ) 142 | { 143 | i_kc_offset = 0; 144 | QDesktopServices::openUrl(QUrl("http://easteregg.labsquare.org/fastqt/enigme.html")); 145 | } 146 | } 147 | 148 | return this->QDialog::event(e); 149 | } 150 | -------------------------------------------------------------------------------- /ui/aboutdialog.h: -------------------------------------------------------------------------------- 1 | #ifndef ABOUTDIALOG_H 2 | #define ABOUTDIALOG_H 3 | #include 4 | #include 5 | #include 6 | #include "qfonticon.h" 7 | class AboutDialog : public QDialog 8 | { 9 | Q_OBJECT 10 | public: 11 | AboutDialog(QWidget * parent = 0); 12 | 13 | protected: 14 | void addTab(const QString& textFile); 15 | void drawHeader(); 16 | 17 | bool event(QEvent *e); 18 | 19 | 20 | 21 | protected Q_SLOTS: 22 | void openGithub(); 23 | void openTwitter(); 24 | 25 | private: 26 | QTabWidget * mTabWidget; 27 | QLabel * mHeader; 28 | QString mTitle; 29 | QString mSubtitle; 30 | QDialogButtonBox * mButtonBox; 31 | QString mKonami; 32 | 33 | /* easter egg */ 34 | Qt::Key kc[10] = { 35 | Qt::Key_Up, Qt::Key_Up, 36 | Qt::Key_Down, Qt::Key_Down, 37 | Qt::Key_Left, Qt::Key_Right, Qt::Key_Left, Qt::Key_Right, 38 | Qt::Key_B, Qt::Key_A 39 | }; 40 | int i_kc_offset; 41 | }; 42 | 43 | #endif // ABOUTDIALOG_H 44 | -------------------------------------------------------------------------------- /ui/mainanalyseview.cpp: -------------------------------------------------------------------------------- 1 | #include "mainanalyseview.h" 2 | 3 | // =============== DELEGATE ============================================ 4 | 5 | void MainAnalyseDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const 6 | { 7 | 8 | if (index.column() == MainAnalyseModel::ProgressColumn) 9 | { 10 | int progress = index.data().toInt(); 11 | // if (progress == 100) 12 | // { 13 | // QApplication::style()->drawItemText(painter,option.rect,Qt::AlignCenter,option.palette,true,"Done"); 14 | // return; 15 | 16 | // } 17 | 18 | if( option.state & QStyle::State_Selected ) 19 | { 20 | painter->fillRect( option.rect, option.palette.highlight() ); 21 | } 22 | 23 | 24 | QStyleOptionProgressBar progressBarOption; 25 | progressBarOption.rect = option.rect.adjusted(5,5,-5,-5); 26 | 27 | 28 | progressBarOption.minimum = 0; 29 | progressBarOption.maximum = progress == -1 ? 0 : 100; 30 | progressBarOption.textAlignment = Qt::AlignCenter; 31 | progressBarOption.progress = progress; 32 | progressBarOption.text = progress == -1 ? QStringLiteral("∞") : QStringLiteral( "%1%" ).arg ( progress ); 33 | progressBarOption.textVisible = true; 34 | QApplication::style()->drawControl ( QStyle::CE_ProgressBar, &progressBarOption, painter ); 35 | 36 | } 37 | 38 | else 39 | QStyledItemDelegate::paint ( painter, option, index ); 40 | 41 | } 42 | 43 | // =============== VIEW ============================================ 44 | 45 | MainAnalyseView::MainAnalyseView(QWidget * parent ) 46 | :QTableView(parent) 47 | { 48 | mModel = new MainAnalyseModel; 49 | mDelegate = new MainAnalyseDelegate; 50 | mExportDialog = new QProgressDialog(); 51 | mExportDialog->close(); 52 | 53 | 54 | 55 | 56 | setModel(mModel); 57 | setItemDelegate(mDelegate); 58 | setAcceptDrops(true); 59 | setDropIndicatorShown(true); 60 | setDragDropMode(QAbstractItemView::DragDrop); 61 | 62 | 63 | verticalHeader()->hide(); 64 | 65 | setAlternatingRowColors(true); 66 | setSelectionBehavior(QAbstractItemView::SelectRows); 67 | setSelectionMode(QAbstractItemView::ExtendedSelection); 68 | horizontalHeader()->setStretchLastSection(true); 69 | 70 | setColumnWidth(0, 250); 71 | 72 | setIconSize(QSize(22,22)); 73 | setShowGrid(false); 74 | 75 | connect(this,SIGNAL(doubleClicked(QModelIndex)),this,SLOT(showAnalysis(QModelIndex))); 76 | 77 | 78 | new QShortcut(QKeySequence::Delete,this, SLOT(removeSelection())); 79 | 80 | 81 | 82 | 83 | } 84 | 85 | MainAnalyseView::~MainAnalyseView() 86 | { 87 | mModel->deleteLater(); 88 | mDelegate->deleteLater(); 89 | } 90 | 91 | void MainAnalyseView::addFile(const QString &filename) 92 | { 93 | checkFile(filename); 94 | 95 | mModel->addFile(filename); 96 | 97 | } 98 | 99 | void MainAnalyseView::showAnalysis(const QModelIndex &index) 100 | { 101 | 102 | AnalysisRunner * runner = mModel->runner(index); 103 | 104 | if (runner->status() != AnalysisRunner::Finished) 105 | return; 106 | 107 | if (mAnalysisWidgets.keys().contains(runner)){ 108 | mAnalysisWidgets[runner]->show(); 109 | qApp->setActiveWindow(mAnalysisWidgets[runner]); 110 | 111 | } 112 | 113 | else 114 | { 115 | qDebug()<<"Create"; 116 | MainAnalyseWidget * w = new MainAnalyseWidget(); 117 | w->setRunner(runner); 118 | mAnalysisWidgets.insert(runner,w); 119 | w->show(); 120 | } 121 | 122 | } 123 | 124 | void MainAnalyseView::exportSelection(const QString &path) 125 | { 126 | QModelIndexList list = selectionModel()->selectedRows(); 127 | if (list.isEmpty()) 128 | return; 129 | 130 | QProgressDialog dialog(tr("Exporting ..."), tr("Cancel"), 0, list.length(), this); 131 | dialog.setWindowTitle(tr("Export analysis")); 132 | dialog.setWindowModality(Qt::WindowModal); 133 | dialog.setMinimumDuration(0); 134 | dialog.resize(300,80); 135 | dialog.show(); 136 | int progress = 0; 137 | 138 | for ( QModelIndex index : list){ 139 | 140 | if (dialog.wasCanceled()) 141 | break; 142 | 143 | AnalysisRunner * runner = mModel->runner(index); 144 | if (runner->status() == AnalysisRunner::Finished) 145 | { 146 | runner->saveAll(path); 147 | } 148 | progress++; 149 | dialog.setValue(progress); 150 | QFileInfo info(runner->filename()); 151 | dialog.setLabelText(info.fileName()); 152 | } 153 | } 154 | 155 | 156 | void MainAnalyseView::dragEnterEvent(QDragEnterEvent *event) 157 | { 158 | if (!event->mimeData()->hasUrls()) 159 | return; 160 | 161 | event->acceptProposedAction(); 162 | } 163 | 164 | void MainAnalyseView::dragMoveEvent(QDragMoveEvent *event) 165 | { 166 | event->acceptProposedAction(); 167 | } 168 | 169 | void MainAnalyseView::dropEvent(QDropEvent *event) 170 | { 171 | for (QUrl url : event->mimeData()->urls()) 172 | addFile(url.toLocalFile()); 173 | 174 | } 175 | 176 | bool MainAnalyseView::checkFile(const QString &path) 177 | { 178 | QFileInfo info(path); 179 | 180 | if (!info.exists()) 181 | return false; 182 | 183 | if (info.size() == 0) 184 | return false; 185 | 186 | return true; 187 | } 188 | 189 | 190 | void MainAnalyseView::removeSelection() 191 | { 192 | 193 | QList rows; 194 | for ( QModelIndex index : selectionModel()->selectedRows()){ 195 | rows.append(index.row()); 196 | 197 | if (mAnalysisWidgets.contains(mModel->runner(index))){ 198 | mAnalysisWidgets[mModel->runner(index)]->close(); 199 | delete mAnalysisWidgets.take(mModel->runner(index)); 200 | } 201 | 202 | } 203 | 204 | mModel->remove(rows); 205 | } 206 | 207 | void MainAnalyseView::stopSelection() 208 | { 209 | for ( QModelIndex index : selectionModel()->selectedRows()){ 210 | mModel->runner(index)->cancel(); 211 | 212 | if (mAnalysisWidgets.contains(mModel->runner(index))){ 213 | mAnalysisWidgets[mModel->runner(index)]->close(); 214 | } 215 | 216 | } 217 | } 218 | 219 | void MainAnalyseView::clearAll() 220 | { 221 | QList rows; 222 | for (int i=0; irowCount(); ++i) 223 | { 224 | AnalysisRunner::Status status = mModel->runner(mModel->index(i))->status(); 225 | 226 | if (status == AnalysisRunner::Finished || status == AnalysisRunner::Canceled) 227 | rows.append(i); 228 | } 229 | 230 | mModel->remove(rows); 231 | } 232 | 233 | 234 | 235 | 236 | -------------------------------------------------------------------------------- /ui/mainanalyseview.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINANALYSEVIEW_H 2 | #define MAINANALYSEVIEW_H 3 | #include 4 | #include 5 | #include 6 | #include "mainanalysemodel.h" 7 | #include "mainanalysewidget.h" 8 | 9 | class MainAnalyseView; 10 | class MainAnalyseDelegate; 11 | 12 | 13 | class MainAnalyseDelegate : public QStyledItemDelegate 14 | { 15 | public: 16 | void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; 17 | }; 18 | 19 | //================================================ 20 | 21 | class MainAnalyseView : public QTableView 22 | { 23 | Q_OBJECT 24 | public: 25 | MainAnalyseView(QWidget * parent = nullptr); 26 | ~MainAnalyseView(); 27 | void addFile(const QString& filename); 28 | 29 | 30 | public Q_SLOTS: 31 | void removeSelection(); 32 | void stopSelection(); 33 | void clearAll(); 34 | void showAnalysis(const QModelIndex& index); 35 | void exportSelection(const QString& path); 36 | 37 | 38 | 39 | protected: 40 | void dragEnterEvent(QDragEnterEvent * event); 41 | void dragMoveEvent(QDragMoveEvent * event); 42 | void dropEvent(QDropEvent * event); 43 | bool checkFile(const QString& path); 44 | 45 | 46 | private: 47 | MainAnalyseModel * mModel; 48 | MainAnalyseDelegate * mDelegate; 49 | // pointer runner as unique key index. Avoid open same result widget 50 | QHash mAnalysisWidgets; 51 | QProgressDialog * mExportDialog; 52 | }; 53 | 54 | #endif // MAINANALYSEVIEW_H 55 | -------------------------------------------------------------------------------- /ui/mainanalysewidget.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Copyright 2016-17 Sacha Schutz 3 | 4 | This file is part of FastQt. 5 | 6 | Foobar is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | Foobar is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with Foobar. If not, see . 18 | 19 | @author : Pierre Lindenbaum from FastQC 20 | @author : Sacha Schutz 21 | @author : Pierre Marijon 22 | */ 23 | #include "mainanalysewidget.h" 24 | 25 | MainAnalyseWidget::MainAnalyseWidget(QWidget *parent): 26 | QMainWindow(parent) 27 | { 28 | 29 | setAttribute(Qt::WA_DeleteOnClose, false); 30 | 31 | mListWidget = new QListWidget; 32 | mStackWidget = new QStackedWidget; 33 | mResultWidget = new QSplitter(Qt::Horizontal); 34 | 35 | 36 | mResultWidget->addWidget(mListWidget); 37 | mResultWidget->addWidget(mStackWidget); 38 | mResultWidget->setStretchFactor(1,4); 39 | 40 | 41 | setCentralWidget(mResultWidget); 42 | 43 | 44 | mToolBar = addToolBar("actions"); 45 | mToolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); 46 | 47 | 48 | connect(mListWidget,SIGNAL(currentRowChanged(int)),this,SLOT(setCurrentIndex(int))); 49 | 50 | 51 | } 52 | 53 | MainAnalyseWidget::~MainAnalyseWidget() 54 | { 55 | delete mResultWidget; 56 | } 57 | 58 | void MainAnalyseWidget::setRunner(AnalysisRunner *runner) 59 | { 60 | mRunner = runner; 61 | 62 | 63 | setWindowTitle(mRunner->filename()); 64 | 65 | for ( Analysis * a : mRunner->analysisList()) 66 | { 67 | 68 | QListWidgetItem * lItem = new QListWidgetItem; 69 | lItem->setText(a->name()); 70 | lItem->setToolTip(a->description()); 71 | lItem->setIcon(a->statusIcon()); 72 | 73 | mListWidget->addItem(lItem); 74 | mStackWidget->addWidget(a->createResultWidget()); 75 | 76 | } 77 | 78 | } 79 | 80 | void MainAnalyseWidget::setCurrentIndex(int index) 81 | { 82 | mStackWidget->setCurrentIndex(index); 83 | //Create tool bar 84 | mToolBar->clear(); 85 | mToolBar->addAction(QFontIcon::icon(0xf0c7),tr("Save"), this, SLOT(saveCurrentAnalysis())); 86 | mToolBar->addActions(mStackWidget->widget(index)->actions()); 87 | 88 | if (mStackWidget->widget(index)->metaObject()->className() == QChartView::staticMetaObject.className()) 89 | { 90 | QChartView * view = qobject_cast(mStackWidget->widget(index)); 91 | view->chart()->zoomReset(); 92 | } 93 | 94 | 95 | 96 | 97 | } 98 | 99 | void MainAnalyseWidget::saveCurrentAnalysis() 100 | { 101 | 102 | QString path = QFileDialog::getExistingDirectory(this,tr("result directory")); 103 | if (!path.isEmpty()) 104 | { 105 | mRunner->saveAll(path); 106 | } 107 | 108 | } 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | -------------------------------------------------------------------------------- /ui/mainanalysewidget.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Copyright 2016-17 Sacha Schutz 3 | 4 | This file is part of FastQt. 5 | 6 | Foobar is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | Foobar is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with Foobar. If not, see . 18 | 19 | @author : Pierre Lindenbaum from FastQC 20 | @author : Sacha Schutz 21 | @author : Pierre Marijon 22 | */ 23 | #ifndef ANALYSETABWIDGET_H 24 | #define ANALYSETABWIDGET_H 25 | 26 | #include 27 | #include 28 | #include "analysisrunner.h" 29 | #include "basicstatsanalysis.h" 30 | #include "perbasequalityanalysis.h" 31 | #include "persequencequalityanalysis.h" 32 | #include "perbasecontentanalysis.h" 33 | #include "overrepresentedseqsanalysis.h" 34 | #include "perbasencontentanalysis.h" 35 | #include "persequencegccontent.h" 36 | #include "lengthdistributionanalysis.h" 37 | 38 | /** \class MainAnalyseWidget 39 | * \brief TabWidget witch encapsulate AnalysisRunner and display AnalysisRunner::resultWidget 40 | * @see Analysis 41 | */ 42 | class MainAnalyseWidget : public QMainWindow 43 | { 44 | Q_OBJECT 45 | public: 46 | explicit MainAnalyseWidget( QWidget *parent = 0); 47 | ~MainAnalyseWidget(); 48 | void setRunner(AnalysisRunner * runner); 49 | 50 | protected Q_SLOTS: 51 | void setCurrentIndex(int index); 52 | void saveCurrentAnalysis(); 53 | 54 | 55 | private: 56 | QToolBar * mToolBar; 57 | QVBoxLayout * mMainLayout; 58 | QSplitter * mResultWidget; 59 | AnalysisRunner * mRunner; 60 | QListWidget * mListWidget; 61 | QStackedWidget * mStackWidget; 62 | 63 | 64 | 65 | }; 66 | 67 | #endif // ANALYSETABWIDGET_H 68 | -------------------------------------------------------------------------------- /ui/mainwindow.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Copyright 2016-17 Sacha Schutz 3 | 4 | This file is part of FastQt. 5 | 6 | Foobar is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | Foobar is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with Foobar. If not, see . 18 | 19 | @author : Pierre Lindenbaum from FastQC 20 | @author : Sacha Schutz 21 | @author : Pierre Marijon 22 | */ 23 | #ifndef MAINWINDOW_H 24 | #define MAINWINDOW_H 25 | 26 | #include 27 | #include 28 | #include "mainanalysewidget.h" 29 | #include "aboutdialog.h" 30 | #include "mainanalyseview.h" 31 | /*! 32 | * \class MainWindow 33 | * \brief Main Widget Application for FastQt 34 | */ 35 | class MainWindow : public QMainWindow 36 | { 37 | Q_OBJECT 38 | 39 | public: 40 | explicit MainWindow(QWidget *parent = 0); 41 | ~MainWindow(); 42 | 43 | 44 | public Q_SLOTS: 45 | void run(); 46 | void addFiles(); 47 | void remFiles(); 48 | void stopFiles(); 49 | void clearFiles(); 50 | void showAnalysis(); 51 | void about(); 52 | void exportSelection(); 53 | 54 | 55 | protected: 56 | void setupActions(); 57 | void addRecent(const QString& path); 58 | QStringList loadRecent(); 59 | void updateRecentMenu(); 60 | 61 | private: 62 | void printEasterEggs(); 63 | 64 | private: 65 | QTabWidget * mTabWidget; 66 | QList mMainList; 67 | MainAnalyseView * mView; 68 | QFuture mRunFuture; 69 | QStatusBar * mStatusBar; 70 | QMenu * mRecentMenu; 71 | static const int MAX_RECENT=10; 72 | }; 73 | 74 | #endif // MAINWINDOW_H 75 | -------------------------------------------------------------------------------- /ui/ui.pri: -------------------------------------------------------------------------------- 1 | INCLUDEPATH+=$$PWD 2 | 3 | FORMS += 4 | 5 | HEADERS += \ 6 | $$PWD/mainanalysewidget.h \ 7 | $$PWD/mainwindow.h \ 8 | $$PWD/aboutdialog.h \ 9 | $$PWD/mainanalyseview.h 10 | 11 | 12 | SOURCES += \ 13 | $$PWD/mainanalysewidget.cpp \ 14 | $$PWD/mainwindow.cpp \ 15 | $$PWD/aboutdialog.cpp \ 16 | $$PWD/mainanalyseview.cpp 17 | -------------------------------------------------------------------------------- /utils/basegroup.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Copyright 2016-17 Sacha Schutz 3 | 4 | This file is part of FastQt. 5 | 6 | Foobar is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | Foobar is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with Foobar. If not, see . 18 | 19 | @author : Pierre Lindenbaum from FastQC 20 | @author : Sacha Schutz 21 | @author : Pierre Marijon 22 | */ 23 | #ifndef BASEGROUP_H 24 | #define BASEGROUP_H 25 | #include 26 | /*! 27 | * \class BaseGroup 28 | * \brief This class groups nucleotid position in a range. 29 | * This is used in PerBaseQualityAnalysis and allow displaying all sequence 30 | * @see FastQC BaseGroup class for more detail 31 | */ 32 | class BaseGroup 33 | { 34 | public: 35 | BaseGroup(); 36 | BaseGroup(int lowerCount, int upperCount); 37 | int lowerCount() const; 38 | int upperCount() const; 39 | bool contains(int value) const; 40 | QString toString() const; 41 | 42 | 43 | 44 | 45 | static QVector makeBaseGroups(int maxLength); 46 | static QVector makeUngroupedGroups(int maxLength); 47 | static QVector makeExponentialBaseGroups(int maxLength); 48 | static QVector makeLinearBaseGroups(int maxLength); 49 | 50 | protected: 51 | static int getLinearInterval (int length); 52 | 53 | 54 | private: 55 | int mLowerCount; 56 | int mUpperCount; 57 | }; 58 | 59 | #endif // BASEGROUP_H 60 | -------------------------------------------------------------------------------- /utils/format_detection.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Copyright 2016-17 Pierre Marijon 3 | 4 | This file is part of fastQT. 5 | 6 | Foobar is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | Foobar is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with Foobar. If not, see . 18 | 19 | @author : Pierre Marijon 20 | */ 21 | 22 | #include "format_detection.h" 23 | #include 24 | 25 | bool is_gz(QIODevice* file) 26 | { 27 | if (file->open(QIODevice::ReadOnly)) 28 | { 29 | QByteArray magic_number = file->read(2); 30 | file->close(); 31 | 32 | if (magic_number.length() < 2) 33 | return false; 34 | 35 | return static_cast(magic_number.at(0)) == 0x1f && static_cast(magic_number.at(1)) == 0x8b; 36 | } 37 | else 38 | { 39 | return false; 40 | } 41 | } 42 | 43 | bool is_bz2(QIODevice* file) 44 | { 45 | if (file->open(QIODevice::ReadOnly)) 46 | { 47 | QByteArray magic_number = file->read(2); 48 | file->close(); 49 | 50 | if (magic_number.length() < 2) 51 | return false; 52 | 53 | return static_cast(magic_number.at(0)) == 'B' && static_cast(magic_number.at(1)) == 'Z'; 54 | } 55 | else 56 | { 57 | return false; 58 | } 59 | } 60 | 61 | bool is_xz(QIODevice* file) 62 | { 63 | if (file->open(QIODevice::ReadOnly)) 64 | { 65 | QByteArray magic_number = file->read(6); 66 | file->close(); 67 | 68 | if (magic_number.length() < 6) 69 | return false; 70 | 71 | return static_cast(magic_number.at(0)) == 0xFD && static_cast(magic_number.at(1)) == '7'\ 72 | && static_cast(magic_number.at(2)) == 'z' && static_cast(magic_number.at(3)) == 'X'\ 73 | && static_cast(magic_number.at(4)) == 'Z' && static_cast(magic_number.at(5)) == 0x00; 74 | } 75 | else 76 | { 77 | return false; 78 | } 79 | } 80 | 81 | bool is_fastq(QIODevice* file) 82 | { 83 | if (file->open(QIODevice::ReadOnly)) 84 | { 85 | QByteArray line; 86 | line = file->readLine(); 87 | if ((line.length() < 1)||(line.at(0) != '@')) 88 | { 89 | file->close(); 90 | return false; 91 | } 92 | 93 | line = file->readLine(); 94 | // Some not alphabetic caractere are in range but you know isn't a problem 95 | if ((line.length() < 1)||(line.at(0) < 'A' || line.at(0) > 'z')){ 96 | file->close(); 97 | return false; 98 | } 99 | 100 | line = file->readLine(); 101 | if ((line.length() < 1)||(line.at(0) != '+')) 102 | { 103 | file->close(); 104 | return false; 105 | } 106 | 107 | line = file->readLine(); 108 | if ((line.length() < 1)||(line.at(0) < '!' || line.at(0) > '~')){ 109 | file->close(); 110 | return false; 111 | } 112 | file->close(); 113 | return true; 114 | } 115 | 116 | else 117 | { 118 | return false; 119 | } 120 | } 121 | 122 | bool is_ubam(QIODevice* file) 123 | { 124 | /*Check is a gzip file*/ 125 | if(is_gz(file)) 126 | { 127 | if (file->open(QIODevice::ReadOnly)) 128 | { 129 | /*Check is a bgzp file*/ 130 | /*We use https://samtools.github.io/hts-specs/SAMv1.pdf page 10*/ 131 | file->seek(12); 132 | QByteArray magic_number = file->read(3); 133 | file->close(); 134 | 135 | if(magic_number.length() != 3) 136 | return false; 137 | 138 | return static_cast(magic_number.at(0)) == 'B' \ 139 | && static_cast(magic_number.at(1)) == 'C' \ 140 | && static_cast(magic_number.at(2)) == 2; 141 | } 142 | else 143 | { 144 | return false; 145 | } 146 | } 147 | else 148 | { 149 | return false; 150 | } 151 | } 152 | -------------------------------------------------------------------------------- /utils/format_detection.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Copyright 2016-17 Pierre Marijon 3 | 4 | This file is part of fastQT. 5 | 6 | Foobar is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | Foobar is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with Foobar. If not, see . 18 | 19 | @author : Pierre Marijon 20 | */ 21 | 22 | #ifndef FORMAT_DETECTION_H 23 | #define FORMAT_DETECTION_H 24 | 25 | #include 26 | 27 | bool is_gz(QIODevice* file); 28 | 29 | bool is_bz2(QIODevice* file); 30 | 31 | bool is_xz(QIODevice* file); 32 | 33 | bool is_fastq(QIODevice* file); 34 | 35 | bool is_ubam(QIODevice* file); 36 | 37 | #endif // FORMAT_DETECTION_H 38 | -------------------------------------------------------------------------------- /utils/imageformatdefinition.h: -------------------------------------------------------------------------------- 1 | #ifndef IMAGEFORMATDEFINITION_H 2 | #define IMAGEFORMATDEFINITION_H 3 | 4 | enum ImageFormat { 5 | PngFormat, 6 | SvgFormat 7 | }; 8 | 9 | #endif // IMAGEFORMATDEFINITION_H 10 | -------------------------------------------------------------------------------- /utils/progressbar.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Copyright 2016-17 Pierre Marijon 3 | 4 | This file is part of fastQT. 5 | 6 | Foobar is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | Foobar is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with Foobar. If not, see . 18 | 19 | @author : Pierre Marijon 20 | 21 | Freely inspired by GATB-Core Progress class https://github.com/GATB/gatb-core 22 | */ 23 | 24 | #include "progressbar.h" 25 | 26 | ProgressBar::ProgressBar(unsigned int ntasks, const std::string& message, std::ostream& output) : message(message), os(output) 27 | { 28 | reset(ntasks); 29 | } 30 | 31 | void ProgressBar::reset(unsigned int ntasks) 32 | { 33 | this->todo = ntasks; 34 | this->done = 0; 35 | this->partial = 0; 36 | this->subdiv = 100; 37 | this->steps = static_cast(ntasks > 0 ? ntasks : 1) / static_cast(subdiv); 38 | } 39 | 40 | void ProgressBar::init() 41 | { 42 | os << message; 43 | postInit(); 44 | } 45 | 46 | void ProgressBar::finish() 47 | { 48 | /** We set the total done. */ 49 | set (todo); 50 | 51 | /** We forward the remaining of the finish to postFinish method. */ 52 | postFinish (); 53 | 54 | /** We reset all progression variables. */ 55 | todo = 0; 56 | done = 0; 57 | partial = 0; 58 | } 59 | 60 | void ProgressBar::inc (unsigned int ntasks_done) 61 | { 62 | done += ntasks_done; 63 | partial += ntasks_done; 64 | 65 | while (partial >= steps) 66 | { 67 | update(); 68 | partial -= steps; 69 | } 70 | } 71 | 72 | void ProgressBar::set (unsigned int ntasks_done) 73 | { 74 | if (ntasks_done > done) 75 | { 76 | inc (ntasks_done-done); 77 | } 78 | } 79 | 80 | void ProgressBar::postInit () 81 | { 82 | os << "["; 83 | os.flush(); 84 | } 85 | 86 | void ProgressBar::postFinish () 87 | { 88 | os << "]" << std::endl; 89 | os.flush(); 90 | } 91 | 92 | void ProgressBar::update() 93 | { 94 | os << "-"; 95 | os.flush(); 96 | } 97 | -------------------------------------------------------------------------------- /utils/progressbar.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright Copyright 2016-17 Pierre Marijon 3 | 4 | This file is part of FastQt. 5 | 6 | Foobar is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | Foobar is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with Foobar. If not, see . 18 | @author : Pierre Marijon 19 | 20 | Freely inspired by GATB-Core Progress class https://github.com/GATB/gatb-core 21 | */ 22 | 23 | #ifndef PROGRESSBAR_H 24 | #define PROGRESSBAR_H 25 | 26 | #include 27 | 28 | class ProgressBar 29 | { 30 | public: 31 | ProgressBar(unsigned int ntask, const std::string& message, std::ostream& os=std::cerr); 32 | 33 | virtual ~ProgressBar() {} 34 | 35 | void init(); 36 | 37 | void finish(); 38 | 39 | void inc(unsigned int ntask_done); 40 | 41 | void set(unsigned int ntask_done); 42 | 43 | void reset(unsigned int ntask); 44 | 45 | protected: 46 | 47 | protected: 48 | 49 | virtual void update (); 50 | virtual void postInit (); 51 | virtual void postFinish (); 52 | 53 | std::string message; 54 | u_int64_t done; 55 | u_int64_t todo; 56 | int subdiv ; // progress printed every 1/subdiv of total to do 57 | double partial; 58 | double steps ; //steps = _todo/subidv 59 | std::ostream& os; 60 | char buffer[512]; 61 | }; 62 | 63 | #endif // PROGRESSBAR_H 64 | -------------------------------------------------------------------------------- /utils/quagzipfile.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2005-2014 Sergey A. Tachenov 3 | 4 | This file is part of QuaZIP. 5 | 6 | QuaZIP is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | QuaZIP is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with QuaZIP. If not, see . 18 | 19 | See COPYING file for the full LGPL text. 20 | 21 | Original ZIP package is copyrighted by Gilles Vollant and contributors, 22 | see quazip/(un)zip.h files for details. Basically it's the zlib license. 23 | */ 24 | 25 | #include 26 | 27 | #include "quagzipfile.h" 28 | 29 | /// \cond internal 30 | class QuaGzipFilePrivate { 31 | friend class QuaGzipFile; 32 | QString fileName; 33 | gzFile gzd; 34 | inline QuaGzipFilePrivate(): gzd(NULL) {} 35 | inline QuaGzipFilePrivate(const QString &fileName): 36 | fileName(fileName), gzd(NULL) {} 37 | template bool open(FileId id, 38 | QIODevice::OpenMode mode, QString &error); 39 | gzFile open(int fd, const char *modeString); 40 | gzFile open(const QString &name, const char *modeString); 41 | }; 42 | 43 | gzFile QuaGzipFilePrivate::open(const QString &name, const char *modeString) 44 | { 45 | return gzopen(QFile::encodeName(name).constData(), modeString); 46 | } 47 | 48 | gzFile QuaGzipFilePrivate::open(int fd, const char *modeString) 49 | { 50 | return gzdopen(fd, modeString); 51 | } 52 | 53 | template 54 | bool QuaGzipFilePrivate::open(FileId id, QIODevice::OpenMode mode, 55 | QString &error) 56 | { 57 | char modeString[2]; 58 | modeString[0] = modeString[1] = '\0'; 59 | if ((mode & QIODevice::Append) != 0) { 60 | error = QuaGzipFile::trUtf8("QIODevice::Append is not " 61 | "supported for GZIP"); 62 | return false; 63 | } 64 | if ((mode & QIODevice::ReadOnly) != 0 65 | && (mode & QIODevice::WriteOnly) != 0) { 66 | error = QuaGzipFile::trUtf8("Opening gzip for both reading" 67 | " and writing is not supported"); 68 | return false; 69 | } else if ((mode & QIODevice::ReadOnly) != 0) { 70 | modeString[0] = 'r'; 71 | } else if ((mode & QIODevice::WriteOnly) != 0) { 72 | modeString[0] = 'w'; 73 | } else { 74 | error = QuaGzipFile::trUtf8("You can open a gzip either for reading" 75 | " or for writing. Which is it?"); 76 | return false; 77 | } 78 | gzd = open(id, modeString); 79 | if (gzd == NULL) { 80 | error = QuaGzipFile::trUtf8("Could not gzopen() file"); 81 | return false; 82 | } 83 | return true; 84 | } 85 | /// \endcond 86 | 87 | QuaGzipFile::QuaGzipFile(): 88 | d(new QuaGzipFilePrivate()) 89 | { 90 | } 91 | 92 | QuaGzipFile::QuaGzipFile(QObject *parent): 93 | QIODevice(parent), 94 | d(new QuaGzipFilePrivate()) 95 | { 96 | } 97 | 98 | QuaGzipFile::QuaGzipFile(const QString &fileName, QObject *parent): 99 | QIODevice(parent), 100 | d(new QuaGzipFilePrivate(fileName)) 101 | { 102 | } 103 | 104 | QuaGzipFile::~QuaGzipFile() 105 | { 106 | if (isOpen()) { 107 | close(); 108 | } 109 | delete d; 110 | } 111 | 112 | void QuaGzipFile::setFileName(const QString& fileName) 113 | { 114 | d->fileName = fileName; 115 | } 116 | 117 | QString QuaGzipFile::getFileName() const 118 | { 119 | return d->fileName; 120 | } 121 | 122 | bool QuaGzipFile::isSequential() const 123 | { 124 | return true; 125 | } 126 | 127 | bool QuaGzipFile::open(QIODevice::OpenMode mode) 128 | { 129 | QString error; 130 | if (!d->open(d->fileName, mode, error)) { 131 | setErrorString(error); 132 | return false; 133 | } 134 | return QIODevice::open(mode); 135 | } 136 | 137 | bool QuaGzipFile::open(int fd, QIODevice::OpenMode mode) 138 | { 139 | QString error; 140 | if (!d->open(fd, mode, error)) { 141 | setErrorString(error); 142 | return false; 143 | } 144 | return QIODevice::open(mode); 145 | } 146 | 147 | bool QuaGzipFile::flush() 148 | { 149 | return gzflush(d->gzd, Z_SYNC_FLUSH) == Z_OK; 150 | } 151 | 152 | void QuaGzipFile::close() 153 | { 154 | QIODevice::close(); 155 | gzclose(d->gzd); 156 | } 157 | 158 | qint64 QuaGzipFile::readData(char *data, qint64 maxSize) 159 | { 160 | return gzread(d->gzd, (voidp)data, (unsigned)maxSize); 161 | } 162 | 163 | qint64 QuaGzipFile::writeData(const char *data, qint64 maxSize) 164 | { 165 | if (maxSize == 0) 166 | return 0; 167 | int written = gzwrite(d->gzd, (voidp)data, (unsigned)maxSize); 168 | if (written == 0) 169 | return -1; 170 | else 171 | return written; 172 | } 173 | -------------------------------------------------------------------------------- /utils/quagzipfile.h: -------------------------------------------------------------------------------- 1 | #ifndef QUAZIP_QUAGZIPFILE_H 2 | #define QUAZIP_QUAGZIPFILE_H 3 | 4 | /* 5 | Copyright (C) 2005-2014 Sergey A. Tachenov 6 | 7 | This file is part of QuaZIP. 8 | 9 | QuaZIP is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU Lesser General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | QuaZIP is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU Lesser General Public License for more details. 18 | 19 | You should have received a copy of the GNU Lesser General Public License 20 | along with QuaZIP. If not, see . 21 | 22 | See COPYING file for the full LGPL text. 23 | 24 | Original ZIP package is copyrighted by Gilles Vollant and contributors, 25 | see quazip/(un)zip.h files for details. Basically it's the zlib license. 26 | */ 27 | 28 | #include 29 | #include 30 | 31 | class QuaGzipFilePrivate; 32 | 33 | /// GZIP file 34 | /** 35 | This class is a wrapper around GZIP file access functions in zlib. Unlike QuaZip classes, it doesn't allow reading from a GZIP file opened as QIODevice, for example, if your GZIP file is in QBuffer. It only provides QIODevice access to a GZIP file contents, but the GZIP file itself must be identified by its name on disk or by descriptor id. 36 | */ 37 | class QuaGzipFile: public QIODevice { 38 | Q_OBJECT 39 | public: 40 | /// Empty constructor. 41 | /** 42 | Must call setFileName() before trying to open. 43 | */ 44 | QuaGzipFile(); 45 | /// Empty constructor with a parent. 46 | /** 47 | Must call setFileName() before trying to open. 48 | \param parent The parent object, as per QObject logic. 49 | */ 50 | QuaGzipFile(QObject *parent); 51 | /// Constructor. 52 | /** 53 | \param fileName The name of the GZIP file. 54 | \param parent The parent object, as per QObject logic. 55 | */ 56 | QuaGzipFile(const QString &fileName, QObject *parent = NULL); 57 | /// Destructor. 58 | virtual ~QuaGzipFile(); 59 | /// Sets the name of the GZIP file to be opened. 60 | void setFileName(const QString& fileName); 61 | /// Returns the name of the GZIP file. 62 | QString getFileName() const; 63 | /// Returns true. 64 | /** 65 | Strictly speaking, zlib supports seeking for GZIP files, but it is 66 | poorly implemented, because there is no way to implement it 67 | properly. For reading, seeking backwards is very slow, and for 68 | writing, it is downright impossible. Therefore, QuaGzipFile does not 69 | support seeking at all. 70 | */ 71 | virtual bool isSequential() const; 72 | /// Opens the file. 73 | /** 74 | \param mode Can be either QIODevice::Write or QIODevice::Read. 75 | ReadWrite and Append aren't supported. 76 | */ 77 | virtual bool open(QIODevice::OpenMode mode); 78 | /// Opens the file. 79 | /** 80 | \overload 81 | \param fd The file descriptor to read/write the GZIP file from/to. 82 | \param mode Can be either QIODevice::Write or QIODevice::Read. 83 | ReadWrite and Append aren't supported. 84 | */ 85 | virtual bool open(int fd, QIODevice::OpenMode mode); 86 | /// Flushes data to file. 87 | /** 88 | The data is written using Z_SYNC_FLUSH mode. Doesn't make any sense 89 | when reading. 90 | */ 91 | virtual bool flush(); 92 | /// Closes the file. 93 | virtual void close(); 94 | protected: 95 | /// Implementation of QIODevice::readData(). 96 | virtual qint64 readData(char *data, qint64 maxSize); 97 | /// Implementation of QIODevice::writeData(). 98 | virtual qint64 writeData(const char *data, qint64 maxSize); 99 | private: 100 | // not implemented by design to disable copy 101 | QuaGzipFile(const QuaGzipFile &that); 102 | QuaGzipFile& operator=(const QuaGzipFile &that); 103 | QuaGzipFilePrivate *d; 104 | }; 105 | 106 | #endif // QUAZIP_QUAGZIPFILE_H 107 | -------------------------------------------------------------------------------- /utils/statistic.h: -------------------------------------------------------------------------------- 1 | #ifndef STATISTIC_H 2 | #define STATISTIC_H 3 | /* Define section */ 4 | #include 5 | 6 | 7 | template 8 | inline double mean(Container &c) 9 | { 10 | double n = 0; 11 | double sum = 0; 12 | for(auto it : c) 13 | { 14 | sum += it; 15 | n++; 16 | } 17 | return sum/n; 18 | 19 | } 20 | template 21 | inline double mean_ponderate(Container& c) 22 | { 23 | double n = 0; 24 | double sum = 0; 25 | for(auto it = c.begin(); it != c.end(); it++) 26 | { 27 | sum += (it - c.begin()) * *it; 28 | n += *it; 29 | } 30 | 31 | return sum/n; 32 | } 33 | template 34 | inline double stddev(Container& c, double mean = 0) 35 | { 36 | double stddev = 0; 37 | double sum = 0; 38 | 39 | for(auto it = c.begin(); it != c.end(); it++) 40 | { 41 | sum += *it; 42 | stddev += pow((it - c.begin()) - mean, 2) * *it; 43 | } 44 | 45 | stddev /= sum - 1; 46 | 47 | return sqrt(stddev); 48 | } 49 | 50 | 51 | double normal_distribution(double mean, double stddev, double x) 52 | { 53 | double lhs = 1/(sqrt(2*M_PI*stddev*stddev)); 54 | double rhs = pow(M_E, 0 - (pow(x-mean,2)/(2*stddev*stddev))); 55 | 56 | return lhs*rhs; 57 | } 58 | 59 | #endif // STATISTIC_H 60 | -------------------------------------------------------------------------------- /utils/utils.pri: -------------------------------------------------------------------------------- 1 | INCLUDEPATH+= $$PWD 2 | 3 | HEADERS += \ 4 | $$PWD/basegroup.h \ 5 | $$PWD/statistic.h \ 6 | $$PWD/imageformatdefinition.h \ 7 | $$PWD/format_detection.h \ 8 | $$PWD/progressbar.h 9 | 10 | SOURCES += \ 11 | $$PWD/basegroup.cpp \ 12 | $$PWD/format_detection.cpp \ 13 | $$PWD/progressbar.cpp 14 | 15 | -------------------------------------------------------------------------------- /win32/KArchive/bin/libKF5Archive.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/labsquare/FastQt/f69f9d5ba51b8863e7a645dbfc775fa0d8e41a50/win32/KArchive/bin/libKF5Archive.dll -------------------------------------------------------------------------------- /win32/KArchive/include/KF5/KArchive/K7Zip: -------------------------------------------------------------------------------- 1 | #include "k7zip.h" 2 | -------------------------------------------------------------------------------- /win32/KArchive/include/KF5/KArchive/KAr: -------------------------------------------------------------------------------- 1 | #include "kar.h" 2 | -------------------------------------------------------------------------------- /win32/KArchive/include/KF5/KArchive/KArchive: -------------------------------------------------------------------------------- 1 | #include "karchive.h" 2 | -------------------------------------------------------------------------------- /win32/KArchive/include/KF5/KArchive/KArchiveDirectory: -------------------------------------------------------------------------------- 1 | #include "karchivedirectory.h" 2 | -------------------------------------------------------------------------------- /win32/KArchive/include/KF5/KArchive/KArchiveEntry: -------------------------------------------------------------------------------- 1 | #include "karchiveentry.h" 2 | -------------------------------------------------------------------------------- /win32/KArchive/include/KF5/KArchive/KArchiveFile: -------------------------------------------------------------------------------- 1 | #include "karchivefile.h" 2 | -------------------------------------------------------------------------------- /win32/KArchive/include/KF5/KArchive/KCompressionDevice: -------------------------------------------------------------------------------- 1 | #include "kcompressiondevice.h" 2 | -------------------------------------------------------------------------------- /win32/KArchive/include/KF5/KArchive/KFilterBase: -------------------------------------------------------------------------------- 1 | #include "kfilterbase.h" 2 | -------------------------------------------------------------------------------- /win32/KArchive/include/KF5/KArchive/KFilterDev: -------------------------------------------------------------------------------- 1 | #include "kfilterdev.h" 2 | -------------------------------------------------------------------------------- /win32/KArchive/include/KF5/KArchive/KTar: -------------------------------------------------------------------------------- 1 | #include "ktar.h" 2 | -------------------------------------------------------------------------------- /win32/KArchive/include/KF5/KArchive/KZip: -------------------------------------------------------------------------------- 1 | #include "kzip.h" 2 | -------------------------------------------------------------------------------- /win32/KArchive/include/KF5/KArchive/KZipFileEntry: -------------------------------------------------------------------------------- 1 | #include "kzipfileentry.h" 2 | -------------------------------------------------------------------------------- /win32/KArchive/include/KF5/KArchive/k7zip.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the KDE libraries 2 | Copyright (C) 2011 Mario Bensi 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License version 2 as published by the Free Software Foundation. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02110-1301, USA. 17 | */ 18 | #ifndef K7ZIP_H 19 | #define K7ZIP_H 20 | 21 | #include 22 | 23 | /** 24 | * A class for reading / writing p7zip archives. 25 | * 26 | * @author Mario Bensi 27 | */ 28 | class KARCHIVE_EXPORT K7Zip : public KArchive 29 | { 30 | Q_DECLARE_TR_FUNCTIONS(K7Zip) 31 | 32 | public: 33 | /** 34 | * Creates an instance that operates on the given filename 35 | * using the compression filter associated to given mimetype. 36 | * 37 | * @param filename is a local path (e.g. "/home/user/myfile.7z") 38 | */ 39 | explicit K7Zip(const QString &filename); 40 | 41 | /** 42 | * Creates an instance that operates on the given device. 43 | * The device can be compressed (KFilterDev) or not (QFile, etc.). 44 | * @warning Do not assume that giving a QFile here will decompress the file, 45 | * in case it's compressed! 46 | * @param dev the device to read from. If the source is compressed, the 47 | * QIODevice must take care of decompression 48 | */ 49 | explicit K7Zip(QIODevice *dev); 50 | 51 | /** 52 | * If the archive is still opened, then it will be 53 | * closed automatically by the destructor. 54 | */ 55 | virtual ~K7Zip(); 56 | 57 | protected: 58 | 59 | /// Reimplemented from KArchive 60 | bool doWriteSymLink(const QString &name, const QString &target, 61 | const QString &user, const QString &group, 62 | mode_t perm, const QDateTime &atime, const QDateTime &mtime, const QDateTime &ctime) Q_DECL_OVERRIDE; 63 | /// Reimplemented from KArchive 64 | bool doWriteDir(const QString &name, const QString &user, const QString &group, 65 | mode_t perm, const QDateTime &atime, const QDateTime &mtime, const QDateTime &ctime) Q_DECL_OVERRIDE; 66 | /// Reimplemented from KArchive 67 | bool doPrepareWriting(const QString &name, const QString &user, 68 | const QString &group, qint64 size, mode_t perm, 69 | const QDateTime &atime, const QDateTime &mtime, const QDateTime &ctime) Q_DECL_OVERRIDE; 70 | /// Reimplemented from KArchive 71 | bool doFinishWriting(qint64 size) Q_DECL_OVERRIDE; 72 | 73 | /// Reimplemented from KArchive 74 | bool writeData(const char *data, qint64 size) Q_DECL_OVERRIDE; 75 | 76 | /** 77 | * Opens the archive for reading. 78 | * Parses the directory listing of the archive 79 | * and creates the KArchiveDirectory/KArchiveFile entries. 80 | * @param mode the mode of the file 81 | */ 82 | bool openArchive(QIODevice::OpenMode mode) Q_DECL_OVERRIDE; 83 | bool closeArchive() Q_DECL_OVERRIDE; 84 | 85 | protected: 86 | void virtual_hook(int id, void *data) Q_DECL_OVERRIDE; 87 | private: 88 | class K7ZipPrivate; 89 | K7ZipPrivate *const d; 90 | }; 91 | 92 | #endif 93 | -------------------------------------------------------------------------------- /win32/KArchive/include/KF5/KArchive/kar.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the KDE libraries 2 | Copyright (C) 2002 Laurence Anderson 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License version 2 as published by the Free Software Foundation. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02110-1301, USA. 17 | */ 18 | #ifndef KAR_H 19 | #define KAR_H 20 | 21 | #include 22 | 23 | /** 24 | * KAr is a class for reading archives in ar format. Writing 25 | * is not supported. 26 | * @short A class for reading ar archives. 27 | * @author Laurence Anderson 28 | */ 29 | class KARCHIVE_EXPORT KAr : public KArchive 30 | { 31 | Q_DECLARE_TR_FUNCTIONS(KAr) 32 | 33 | public: 34 | /** 35 | * Creates an instance that operates on the given filename. 36 | * 37 | * @param filename is a local path (e.g. "/home/holger/myfile.ar") 38 | */ 39 | KAr(const QString &filename); 40 | 41 | /** 42 | * Creates an instance that operates on the given device. 43 | * The device can be compressed (KFilterDev) or not (QFile, etc.). 44 | * @param dev the device to read from 45 | */ 46 | KAr(QIODevice *dev); 47 | 48 | /** 49 | * If the ar file is still opened, then it will be 50 | * closed automatically by the destructor. 51 | */ 52 | virtual ~KAr(); 53 | 54 | protected: 55 | 56 | /* 57 | * Writing is not supported by this class, will always fail. 58 | * @return always false 59 | */ 60 | bool doPrepareWriting(const QString &name, const QString &user, const QString &group, qint64 size, 61 | mode_t perm, const QDateTime &atime, const QDateTime &mtime, const QDateTime &ctime) Q_DECL_OVERRIDE; 62 | 63 | /* 64 | * Writing is not supported by this class, will always fail. 65 | * @return always false 66 | */ 67 | bool doFinishWriting(qint64 size) Q_DECL_OVERRIDE; 68 | 69 | /* 70 | * Writing is not supported by this class, will always fail. 71 | * @return always false 72 | */ 73 | bool doWriteDir(const QString &name, const QString &user, const QString &group, 74 | mode_t perm, const QDateTime &atime, const QDateTime &mtime, const QDateTime &ctime) Q_DECL_OVERRIDE; 75 | 76 | bool doWriteSymLink(const QString &name, const QString &target, 77 | const QString &user, const QString &group, mode_t perm, 78 | const QDateTime &atime, const QDateTime &mtime, const QDateTime &ctime) Q_DECL_OVERRIDE; 79 | 80 | /** 81 | * Opens the archive for reading. 82 | * Parses the directory listing of the archive 83 | * and creates the KArchiveDirectory/KArchiveFile entries. 84 | * 85 | */ 86 | bool openArchive(QIODevice::OpenMode mode) Q_DECL_OVERRIDE; 87 | bool closeArchive() Q_DECL_OVERRIDE; 88 | 89 | protected: 90 | void virtual_hook(int id, void *data) Q_DECL_OVERRIDE; 91 | private: 92 | class KArPrivate; 93 | KArPrivate *const d; 94 | }; 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /win32/KArchive/include/KF5/KArchive/karchive_export.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef KARCHIVE_EXPORT_H 3 | #define KARCHIVE_EXPORT_H 4 | 5 | #ifdef KARCHIVE_STATIC_DEFINE 6 | # define KARCHIVE_EXPORT 7 | # define KARCHIVE_NO_EXPORT 8 | #else 9 | # ifndef KARCHIVE_EXPORT 10 | # ifdef KF5Archive_EXPORTS 11 | /* We are building this library */ 12 | # define KARCHIVE_EXPORT __declspec(dllexport) 13 | # else 14 | /* We are using this library */ 15 | # define KARCHIVE_EXPORT __declspec(dllimport) 16 | # endif 17 | # endif 18 | 19 | # ifndef KARCHIVE_NO_EXPORT 20 | # define KARCHIVE_NO_EXPORT 21 | # endif 22 | #endif 23 | 24 | #ifndef KARCHIVE_DEPRECATED 25 | # define KARCHIVE_DEPRECATED __attribute__ ((__deprecated__)) 26 | #endif 27 | 28 | #ifndef KARCHIVE_DEPRECATED_EXPORT 29 | # define KARCHIVE_DEPRECATED_EXPORT KARCHIVE_EXPORT KARCHIVE_DEPRECATED 30 | #endif 31 | 32 | #ifndef KARCHIVE_DEPRECATED_NO_EXPORT 33 | # define KARCHIVE_DEPRECATED_NO_EXPORT KARCHIVE_NO_EXPORT KARCHIVE_DEPRECATED 34 | #endif 35 | 36 | #if 0 /* DEFINE_NO_DEPRECATED */ 37 | # ifndef KARCHIVE_NO_DEPRECATED 38 | # define KARCHIVE_NO_DEPRECATED 39 | # endif 40 | #endif 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /win32/KArchive/include/KF5/KArchive/karchivedirectory.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the KDE libraries 2 | Copyright (C) 2000-2005 David Faure 3 | Copyright (C) 2003 Leo Savernik 4 | 5 | Moved from ktar.h by Roberto Teixeira 6 | 7 | This library is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Library General Public 9 | License version 2 as published by the Free Software Foundation. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Library General Public License for more details. 15 | 16 | You should have received a copy of the GNU Library General Public License 17 | along with this library; see the file COPYING.LIB. If not, write to 18 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 | Boston, MA 02110-1301, USA. 20 | */ 21 | #ifndef KARCHIVEDIRECTORY_H 22 | #define KARCHIVEDIRECTORY_H 23 | 24 | #include 25 | #include 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | #include 32 | 33 | class KArchiveDirectoryPrivate; 34 | class KArchiveFile; 35 | /** 36 | * Represents a directory entry in a KArchive. 37 | * @short A directory in an archive. 38 | * 39 | * @see KArchive 40 | * @see KArchiveFile 41 | */ 42 | class KARCHIVE_EXPORT KArchiveDirectory : public KArchiveEntry 43 | { 44 | public: 45 | /** 46 | * Creates a new directory entry. 47 | * @param archive the entries archive 48 | * @param name the name of the entry 49 | * @param access the permissions in unix format 50 | * @param date the date (in seconds since 1970) 51 | * @param user the user that owns the entry 52 | * @param group the group that owns the entry 53 | * @param symlink the symlink, or QString() 54 | */ 55 | KArchiveDirectory(KArchive *archive, const QString &name, int access, const QDateTime &date, 56 | const QString &user, const QString &group, 57 | const QString &symlink); 58 | 59 | virtual ~KArchiveDirectory(); 60 | 61 | /** 62 | * Returns a list of sub-entries. 63 | * Note that the list is not sorted, it's even in random order (due to using a hashtable). 64 | * Use sort() on the result to sort the list by filename. 65 | * 66 | * @return the names of all entries in this directory (filenames, no path). 67 | */ 68 | QStringList entries() const; 69 | 70 | /** 71 | * Returns the entry in the archive with the given name. 72 | * The entry could be a file or a directory, use isFile() to find out which one it is. 73 | * @param name may be "test1", "mydir/test3", "mydir/mysubdir/test3", etc. 74 | * @return a pointer to the entry in the directory, or a null pointer if there is no such entry. 75 | */ 76 | const KArchiveEntry *entry(const QString &name) const; 77 | 78 | /** 79 | * Returns the file entry in the archive with the given name. 80 | * If the entry exists and is a file, a KArchiveFile is returned. 81 | * Otherwise, a null pointer is returned. 82 | * This is a convenience method for entry(), when we know the entry is expected to be a file. 83 | * 84 | * @param name may be "test1", "mydir/test3", "mydir/mysubdir/test3", etc. 85 | * @return a pointer to the file entry in the directory, or a null pointer if there is no such file entry. 86 | * @since 5.3 87 | */ 88 | const KArchiveFile *file(const QString &name) const; 89 | 90 | /** 91 | * @internal 92 | * Adds a new entry to the directory. 93 | * Note: this can delete the entry if another one with the same name is already present 94 | */ 95 | void addEntry(KArchiveEntry *); // KF6 TODO: return bool 96 | 97 | /** 98 | * @internal 99 | * Adds a new entry to the directory. 100 | */ 101 | void removeEntry(KArchiveEntry *); 102 | 103 | /** 104 | * Checks whether this entry is a directory. 105 | * @return true, since this entry is a directory 106 | */ 107 | bool isDirectory() const Q_DECL_OVERRIDE; 108 | 109 | /** 110 | * Extracts all entries in this archive directory to the directory 111 | * @p dest. 112 | * @param dest the directory to extract to 113 | * @param recursive if set to true, subdirectories are extracted as well 114 | * @return true on success, false if the directory (dest + '/' + name()) couldn't be created 115 | */ 116 | bool copyTo(const QString &dest, bool recursive = true) const; 117 | 118 | protected: 119 | void virtual_hook(int id, void *data) Q_DECL_OVERRIDE; 120 | private: 121 | KArchiveDirectoryPrivate *const d; 122 | }; 123 | 124 | #endif 125 | -------------------------------------------------------------------------------- /win32/KArchive/include/KF5/KArchive/karchiveentry.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the KDE libraries 2 | Copyright (C) 2000-2005 David Faure 3 | Copyright (C) 2003 Leo Savernik 4 | 5 | Moved from ktar.h by Roberto Teixeira 6 | 7 | This library is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Library General Public 9 | License version 2 as published by the Free Software Foundation. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Library General Public License for more details. 15 | 16 | You should have received a copy of the GNU Library General Public License 17 | along with this library; see the file COPYING.LIB. If not, write to 18 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 | Boston, MA 02110-1301, USA. 20 | */ 21 | #ifndef KARCHIVEENTRY_H 22 | #define KARCHIVEENTRY_H 23 | 24 | #include 25 | #include 26 | 27 | #include 28 | 29 | #ifdef Q_OS_WIN 30 | #include // mode_t 31 | #endif 32 | 33 | class KArchiveDirectory; 34 | class KArchiveFile; 35 | 36 | class KArchiveEntryPrivate; 37 | /** 38 | * A base class for entries in an KArchive. 39 | * @short Base class for the archive-file's directory structure. 40 | * 41 | * @see KArchiveFile 42 | * @see KArchiveDirectory 43 | */ 44 | class KARCHIVE_EXPORT KArchiveEntry 45 | { 46 | public: 47 | /** 48 | * Creates a new entry. 49 | * @param archive the entries archive 50 | * @param name the name of the entry 51 | * @param access the permissions in unix format 52 | * @param date the date (in seconds since 1970) 53 | * @param user the user that owns the entry 54 | * @param group the group that owns the entry 55 | * @param symlink the symlink, or QString() 56 | */ 57 | KArchiveEntry(KArchive *archive, const QString &name, int access, const QDateTime &date, 58 | const QString &user, const QString &group, 59 | const QString &symlink); 60 | 61 | virtual ~KArchiveEntry(); 62 | 63 | /** 64 | * Creation date of the file. 65 | * @return the creation date 66 | */ 67 | QDateTime date() const; 68 | 69 | /** 70 | * Name of the file without path. 71 | * @return the file name without path 72 | */ 73 | QString name() const; 74 | /** 75 | * The permissions and mode flags as returned by the stat() function 76 | * in st_mode. 77 | * @return the permissions 78 | */ 79 | mode_t permissions() const; 80 | /** 81 | * User who created the file. 82 | * @return the owner of the file 83 | */ 84 | QString user() const; 85 | /** 86 | * Group of the user who created the file. 87 | * @return the group of the file 88 | */ 89 | QString group() const; 90 | 91 | /** 92 | * Symlink if there is one. 93 | * @return the symlink, or QString() 94 | */ 95 | QString symLinkTarget() const; 96 | 97 | /** 98 | * Checks whether the entry is a file. 99 | * @return true if this entry is a file 100 | */ 101 | virtual bool isFile() const; 102 | 103 | /** 104 | * Checks whether the entry is a directory. 105 | * @return true if this entry is a directory 106 | */ 107 | virtual bool isDirectory() const; 108 | 109 | protected: 110 | KArchive *archive() const; 111 | 112 | protected: 113 | virtual void virtual_hook(int id, void *data); 114 | private: 115 | KArchiveEntryPrivate *const d; 116 | }; 117 | 118 | #endif 119 | -------------------------------------------------------------------------------- /win32/KArchive/include/KF5/KArchive/karchivefile.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the KDE libraries 2 | Copyright (C) 2000-2005 David Faure 3 | Copyright (C) 2003 Leo Savernik 4 | 5 | Moved from ktar.h by Roberto Teixeira 6 | 7 | This library is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Library General Public 9 | License version 2 as published by the Free Software Foundation. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Library General Public License for more details. 15 | 16 | You should have received a copy of the GNU Library General Public License 17 | along with this library; see the file COPYING.LIB. If not, write to 18 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 | Boston, MA 02110-1301, USA. 20 | */ 21 | #ifndef KARCHIVEFILE_H 22 | #define KARCHIVEFILE_H 23 | 24 | #include 25 | 26 | class KArchiveFilePrivate; 27 | /** 28 | * Represents a file entry in a KArchive. 29 | * @short A file in an archive. 30 | * 31 | * @see KArchive 32 | * @see KArchiveDirectory 33 | */ 34 | class KARCHIVE_EXPORT KArchiveFile : public KArchiveEntry 35 | { 36 | public: 37 | /** 38 | * Creates a new file entry. Do not call this, KArchive takes care of it. 39 | * @param archive the entries archive 40 | * @param name the name of the entry 41 | * @param access the permissions in unix format 42 | * @param date the date (in seconds since 1970) 43 | * @param user the user that owns the entry 44 | * @param group the group that owns the entry 45 | * @param symlink the symlink, or QString() 46 | * @param pos the position of the file in the directory 47 | * @param size the size of the file 48 | */ 49 | KArchiveFile(KArchive *archive, const QString &name, int access, const QDateTime &date, 50 | const QString &user, const QString &group, const QString &symlink, 51 | qint64 pos, qint64 size); 52 | 53 | /** 54 | * Destructor. Do not call this, KArchive takes care of it. 55 | */ 56 | virtual ~KArchiveFile(); 57 | 58 | /** 59 | * Position of the data in the [uncompressed] archive. 60 | * @return the position of the file 61 | */ 62 | qint64 position() const; 63 | /** 64 | * Size of the data. 65 | * @return the size of the file 66 | */ 67 | qint64 size() const; 68 | /** 69 | * Set size of data, usually after writing the file. 70 | * @param s the new size of the file 71 | */ 72 | void setSize(qint64 s); 73 | 74 | /** 75 | * Returns the data of the file. 76 | * Call data() with care (only once per file), this data isn't cached. 77 | * @return the content of this file. 78 | */ 79 | virtual QByteArray data() const; 80 | 81 | /** 82 | * This method returns QIODevice (internal class: KLimitedIODevice) 83 | * on top of the underlying QIODevice. This is obviously for reading only. 84 | * 85 | * WARNING: Note that the ownership of the device is being transferred to the caller, 86 | * who will have to delete it. 87 | * 88 | * The returned device auto-opens (in readonly mode), no need to open it. 89 | * @return the QIODevice of the file 90 | */ 91 | virtual QIODevice *createDevice() const; 92 | 93 | /** 94 | * Checks whether this entry is a file. 95 | * @return true, since this entry is a file 96 | */ 97 | bool isFile() const Q_DECL_OVERRIDE; 98 | 99 | /** 100 | * Extracts the file to the directory @p dest 101 | * @param dest the directory to extract to 102 | * @return true on success, false if the file (dest + '/' + name()) couldn't be created 103 | */ 104 | bool copyTo(const QString &dest) const; 105 | 106 | protected: 107 | void virtual_hook(int id, void *data) Q_DECL_OVERRIDE; 108 | private: 109 | KArchiveFilePrivate *const d; 110 | }; 111 | 112 | #endif 113 | -------------------------------------------------------------------------------- /win32/KArchive/include/KF5/KArchive/kcompressiondevice.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the KDE libraries 2 | Copyright (C) 2000 David Faure 3 | Copyright (C) 2011 Mario Bensi 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Library General Public 7 | License version 2 as published by the Free Software Foundation. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | Library General Public License for more details. 13 | 14 | You should have received a copy of the GNU Library General Public License 15 | along with this library; see the file COPYING.LIB. If not, write to 16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 | Boston, MA 02110-1301, USA. 18 | */ 19 | #ifndef __kcompressiondevice_h 20 | #define __kcompressiondevice_h 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | class KCompressionDevicePrivate; 27 | 28 | class KFilterBase; 29 | 30 | /** 31 | * A class for reading and writing compressed data onto a device 32 | * (e.g. file, but other usages are possible, like a buffer or a socket). 33 | * 34 | * Use this class to read/write compressed files. 35 | */ 36 | 37 | class KARCHIVE_EXPORT KCompressionDevice : public QIODevice 38 | { 39 | public: 40 | enum CompressionType { 41 | GZip, 42 | BZip2, 43 | Xz, 44 | None 45 | }; 46 | 47 | /** 48 | * Constructs a KCompressionDevice for a given CompressionType (e.g. GZip, BZip2 etc.). 49 | * @param inputDevice input device. 50 | * @param autoDeleteInputDevice if true, @p inputDevice will be deleted automatically 51 | * @param type the CompressionType to use. 52 | */ 53 | KCompressionDevice(QIODevice *inputDevice, bool autoDeleteInputDevice, CompressionType type); 54 | 55 | /** 56 | * Constructs a KCompressionDevice for a given CompressionType (e.g. GZip, BZip2 etc.). 57 | * @param fileName the name of the file to filter. 58 | * @param type the CompressionType to use. 59 | */ 60 | KCompressionDevice(const QString &fileName, CompressionType type); 61 | 62 | /** 63 | * Destructs the KCompressionDevice. 64 | * Calls close() if the filter device is still open. 65 | */ 66 | virtual ~KCompressionDevice(); 67 | 68 | /** 69 | * The compression actually used by this device. 70 | * If the support for the compression requested in the constructor 71 | * is not available, then the device will use None. 72 | */ 73 | CompressionType compressionType() const; 74 | 75 | /** 76 | * Open for reading or writing. 77 | */ 78 | bool open(QIODevice::OpenMode mode) Q_DECL_OVERRIDE; 79 | 80 | /** 81 | * Close after reading or writing. 82 | */ 83 | void close() Q_DECL_OVERRIDE; 84 | 85 | /** 86 | * For writing gzip compressed files only: 87 | * set the name of the original file, to be used in the gzip header. 88 | * @param fileName the name of the original file 89 | */ 90 | void setOrigFileName(const QByteArray &fileName); 91 | 92 | /** 93 | * Call this let this device skip the gzip headers when reading/writing. 94 | * This way KCompressionDevice (with gzip filter) can be used as a direct wrapper 95 | * around zlib - this is used by KZip. 96 | */ 97 | void setSkipHeaders(); 98 | 99 | /** 100 | * That one can be quite slow, when going back. Use with care. 101 | */ 102 | bool seek(qint64) Q_DECL_OVERRIDE; 103 | 104 | bool atEnd() const Q_DECL_OVERRIDE; 105 | 106 | /** 107 | * Call this to create the appropriate filter for the CompressionType 108 | * named @p type. 109 | * @param type the type of the compression filter 110 | * @return the filter for the @p type, or 0 if not found 111 | */ 112 | static KFilterBase *filterForCompressionType(CompressionType type); 113 | 114 | protected: 115 | friend class K7Zip; 116 | 117 | qint64 readData(char *data, qint64 maxlen) Q_DECL_OVERRIDE; 118 | qint64 writeData(const char *data, qint64 len) Q_DECL_OVERRIDE; 119 | 120 | KFilterBase *filterBase(); 121 | private: 122 | KCompressionDevicePrivate *const d; 123 | }; 124 | 125 | Q_DECLARE_METATYPE(KCompressionDevice::CompressionType) 126 | 127 | #endif 128 | -------------------------------------------------------------------------------- /win32/KArchive/include/KF5/KArchive/kfilterbase.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the KDE libraries 2 | Copyright (C) 2000 David Faure 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License as published by the Free Software Foundation; either 7 | version 2 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | Library General Public License for more details. 13 | 14 | You should have received a copy of the GNU Library General Public License 15 | along with this library; see the file COPYING.LIB. If not, write to 16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 | Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | #ifndef __kfilterbase__h 21 | #define __kfilterbase__h 22 | 23 | #include 24 | 25 | #include 26 | #include 27 | class KFilterBasePrivate; 28 | 29 | class QIODevice; 30 | 31 | /** 32 | * This is the base class for compression filters 33 | * such as gzip and bzip2. It's pretty much internal. 34 | * Don't use directly, use KFilterDev instead. 35 | * @internal 36 | */ 37 | class KARCHIVE_EXPORT KFilterBase 38 | { 39 | public: 40 | KFilterBase(); 41 | virtual ~KFilterBase(); 42 | 43 | /** 44 | * Sets the device on which the filter will work 45 | * @param dev the device on which the filter will work 46 | * @param autodelete if true, @p dev is deleted when the filter is deleted 47 | */ 48 | void setDevice(QIODevice *dev, bool autodelete = false); 49 | // Note that this isn't in the constructor, because of KLibFactory::create, 50 | // but it should be called before using the filterbase ! 51 | 52 | /** 53 | * Returns the device on which the filter will work. 54 | * @returns the device on which the filter will work 55 | */ 56 | QIODevice *device(); 57 | /** \internal */ 58 | virtual bool init(int mode) = 0; 59 | /** \internal */ 60 | virtual int mode() const = 0; 61 | /** \internal */ 62 | virtual bool terminate(); 63 | /** \internal */ 64 | virtual void reset(); 65 | /** \internal */ 66 | virtual bool readHeader() = 0; 67 | /** \internal */ 68 | virtual bool writeHeader(const QByteArray &filename) = 0; 69 | /** \internal */ 70 | virtual void setOutBuffer(char *data, uint maxlen) = 0; 71 | /** \internal */ 72 | virtual void setInBuffer(const char *data, uint size) = 0; 73 | /** \internal */ 74 | virtual bool inBufferEmpty() const; 75 | /** \internal */ 76 | virtual int inBufferAvailable() const = 0; 77 | /** \internal */ 78 | virtual bool outBufferFull() const; 79 | /** \internal */ 80 | virtual int outBufferAvailable() const = 0; 81 | 82 | /** \internal */ 83 | enum Result { 84 | Ok, 85 | End, 86 | Error 87 | }; 88 | /** \internal */ 89 | virtual Result uncompress() = 0; 90 | /** \internal */ 91 | virtual Result compress(bool finish) = 0; 92 | 93 | /** 94 | * \internal 95 | * \since 4.3 96 | */ 97 | enum FilterFlags { 98 | NoHeaders = 0, 99 | WithHeaders = 1, 100 | ZlibHeaders = 2 // only use for gzip compression 101 | }; 102 | /** 103 | * \internal 104 | * \since 4.3 105 | */ 106 | void setFilterFlags(FilterFlags flags); 107 | FilterFlags filterFlags() const; 108 | 109 | protected: 110 | /** Virtual hook, used to add new "virtual" functions while maintaining 111 | binary compatibility. Unused in this class. 112 | */ 113 | virtual void virtual_hook(int id, void *data); 114 | private: 115 | Q_DISABLE_COPY(KFilterBase) 116 | KFilterBasePrivate *const d; 117 | }; 118 | 119 | #endif 120 | -------------------------------------------------------------------------------- /win32/KArchive/include/KF5/KArchive/ktar.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the KDE libraries 2 | Copyright (C) 2000-2005 David Faure 3 | Copyright (C) 2003 Leo Savernik 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Library General Public 7 | License version 2 as published by the Free Software Foundation. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | Library General Public License for more details. 13 | 14 | You should have received a copy of the GNU Library General Public License 15 | along with this library; see the file COPYING.LIB. If not, write to 16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 | Boston, MA 02110-1301, USA. 18 | */ 19 | #ifndef KTAR_H 20 | #define KTAR_H 21 | 22 | #include 23 | 24 | /** 25 | * A class for reading / writing (optionally compressed) tar archives. 26 | * 27 | * KTar allows you to read and write tar archives, including those 28 | * that are compressed using gzip, bzip2 or xz. 29 | * 30 | * @author Torben Weis , David Faure 31 | */ 32 | class KARCHIVE_EXPORT KTar : public KArchive 33 | { 34 | Q_DECLARE_TR_FUNCTIONS(KTar) 35 | 36 | public: 37 | /** 38 | * Creates an instance that operates on the given filename 39 | * using the compression filter associated to given mimetype. 40 | * 41 | * @param filename is a local path (e.g. "/home/weis/myfile.tgz") 42 | * @param mimetype "application/x-gzip", "application/x-bzip" or 43 | * "application/x-xz" 44 | * Do not use application/x-compressed-tar or similar - you only need to 45 | * specify the compression layer ! If the mimetype is omitted, it 46 | * will be determined from the filename. 47 | */ 48 | explicit KTar(const QString &filename, 49 | const QString &mimetype = QString()); 50 | 51 | /** 52 | * Creates an instance that operates on the given device. 53 | * The device can be compressed (KFilterDev) or not (QFile, etc.). 54 | * @warning Do not assume that giving a QFile here will decompress the file, 55 | * in case it's compressed! 56 | * @param dev the device to read from. If the source is compressed, the 57 | * QIODevice must take care of decompression 58 | */ 59 | explicit KTar(QIODevice *dev); 60 | 61 | /** 62 | * If the tar ball is still opened, then it will be 63 | * closed automatically by the destructor. 64 | */ 65 | virtual ~KTar(); 66 | 67 | /** 68 | * Special function for setting the "original file name" in the gzip header, 69 | * when writing a tar.gz file. It appears when using in the "file" command, 70 | * for instance. Should only be called if the underlying device is a KFilterDev! 71 | * @param fileName the original file name 72 | */ 73 | void setOrigFileName(const QByteArray &fileName); 74 | 75 | protected: 76 | 77 | /// Reimplemented from KArchive 78 | bool doWriteSymLink(const QString &name, const QString &target, 79 | const QString &user, const QString &group, 80 | mode_t perm, const QDateTime &atime, const QDateTime &mtime, const QDateTime &ctime) Q_DECL_OVERRIDE; 81 | /// Reimplemented from KArchive 82 | bool doWriteDir(const QString &name, const QString &user, const QString &group, 83 | mode_t perm, const QDateTime &atime, const QDateTime &mtime, const QDateTime &ctime) Q_DECL_OVERRIDE; 84 | /// Reimplemented from KArchive 85 | bool doPrepareWriting(const QString &name, const QString &user, 86 | const QString &group, qint64 size, mode_t perm, 87 | const QDateTime &atime, const QDateTime &mtime, const QDateTime &ctime) Q_DECL_OVERRIDE; 88 | /// Reimplemented from KArchive 89 | bool doFinishWriting(qint64 size) Q_DECL_OVERRIDE; 90 | 91 | /** 92 | * Opens the archive for reading. 93 | * Parses the directory listing of the archive 94 | * and creates the KArchiveDirectory/KArchiveFile entries. 95 | * @param mode the mode of the file 96 | */ 97 | bool openArchive(QIODevice::OpenMode mode) Q_DECL_OVERRIDE; 98 | bool closeArchive() Q_DECL_OVERRIDE; 99 | 100 | bool createDevice(QIODevice::OpenMode mode) Q_DECL_OVERRIDE; 101 | 102 | private: 103 | 104 | protected: 105 | void virtual_hook(int id, void *data) Q_DECL_OVERRIDE; 106 | private: 107 | class KTarPrivate; 108 | KTarPrivate *const d; 109 | }; 110 | 111 | #endif 112 | -------------------------------------------------------------------------------- /win32/KArchive/include/KF5/KArchive/kzipfileentry.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the KDE libraries 2 | Copyright (C) 2002 Holger Schroeder 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License version 2 as published by the Free Software Foundation. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | #ifndef KZIPFILEENTRY_H 20 | #define KZIPFILEENTRY_H 21 | 22 | #include "karchive.h" 23 | 24 | class KZip; 25 | /** 26 | * A KZipFileEntry represents a file in a zip archive. 27 | */ 28 | class KARCHIVE_EXPORT KZipFileEntry : public KArchiveFile 29 | { 30 | public: 31 | /** 32 | * Creates a new zip file entry. Do not call this, KZip takes care of it. 33 | */ 34 | KZipFileEntry(KZip *zip, const QString &name, int access, const QDateTime &date, 35 | const QString &user, const QString &group, const QString &symlink, 36 | const QString &path, qint64 start, qint64 uncompressedSize, 37 | int encoding, qint64 compressedSize); 38 | 39 | /** 40 | * Destructor. Do not call this. 41 | */ 42 | ~KZipFileEntry(); 43 | 44 | int encoding() const; 45 | qint64 compressedSize() const; 46 | 47 | /// Only used when writing 48 | void setCompressedSize(qint64 compressedSize); 49 | 50 | /// Header start: only used when writing 51 | void setHeaderStart(qint64 headerstart); 52 | qint64 headerStart() const; 53 | 54 | /// CRC: only used when writing 55 | unsigned long crc32() const; 56 | void setCRC32(unsigned long crc32); 57 | 58 | /// Name with complete path - KArchiveFile::name() is the filename only (no path) 59 | const QString &path() const; 60 | 61 | /** 62 | * @return the content of this file. 63 | * Call data() with care (only once per file), this data isn't cached. 64 | */ 65 | QByteArray data() const Q_DECL_OVERRIDE; 66 | 67 | /** 68 | * This method returns a QIODevice to read the file contents. 69 | * This is obviously for reading only. 70 | * Note that the ownership of the device is being transferred to the caller, 71 | * who will have to delete it. 72 | * The returned device auto-opens (in readonly mode), no need to open it. 73 | */ 74 | QIODevice *createDevice() const Q_DECL_OVERRIDE; 75 | 76 | private: 77 | class KZipFileEntryPrivate; 78 | KZipFileEntryPrivate *const d; 79 | }; 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /win32/KArchive/include/KF5/karchive_version.h: -------------------------------------------------------------------------------- 1 | #ifndef KARCHIVE_VERSION_H 2 | #define KARCHIVE_VERSION_H 3 | 4 | #define KARCHIVE_VERSION_STRING "5.32.0" 5 | #define KARCHIVE_VERSION_MAJOR 5 6 | #define KARCHIVE_VERSION_MINOR 32 7 | #define KARCHIVE_VERSION_PATCH 0 8 | #define KARCHIVE_VERSION ((5<<16)|(32<<8)|(0)) 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /win32/KArchive/lib/cmake/KF5Archive/KF5ArchiveConfig.cmake: -------------------------------------------------------------------------------- 1 | 2 | ####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() ####### 3 | ####### Any changes to this file will be overwritten by the next CMake run #### 4 | ####### The input file was KF5ArchiveConfig.cmake.in ######## 5 | 6 | get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE) 7 | 8 | macro(set_and_check _var _file) 9 | set(${_var} "${_file}") 10 | if(NOT EXISTS "${_file}") 11 | message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !") 12 | endif() 13 | endmacro() 14 | 15 | macro(check_required_components _NAME) 16 | foreach(comp ${${_NAME}_FIND_COMPONENTS}) 17 | if(NOT ${_NAME}_${comp}_FOUND) 18 | if(${_NAME}_FIND_REQUIRED_${comp}) 19 | set(${_NAME}_FOUND FALSE) 20 | endif() 21 | endif() 22 | endforeach() 23 | endmacro() 24 | 25 | #################################################################################### 26 | 27 | include(CMakeFindDependencyMacro) 28 | find_dependency(Qt5Core 5.6.0) 29 | 30 | 31 | set(KArchive_HAVE_BZIP2 "TRUE") 32 | set(KArchive_HAVE_LZMA "TRUE") 33 | 34 | include("${CMAKE_CURRENT_LIST_DIR}/KF5ArchiveTargets.cmake") 35 | 36 | -------------------------------------------------------------------------------- /win32/KArchive/lib/cmake/KF5Archive/KF5ArchiveConfigVersion.cmake: -------------------------------------------------------------------------------- 1 | # This is a basic version file for the Config-mode of find_package(). 2 | # It is used by write_basic_package_version_file() as input file for configure_file() 3 | # to create a version-file which can be installed along a config.cmake file. 4 | # 5 | # The created file sets PACKAGE_VERSION_EXACT if the current version string and 6 | # the requested version string are exactly the same and it sets 7 | # PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version. 8 | # The variable CVF_VERSION must be set before calling configure_file(). 9 | 10 | set(PACKAGE_VERSION "5.32.0") 11 | 12 | if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) 13 | set(PACKAGE_VERSION_COMPATIBLE FALSE) 14 | else() 15 | set(PACKAGE_VERSION_COMPATIBLE TRUE) 16 | if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) 17 | set(PACKAGE_VERSION_EXACT TRUE) 18 | endif() 19 | endif() 20 | 21 | # if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it: 22 | if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "4" STREQUAL "") 23 | return() 24 | endif() 25 | 26 | # check that the installed version has the same 32/64bit-ness as the one which is currently searching: 27 | if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "4") 28 | math(EXPR installedBits "4 * 8") 29 | set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)") 30 | set(PACKAGE_VERSION_UNSUITABLE TRUE) 31 | endif() 32 | -------------------------------------------------------------------------------- /win32/KArchive/lib/cmake/KF5Archive/KF5ArchiveTargets-release.cmake: -------------------------------------------------------------------------------- 1 | #---------------------------------------------------------------- 2 | # Generated CMake target import file for configuration "RELEASE". 3 | #---------------------------------------------------------------- 4 | 5 | # Commands may need to know the format version. 6 | set(CMAKE_IMPORT_FILE_VERSION 1) 7 | 8 | # Import target "KF5::Archive" for configuration "RELEASE" 9 | set_property(TARGET KF5::Archive APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) 10 | set_target_properties(KF5::Archive PROPERTIES 11 | IMPORTED_IMPLIB_RELEASE "${_IMPORT_PREFIX}/lib/libKF5Archive.dll.a" 12 | IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/bin/libKF5Archive.dll" 13 | ) 14 | 15 | list(APPEND _IMPORT_CHECK_TARGETS KF5::Archive ) 16 | list(APPEND _IMPORT_CHECK_FILES_FOR_KF5::Archive "${_IMPORT_PREFIX}/lib/libKF5Archive.dll.a" "${_IMPORT_PREFIX}/bin/libKF5Archive.dll" ) 17 | 18 | # Commands beyond this point should not need to know the version. 19 | set(CMAKE_IMPORT_FILE_VERSION) 20 | -------------------------------------------------------------------------------- /win32/KArchive/lib/cmake/KF5Archive/KF5ArchiveTargets.cmake: -------------------------------------------------------------------------------- 1 | # Generated by CMake 2 | 3 | if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.5) 4 | message(FATAL_ERROR "CMake >= 2.6.0 required") 5 | endif() 6 | cmake_policy(PUSH) 7 | cmake_policy(VERSION 2.6) 8 | #---------------------------------------------------------------- 9 | # Generated CMake target import file. 10 | #---------------------------------------------------------------- 11 | 12 | # Commands may need to know the format version. 13 | set(CMAKE_IMPORT_FILE_VERSION 1) 14 | 15 | # Protect against multiple inclusion, which would fail when already imported targets are added once more. 16 | set(_targetsDefined) 17 | set(_targetsNotDefined) 18 | set(_expectedTargets) 19 | foreach(_expectedTarget KF5::Archive) 20 | list(APPEND _expectedTargets ${_expectedTarget}) 21 | if(NOT TARGET ${_expectedTarget}) 22 | list(APPEND _targetsNotDefined ${_expectedTarget}) 23 | endif() 24 | if(TARGET ${_expectedTarget}) 25 | list(APPEND _targetsDefined ${_expectedTarget}) 26 | endif() 27 | endforeach() 28 | if("${_targetsDefined}" STREQUAL "${_expectedTargets}") 29 | unset(_targetsDefined) 30 | unset(_targetsNotDefined) 31 | unset(_expectedTargets) 32 | set(CMAKE_IMPORT_FILE_VERSION) 33 | cmake_policy(POP) 34 | return() 35 | endif() 36 | if(NOT "${_targetsDefined}" STREQUAL "") 37 | message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_targetsDefined}\nTargets not yet defined: ${_targetsNotDefined}\n") 38 | endif() 39 | unset(_targetsDefined) 40 | unset(_targetsNotDefined) 41 | unset(_expectedTargets) 42 | 43 | 44 | # Compute the installation prefix relative to this file. 45 | get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH) 46 | get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) 47 | get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) 48 | get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) 49 | if(_IMPORT_PREFIX STREQUAL "/") 50 | set(_IMPORT_PREFIX "") 51 | endif() 52 | 53 | # Create imported target KF5::Archive 54 | add_library(KF5::Archive SHARED IMPORTED) 55 | 56 | set_target_properties(KF5::Archive PROPERTIES 57 | INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include/KF5/KArchive;${_IMPORT_PREFIX}/include/KF5" 58 | INTERFACE_LINK_LIBRARIES "Qt5::Core" 59 | ) 60 | 61 | if(CMAKE_VERSION VERSION_LESS 2.8.12) 62 | message(FATAL_ERROR "This file relies on consumers using CMake 2.8.12 or greater.") 63 | endif() 64 | 65 | # Load information for each installed configuration. 66 | get_filename_component(_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) 67 | file(GLOB CONFIG_FILES "${_DIR}/KF5ArchiveTargets-*.cmake") 68 | foreach(f ${CONFIG_FILES}) 69 | include(${f}) 70 | endforeach() 71 | 72 | # Cleanup temporary variables. 73 | set(_IMPORT_PREFIX) 74 | 75 | # Loop over all imported files and verify that they actually exist 76 | foreach(target ${_IMPORT_CHECK_TARGETS} ) 77 | foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} ) 78 | if(NOT EXISTS "${file}" ) 79 | message(FATAL_ERROR "The imported target \"${target}\" references the file 80 | \"${file}\" 81 | but this file does not exist. Possible reasons include: 82 | * The file was deleted, renamed, or moved to another location. 83 | * An install or uninstall procedure did not complete successfully. 84 | * The installation package was faulty and contained 85 | \"${CMAKE_CURRENT_LIST_FILE}\" 86 | but not all the files it references. 87 | ") 88 | endif() 89 | endforeach() 90 | unset(_IMPORT_CHECK_FILES_FOR_${target}) 91 | endforeach() 92 | unset(_IMPORT_CHECK_TARGETS) 93 | 94 | # This file does not depend on other imported targets which have 95 | # been exported from the same project but in a separate export set. 96 | 97 | # Commands beyond this point should not need to know the version. 98 | set(CMAKE_IMPORT_FILE_VERSION) 99 | cmake_policy(POP) 100 | -------------------------------------------------------------------------------- /win32/KArchive/lib/libKF5Archive.dll.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/labsquare/FastQt/f69f9d5ba51b8863e7a645dbfc775fa0d8e41a50/win32/KArchive/lib/libKF5Archive.dll.a -------------------------------------------------------------------------------- /win32/KArchive/mkspecs/modules/qt_KArchive.pri: -------------------------------------------------------------------------------- 1 | QT.KArchive.VERSION = 5.32.0 2 | QT.KArchive.MAJOR_VERSION = 5 3 | QT.KArchive.MINOR_VERSION = 32 4 | QT.KArchive.PATCH_VERSION = 0 5 | QT.KArchive.name = KF5Archive 6 | QT.KArchive.defines = 7 | QT.KArchive.includes = C:/Program Files (x86)/KArchive/include/KF5/KArchive 8 | QT.KArchive.private_includes = 9 | QT.KArchive.libs = C:/Program Files (x86)/KArchive/lib 10 | QT.KArchive.depends = core 11 | -------------------------------------------------------------------------------- /win32/innosetup.iss: -------------------------------------------------------------------------------- 1 | ; Script generated by the Inno Setup Script Wizard. 2 | ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! 3 | 4 | #define MyAppName "fastqt" 5 | #define MyAppVersion "0.2-rc" 6 | #define MyAppPublisher "labsquare" 7 | #define MyAppURL "http://www.labsquare.org" 8 | #define MyAppExeName "fastqt.exe" 9 | 10 | [Setup] 11 | ; NOTE: The value of AppId uniquely identifies this application. 12 | ; Do not use the same AppId value in installers for other applications. 13 | ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) 14 | AppId={{2E6BDE27-73F1-46FD-A12A-274E254CC13B} 15 | AppName={#MyAppName} 16 | AppVersion={#MyAppVersion} 17 | ;AppVerName={#MyAppName} {#MyAppVersion} 18 | AppPublisher={#MyAppPublisher} 19 | AppPublisherURL={#MyAppURL} 20 | AppSupportURL={#MyAppURL} 21 | AppUpdatesURL={#MyAppURL} 22 | DefaultDirName={pf}\labsquare\{#MyAppName} 23 | DisableProgramGroupPage=yes 24 | OutputBaseFilename=fastqt-0.2-rc 25 | Compression=lzma 26 | SolidCompression=yes 27 | 28 | [Languages] 29 | Name: "english"; MessagesFile: "compiler:Default.isl" 30 | 31 | [Tasks] 32 | Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked 33 | 34 | [Files] 35 | Source: "release\fastqt.exe"; DestDir: "{app}"; Flags: ignoreversion 36 | Source: "release\D3Dcompiler_47.dll"; DestDir: "{app}"; Flags: ignoreversion 37 | Source: "release\fastqt.exe"; DestDir: "{app}"; Flags: ignoreversion 38 | Source: "release\libbz2-1.dll"; DestDir: "{app}"; Flags: ignoreversion 39 | Source: "release\libEGL.dll"; DestDir: "{app}"; Flags: ignoreversion 40 | Source: "release\libgcc_s_dw2-1.dll"; DestDir: "{app}"; Flags: ignoreversion 41 | Source: "release\libGLESV2.dll"; DestDir: "{app}"; Flags: ignoreversion 42 | Source: "release\libKF5Archive.dll"; DestDir: "{app}"; Flags: ignoreversion 43 | Source: "release\liblzma-5.dll"; DestDir: "{app}"; Flags: ignoreversion 44 | Source: "release\libstdc++-6.dll"; DestDir: "{app}"; Flags: ignoreversion 45 | Source: "release\libwinpthread-1.dll"; DestDir: "{app}"; Flags: ignoreversion 46 | Source: "release\opengl32sw.dll"; DestDir: "{app}"; Flags: ignoreversion 47 | Source: "release\Qt5Charts.dll"; DestDir: "{app}"; Flags: ignoreversion 48 | Source: "release\Qt5Core.dll"; DestDir: "{app}"; Flags: ignoreversion 49 | Source: "release\Qt5Gui.dll"; DestDir: "{app}"; Flags: ignoreversion 50 | Source: "release\Qt5Svg.dll"; DestDir: "{app}"; Flags: ignoreversion 51 | Source: "release\Qt5Widgets.dll"; DestDir: "{app}"; Flags: ignoreversion 52 | Source: "release\zlib1.dll"; DestDir: "{app}"; Flags: ignoreversion 53 | Source: "release\iconengines\*"; DestDir: "{app}\iconengines"; Flags: ignoreversion recursesubdirs createallsubdirs 54 | Source: "release\imageformats\*"; DestDir: "{app}\imageformats"; Flags: ignoreversion recursesubdirs createallsubdirs 55 | Source: "release\platforms\*"; DestDir: "{app}\platforms"; Flags: ignoreversion recursesubdirs createallsubdirs 56 | Source: "release\translations\*"; DestDir: "{app}\translations"; Flags: ignoreversion recursesubdirs createallsubdirs 57 | 58 | 59 | 60 | ; NOTE: Don't use "Flags: ignoreversion" on any shared system files 61 | 62 | [Icons] 63 | Name: "{commonprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}" 64 | Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon 65 | 66 | [Run] 67 | Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent 68 | 69 | -------------------------------------------------------------------------------- /win32/libbz2-1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/labsquare/FastQt/f69f9d5ba51b8863e7a645dbfc775fa0d8e41a50/win32/libbz2-1.dll -------------------------------------------------------------------------------- /win32/libhts-0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/labsquare/FastQt/f69f9d5ba51b8863e7a645dbfc775fa0d8e41a50/win32/libhts-0.dll -------------------------------------------------------------------------------- /win32/libhts.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/labsquare/FastQt/f69f9d5ba51b8863e7a645dbfc775fa0d8e41a50/win32/libhts.a -------------------------------------------------------------------------------- /win32/libhts.dll.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/labsquare/FastQt/f69f9d5ba51b8863e7a645dbfc775fa0d8e41a50/win32/libhts.dll.a -------------------------------------------------------------------------------- /win32/liblzma-5.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/labsquare/FastQt/f69f9d5ba51b8863e7a645dbfc775fa0d8e41a50/win32/liblzma-5.dll -------------------------------------------------------------------------------- /win32/zlib1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/labsquare/FastQt/f69f9d5ba51b8863e7a645dbfc775fa0d8e41a50/win32/zlib1.dll --------------------------------------------------------------------------------