<commit_before>#ifndef STATISTICS_H
#define STATISTICS_H

#include "cppNGS_global.h"
#include "VariantList.h"
#include "BedFile.h"
#include "QCCollection.h"
#include <QMap>


///NGS statistics and some BAM file operations.
class CPPNGSSHARED_EXPORT Statistics
{
public:
	///Calculates QC metrics on a variant list (only for VCF).
	static QCCollection variantList(const VariantList& variants);
	///Calculates mapping QC metrics for a target region from a BAM file. The input BED file must be merged!
	static QCCollection mapping(const BedFile& bed_file, const QString& bam_file, int min_mapq=1);
	///Calculates mapping QC metrics for WGS from a BAM file.
	static QCCollection mapping(const QString& bam_file, int min_mapq=1);
    ///Calculates special mapping QC metrics on three defined exons.
	static QCCollection mapping3Exons(const QString& bam_file);
	///Calculates target region statistics (term-value pairs). @p merge determines if overlapping regions are merged before calculating the statistics.
	static QCCollection region(const BedFile& bed_file, bool merge);
	///Calculates somatic QC metrics from BAM and vcf file
	static QCCollection somatic(QString& tumor_bam, QString& normal_bam, QString& somatic_vcf, QString target_file = nullptr);

	///Calculates the part of the target region that has a lower coverage than the given cutoff. The input BED file must be merged and sorted!
	static BedFile lowCoverage(const BedFile& bed_file, const QString& bam_file, int cutoff, int min_mapq=1);
    ///Calculates the part of the genome that has a lower coverage than the given cutoff.
    static BedFile lowCoverage(const QString& bam_file, int cutoff, int min_mapq=1);
    ///Calculates and annotates the average coverage of the regions in the bed file. The input BED file must be merged and sorted!
	static void avgCoverage(BedFile& bed_file, const QString& bam_file, int min_mapq=1);

	///Determines the gender based on the read ratio between X and Y chromosome.
	static QString genderXY(const QString& bam_file, QStringList& debug_output, double max_female=0.06, double min_male=0.09);
	///Determines the gender based on the fraction of heterocygous SNPs on chromosome X.
	static QString genderHetX(const QString& bam_file, QStringList& debug_output, double max_male=0.15, double min_female=0.24);
	///Determines the gender based on the coverge of the SRY gene on chrY.
	static QString genderSRY(const QString& bam_file, QStringList& debug_output, double min_cov=20.0);

protected:
	///No default constructor
	Statistics();
};

#endif // STATISTICS_H
<commit_msg>Statistics: fixed linux specific nullptr problem.<commit_after>#ifndef STATISTICS_H
#define STATISTICS_H

#include "cppNGS_global.h"
#include "VariantList.h"
#include "BedFile.h"
#include "QCCollection.h"
#include <QMap>


///NGS statistics and some BAM file operations.
class CPPNGSSHARED_EXPORT Statistics
{
public:
	///Calculates QC metrics on a variant list (only for VCF).
	static QCCollection variantList(const VariantList& variants);
	///Calculates mapping QC metrics for a target region from a BAM file. The input BED file must be merged!
	static QCCollection mapping(const BedFile& bed_file, const QString& bam_file, int min_mapq=1);
	///Calculates mapping QC metrics for WGS from a BAM file.
	static QCCollection mapping(const QString& bam_file, int min_mapq=1);
    ///Calculates special mapping QC metrics on three defined exons.
	static QCCollection mapping3Exons(const QString& bam_file);
	///Calculates target region statistics (term-value pairs). @p merge determines if overlapping regions are merged before calculating the statistics.
	static QCCollection region(const BedFile& bed_file, bool merge);
	///Calculates somatic QC metrics from BAM and vcf file
	static QCCollection somatic(QString& tumor_bam, QString& normal_bam, QString& somatic_vcf, QString target_file = QString());

	///Calculates the part of the target region that has a lower coverage than the given cutoff. The input BED file must be merged and sorted!
	static BedFile lowCoverage(const BedFile& bed_file, const QString& bam_file, int cutoff, int min_mapq=1);
    ///Calculates the part of the genome that has a lower coverage than the given cutoff.
    static BedFile lowCoverage(const QString& bam_file, int cutoff, int min_mapq=1);
    ///Calculates and annotates the average coverage of the regions in the bed file. The input BED file must be merged and sorted!
	static void avgCoverage(BedFile& bed_file, const QString& bam_file, int min_mapq=1);

	///Determines the gender based on the read ratio between X and Y chromosome.
	static QString genderXY(const QString& bam_file, QStringList& debug_output, double max_female=0.06, double min_male=0.09);
	///Determines the gender based on the fraction of heterocygous SNPs on chromosome X.
	static QString genderHetX(const QString& bam_file, QStringList& debug_output, double max_male=0.15, double min_female=0.24);
	///Determines the gender based on the coverge of the SRY gene on chrY.
	static QString genderSRY(const QString& bam_file, QStringList& debug_output, double min_cov=20.0);

protected:
	///No default constructor
	Statistics();
};

#endif // STATISTICS_H

{'fraction_non_alphanumeric': 0.07531865585168018, 'fraction_numerical': 0.008111239860950173, 'mean_word_length': 4.973471741637832, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7284969', 'n_tokens_mistral': 1606, 'n_tokens_neox': 1526, 'n_words': 633}