<commit_before>// Copyright 2013 EMBL-EBI
// 
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// 
// http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef _WIGGLETOOLS_DEF_
#define _WIGGLETOOLS_DEF_

#ifndef true
typedef int bool;
#define true 1
#define false 0
#endif

#include <stdio.h>

typedef struct wiggleIterator_st WiggleIterator;
typedef struct multiplexer_st Multiplexer;
typedef struct multiset_st Multiset;
typedef struct histogram_st Histogram;

// Creators
WiggleIterator * SmartReader (char *);
WiggleIterator * CatWiggleIterator (char **, int);
// Secondary creators (to force file format recognition if necessary)
WiggleIterator * WiggleReader (char *);
WiggleIterator * BigWiggleReader (char *);
WiggleIterator * BedReader (char *);
WiggleIterator * BigBedReader (char *);
WiggleIterator * BamReader (char *);
WiggleIterator * VcfReader (char *);
WiggleIterator * BcfReader (char *);

// Generic class functions 
void seek(WiggleIterator *, const char *, int, int);

// Algebraic operations on iterators
	
	// Unary
WiggleIterator * UnitWiggleIterator (WiggleIterator *);
WiggleIterator * UnionWiggleIterator (WiggleIterator *);
WiggleIterator * NonOverlappingWiggleIterator (WiggleIterator *);
WiggleIterator * DefaultValueWiggleIterator(WiggleIterator *, double);
WiggleIterator * AbsWiggleIterator (WiggleIterator * );
WiggleIterator * NaturalLogWiggleIterator (WiggleIterator *);
WiggleIterator * NaturalExpWiggleIterator (WiggleIterator *);
WiggleIterator * TestNonOverlappingWiggleIterator(WiggleIterator * );
WiggleIterator * HighPassFilterWiggleIterator(WiggleIterator *, double);
WiggleIterator * TestNonOverlappingWiggleIterator(WiggleIterator *);
WiggleIterator * OverlapWiggleIterator(WiggleIterator * source, WiggleIterator * mask);
	// Scalar operations
WiggleIterator * ScaleWiggleIterator (WiggleIterator *, double);
WiggleIterator * ShiftWiggleIterator(WiggleIterator *, double);
WiggleIterator * PowerWiggleIterator (WiggleIterator *, double);
WiggleIterator * LogWiggleIterator (WiggleIterator * , double);
WiggleIterator * ExpWiggleIterator (WiggleIterator *, double);
WiggleIterator * SmoothWiggleIterator(WiggleIterator * i, int width);

// Sets of iterators 
Multiplexer * newMultiplexer(WiggleIterator **, int);
Multiplexer * newStrictMultiplexer(WiggleIterator **, int);

// Reduction operators on sets

WiggleIterator * SelectReduction(Multiplexer *, int);
WiggleIterator * MaxReduction ( Multiplexer * );
WiggleIterator * MinReduction ( Multiplexer * );
WiggleIterator * SumReduction ( Multiplexer * );
WiggleIterator * ProductReduction ( Multiplexer * );
WiggleIterator * MeanReduction ( Multiplexer * );
WiggleIterator * VarianceReduction ( Multiplexer * );
WiggleIterator * StdDevReduction ( Multiplexer * );
WiggleIterator * EntropyReduction ( Multiplexer * );
WiggleIterator * CVReduction ( Multiplexer * );
WiggleIterator * MedianReduction ( Multiplexer * );

// Sets of sets iterators 
Multiset * newMultiset(Multiplexer **, int);

// Reduction operators on sets of sets:
WiggleIterator * TTestReduction(Multiset *);
WiggleIterator * MWUReduction(Multiset *);

// Output
void toFile (WiggleIterator *, char *, bool, bool);
void toStdout (WiggleIterator *, bool, bool);
WiggleIterator * TeeWiggleIterator(WiggleIterator *, FILE *, bool, bool);
void runWiggleIterator(WiggleIterator * );

WiggleIterator * ApplyWiggleIterator(WiggleIterator * regions, double (*statistic)(WiggleIterator *), WiggleIterator * dataset);
WiggleIterator * ProfileWiggleIterator(WiggleIterator * regions, int width, WiggleIterator * dataset);
WiggleIterator * PasteWiggleIterator(WiggleIterator * i, FILE * infile, FILE * outfile, bool);

// Statistics
// 	Unary
double AUC (WiggleIterator *);
double mean (WiggleIterator *);
double min (WiggleIterator *);
double max (WiggleIterator *);
double variance (WiggleIterator *);
double isZero(WiggleIterator * wi);
void regionProfile(WiggleIterator *, double *, int, int, bool);
void addProfile(double *, double *, int);
//	Binary 
double pearsonCorrelation (WiggleIterator * , WiggleIterator * );
//	Histograms
Histogram * histogram(WiggleIterator **, int, int);
void normalize_histogram(Histogram *);
void print_histogram(Histogram *, FILE *);

// Regional statistics
WiggleIterator * apply(WiggleIterator * , double (*statistic)(WiggleIterator *), WiggleIterator *);

// Cleaning up
void destroyWiggleIterator (WiggleIterator *);

// Big file params
void setMaxBlocks(int);
void setMaxHeadStart(int);

// Command line parser
void rollYourOwn(int argc, char ** argv);
void printHelp();

#endif
<commit_msg>Cleaning up header<commit_after>// Copyright 2013 EMBL-EBI
// 
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// 
// http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef _WIGGLETOOLS_DEF_
#define _WIGGLETOOLS_DEF_

#ifndef true
typedef int bool;
#define true 1
#define false 0
#endif

#include <stdio.h>

typedef struct wiggleIterator_st WiggleIterator;
typedef struct multiplexer_st Multiplexer;
typedef struct multiset_st Multiset;
typedef struct histogram_st Histogram;

// Creators
WiggleIterator * SmartReader (char *);
WiggleIterator * CatWiggleIterator (char **, int);
// Secondary creators (to force file format recognition if necessary)
WiggleIterator * WiggleReader (char *);
WiggleIterator * BigWiggleReader (char *);
WiggleIterator * BedReader (char *);
WiggleIterator * BigBedReader (char *);
WiggleIterator * BamReader (char *);
WiggleIterator * VcfReader (char *);
WiggleIterator * BcfReader (char *);

// Generic class functions 
void seek(WiggleIterator *, const char *, int, int);

// Algebraic operations on iterators
	
	// Unary
WiggleIterator * UnitWiggleIterator (WiggleIterator *);
WiggleIterator * UnionWiggleIterator (WiggleIterator *);
WiggleIterator * NonOverlappingWiggleIterator (WiggleIterator *);
WiggleIterator * DefaultValueWiggleIterator(WiggleIterator *, double);
WiggleIterator * AbsWiggleIterator (WiggleIterator * );
WiggleIterator * NaturalLogWiggleIterator (WiggleIterator *);
WiggleIterator * NaturalExpWiggleIterator (WiggleIterator *);
WiggleIterator * TestNonOverlappingWiggleIterator(WiggleIterator * );
WiggleIterator * HighPassFilterWiggleIterator(WiggleIterator *, double);
WiggleIterator * TestNonOverlappingWiggleIterator(WiggleIterator *);
WiggleIterator * OverlapWiggleIterator(WiggleIterator * source, WiggleIterator * mask);
	// Scalar operations
WiggleIterator * ScaleWiggleIterator (WiggleIterator *, double);
WiggleIterator * ShiftWiggleIterator(WiggleIterator *, double);
WiggleIterator * PowerWiggleIterator (WiggleIterator *, double);
WiggleIterator * LogWiggleIterator (WiggleIterator * , double);
WiggleIterator * ExpWiggleIterator (WiggleIterator *, double);
WiggleIterator * SmoothWiggleIterator(WiggleIterator * i, int width);

// Sets of iterators 
Multiplexer * newMultiplexer(WiggleIterator **, int);
Multiplexer * newStrictMultiplexer(WiggleIterator **, int);

// Reduction operators on sets

WiggleIterator * SelectReduction(Multiplexer *, int);
WiggleIterator * MaxReduction ( Multiplexer * );
WiggleIterator * MinReduction ( Multiplexer * );
WiggleIterator * SumReduction ( Multiplexer * );
WiggleIterator * ProductReduction ( Multiplexer * );
WiggleIterator * MeanReduction ( Multiplexer * );
WiggleIterator * VarianceReduction ( Multiplexer * );
WiggleIterator * StdDevReduction ( Multiplexer * );
WiggleIterator * EntropyReduction ( Multiplexer * );
WiggleIterator * CVReduction ( Multiplexer * );
WiggleIterator * MedianReduction ( Multiplexer * );

// Sets of sets iterators 
Multiset * newMultiset(Multiplexer **, int);

// Reduction operators on sets of sets:
WiggleIterator * TTestReduction(Multiset *);
WiggleIterator * MWUReduction(Multiset *);

// Output
void toFile (WiggleIterator *, char *, bool, bool);
void toStdout (WiggleIterator *, bool, bool);
WiggleIterator * TeeWiggleIterator(WiggleIterator *, FILE *, bool, bool);
void runWiggleIterator(WiggleIterator * );

WiggleIterator * ApplyWiggleIterator(WiggleIterator *, double (*)(WiggleIterator *), WiggleIterator *, bool);
WiggleIterator * ProfileWiggleIterator(WiggleIterator *, int, WiggleIterator *);
WiggleIterator * PasteWiggleIterator(WiggleIterator * i, FILE * infile, FILE * outfile, bool);

// Statistics
// 	Unary
double AUC (WiggleIterator *);
double mean (WiggleIterator *);
double min (WiggleIterator *);
double max (WiggleIterator *);
double variance (WiggleIterator *);
double isZero(WiggleIterator * wi);
void regionProfile(WiggleIterator *, double *, int, int, bool);
void addProfile(double *, double *, int);
//	Binary 
double pearsonCorrelation (WiggleIterator * , WiggleIterator * );
//	Histograms
Histogram * histogram(WiggleIterator **, int, int);
void normalize_histogram(Histogram *);
void print_histogram(Histogram *, FILE *);

// Regional statistics
WiggleIterator * apply(WiggleIterator * , double (*statistic)(WiggleIterator *), WiggleIterator *);

// Cleaning up
void destroyWiggleIterator (WiggleIterator *);

// Big file params
void setMaxBlocks(int);
void setMaxHeadStart(int);

// Command line parser
void rollYourOwn(int argc, char ** argv);
void printHelp();

#endif

{'fraction_non_alphanumeric': 0.10057814992025518, 'fraction_numerical': 0.001993620414673046, 'mean_word_length': 6.151104775481112, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4287867', 'n_tokens_mistral': 3158, 'n_tokens_neox': 2974, 'n_words': 810}